/* abdefghijklmnopqrstuvwxyz.com - dark gray, shadcn-ish, one screen, no scroll */

:root {
  --bg:        #1c1c1f;
  --elevated:  #232327;
  --card:      #26262b;
  --border:    #34343a;
  --border-hi: #45454d;
  --fg:        #f2f2f3;
  --muted:     #a1a1aa;
  --dim:       #71717a;
  --radius:    0.625rem;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* faint grid so the gray does not read as flat paint */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(to right, #ffffff06 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(to bottom, #ffffff06 1px, transparent 1px) 0 0 / 56px 56px,
    radial-gradient(120% 90% at 50% 0%, #ffffff09, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* -- gate ------------------------------------------------ */

.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  width: 100%;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity .5s ease;
}
.gate.gone { opacity: 0; pointer-events: none; }

.gate-title {
  font-size: clamp(1.9rem, 7vw, 3rem);
  font-weight: 600;
  letter-spacing: -.035em;
  animation: rise .5s cubic-bezier(.2,.7,.3,1) both;
}
.gate-title::after {
  content: "_";
  color: var(--dim);
  animation: blink 1.1s steps(1) infinite;
}

.gate-hint {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  animation: rise .5s cubic-bezier(.2,.7,.3,1) .12s both;
}

.gate:hover .gate-hint { color: var(--muted); }
.gate:focus-visible { outline: 2px solid var(--border-hi); outline-offset: -6px; }

/* -- page shell ------------------------------------------ */

.page {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: .5rem;
  padding: clamp(.75rem, 2vw, 1.25rem);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--mono);
  font-size: .72rem;
}
.foot { color: var(--dim); }
.dim { color: var(--dim); }
.credit s { text-decoration-color: var(--border-hi); }

.brand { display: flex; align-items: baseline; letter-spacing: .01em; color: var(--muted); cursor: default; }
.brand span { transition: transform .25s cubic-bezier(.2,.7,.3,1), color .25s ease; }
.brand:hover span { color: var(--fg); transform: translateY(-3px); }
.brand .gap {
  position: relative;
  width: .62em;
  border-bottom: 1px dashed var(--border-hi);
  animation: pulse 2.4s ease-in-out infinite;
}
.brand .gap::after {
  content: "no c";
  position: absolute;
  top: 1.5em;
  left: 50%;
  transform: translate(-50%, 4px);
  padding: .2rem .4rem;
  font-size: .62rem;
  white-space: nowrap;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: .35rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.brand:hover .gap::after { opacity: 1; transform: translate(-50%, 0); }

.bar-right { display: flex; align-items: center; gap: .5rem; }

.badge {
  padding: .2rem .5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff08;
  color: var(--muted);
}
.badge .slash { color: var(--dim); }

.ghost {
  white-space: nowrap;
  font: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .55rem;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.ghost:hover { color: var(--fg); border-color: var(--border-hi); background: #ffffff08; }
.ghost:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* -- stage ----------------------------------------------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) minmax(0, 15rem);
  align-items: center;
  gap: clamp(.75rem, 2.5vw, 2.5rem);
  min-height: 0;
}

.thread { display: grid; gap: .45rem; align-content: center; min-width: 0; }
.thread.left { justify-items: start; }
.thread.right { justify-items: end; text-align: right; }

.who {
  font-family: var(--mono);
  font-size: .66rem;
  color: var(--dim);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.msg {
  max-width: 24ch;
  padding: .5rem .7rem;
  font-size: clamp(.72rem, 1.35vw, .84rem);
  line-height: 1.45;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  transition: transform .2s cubic-bezier(.2,.7,.3,1), border-color .2s ease, background .2s ease;
}
.msg b { font-weight: 600; }
.msg:hover { transform: translateY(-2px); border-color: var(--border-hi); background: var(--elevated); }
.thread.left  .msg { border-bottom-left-radius: .25rem; }
.thread.right .msg { border-bottom-right-radius: .25rem; }

.msg.me { background: var(--fg); color: #18181b; border-color: transparent; }
.msg.me:hover { background: #fff; }

.typing { display: inline-flex; gap: .22rem; padding: .65rem .7rem; }
.typing i { width: .3rem; height: .3rem; border-radius: 50%; background: #18181b60; animation: bob 1.1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

/* -- face ------------------------------------------------ */

/* the face is the only thing in the flow here, so it lands dead centre; the
   caption is hung off it by fit() and never shifts it */
.face-wrap {
  position: relative;
  min-width: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#face {
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1.05;
  white-space: pre;
  width: max-content;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* every cell gets the same box (--cell is measured in JS from the widest glyph
   in the art) so the drawing sits on a real grid; only inked cells animate */
#face b,
#face i {
  display: inline-block;
  width: var(--cell, 1ch);
  font-style: normal;
  font-weight: 400;
  text-align: center;
}
#face b { opacity: 0; }
#face.go b {
  animation:
    dot-in .5s var(--d) both,
    dot-wave 3.6s calc(var(--d) + 620ms) infinite;
}

@keyframes dot-in {
  from { opacity: 0; filter: blur(4px); }
  to   { opacity: 1; filter: blur(0); }
}
@keyframes dot-wave {
  0%, 100% { opacity: .62; }
  50%      { opacity: 1; }
}

.poke {
  position: absolute;
  left: 0;
  right: 0;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--dim);
  text-align: center;
  min-height: 1.2em;
  transition: color .2s ease;
}
.poke.hot { color: var(--muted); }

/* -- entrance choreography ------------------------------- */

.page > *, .r0, .r1, .r2, .r3, .r4 { opacity: 0; }
.page.in > * { animation: rise .55s cubic-bezier(.2,.7,.3,1) both; }
.page.in .r0 { animation: rise .55s cubic-bezier(.2,.7,.3,1) .10s both; }
.page.in .r1 { animation: rise .55s cubic-bezier(.2,.7,.3,1) .22s both; }
.page.in .r2 { animation: rise .55s cubic-bezier(.2,.7,.3,1) .34s both; }
.page.in .r3 { animation: rise .55s cubic-bezier(.2,.7,.3,1) .46s both; }
.page.in .r4 { animation: rise .55s cubic-bezier(.2,.7,.3,1) .58s both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes bob   { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: .9; } }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* -- narrow screens: still one screen, still no scroll --- */

@media (max-width: 860px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: .4rem;
  }
  .thread { gap: .35rem; }
  .thread .who { display: none; }
  .thread.left .msg:nth-of-type(n+3),
  .thread.right .msg:nth-of-type(n+3) { display: none; }
  .msg { max-width: min(30ch, 82vw); }
  .thread.left { justify-items: start; }
  .bar { font-size: .62rem; }
  .badge { display: none; }
  .credit { display: none; }
  .foot { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .page > *, .r0, .r1, .r2, .r3, .r4 { opacity: 1; }
}
