/* Hallmark · macrostructure: bespoke Calling Card (single viewport) · genre: atmospheric
 * theme: custom (vibe: "mystery luxury calling card" · paper oklch(13.88% 0.005 107) #090907
 * · accent oklch(50.16% 0.173 27.9) #b12a24 warm-red · display: logo art · body: Hanken Grotesk)
 * nav: none (bespoke: one-card page) · footer: none · enrichment: user-supplied logo art
 * pre-emit critique: P5 H5 E4 S5 R5 V5
 */
@import url("tokens.css");

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
}

html { height: 100%; }

body {
  min-height: 100svh;
  background-color: var(--color-paper);
  background-image: radial-gradient(
    120vmax circle at 50% 40%,
    var(--color-paper-lift) 0%,
    var(--color-paper) 52%,
    var(--color-paper-deep) 100%
  );
  color: var(--color-chalk);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
}

/* film grain over everything — ties the page to the chalk texture */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}

.card {
  display: grid;
  justify-items: center;
  padding: var(--space-12) var(--space-6);
  width: 100%;
  max-width: 40rem;
}

/* ---- logo ---- */

.logo {
  position: relative;
  width: min(58vmin, 21rem);
}

.logo svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 997 / 890;
}

/* finger-on-glass write-on: mask strokes trace the pen path of each letter,
   then the red flick, then the underline; sfill guarantees the final art */
.s {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: stroke var(--dw, 300ms) var(--ease-write) var(--ds, 0ms) forwards;
}

.s1 { --dw: 450ms; --ds: 250ms; }   /* B downstroke */
.s2 { --dw: 780ms; --ds: 730ms; }   /* B hook + bowls + swash */
.s3 { --dw: 240ms; --ds: 1590ms; }  /* i */
.s4 { --dw: 360ms; --ds: 1890ms; }  /* l */
.s5 { --dw: 360ms; --ds: 2290ms; }  /* l */
.s6 { --dw: 324ms; --ds: 2750ms; }  /* red flick */
.s7 { --dw: 221ms; --ds: 3174ms; }  /* underline slash */

.sfill {
  opacity: 0;
  animation: fillin 1600ms linear 3420ms forwards;
}

/* red glint behind the brush dot on hover (decorative) */
.logo::after {
  content: "";
  position: absolute;
  left: 65.5%;
  top: 20.8%;
  width: 22%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-red-glow) 0%, transparent 62%);
  opacity: 0;
  transition: opacity var(--dur-mid) var(--ease-out);
  pointer-events: none;
}

.logo:hover::after { opacity: 1; }

/* ---- red rule ---- */

.rule {
  width: 4.5rem;
  height: var(--rule-red);
  margin-top: var(--space-12);
  background: var(--color-red);
  border: 0;
  transform-origin: center;
  animation: draw 600ms var(--ease-out) 3395ms backwards;
}

/* ---- contact ---- */

.contact {
  margin-top: var(--space-8);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  column-gap: var(--space-6);
  row-gap: var(--space-4);
  animation: rise var(--dur-mid) var(--ease-out) 3645ms backwards;
}

.contact a {
  display: inline-block;
  padding: var(--space-2) 0;
  color: var(--color-chalk-dim);
  text-decoration: none;
  font-size: var(--text-contact);
  font-weight: 500;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.contact a:hover { color: var(--color-chalk); border-bottom-color: var(--color-red); }
.contact a:active { color: var(--color-chalk); }

.contact a:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 4px;
  color: var(--color-chalk);
}

.dot {
  color: var(--color-red);
  font-size: var(--text-contact);
  user-select: none;
}

/* ---- whisper ---- */

.whisper {
  margin: var(--space-12) 0 0;
  color: var(--color-chalk-faint);
  font-size: var(--text-whisper);
  font-weight: 400;
  letter-spacing: var(--track-whisper);
  text-transform: uppercase;
  text-align: center;
  animation: fade var(--dur-mid) var(--ease-out) 4095ms backwards;
}

/* ---- red-dot hotspot + secret ---- */

.dot-hot {
  position: absolute;
  left: 65.5%;
  top: 20.8%;
  width: 16%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}

.dot-hot:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 4px;
}

.secret {
  margin: var(--space-6) 0 0;
  color: var(--color-red);
  font-size: var(--text-whisper);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  max-width: 30rem;
}

.secret--shown { animation: rise var(--dur-mid) var(--ease-out) backwards; }

/* ---- ask the assistant ---- */

.ask {
  margin-top: var(--space-8);
  background: none;
  border: 0;
  padding: var(--space-2) var(--space-3);
  color: var(--color-chalk-faint);
  font-family: var(--font-body);
  font-size: var(--text-whisper);
  font-weight: 500;
  letter-spacing: var(--track-whisper);
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
  animation: fade var(--dur-mid) var(--ease-out) 4600ms backwards;
}

.ask:hover { color: var(--color-chalk); border-bottom-color: var(--color-red); }

.ask:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 4px;
  color: var(--color-chalk);
}

/* ---- status line ---- */

.status {
  position: fixed;
  bottom: var(--space-4);
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  color: var(--color-chalk-faint);
  font-size: var(--text-whisper);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  pointer-events: none;
  animation: fade var(--dur-mid) var(--ease-out) 5000ms backwards;
}

/* ---- the assistant (parlor) ---- */

.veil[hidden] { display: none; }

.veil {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: end center;
  background: oklch(12.15% 0.0031 106.86 / 0.72);
  padding: var(--space-4);
}

.parlor {
  width: 100%;
  max-width: 26rem;
  max-height: min(75svh, 34rem);
  display: flex;
  flex-direction: column;
  background: var(--color-paper-lift);
  border: 1px solid oklch(87.7% 0.0076 80.72 / 0.14);
  animation: rise 320ms var(--ease-out) backwards;
  margin-bottom: var(--space-6);
}

.parlor__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid oklch(87.7% 0.0076 80.72 / 0.12);
  color: var(--color-chalk-dim);
  font-size: var(--text-whisper);
  letter-spacing: var(--track-whisper);
  text-transform: uppercase;
}

.parlor__head span::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-right: 0.7em;
  border-radius: 50%;
  background: var(--color-red);
  vertical-align: 6%;
}

.parlor__close {
  background: none;
  border: 0;
  color: var(--color-chalk-dim);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: var(--space-2);
}

.parlor__close:hover { color: var(--color-chalk); }
.parlor__close:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.thread {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 9rem;
}

.msg {
  margin: 0;
  max-width: 88%;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--color-chalk);
}

.msg--guest {
  align-self: flex-end;
  color: var(--color-chalk-dim);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.msg--typing { color: var(--color-chalk-faint); letter-spacing: 0.3em; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid oklch(87.7% 0.0076 80.72 / 0.12);
}

.chip {
  background: none;
  border: 1px solid oklch(87.7% 0.0076 80.72 / 0.28);
  border-radius: 999px;
  color: var(--color-chalk-dim);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.chip:hover { color: var(--color-chalk); border-color: var(--color-red); }
.chip:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.chip--quiet { border-color: transparent; color: var(--color-chalk-faint); }

.veiled { overflow: hidden; }

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

@keyframes stroke {
  to { stroke-dashoffset: 0; }
}

@keyframes fillin {
  to { opacity: 1; }
}

@keyframes draw {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .rule, .contact, .whisper, .ask, .status {
    animation: fade 150ms linear backwards;
  }
  .parlor, .secret--shown { animation: none; }
  .s { animation: none; }
  .sfill { animation: none; opacity: 1; }
  .logo::after { transition: none; }
}

/* ---- small screens ---- */

@media (max-width: 480px) {
  .contact { flex-direction: column; column-gap: 0; }
  .dot { display: none; }
  .rule { margin-top: var(--space-8); }
  .whisper { margin-top: var(--space-8); }
}
