/* Flow — Meta Ray-Ban Display web app
   Additive waveguide display: black renders as fully transparent, so the
   background stays pure black and everything readable is light + high contrast. */

/* Barlow (SIL Open Font License) — self-hosted so it loads from our own
   HTTPS origin with no runtime dependency on Google Fonts. */
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/barlow-400.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/barlow-600.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/barlow-700.woff2") format("woff2");
}

:root {
  --bg:        #000000;              /* transparent on-glass */
  --ink:       #FFFFFF;              /* primary text */
  --ink-dim:   rgba(255,255,255,.62);   /* secondary — kept ≥7:1 for the additive display */
  --orp:       #FF9E80;             /* pivot letter — warm coral anchor (bright = additive-friendly) */
  --accent:    #7FE0C4;             /* mint — focus / selection / progress */
  --font:      "Barlow", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Glow removed — kept as no-op tokens so shadow lists stay valid. */
  --glow-ink:    0 0 0 transparent;
  --glow-orp:    0 0 0 transparent;
  --glow-accent: 0 0 0 transparent;
  --ease-out:    cubic-bezier(.22,.9,.3,1);
}

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

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: relative;
  width: 600px;
  height: 600px;
}

/* ---- Screen switching ---- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}
.screen.is-active { display: flex; }

/* ============ LIBRARY ============ */
.lib-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 36px 48px 18px;
}
.lib-logo { width: 52px; height: 52px; flex: 0 0 auto; }
.lib-logo svg { width: 100%; height: 100%; }
.wordmark {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: 2px;
}
.tagline {
  font-size: 20px;
  color: var(--ink-dim);
  margin-top: 4px;
}

.lib-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;              /* scrolled programmatically to follow selection */
  scroll-behavior: smooth;
  scrollbar-width: none;        /* no visible bar — driven by the D-pad */
  padding: 8px 32px;
}
.lib-list::-webkit-scrollbar { width: 0; height: 0; }
.lib-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;              /* MRBD minimum tap target */
  padding: 0 24px;
  margin-bottom: 12px;
  border: 2px solid transparent;
  border-radius: 16px;
}
.lib-row.is-selected {
  border-color: var(--accent);
  box-shadow: var(--glow-accent), inset 0 0 0 1px rgba(127,224,196,.28);
  background: rgba(127,224,196,.08);
}
.lib-row.is-selected .title { text-shadow: var(--glow-ink); }
.lib-row .meta { display: flex; flex-direction: column; }
.lib-row .title  { font-size: 26px; font-weight: 600; }
.lib-row .author { font-size: 18px; color: var(--ink-dim); }
.lib-row .pct    { font-size: 20px; color: var(--accent); min-width: 64px; text-align: right; }

.lib-foot {
  padding: 18px 48px 32px;
  font-size: 18px;
  color: var(--ink-dim);
}
.key {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--ink-dim);
  border-radius: 8px;
  color: var(--ink);
}

/* ============ READER ============ */
#reader { align-items: center; justify-content: center; }

.rsvp-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  width: 100%;
  font-size: 84px;              /* base; app.js shrinks per word so long words fit */
  font-weight: 600;
  line-height: 1;
  white-space: pre;
  text-shadow: var(--glow-ink);   /* hold legibility against the real world */
}
/* Equal side columns keep the pivot letter locked to the exact centre */
.rsvp-line .pre  { flex: 1 1 0; text-align: right; }
.rsvp-line .orp  { color: var(--orp); flex: 0 0 auto; text-shadow: var(--glow-orp); }
.rsvp-line .post { flex: 1 1 0; text-align: left; }

/* Reticle: two short ticks above/below the centre column */
.reticle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 44px;
  background: var(--orp);
  border-radius: 2px;
  box-shadow: var(--glow-orp);
  opacity: .7;
}
.reticle-top    { top: calc(50% - 84px); }
.reticle-bottom { top: calc(50% + 38px); }

.hint {
  position: absolute;
  bottom: 96px;
  font-size: 20px;
  color: var(--ink-dim);
  transition: opacity .3s ease;
}
.hint.is-hidden { opacity: 0; }

.hud {
  position: absolute;
  top: 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 22px;
  color: var(--ink);
  transition: opacity .35s ease;
}
.hud.is-hidden { opacity: 0; }
.hud-state { color: var(--accent); }

.progress {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,.12);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  box-shadow: var(--glow-accent);
  transition: width .12s linear;
}

/* ============ LANDING ============ */
#landing { align-items: center; justify-content: center; }
.landing-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.logo { width: 216px; height: 196px; margin-bottom: 2px; }
.logo svg { width: 100%; height: 100%; display: block; }
#landing .wordmark {
  font-size: 80px;
  font-weight: 700;
  letter-spacing: -1.5px;          /* tight display tracking reads more designed */
  text-shadow: var(--glow-ink);
}
#landing .tagline {
  font-size: 22px;
  color: var(--ink-dim);
  margin-top: 2px;
  letter-spacing: .2px;
}
.enter-hint {
  margin-top: 40px;
  font-size: 22px;
  color: var(--accent);
  text-shadow: var(--glow-accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

/* ============ LIBRARY (additions) ============ */
.lib-title {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-shadow: var(--glow-ink);
}
/* "live" pill for dynamic feed rows */
.lib-row .live {
  font-size: 16px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 3px 12px;
  white-space: nowrap;
}

/* ============ READER (message overlay) ============ */
.reader-msg {
  position: absolute;
  left: 48px; right: 48px;
  text-align: center;
  font-size: 30px;
  line-height: 1.35;
  color: var(--ink);
}
.reader-msg.is-hidden { display: none; }

/* ============ DICTIONARY PANEL ============ */
.define {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 56px;
  text-align: center;
  background: #000;              /* opaque so it fully replaces the word */
}
.define.is-hidden { display: none; }
.define-word { font-size: 58px; font-weight: 700; }
.define-word .pivot { color: var(--orp); }
.define-phon { font-size: 24px; color: var(--ink-dim); margin-top: 4px; }
.define-body { font-size: 28px; line-height: 1.4; margin-top: 22px; }
.define-body .pos { color: var(--accent); font-style: italic; margin-right: 8px; }
.define-foot {
  position: absolute;
  bottom: 40px;
  font-size: 18px;
  color: var(--ink-dim);
}

/* ============ ANIMATIONS ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Gentle cross-fade when a screen becomes active */
.screen.is-active { animation: screenIn .28s ease both; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* Landing: the logo draws its streams, the anchor pops, text rises */
.logo .stream {
  stroke-dasharray: 240; stroke-dashoffset: 240;
  animation: draw 1.1s ease forwards, streamFlow 3.6s ease-in-out 1.3s infinite;
}
.logo .stream:nth-child(2) { animation-delay: .12s, 1.6s; }
.logo .stream:nth-child(3) { animation-delay: .24s, 1.9s; }
/* Streams breathe like moving water (opacity ripple, staggered per line) */
@keyframes streamFlow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.lib-logo path { animation: streamFlow 3.6s ease-in-out infinite; }
.lib-logo path:nth-child(2) { animation-delay: .3s; }
.lib-logo path:nth-child(3) { animation-delay: .6s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
#landing .wordmark { animation: riseIn .6s .7s ease both; }
#landing .tagline  { animation: riseIn .6s .85s ease both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Library: rows spring in, staggered; selection bounces + lifts */
.lib-row {
  transition: transform .32s cubic-bezier(.34,1.56,.64,1), border-color .16s ease, box-shadow .16s ease, background .16s ease;
  animation: rowIn .44s cubic-bezier(.34,1.56,.64,1) both;
}
.lib-row:nth-child(1){animation-delay:.03s}.lib-row:nth-child(2){animation-delay:.07s}
.lib-row:nth-child(3){animation-delay:.11s}.lib-row:nth-child(4){animation-delay:.15s}
.lib-row:nth-child(5){animation-delay:.19s}.lib-row:nth-child(6){animation-delay:.23s}
.lib-row:nth-child(7){animation-delay:.27s}.lib-row:nth-child(8){animation-delay:.31s}
.lib-row:nth-child(n+9){animation-delay:.35s}
@keyframes rowIn { 0% { opacity: 0; transform: translateY(16px) scale(.97); } 100% { opacity: 1; transform: none; } }
.lib-row.is-selected { transform: scale(1.04); }

/* Reader: the flowing word is deliberately NOT animated (instant swap = readable). */

/* HUD bounces down as it fades in */
.hud { transform: translateY(-8px); transition: opacity .35s ease, transform .4s cubic-bezier(.34,1.56,.64,1); }
.hud:not(.is-hidden) { transform: none; }

/* Dictionary panel bounces in */
.define:not(.is-hidden) { animation: defIn .34s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes defIn { 0% { opacity: 0; transform: scale(.9); } 100% { opacity: 1; transform: none; } }

/* Breathing — gentle, ambient, UI only (never the reading word) */
@keyframes breathe    { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes dotBreathe { 0%,100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.22); opacity: 1; } }
#landing .logo { animation: breathe 3.8s ease-in-out 1.7s infinite; }
.lib-logo      { animation: breathe 4.6s ease-in-out infinite; }
.feed-dot      { animation: dotBreathe 2.8s ease-in-out infinite; }

/* ============ POLISH PASS (ui-ux-pro-max) ============ */
/* Per-feed colour dot — playful colour-coding that keeps the label as the
   real signal (colour is not the only cue). */
.feed-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-left: 8px;
}
/* ease-out on entrances (feels natural; skill guideline). Rows/panels keep
   their own spring easing set above. */
.screen.is-active { animation-timing-function: var(--ease-out); }
#landing .wordmark, #landing .tagline { animation-timing-function: var(--ease-out); }

/* Settings values + library chevron */
.set-val  { font-size: 26px; font-weight: 600; color: var(--accent); min-width: 96px; text-align: right; }
.chevron  { font-size: 30px; color: var(--ink-dim); }
