/* ==========================================================================
   Journalify — launch site
   Palette + glass recipe ported from the app (journify/src/theme.js,
   GlassButton.js, GlassSurface.js). Domine = display, Nunito = body,
   Inter = UI labels / legal text.
   ========================================================================== */

/* ---------- Fonts (self-hosted, latin subsets, variable) ---------- */
@font-face {
  font-family: "Domine";
  src: url("/assets/domine-var.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("/assets/nunito-var.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

/* ---------- Tokens (source of truth: src/theme.js) ---------- */
:root {
  color-scheme: light;

  --primary: #c4ace8;            /* theme.colors.primary        */
  --light-pink: #f5e6ff;         /* theme.colors.lightPink      */
  --accent: #9488ff;             /* theme.colors.accent         */
  --accent-deep: #9c7ed1;        /* theme.colors.accentDeep     */
  --accent-deep-pressed: #856bb2;
  --cta: #6d4fc4;                /* theme.colors.ctaPurple      */
  --cta-pressed: #5b3fa8;
  --cta-soft: rgba(109, 79, 196, 0.12);

  --ink: #111;                   /* theme.colors.ink            */
  --ink-rich: #1a1320;           /* theme.colors.inkRich        */
  --text-mute: #5b5666;          /* theme.colors.textMute       */
  --text-faint: #7a7385;         /* theme.colors.textFaint      */

  --paper: #fcfaf4;              /* theme.colors.paperLined     */
  --paper-soft: #fff7f7;         /* theme.colors.paperSoft      */
  --blush: #fbedeb;              /* theme.colors.welcomeBg      */
  --hairline: rgba(0, 0, 0, 0.08);

  --blob-lavender: rgba(196, 172, 232, 0.55);
  --blob-peach: rgba(255, 218, 196, 0.5);
  --blob-cream: rgba(250, 235, 215, 0.55);
  --primary-glow: rgba(156, 126, 209, 0.25);

  --glass-fill: rgba(250, 248, 245, 0.62);   /* web take on glassFillBg   */
  --glass-fill-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.7);  /* glassFillBorder           */
  --glass-highlight: rgba(255, 255, 255, 0.85);

  --font-display: "Domine", Georgia, "Times New Roman", serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --container: 1140px;
  --gutter: clamp(20px, 5vw, 48px);
  --radius-pill: 999px;
  --radius-card: 28px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink-rich);
  background: var(--paper);
  overflow-x: clip;
  touch-action: manipulation;
}

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

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; }
p { margin: 0; }

a { color: var(--cta); text-decoration-thickness: 1px; text-underline-offset: 3px; }

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 18px;
  background: var(--ink-rich);
  color: #fff;
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: 0.875rem;
}
.skip-link:focus { top: 12px; }

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ==========================================================================
   Backdrop — drifting color blobs the glass surfaces blur against.
   (Same idea as the app: flat backgrounds defeat the liquid-glass effect.)
   ========================================================================== */
.scene {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--paper-soft) 0%, var(--paper) 42%, var(--paper) 100%);
}
.blob {
  position: absolute;
  width: 58vmax;
  aspect-ratio: 1;
  border-radius: 50%;
  will-change: transform;
}
.blob--lavender {
  top: -22vmax; right: -14vmax;
  background: radial-gradient(closest-side, var(--blob-lavender), transparent 72%);
  animation: drift-a 34s ease-in-out infinite alternate;
}
.blob--peach {
  bottom: -26vmax; left: -16vmax;
  background: radial-gradient(closest-side, var(--blob-peach), transparent 72%);
  animation: drift-b 41s ease-in-out infinite alternate;
}
.blob--pink {
  top: 32%; left: -20vmax;
  width: 46vmax;
  background: radial-gradient(closest-side, rgba(245, 230, 255, 0.8), transparent 70%);
  animation: drift-c 29s ease-in-out infinite alternate;
}
.blob--cream {
  bottom: -12vmax; right: -10vmax;
  width: 42vmax;
  background: radial-gradient(closest-side, var(--blob-cream), transparent 72%);
  animation: drift-b 37s ease-in-out infinite alternate-reverse;
}
@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-7vmax, 9vmax, 0) scale(1.14); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.05); }
  to   { transform: translate3d(8vmax, -6vmax, 0) scale(0.94); }
}
@keyframes drift-c {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vmax, -9vmax, 0) scale(1.1); }
}

/* Legal pages: quieter backdrop so long text stays effortless to read */
.page-legal .blob { opacity: 0.55; }

/* Fine grain so the soft gradients never band */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Liquid glass — port of GlassSurface.js / GlassButton.js
   fill rgba(242,242,242,.85) → lighter on web so the blobs glow through;
   border 1px rgba(255,255,255,.7); shadow 0 12 20 rgba(0,0,0,.18) softened;
   BlurView(85) → backdrop-filter blur + saturate.
   ========================================================================== */
.glass {
  position: relative;
  background: var(--glass-fill);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    inset 0 -1px 0 rgba(255, 255, 255, 0.35),
    0 12px 24px rgba(26, 19, 32, 0.1),
    0 2px 6px rgba(26, 19, 32, 0.05);
}
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.1) 34%,
    rgba(255, 255, 255, 0) 55%
  );
}

/* ==========================================================================
   Nav
   ========================================================================== */
.nav-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 14px var(--gutter) 0;
  display: flex;
  justify-content: center;
}
.nav {
  width: 100%;
  max-width: calc(var(--container) - 2 * var(--gutter) + 96px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px 10px 20px;
  border-radius: var(--radius-pill);
  transition: box-shadow 0.4s ease, background-color 0.4s ease;
}
.nav.scrolled {
  background: var(--glass-fill-strong);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 12px 28px rgba(26, 19, 32, 0.13),
    0 2px 6px rgba(26, 19, 32, 0.06);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink-rich);
}
.brand img { width: 30px; height: 30px; }
.brand span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 28px);
}
.nav-links .nav-anchor {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-mute);
  text-decoration: none;
  transition: color 0.2s ease;
}
.nav-links .nav-anchor:hover { color: var(--ink-rich); }

/* Small solid pill — mirrors the app's one-solid-CTA rule (ctaPurple) */
.pill-cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  background: var(--cta);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(109, 79, 196, 0.32);
  transition: background-color 0.2s ease, transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}
.pill-cta:hover {
  background: var(--cta-pressed);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(109, 79, 196, 0.4);
}
.pill-cta:active { transform: scale(0.97); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  padding-top: clamp(120px, 16vh, 176px);
  padding-bottom: clamp(64px, 9vh, 120px);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  align-items: center;
  gap: clamp(40px, 6vw, 72px);
}
.hero-logo {
  width: clamp(58px, 7vw, 76px);
  height: auto;
  margin-bottom: clamp(20px, 3vh, 30px);
  filter: drop-shadow(0 10px 18px rgba(156, 126, 209, 0.35));
}
.hero h1 {
  font-size: clamp(2.4rem, 4.2vw + 1rem, 4rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--ink-rich);
}
.squiggle {
  position: relative;
  white-space: nowrap;
}
.squiggle svg {
  position: absolute;
  left: -1%;
  bottom: -0.18em;
  width: 102%;
  height: 0.32em;
  color: var(--accent-deep);
  opacity: 0.85;
}
.squiggle path {
  stroke-dasharray: 230;
  stroke-dashoffset: 230;
  animation: draw-line 1.1s var(--ease-out) 0.7s forwards;
}
@keyframes draw-line { to { stroke-dashoffset: 0; } }

.hero-sub {
  max-width: 34em;
  margin-top: clamp(18px, 2.5vh, 26px);
  font-size: clamp(1.1rem, 1.1vw + 0.8rem, 1.3rem);
  line-height: 1.6;
  color: var(--text-mute);
}
.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: clamp(26px, 4vh, 38px);
}
.hero-note {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-faint);
}
.hero-note a { color: var(--text-faint); }
.hero-note a:hover { color: var(--cta); }

/* --- App Store badge (official styling, SVG) --- */
.store-badge {
  display: inline-block;
  border-radius: 10px;
  line-height: 0;
  transition: transform 0.25s var(--ease-out), filter 0.25s ease;
}
.store-badge svg { height: 54px; width: auto; }
.store-badge:hover { transform: translateY(-2px); filter: brightness(1.15); }
.store-badge:active { transform: scale(0.97); }

/* --- Hero phone + floating jot chips --- */
.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
}
.hero-visual::before {
  /* soft lavender glow behind the phone */
  content: "";
  position: absolute;
  inset: -6% -14%;
  background: radial-gradient(closest-side, var(--primary-glow), transparent 74%);
  z-index: -1;
}
.phone {
  width: min(380px, 78vw);
  filter: drop-shadow(0 34px 56px rgba(109, 79, 196, 0.28));
}
.hero-visual .phone { transform: rotate(-2.5deg); }
.phone-wrap { line-height: 0; }
.chip-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink-rich);
  white-space: nowrap;
  animation: bob 5.4s ease-in-out infinite alternate;
}
.chip::after {
  content: "";
  order: -1;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-deep);
  flex: none;
}
.chip--1 { top: 9%; left: -9%; animation-delay: -1.2s; }
.chip--2 { top: 46%; right: -13%; animation-duration: 6.6s; animation-delay: -3s; }
.chip--3 { bottom: 17%; left: -5%; animation-duration: 6s; animation-delay: -4.4s; }
@keyframes bob {
  from { transform: translateY(-7px); }
  to   { transform: translateY(7px); }
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding-block: clamp(84px, 12vh, 150px); }

.eyebrow {
  display: block;
  margin-bottom: 14px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.section-title {
  font-size: clamp(1.9rem, 2.6vw + 0.8rem, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
  max-width: 18em;
}
.section-head { margin-bottom: clamp(48px, 8vh, 88px); }

/* --- Steps: jot → compile → look back --- */
.step {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(36px, 6vw, 84px);
}
.step + .step { margin-top: clamp(72px, 11vh, 140px); }
.step-media {
  display: flex;
  justify-content: center;
}
.step-media .phone { width: min(320px, 68vw); }
.step--flip .step-media { order: 2; }

.step-copy .eyebrow { color: var(--cta); }
.step-copy h3 {
  font-size: clamp(1.55rem, 1.6vw + 0.9rem, 2.15rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.step-copy p {
  margin-top: 16px;
  max-width: 32em;
  color: var(--text-mute);
  font-size: 1.08rem;
}
.step-copy .step-aside {
  margin-top: 14px;
  font-family: var(--font-ui);
  font-size: 0.86rem;
  color: var(--text-faint);
}
.jot-example {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink-rich);
}

/* --- Value band: type-led glass panel --- */
.value-panel {
  border-radius: calc(var(--radius-card) + 6px);
  padding: clamp(36px, 5vw, 64px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(28px, 4vw, 56px);
}
.value-cell + .value-cell {
  border-left: 1px solid var(--hairline);
  padding-left: clamp(28px, 4vw, 56px);
}
.value-cell .big {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 1.8vw + 0.8rem, 2.3rem);
  letter-spacing: -0.01em;
  color: var(--ink-rich);
}
.value-cell p {
  margin-top: 12px;
  color: var(--text-mute);
  font-size: 1rem;
}

/* --- Closing CTA --- */
.closing { text-align: center; }
.closing-panel {
  border-radius: calc(var(--radius-card) + 8px);
  padding: clamp(48px, 8vw, 96px) clamp(24px, 6vw, 96px);
  max-width: 880px;
  margin-inline: auto;
}
.closing-panel h2 {
  font-size: clamp(1.9rem, 3vw + 0.6rem, 3.1rem);
  line-height: 1.14;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.closing-panel p {
  margin: 18px auto 0;
  max-width: 30em;
  color: var(--text-mute);
  font-size: 1.1rem;
}
.closing-panel .store-badge { margin-top: 34px; }

/* --- Support --- */
.support {
  padding-top: 0;
  text-align: center;
}
.support .eyebrow { margin-bottom: 12px; }
.support .section-title { margin-inline: auto; }
.support p {
  margin: 16px auto 0;
  max-width: 32em;
  color: var(--text-mute);
}
.support-email {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  margin-top: 30px;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--cta);
  text-decoration: none;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}
.support-email:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 14px 28px rgba(26, 19, 32, 0.13),
    0 2px 6px rgba(26, 19, 32, 0.06);
}
.support-email:active { transform: scale(0.98); }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  border-top: 1px solid var(--hairline);
  padding: 36px 0 44px;
  margin-top: clamp(40px, 8vh, 96px);
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}
.footer .brand img { width: 24px; height: 24px; }
.footer .brand span { font-size: 1.05rem; }
.footer-links {
  display: flex;
  gap: 26px;
  font-family: var(--font-ui);
  font-size: 0.88rem;
}
.footer-links a {
  color: var(--text-mute);
  text-decoration: none;
}
.footer-links a:hover { color: var(--cta); text-decoration: underline; }
.footer-copy {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-faint);
}

/* ==========================================================================
   Toast (shown while the App Store link is still a placeholder)
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  transform: translate(-50%, calc(100% + 44px));
  visibility: hidden;
  padding: 14px 24px;
  border-radius: var(--radius-pill);
  background: var(--glass-fill-strong);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-rich);
  transition: transform 0.5s var(--ease-out), visibility 0s linear 0.5s;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show {
  transform: translate(-50%, 0);
  visibility: visible;
  transition: transform 0.5s var(--ease-out), visibility 0s;
}

/* ==========================================================================
   Legal pages (privacy / terms)
   ========================================================================== */
.legal-main {
  padding-top: clamp(120px, 16vh, 168px);
  padding-bottom: clamp(64px, 10vh, 120px);
}
.legal-header { margin-bottom: clamp(36px, 6vh, 56px); max-width: 65ch; }
.legal-header h1 {
  font-size: clamp(2.1rem, 3vw + 0.8rem, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.012em;
}
.legal-header .legal-meta {
  margin-top: 14px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-faint);
}
.prose-panel {
  max-width: 760px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.66);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 12px 28px rgba(26, 19, 32, 0.07);
  padding: clamp(28px, 5vw, 64px);
}
.prose {
  max-width: 65ch;
  font-family: var(--font-ui);
  font-size: 1.03rem;
  line-height: 1.75;
  color: #2e2938;
}
.prose h2 {
  font-size: 1.42rem;
  line-height: 1.3;
  margin: 2.4em 0 0.7em;
  color: var(--ink-rich);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
  font-size: 1.12rem;
  margin: 1.8em 0 0.5em;
  color: var(--ink-rich);
}
.prose p { margin: 0 0 1.1em; }
.prose ul { margin: 0 0 1.1em; padding-left: 1.3em; }
.prose li { margin-bottom: 0.45em; }
.prose li::marker { color: var(--accent-deep); }

/* ==========================================================================
   Reveal-on-scroll (JS adds .is-in; hidden states only when JS is present)
   ========================================================================== */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.9s var(--ease-out),
    transform 0.9s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}
[data-parallax] { will-change: transform; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 64px; }
  .hero-copy { max-width: 560px; }
  .hero-visual { margin-inline: auto; }

  .step,
  .step--flip { grid-template-columns: 1fr; gap: 36px; }
  .step--flip .step-media { order: 0; }
  .step-media { order: 0; }
  .step-copy { max-width: 560px; }

  .value-panel { grid-template-columns: 1fr; gap: 0; }
  .value-cell + .value-cell {
    border-left: 0;
    border-top: 1px solid var(--hairline);
    padding-left: 0;
    padding-top: 28px;
    margin-top: 28px;
  }
}

@media (max-width: 640px) {
  .nav-links .nav-anchor { display: none; }
  .pill-cta { min-height: 42px; padding: 9px 18px; font-size: 0.9rem; }
  .store-badge svg { height: 50px; }
  .chip { font-size: 0.82rem; padding: 9px 14px; }
  .chip--1 { left: 0; }
  .chip--2 { right: 0; }
  .chip--3 { display: none; }
  .hero-visual .phone { transform: none; }
}

/* ==========================================================================
   Reduced motion — everything lands instantly, nothing drifts
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .blob, .chip, .squiggle path {
    animation: none;
  }
  .squiggle path { stroke-dashoffset: 0; }
  .js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .store-badge, .pill-cta, .support-email { transition: none; }
}
