/* Gleed, phone app. Gleed is the interface; everything else stays quiet. */
@font-face { font-family: "Cormorant"; src: url(fonts/cormorant-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url(fonts/cormorant-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Jost"; src: url(fonts/jost-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Jost"; src: url(fonts/jost-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  /* night (default): the navy he burns in */
  --ground: #070b1c;
  --sheet: #0e1533;
  --field: #0d1430;
  --ink: #e7ecfb;
  --soft: #a7b1cf;
  --faint: #6f7a9c;
  --line: rgba(167, 177, 207, .2);
  --aurora: #8fb4ff;
  --action: #5b7cff;
  --action-ink: #05091a;
  --display: "Cormorant", "Cormorant Garamond", Georgia, serif;
  --text: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    /* day: cream page, his blue light sits straight on it */
    --ground: #f3efe6;
    --sheet: #fbf8f1;
    --field: #ebe5d7;
    --ink: #121a33;
    --soft: #4a5370;
    --faint: #7b8199;
    --line: rgba(18, 26, 51, .14);
    --aurora: #2f5be0;
    --action: #1f3fb8;
    --action-ink: #ffffff;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--ground); color: var(--ink); overscroll-behavior: none; }
body { font-family: var(--text); font-size: 16px; line-height: 1.5; min-height: 100dvh; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

.app {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: env(safe-area-inset-top, 0px) max(20px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(20px, env(safe-area-inset-left, 0px));
}

.top { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.wordmark { font-family: var(--display); font-weight: 600; font-size: 22px; color: var(--soft); }
.icon-btn {
  width: 44px; height: 44px; margin-right: -10px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: transparent; color: var(--soft);
  cursor: pointer; touch-action: manipulation; transition: background-color .15s var(--ease-out);
}
.icon-btn:active { background: var(--line); }
.icon-btn:focus-visible { outline: 2px solid var(--aurora); outline-offset: 2px; }

.home { display: flex; flex-direction: column; align-items: center; padding-bottom: 32px; }
.app[data-view="paired"] .home { justify-content: center; padding-bottom: 56px; }

/* His hearth: the page itself is his night (or day). No disc, no box. */
.hearth {
  position: relative; width: min(86vw, 400px); aspect-ratio: 4 / 5; margin-top: -4px;
  -webkit-mask-image: radial-gradient(closest-side, #000 74%, transparent);
  mask-image: radial-gradient(closest-side, #000 74%, transparent);
  cursor: pointer; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.app[data-view="unpaired"] .hearth { width: min(74vw, 340px); }
.hearth img, .hearth canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hearth img { object-fit: cover; transition: opacity .4s ease; }
.hearth canvas { opacity: 0; transition: opacity .4s ease; }
.hearth #sparks { pointer-events: none; }
.hearth.live canvas { opacity: 1; }
.hearth.live img { opacity: 0; }

.whisper {
  margin: -18px 0 6px; min-height: 1.4em; font-family: var(--display); font-weight: 500; font-size: 20px;
  color: var(--soft); text-align: center; opacity: 0; transition: opacity .4s var(--ease-out);
}
.whisper.on { opacity: 1; }

.voice { display: grid; justify-items: center; gap: 10px; max-width: 34ch; text-align: center; }
.says {
  margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(31px, 8.4vw, 42px);
  line-height: 1.06; letter-spacing: -.01em; text-wrap: balance;
}
.sub { margin: 0; color: var(--soft); text-wrap: pretty; }
.sub:empty { display: none; }
.meta { margin: 6px 0 0; display: inline-flex; align-items: center; gap: 9px; color: var(--faint); font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--faint); transition: background-color .4s, border-color .4s, box-shadow .4s; }
.meta[data-state="online"] .dot { background: var(--aurora); border-color: var(--aurora); box-shadow: 0 0 8px color-mix(in srgb, var(--aurora) 60%, transparent); }

/* Pairing */
.pair { width: 100%; max-width: 340px; display: grid; gap: 12px; margin-top: 26px; }
.pair label { font-size: 14px; color: var(--soft); text-align: center; }
.pair input {
  width: 100%; padding: 16px 12px 16px calc(12px + .22em); border-radius: 16px;
  border: 1px solid var(--line); background: var(--field); color: var(--ink);
  font: 500 26px/1 var(--text); letter-spacing: .22em; text-align: center; text-transform: uppercase;
  caret-color: var(--aurora);
}
.pair input::placeholder { color: var(--faint); opacity: .55; }
.pair input:focus-visible { outline: 2px solid var(--aurora); outline-offset: 2px; }
.pair input[aria-invalid="true"] { border-color: var(--aurora); }
.hint { margin: 0; min-height: 2.6em; font-size: 14px; color: var(--faint); text-align: center; text-wrap: pretty; }
.hint[data-tone="problem"] { color: var(--ink); }

.primary {
  height: 52px; padding: 0 24px; border: 0; border-radius: 999px; background: var(--action); color: var(--action-ink);
  font-size: 17px; font-weight: 500; cursor: pointer; touch-action: manipulation;
  transition: transform .12s var(--ease-out), opacity .2s var(--ease-out);
}
.primary:active { transform: scale(.97); }
.primary[disabled] { opacity: .55; cursor: default; }
.primary:focus-visible, .quiet:focus-visible, .install:focus-visible { outline: 2px solid var(--aurora); outline-offset: 3px; }

.install {
  margin-top: 20px; height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--soft); font-size: 15px; cursor: pointer; touch-action: manipulation;
}
.install:active { background: var(--line); }

/* The sheet for this phone and its computer */
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 520px; max-height: 85dvh;
  border: 0; border-radius: 24px 24px 0 0; background: var(--sheet); color: var(--ink);
  padding: 12px max(24px, env(safe-area-inset-left, 0px)) calc(24px + env(safe-area-inset-bottom, 0px));
  overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(3, 6, 16, .55); }
.sheet[open] { animation: rise .32s var(--ease-out); }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
.grip { display: block; width: 36px; height: 4px; margin: 0 auto 14px; border-radius: 2px; background: var(--line); }
.sheet h2 { margin: 4px 0 14px; font-family: var(--display); font-weight: 600; font-size: 30px; line-height: 1.1; }
.sheet dl { margin: 0 0 18px; }
.sheet dl div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.sheet dt { color: var(--soft); }
.sheet dd { margin: 0; text-align: right; }
.quiet {
  padding: 12px 0; border: 0; background: none; color: var(--ink); font-size: 16px; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 5px; touch-action: manipulation;
}
.sheet .hint { text-align: left; min-height: 0; margin-bottom: 8px; }
.sheet .primary { width: 100%; margin-top: 12px; }

@media (hover: hover) and (pointer: fine) {
  .primary:hover { filter: brightness(1.08); }
  .icon-btn:hover, .install:hover { background: var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: none; }
  .hearth img, .hearth canvas, .whisper, .primary, .dot { transition: none; }
}
