/* ==========================================================================
   The Familiar — marketing site
   Aesthetic: warm paper, soft light, big serif. The opposite ground to the
   Liminalis site on purpose — this one is read by someone who might be
   having a hard week, not by a hiring manager.
   Colour is lifted from the creature's own PAD palette anchors
   (frontend/familiar/src/creature/affect.ts) so the page and the creature
   are demonstrably the same world.
   ========================================================================== */

:root {
  /* Ground — warm paper, never white */
  --paper: #fdf8f2;
  --paper-2: #f7efe4;
  --paper-3: #f2e6d7;
  --card: #fffcf8;

  /* Ink — warm near-black, never #000 */
  --ink: #2c2733;
  --ink-2: #4f4757;
  --ink-soft: #6f6678;
  --ink-faint: #978d9c;

  /* PAD anchors, edge set — the creature's own colours */
  --grief: #6b6fa0;     /* low pleasure, low arousal  */
  --anger: #93255f;     /* low pleasure, high arousal */
  --calm: #4478c0;      /* high pleasure, low arousal */
  --delight: #ff7fb0;   /* high pleasure, high arousal */
  --warm: #ffe39a;      /* the creature's warm edge   */

  /* Working accents derived from those */
  --accent: #7b6ad0;
  --accent-deep: #57499e;
  --accent-wash: #efeafd;
  --blush: #ffe1ec;
  --sun: #fff0c9;
  --sky: #dceeff;

  --line: rgba(44, 39, 51, 0.11);
  --line-soft: rgba(44, 39, 51, 0.07);
  --shadow-soft: 0 1px 2px rgba(70, 50, 60, 0.04), 0 8px 28px rgba(90, 60, 90, 0.06);
  --shadow-lift: 0 2px 6px rgba(70, 50, 60, 0.05), 0 22px 48px rgba(90, 60, 90, 0.1);

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'Newsreader', Georgia, 'Times New Roman', serif;
  --meta: 'Nunito Sans', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;

  --wrap: 1120px;
  --narrow: 44rem;
  --gutter: clamp(20px, 5vw, 48px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: light;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.68;
}

/* No overflow clamp on <body>: any horizontal overflow rule there makes it a
   scroll container, which breaks position:sticky on the header. The only thing
   that overhangs is the hero's glow, and .hero clips that itself. */

img { max-width: 100%; height: auto; }

a { color: var(--accent-deep); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--anger); }

h1, h2, h3, h4 {
  font-family: var(--display);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  font-variation-settings: 'SOFT' 40, 'WONK' 1;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: var(--narrow); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 0 0 10px 0;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ============================== header ================================= */

.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(253, 248, 242, 0.86);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.site-head.stuck { border-bottom-color: var(--line-soft); }

.head-inner {
  width: 100%; max-width: var(--wrap); margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex; align-items: center; gap: 18px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 600; font-size: 1.14rem;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
  margin-right: auto;
}
.brand img { width: 26px; height: 26px; border-radius: 7px; }

.nav { display: flex; align-items: center; gap: 4px; font-family: var(--meta); font-size: 0.93rem; }
.nav a {
  color: var(--ink-2); text-decoration: none; padding: 7px 12px; border-radius: 999px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.nav a:hover { background: var(--accent-wash); color: var(--accent-deep); }
.nav a.cta {
  background: var(--ink); color: var(--paper); margin-left: 8px; padding: 8px 18px; font-weight: 600;
}
.nav a.cta:hover { background: var(--accent-deep); color: #fff; }

.navtoggle {
  display: none; font-family: var(--meta); font-size: 0.9rem; font-weight: 600;
  background: none; border: 1px solid var(--line); color: var(--ink);
  padding: 8px 15px; border-radius: 999px; cursor: pointer;
}

@media (max-width: 860px) {
  .navtoggle { display: block; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--card); border-bottom: 1px solid var(--line);
    padding: 10px var(--gutter) 20px; box-shadow: var(--shadow-soft);
    display: none; font-size: 1.05rem;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; border-radius: 12px; }
  .nav a.cta { margin-left: 0; text-align: center; margin-top: 8px; }
}

/* ============================== buttons ================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--meta); font-size: 1rem; font-weight: 600; line-height: 1;
  padding: 15px 26px; border-radius: 999px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-soft); }
.btn-primary:hover { background: var(--accent-deep); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--card); color: var(--ink); border-color: var(--accent); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .btn:hover { transform: none; } }

/* ============================== hero =================================== */

.hero { position: relative; padding: clamp(48px, 9vw, 104px) 0 clamp(56px, 8vw, 96px); overflow: hidden; }

.hero::before {
  content: ''; position: absolute; inset: -30% -10% auto -10%; height: 130%;
  background:
    radial-gradient(46% 42% at 72% 22%, rgba(255, 127, 176, 0.22), transparent 68%),
    radial-gradient(50% 48% at 30% 8%, rgba(123, 106, 208, 0.16), transparent 70%),
    radial-gradient(46% 44% at 88% 62%, rgba(255, 227, 154, 0.34), transparent 66%);
  filter: blur(4px);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(28px, 5vw, 68px); align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-copy .eyebrow, .hero-copy .herofoot { justify-content: center; }
  .hero-actions { justify-content: center; }
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--meta); font-size: 0.79rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-deep);
  background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(123, 106, 208, 0.22);
  padding: 7px 15px; border-radius: 999px; margin-bottom: 22px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--delight); box-shadow: 0 0 0 4px rgba(255, 127, 176, 0.2); }

.hero h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.1rem);
  font-variation-settings: 'SOFT' 60, 'WONK' 1;
  margin-bottom: 0.42em;
}
.hero h1 em { font-style: italic; color: var(--accent-deep); font-variation-settings: 'SOFT' 100, 'WONK' 1; }

.lede { font-size: clamp(1.1rem, 1.7vw, 1.24rem); color: var(--ink-2); max-width: 30rem; }
@media (max-width: 900px) { .lede { margin-left: auto; margin-right: auto; } }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }

.herofoot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 26px;
  font-family: var(--meta); font-size: 0.86rem; color: var(--ink-soft);
}
.herofoot .pill {
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; background: rgba(255,255,255,0.65);
}

/* ------------------------------ the orb -------------------------------- */

.orb-stage { position: relative; aspect-ratio: 1 / 1; max-width: 460px; margin: 0 auto; width: 100%; }

/* A well of night cut into the paper. The creature is bright grains on dark in
   the app, and on a cream page those grains have almost no contrast — so the
   page keeps its warmth and the creature keeps its own ground. Edge fades out
   entirely rather than ending, so it reads as depth, not as a sphere. */
.orb-stage::before {
  content: ''; position: absolute; inset: 3%; border-radius: 50%;
  background: radial-gradient(circle,
    rgba(35, 28, 45, 0.98) 0%,
    rgba(35, 28, 45, 0.96) 42%,
    rgba(37, 30, 47, 0.8) 56%,
    rgba(40, 33, 50, 0.32) 68%,
    rgba(40, 33, 50, 0) 78%);
}

.orb {
  position: absolute; inset: 15%; z-index: 1;
  border-radius: 50%;
  /* Glow only. The grains are the body — if this gradient is opaque enough to
     read as the creature on its own, the thing looks like a lens flare. */
  background:
    radial-gradient(circle at 45% 42%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 227, 154, 0.55) 18%, rgba(255, 127, 176, 0.4) 44%, rgba(123, 106, 208, 0.24) 66%, rgba(107, 111, 160, 0) 78%);
  filter: blur(16px);
  animation: breathe 10s var(--ease) infinite;
}
.orb::after {
  content: ''; position: absolute; inset: -34%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 127, 176, 0.2) 0%, rgba(123, 106, 208, 0.11) 44%, transparent 68%);
  animation: breathe 10s var(--ease) infinite reverse;
}

/* The real thing: the particle renderer, ported down in assets/creature.js. The
   canvas fades in over the CSS orb once it has a context, so a browser without
   WebGL (or with the script blocked) still gets a creature-shaped glow rather
   than a hole in the page. Masked to a soft circle so its dark ground dissolves
   into the paper instead of ending at an edge. */
.creature {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%;
  border-radius: 50%;
  opacity: 0; transition: opacity 1.2s var(--ease);
  -webkit-mask-image: radial-gradient(circle, #000 54%, rgba(0, 0, 0, 0.55) 66%, transparent 76%);
  mask-image: radial-gradient(circle, #000 54%, rgba(0, 0, 0, 0.55) 66%, transparent 76%);
}
.orb-stage.live .creature { opacity: 1; }
/* Only the CSS glow goes. The ::before well stays: the creature sits inside it,
   small and dark-grounded, which is the look. */
.orb-stage.live .orb { opacity: 0; transition: opacity 1.2s var(--ease); }

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.055); }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .orb::after { animation: none !important; }
}

.orb-caption {
  position: absolute; bottom: -3%; left: 50%; transform: translateX(-50%); z-index: 3;
  font-family: var(--meta); font-size: 0.78rem; color: var(--ink-faint); white-space: nowrap;
}

/* ============================== sections =============================== */

section { position: relative; }
.band { padding: clamp(56px, 8vw, 104px) 0; }
.band-tint { background: var(--paper-2); }
.band-tint-2 {
  background: linear-gradient(170deg, var(--sun) 0%, var(--blush) 52%, var(--sky) 100%);
}
.band-ink { background: #241f2c; color: #d9d2dd; }
.band-ink h2, .band-ink h3 { color: #fdf8f2; }

/* Interior page opener — the hero's glow, without the hero. */
.pagehead { padding-bottom: clamp(20px, 3vw, 34px); overflow: hidden; }
.pagehead::before {
  content: ''; position: absolute; inset: -60% -10% auto -10%; height: 190%;
  background:
    radial-gradient(40% 60% at 82% 40%, rgba(255, 227, 154, 0.34), transparent 68%),
    radial-gradient(46% 60% at 24% 20%, rgba(123, 106, 208, 0.14), transparent 70%);
  pointer-events: none;
}
.pagehead .wrap { position: relative; }
.pagehead .sec-head { margin-bottom: 0; }

.sec-head { max-width: 40rem; margin-bottom: clamp(30px, 4vw, 52px); }
.sec-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.sec-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.65rem); }
.sec-head p { font-size: 1.08rem; color: var(--ink-soft); margin-bottom: 0; }
.band-ink .sec-head p { color: #b3a9b8; }

.kicker {
  font-family: var(--meta); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent-deep);
  margin-bottom: 14px;
}
.band-ink .kicker { color: var(--delight); }

/* ============================== cards ================================== */

.cards { display: grid; gap: 20px; }
.cards.c2 { grid-template-columns: repeat(2, 1fr); }
.cards.c3 { grid-template-columns: repeat(3, 1fr); }
.cards.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 940px) { .cards.c3, .cards.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cards.c2, .cards.c3, .cards.c4 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 20px; padding: 26px 26px 28px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
a.card { text-decoration: none; display: block; color: inherit; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); color: inherit; }
@media (prefers-reduced-motion: reduce) { a.card:hover { transform: none; } }

.card h3 { font-size: 1.24rem; margin-bottom: 0.4em; }
.card p { font-size: 0.98rem; color: var(--ink-soft); }

.glyph {
  width: 46px; height: 46px; border-radius: 14px; margin-bottom: 16px;
  display: grid; place-items: center;
  background: var(--accent-wash);
}
.glyph svg { width: 24px; height: 24px; }
.glyph.g-rose { background: var(--blush); }
.glyph.g-sun { background: var(--sun); }
.glyph.g-sky { background: var(--sky); }

.card .more {
  font-family: var(--meta); font-size: 0.85rem; font-weight: 700; color: var(--accent-deep);
  margin-top: 16px; display: inline-block;
}

/* ============================== split ================================== */

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.split.wide-left { grid-template-columns: 1.15fr 0.85fr; }
@media (max-width: 900px) { .split, .split.wide-left { grid-template-columns: 1fr; } }

.prose { font-size: 1.06rem; }
.prose h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
.prose h3 { font-size: 1.2rem; margin-top: 1.6em; }
.prose .pull {
  font-family: var(--display); font-size: 1.3rem; line-height: 1.4; color: var(--ink);
  border-left: 3px solid var(--delight); padding-left: 20px; margin: 1.5em 0;
  font-variation-settings: 'SOFT' 80, 'WONK' 1;
}

/* =========================== emotion chips ============================= */

.emochips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.emochips span {
  font-family: var(--meta); font-size: 0.79rem; font-weight: 600; color: var(--ink-2);
  background: var(--paper); border: 1px solid var(--line-soft);
  padding: 4px 11px; border-radius: 999px;
}
/* The tail fades: the point is that the list keeps going and that the creature
   sits between the names, not that these sixteen are the set. */
.emochips span:nth-child(n + 11) { opacity: 0.62; }
.emochips span:nth-child(n + 14) { opacity: 0.4; }

/* ============================ promises ================================= */

.promise-list { display: grid; gap: 2px; margin-top: 34px; }
.promise {
  display: flex; gap: 16px; align-items: baseline;
  padding: 18px 0; border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.promise:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.promise .no {
  font-family: var(--meta); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--delight); flex: 0 0 5.4rem; padding-top: 0.35em;
}
.promise p { font-size: 1.04rem; margin: 0; }
.promise strong { color: #fdf8f2; font-weight: 600; }

/* ============================== tiers ================================== */

.tier {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 22px;
  padding: 30px; box-shadow: var(--shadow-soft);
}
.tier.feature { border-color: rgba(123, 106, 208, 0.3); box-shadow: var(--shadow-lift); }
.tier h3 { font-size: 1.45rem; margin-bottom: 0.15em; }
.tier .price { font-family: var(--meta); font-size: 0.9rem; color: var(--ink-faint); margin-bottom: 18px; }
.tier ul { list-style: none; margin: 0; padding: 0; }
.tier li {
  position: relative; padding: 7px 0 7px 26px; font-size: 0.99rem; color: var(--ink-2);
  border-bottom: 1px solid var(--line-soft);
}
.tier li:last-child { border-bottom: 0; }
.tier li::before {
  content: ''; position: absolute; left: 4px; top: 1.05em; width: 8px; height: 8px;
  border-radius: 50%; background: var(--delight);
}
.tier.feature li::before { background: var(--accent); }

.tier-note {
  margin-top: 22px; font-size: 0.95rem; color: var(--ink-soft);
  background: var(--paper-2); border-radius: 14px; padding: 16px 18px;
}

/* ============================== notes ================================== */

.note-box {
  border: 1px solid var(--line); border-radius: 18px; padding: 24px 26px;
  background: rgba(255, 255, 255, 0.62);
}
.note-box.warm { background: linear-gradient(160deg, var(--blush), var(--sun)); border-color: transparent; }
.note-box h3 { font-size: 1.1rem; }
.note-box p { font-size: 0.98rem; color: var(--ink-soft); margin-bottom: 0.8em; }
.note-box p:last-child { margin-bottom: 0; }

.soon {
  display: inline-block; font-family: var(--meta); font-size: 0.7rem; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--sun); color: #7a5a12; border-radius: 999px; padding: 4px 10px;
  vertical-align: middle; margin-left: 8px;
}

/* ============================== cta ==================================== */

.cta-band { text-align: center; }
.cta-band h2 { font-size: clamp(2rem, 4.4vw, 3rem); }
.cta-band .lede { margin: 0 auto; max-width: 34rem; }
.cta-band .hero-actions { justify-content: center; }

/* ============================== footer ================================= */

.site-foot {
  background: var(--paper-3);
  padding: clamp(46px, 6vw, 72px) 0 34px;
  font-size: 0.95rem;
}
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
@media (max-width: 820px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .foot-grid { grid-template-columns: 1fr; } }

.foot-grid h5 {
  font-family: var(--meta); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 12px;
}
.foot-grid ul { list-style: none; margin: 0; padding: 0; }
.foot-grid li { margin-bottom: 7px; }
.foot-grid a { color: var(--ink-2); text-decoration: none; }
.foot-grid a:hover { color: var(--accent-deep); text-decoration: underline; }
.foot-blurb { color: var(--ink-soft); font-size: 0.95rem; max-width: 22rem; }
.foot-blurb .brand { margin-bottom: 12px; }

/* The byline is a route to a person, not fine print — it stays at body weight
   with the name plainly a link. */
.byline { color: var(--ink-2); }
.byline a { color: var(--accent-deep); text-decoration-thickness: 1px; }
.byline a.me { font-weight: 700; }
.byline a:hover { color: var(--anger); }

.foot-bottom {
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center;
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line);
  font-family: var(--meta); font-size: 0.85rem; color: var(--ink-faint);
}
/* Underlined, not bare: an unstyled link in a muted footer row reads as text,
   and "Built on Liminalis" has to be visibly clickable. */
.foot-bottom a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.foot-bottom a:hover { color: var(--accent-deep); }
.foot-bottom a.lit { font-weight: 700; }

/* =========================== build state ==============================
   Two switches, both meant to be flipped by hand.

   .prelaunch — links to things that only make sense once the app is on a
   store (the legal shells). Written into the markup now so the information
   architecture is real; hidden until there is something to link to. To turn
   them on, comment out the display rule.

   .ph — placeholder: a link whose page has not been built yet. Visible, but
   marked with a dotted underline so an unbuilt path is obvious at a glance
   while we are still assembling the site. Delete the rule (or the classes)
   when the pages exist.
   ====================================================================== */

.prelaunch { display: none; }

.ph { text-decoration: underline dotted 1.5px; text-decoration-color: rgba(148, 130, 190, 0.6); }
.nav .ph, .foot-grid .ph { text-decoration: underline dotted 1.5px rgba(148, 130, 190, 0.55); }
a.card.ph { text-decoration: none; box-shadow: var(--shadow-soft), inset 0 0 0 1.5px rgba(148, 130, 190, 0.22); }
.btn.ph { text-decoration: none; }

/* ============================== reveal ================================= */

.rv { opacity: 0; transform: translateY(14px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.rv.in { opacity: 1; transform: none; }
.no-js .rv { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; transition: none; } }
