/* ============================================================================
   Cairn — site.css
   Device frame, font wiring, starfield, section washes, components, and the
   small motion/helper bits Tailwind utilities don't cover. Colors come from
   assets/brand-tokens.css (CSS variables); this file only references them.
   ============================================================================ */

/* ---- base ---------------------------------------------------------------- */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Spectral looks best with old-style figures off and proper ligatures */
.font-serif { font-feature-settings: "liga" 1, "kern" 1; }

/* Tighter, more editorial headline leading + optical sizing */
h1, h2, h3, .headline { letter-spacing: -0.015em; }
.display { line-height: 1.04; letter-spacing: -0.02em; }

/* Warm text selection */
::selection { background: var(--gold-tint); color: var(--ink); }
:root[data-theme="dark"] ::selection,
.on-dark ::selection { background: rgba(215,176,92,.32); color: #fff; }

/* Visible, on-brand focus rings everywhere */
:where(a, button, summary, input, [tabindex]):focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 6px;
}
.on-dark :where(a, button, summary):focus-visible { outline-color: #cdd8f2; }

/* ---- eyebrow / small-caps label (matches the app's "A STONE IS SET") ----- */
.eyebrow {
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold-deep);
}
.eyebrow--indigo { color: var(--indigo); }
.eyebrow--sage   { color: var(--sage); }
.eyebrow--mute   { color: var(--ink3); }
.on-dark .eyebrow { color: var(--gold); }

/* ---- section washes (from brand tokens) ---------------------------------- */
.wash-warm    { background: var(--wash-warm); }
.wash-declare { background: var(--wash-declare); }
.wash-sage    { background: var(--wash-sage); }
.wash-dawn    { background: var(--wash-dawn); }
.wash-cool    { background: var(--wash-cool); }
.wash-airy    { background: var(--wash-airy); }

/* ---- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.95rem;
  padding: 0.78rem 1.4rem; border-radius: var(--r-pill);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .25s cubic-bezier(.2,.7,.3,1), box-shadow .25s ease, background-color .2s ease, border-color .2s ease;
}
.btn svg { width: 1.05em; height: 1.05em; }
.btn-primary {
  background: var(--grad-button); color: #fff;
  box-shadow: 0 10px 24px -12px rgba(46,69,116,.85), inset 0 1px 0 rgba(255,255,255,.14);
}
.btn-primary:hover { box-shadow: 0 18px 34px -14px rgba(46,69,116,.9), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-ghost {
  background: var(--surface); color: var(--ink); border-color: var(--line2);
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset;
}
.btn-ghost:hover { background: var(--surface-hi); border-color: var(--ink3); }
/* on a dark hero panel */
.btn-on-dark-ghost {
  background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.28);
  backdrop-filter: blur(4px);
}
.btn-on-dark-ghost:hover { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.5); }
@media (prefers-reduced-motion: no-preference) {
  .btn:hover { transform: translateY(-2px); }
  .btn:active { transform: translateY(0); }
}

/* ---- cards & tiles ------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: 0 10px 30px -18px rgba(30,33,46,.22);
}
.card-hover { transition: transform .3s cubic-bezier(.2,.7,.3,1), box-shadow .3s ease, border-color .3s ease; }
@media (prefers-reduced-motion: no-preference) {
  .card-hover:hover { transform: translateY(-4px); box-shadow: 0 22px 48px -22px rgba(30,33,46,.34); border-color: var(--line2); }
}

/* rounded-square brand icon tile (mirrors the colorful rows in settings.png) */
.icon-tile {
  display: inline-grid; place-items: center;
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.03);
}
.icon-tile svg { width: 24px; height: 24px; }
.tile-indigo { background: var(--indigo-tint); color: var(--indigo); }
.tile-sage   { background: var(--sage-tint);   color: var(--sage); }
.tile-gold   { background: var(--gold-tint);   color: var(--gold-deep); }
.tile-amber  { background: var(--amber-tint);  color: var(--amber-deep); }
.tile-rose   { background: var(--rose-tint);   color: var(--rose); }

/* ---- the device frame (key component) ------------------------------------ */
.phone { position: relative; width: 100%; max-width: 300px; margin-inline: auto; }
.phone__frame {
  border-radius: 44px;
  background: #0b0d12;
  padding: 10px;
  box-shadow:
    0 30px 60px -20px rgba(30,33,46,.45),
    0 8px 22px -12px rgba(30,33,46,.4),
    0 0 0 1px rgba(0,0,0,.06),
    inset 0 0 0 2px rgba(255,255,255,.04);
}
.phone__screen {
  display: block; width: 100%; border-radius: 34px; aspect-ratio: 1206 / 2622;
  object-fit: cover; background: var(--paper);
}
.phone--tilt  { transform: rotate(-3deg); }
.phone--tiltR { transform: rotate(3deg); }
@media (prefers-reduced-motion: no-preference) {
  .phone--float { animation: phoneFloat 6s ease-in-out infinite; }
  .phone--floatSlow { animation: phoneFloat 8s ease-in-out infinite; }
}
@keyframes phoneFloat { 0%,100% { translate: 0 0 } 50% { translate: 0 -10px } }

/* soft glow puddle under a floating phone */
.phone__glow {
  position: absolute; left: 50%; bottom: -6%; width: 78%; height: 14%;
  transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(30,33,46,.28), transparent 70%);
  filter: blur(8px); z-index: -1;
}

/* ---- hero panel + starfield ---------------------------------------------- */
.hero-panel {
  position: relative; overflow: hidden;
  background: var(--grad-hero);
  color: #fff;
  isolation: isolate;
}
/* a quiet scattering of stars + two faint nebula glows for depth */
.starfield::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 8% 14%,  rgba(255,255,255,.65), transparent 60%),
    radial-gradient(1px 1px   at 17% 42%,  rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1.2px 1.2px at 24% 76%, rgba(255,255,255,.40), transparent 60%),
    radial-gradient(1px 1px   at 33% 22%,  rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.5px 1.5px at 41% 58%, rgba(255,255,255,.50), transparent 60%),
    radial-gradient(1px 1px   at 49% 12%,  rgba(255,255,255,.40), transparent 60%),
    radial-gradient(1.2px 1.2px at 57% 84%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1px 1px   at 63% 34%,  rgba(255,255,255,.35), transparent 60%),
    radial-gradient(1.6px 1.6px at 71% 66%, rgba(255,255,255,.60), transparent 60%),
    radial-gradient(1px 1px   at 78% 20%,  rgba(255,255,255,.42), transparent 60%),
    radial-gradient(1.3px 1.3px at 84% 50%, rgba(255,255,255,.48), transparent 60%),
    radial-gradient(1px 1px   at 91% 78%,  rgba(255,255,255,.38), transparent 60%),
    radial-gradient(1.2px 1.2px at 95% 30%, rgba(255,255,255,.5),  transparent 60%),
    radial-gradient(1px 1px   at 12% 88%,  rgba(255,255,255,.35), transparent 60%),
    radial-gradient(1.1px 1.1px at 45% 92%, rgba(255,255,255,.4),  transparent 60%),
    radial-gradient(1px 1px   at 67% 8%,   rgba(255,255,255,.4),  transparent 60%);
  background-repeat: no-repeat;
}
.starfield::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 30% at 78% 12%, rgba(120,150,210,.22), transparent 70%),
    radial-gradient(45% 35% at 14% 86%, rgba(200,162,74,.10), transparent 70%);
}
@media (prefers-reduced-motion: no-preference) {
  .starfield::before { animation: twinkle 7s ease-in-out infinite; }
}
@keyframes twinkle { 0%,100% { opacity: .85 } 50% { opacity: .55 } }

/* ---- sticky translucent nav ---------------------------------------------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-link {
  position: relative; font-weight: 500; color: var(--ink2);
  padding: 0.4rem 0.2rem; transition: color .2s ease;
}
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="page"] { color: var(--ink); }
.nav-link[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  border-radius: 2px; background: var(--indigo);
}
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--r-pill); border: 1px solid var(--line2);
  background: var(--surface-hi); color: var(--ink2); cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink3); }
.icon-btn svg { width: 20px; height: 20px; }

/* theme toggle: swap sun/moon based on effective theme */
.theme-toggle .i-sun  { display: none; }
.theme-toggle .i-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .i-sun,
.theme-dark .theme-toggle .i-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon,
.theme-dark .theme-toggle .i-moon { display: none; }

/* mobile menu */
.mobile-menu { display: none; }
.mobile-menu.open { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .mobile-menu.open { animation: menuIn .22s ease both; }
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.hamburger {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-pill);
  border: 1px solid var(--line2); background: var(--surface-hi); color: var(--ink2); cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.hamburger:hover { color: var(--ink); border-color: var(--ink3); }
.hamburger span {
  display: block; width: 20px; height: 2px; border-radius: 2px;
  background: currentColor; transition: transform .25s ease, opacity .2s ease;
}
.hamburger span + span { margin-top: 5px; }
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- FAQ accordion (<details>) ------------------------------------------- */
.faq-item { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; transition: border-color .2s ease, box-shadow .3s ease; }
.faq-item[open] { border-color: var(--line2); box-shadow: 0 12px 30px -20px rgba(30,33,46,.28); }
.faq-item > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.15rem 1.3rem; font-family: var(--font-serif); font-size: 1.12rem; color: var(--ink);
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item .faq-chevron { flex: none; transition: transform .25s ease; color: var(--ink3); }
.faq-item[open] .faq-chevron { transform: rotate(90deg); color: var(--indigo); }
.faq-body { padding: 0 1.3rem 1.25rem; color: var(--ink2); line-height: 1.65; }
@media (prefers-reduced-motion: no-preference) {
  .faq-item[open] .faq-body { animation: faqIn .28s ease both; }
}
@keyframes faqIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---- scroll reveal ------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); }
.reveal.is-visible { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.3,1); }
.reveal-d1.is-visible { transition-delay: .08s; }
.reveal-d2.is-visible { transition-delay: .16s; }
.reveal-d3.is-visible { transition-delay: .24s; }
.reveal-d4.is-visible { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---- misc helpers -------------------------------------------------------- */
.verse { font-style: italic; font-family: var(--font-serif); }
.hairline { height: 1px; background: var(--line); border: 0; }
.link-underline { text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; transition: text-decoration-color .2s ease; }
.link-underline:hover { text-decoration-color: var(--indigo); }
.stone-shadow { filter: drop-shadow(0 14px 22px rgba(30,33,46,.28)); }

/* faint paper grain for warmth on large washes (very subtle) */
.grain { position: relative; }
.grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* keep content above grain */
.grain > * { position: relative; z-index: 1; }

/* float animation utility for the small stone mark near the headline */
@media (prefers-reduced-motion: no-preference) {
  .float-slow { animation: phoneFloat 7s ease-in-out infinite; }
}

/* ---- legal / long-form prose (privacy, terms) ---------------------------- */
.legal { color: var(--ink2); line-height: 1.72; }
.legal > * + * { margin-top: 1rem; }
.legal h2 {
  font-family: var(--font-serif); color: var(--ink); font-size: 1.5rem;
  letter-spacing: -0.01em; margin-top: 2.6rem; margin-bottom: 0.2rem; scroll-margin-top: 6rem;
}
.legal h3 { font-family: var(--font-serif); color: var(--ink); font-size: 1.16rem; margin-top: 1.6rem; margin-bottom: 0.1rem; }
.legal p { margin-bottom: 0; }
.legal ul { margin: 0.5rem 0 0.25rem; padding-left: 1.2rem; list-style: disc; }
.legal ul li { margin-bottom: 0.45rem; }
.legal ul li::marker { color: var(--ink3); }
.legal a { color: var(--indigo); text-decoration: underline; text-underline-offset: 2px; }
.legal a:hover { text-decoration-color: var(--indigo2); }
.legal strong { color: var(--ink); font-weight: 600; }
.legal .legal-note {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--indigo);
  border-radius: var(--r-md); padding: 1.1rem 1.25rem; color: var(--ink2);
}
.legal .legal-note p { margin: 0; }
.legal hr { border: 0; height: 1px; background: var(--line); margin: 2.5rem 0; }

/* ---- store badges (placeholder until App Store / Play URLs exist) --------- */
.store-badge {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 1.15rem; border-radius: 14px;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.28);
  color: #fff; text-align: left; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: background-color .2s ease, border-color .2s ease, transform .25s cubic-bezier(.2,.7,.3,1);
}
.store-badge:hover { background: rgba(255,255,255,.17); border-color: rgba(255,255,255,.5); }
@media (prefers-reduced-motion: no-preference) { .store-badge:hover { transform: translateY(-2px); } }
.store-badge svg { width: 22px; height: 22px; flex: none; }
.store-badge .sb-top { display: block; font-size: 0.64rem; letter-spacing: 0.04em; opacity: .8; line-height: 1.1; }
.store-badge .sb-name { display: block; font-size: 1rem; font-weight: 600; line-height: 1.15; }
/* light-surface variant (for use off the navy panel) */
.store-badge--ink { background: var(--ink); border-color: var(--ink); }
.store-badge--ink:hover { background: #000; }

/* ---- toast (e.g. "email copied" confirmation) ---------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px);
  display: inline-flex; align-items: center; gap: 0.5rem; max-width: min(92vw, 26rem);
  background: var(--ink); color: var(--paper);
  padding: 0.7rem 1.1rem; border-radius: var(--r-pill);
  font-size: 0.9rem; font-weight: 500; line-height: 1.2;
  box-shadow: 0 14px 34px -12px rgba(30,33,46,.55);
  opacity: 0; pointer-events: none; z-index: 100;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.7,.3,1);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 1.05em; height: 1.05em; color: var(--sage); flex: none; }
@media (prefers-reduced-motion: reduce) { .toast { transition: opacity .2s ease; } }

/* ---- pricing plans ------------------------------------------------------- */
.plan { position: relative; display: flex; flex-direction: column; height: 100%; }
.plan-featured {
  border-color: var(--indigo); border-width: 1.5px;
  box-shadow: 0 22px 50px -24px rgba(46,69,116,.5);
}
.plan-badge {
  position: absolute; top: -0.85rem; left: 50%; transform: translateX(-50%);
  background: var(--grad-button); color: #fff;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  padding: 0.32rem 0.85rem; border-radius: var(--r-pill); white-space: nowrap;
  box-shadow: 0 8px 18px -7px rgba(46,69,116,.65);
}
.plan-price { font-family: var(--font-serif); letter-spacing: -0.02em; line-height: 1; }
/* feature checklist (free vs Cairn+) */
.check-list li { display: flex; gap: 0.6rem; align-items: flex-start; }
.check-list li svg { flex: none; width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; }
