/* pabloio playground — independent design system.
   near-white paper + ink + ultramarine accent. nothing here inherits from other pablo surfaces. */

:root {
  --paper: #fbfbfa;
  --ink: #161719;
  --muted: #6d6a63;
  --line: #e8e7e3;
  --bar: #f3f2ee;
  --field: #141517;          /* the black field */
  --field-ink: #eceae4;
  --field-dim: #8b8880;
  --accent: #3230e3;         /* ultramarine, on paper */
  --accent-bright: #6f7cff;  /* ultramarine, on the dark field */
  --wash: rgba(50, 48, 227, 0.10);
  --wash-hover: rgba(50, 48, 227, 0.20);
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Instrument Sans", -apple-system, "Helvetica Neue", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --shadow: 0 24px 70px -18px rgba(22, 23, 25, 0.35);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-inout: cubic-bezier(0.83, 0, 0.17, 1);
}

* { box-sizing: border-box; }

/* the hidden attribute always wins, whatever display a utility rule sets */
[hidden] { display: none !important; }

/* visually hidden, still read by assistive tech */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

body.locked { overflow: hidden; }

/* a whisper of paper grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--wash-hover); }

a { color: inherit; }

/* ---------- welcome gate (pacome choreography) ---------- */

#gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--field);
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

#gate.leaving {
  pointer-events: none;
  transform: translateY(100%);
  transition: transform 0.64s var(--ease-inout);
}

#gate.leaving .gate-inner { opacity: 0; transition: opacity 0.22s ease-out; }

.gate-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 40px);
}

.greet {
  position: relative;
  height: 1.3em;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.2;
  color: var(--field-ink);
}

.gword {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* per-letter masked reveal */
.gword .lmask {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

.gword .l {
  display: inline-block;
  transform: translateY(120%) rotate(6deg);
  will-change: transform;
}

.gword.in .l {
  transform: translateY(0) rotate(0deg);
  transition: transform 0.7s var(--ease-out);
  transition-delay: var(--d, 0ms);
}

.gword.out .l {
  transform: translateY(-130%) rotate(-4deg);
  transition: transform 0.5s var(--ease-inout);
  transition-delay: var(--d, 0ms);
}

.gate-sub {
  margin: 4px 0 22px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: clamp(13px, 1.8vw, 15px);
  color: var(--field-dim);
}

.gsub {
  display: block;
  transform: translateY(120%);
  will-change: transform;
}

.gsub.in {
  transform: translateY(0);
  transition: transform 0.65s var(--ease-out) 0.05s;
}

.enter-btn {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 99px;
  padding: 13px 30px;
  cursor: pointer;
  visibility: hidden;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  will-change: transform, opacity;
}

.enter-btn.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity 0.4s ease-out, transform 0.5s var(--ease-out);
}

.hidden-label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.enter-letters .letter {
  display: inline-block;
  will-change: transform;
  transition: transform 0.3s var(--ease-out);
  transition-delay: calc(var(--i) * 22ms);
}

.enter-btn:hover .letter { transform: translateY(-4px); }

/* ---------- cursor (the terminal one) ---------- */

.cursor {
  display: inline-block;
  width: 0.62em;
  height: 1.15em;
  margin-left: 0.18em;
  background: var(--accent-bright);
  vertical-align: text-bottom;
  animation: blink 1.06s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ---------- hero terminal ---------- */

#page {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 22px;
}

.hero { padding-top: clamp(48px, 9vh, 96px); }

#terminal {
  max-width: 760px;
  margin: 0 auto;
  background: var(--field);
  color: var(--field-ink);
  border-radius: 16px;
  padding: clamp(24px, 4.5vw, 40px) clamp(22px, 4.5vw, 44px);
  font-family: var(--mono);
  font-size: clamp(13.5px, 1.9vw, 16.5px);
  line-height: 2.05;
  box-shadow: var(--shadow);
  min-height: 9.2em;
}

.tline { margin: 0; white-space: nowrap; }

.prompt { color: var(--accent-bright); margin-right: 0.65em; }

#rotator {
  color: var(--field-ink);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.24em;
  line-height: 1;
  text-decoration: none;
  border-bottom: 1px solid var(--accent-bright);
}

#rotator:hover { color: #fff; }

@media (max-width: 560px) {
  .tline { white-space: normal; padding-left: 1.15em; text-indent: -1.15em; }
  #rotator { min-width: 8.5em; }
}

/* ---------- the registry ---------- */

.chapter { padding-top: clamp(56px, 9vh, 96px); }

.filters {
  display: flex;
  gap: 20px;
  margin: 0 0 20px;
  font-family: var(--mono);
}

.filters .f {
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 11.5px;
  letter-spacing: 0.18em;
  color: var(--muted);
  cursor: pointer;
  padding: 3px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.filters .f:hover { color: var(--ink); }

.filters .f[aria-pressed="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.registry {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.registry li { border-bottom: 1px solid var(--line); }

.registry li[data-off] { display: none; }

.entry {
  display: grid;
  grid-template-columns: 3.4em 7em 1fr auto;
  align-items: baseline;
  gap: 14px;
  padding: 18px 6px;
  text-decoration: none;
}

/* the content slides, the hit region stays put */
.entry > * { transition: transform 0.35s var(--ease-out); }

.entry:hover > * { transform: translateX(10px); }

.e-num {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  transition: color 0.2s ease;
}

.entry:hover .e-num { color: var(--accent); }

.e-kind {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.e-title {
  min-width: 0;
  font-size: clamp(19px, 2.8vw, 25px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.e-title span {
  background-image: linear-gradient(var(--wash), var(--wash));
  background-repeat: no-repeat;
  background-size: 0% 42%;
  background-position: 0 84%;
  transition: background-size 0.4s var(--ease-out);
}

.entry:hover .e-title span, .entry:focus-visible .e-title span { background-size: 100% 42%; }

.e-side {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* small inline proof for touch screens; fine pointers get the cursor preview instead */
.e-thumb {
  width: 42px;
  height: 27px;
  object-fit: cover;
  object-position: top;
  border-radius: 5px;
  border: 1px solid var(--line);
  align-self: center;
}

@media (hover: hover) and (pointer: fine) {
  .e-thumb { display: none; }
}

.draft-chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px 8px;
}

.reg-empty {
  margin: 26px 6px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.reg-empty span { color: var(--accent); margin-right: 0.6em; }

/* registry entrance: lines cascade in */
.chapter .registry li {
  opacity: 0;
  transform: translateY(14px);
}

.chapter.in .registry li {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
  transition-delay: var(--d, 0ms);
}

.chapter .filters { opacity: 0; transition: opacity 0.6s ease; }
.chapter.in .filters { opacity: 1; }

html.reduced .chapter .registry li, html.no-io .chapter .registry li,
html.reduced .chapter .filters, html.no-io .chapter .filters {
  opacity: 1; transform: none; transition: none;
}

/* ---------- footer ---------- */

.foot {
  padding: clamp(70px, 12vh, 130px) 0 46px;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.foot.in { opacity: 1; transform: none; }

html.reduced .foot, html.no-io .foot { opacity: 1; transform: none; transition: none; }

.foot a {
  display: inline-block;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
}

.foot a:hover { color: var(--accent); }

.foot .dot { margin: 0 14px; color: var(--muted); }

.fine {
  margin: 26px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.fine span { color: var(--accent); }

/* ---------- window layer ---------- */

#layer { position: fixed; inset: 0; z-index: 40; }

#backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 21, 23, 0.44);
  opacity: 0;
  transition: opacity 0.32s ease;
}

#layer.open #backdrop { opacity: 1; }

/* the blur arrives after the morph settles, off the animation's critical frames */
#layer.settled #backdrop {
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

#window {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(860px, calc(100vw - 32px));
  max-height: min(86vh, 900px);
  max-height: min(86dvh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.55);
}

.winbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.dots { display: inline-flex; gap: 5px; flex: none; }

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4d1c8;
}

.cardbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}

.cardbar span:last-child, #win-domain {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.cardbar span:last-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#win-close {
  margin-left: auto;
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}

#win-close:hover { color: var(--ink); }

#win-body {
  overflow-y: auto;
  padding: clamp(26px, 5vw, 52px);
  outline: none;
}

/* window content */

.win-kind {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin: 0 0 14px;
}

#win-body h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.win-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 30px;
}

#win-body p { max-width: 60ch; }

.win-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(19px, 3vw, 23px);
  color: var(--ink);
  margin: 18px 0 24px;
  max-width: 32ch;
  line-height: 1.4;
}

.win-shot {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 6px 0 22px;
  display: block;
}

.visit {
  display: inline-block;
  font-family: var(--mono);
  font-size: 14px;
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: 99px;
  padding: 10px 20px;
  transition: background 0.2s ease, color 0.2s ease;
}

.visit:hover {
  background: var(--ink);
  color: var(--paper);
}

.say-hi {
  font-family: var(--mono);
  font-size: 14px;
}

.say-hi a { border-bottom: 1px solid var(--accent); text-decoration: none; }
.say-hi a:hover { color: var(--accent); }

/* morph ghost: the flying window used during open/close */
.ghost {
  position: fixed;
  z-index: 50;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  pointer-events: none;
  overflow: hidden;
  will-change: transform;
  transform-origin: 0 0;
}

.ghost > * {
  transform-origin: 0 0;
  will-change: transform;
}

/* ---------- custom cursor + hover preview ---------- */

#cursor { display: none; }

html.cc, html.cc * { cursor: none !important; }

html.cc #cursor { display: block; }

#cur-dot, #cur-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  pointer-events: none;
  will-change: transform;
}

#cur-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: difference;
}

/* JS translates the outer ring; CSS scales the inner circle — transform-only, no layout */
#cursor { --rs: 0.654; }
#cursor.is-hover { --rs: 1; }
#cursor.has-label { --rs: 1.31; }

.ring-c {
  position: absolute;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  mix-blend-mode: difference;
  transform: scale(var(--rs));
  transition: transform 0.3s var(--ease-out);
  will-change: transform;
}

#cursor.is-down .ring-c { transform: scale(calc(var(--rs) * 0.85)); }

#cur-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: #fff;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#cursor.has-label #cur-label { opacity: 1; }

#cursor.is-gone #cur-dot, #cursor.is-gone #cur-ring { opacity: 0; }

/* the preview that grows out of the cursor over registry entries.
   card styles are class-scoped so the morph ghost's clone keeps them */
#preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  width: 264px;
  pointer-events: none;
  will-change: transform;
  opacity: 0;
}

#preview.on {
  opacity: 1;
  transition: opacity 0.22s ease;
}

.pwin {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 20px 44px rgba(22, 23, 25, 0.3);
}

.pwin img {
  display: block;
  width: 100%;
  aspect-ratio: 1400 / 722;
  object-fit: cover;
  object-position: top;
}

.pquote {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.5;
  box-shadow: 0 20px 44px rgba(22, 23, 25, 0.3);
}

#preview .pwin, #preview .pquote {
  transform: scale(0.92);
  transform-origin: 0 50%;
  transition: transform 0.3s var(--ease-out);
}

#preview.on .pwin, #preview.on .pquote { transform: scale(1); }

/* magnetic elements ride a spring back */
[data-mag] {
  display: inline-block;
  transition: transform 0.35s var(--ease-out);
  will-change: transform;
}

/* ---------- noscript ---------- */

.noscript {
  max-width: 760px;
  margin: 40px auto;
  padding: 0 22px;
  font-family: var(--mono);
  font-size: 14px;
}

/* ---------- responsive registry ---------- */

@media (max-width: 640px) {
  .entry { grid-template-columns: 2.8em 1fr auto; gap: 11px; padding: 15px 2px; }
  /* kind stays in the accessibility tree, leaves the layout */
  .e-kind {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .filters { gap: 15px; flex-wrap: wrap; }
}

@media (max-width: 400px) {
  .e-thumb { display: none; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  .entry > *, .e-title span, #backdrop, [data-mag], .filters .f { transition: none; }
}

/* focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
