/* app.css — shared styles for an app's landing + legal pages under mafham.dev.
   Mirrors the main site's tokens (Inter/Clash Display, blue accent, dark-first
   with a light override). Copy this whole folder as a template for future apps:
   swap the copy, the --brand colour, and the icon. */

:root {
  --font-display: 'Clash Display', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --max-w: 800px;
  --ease: cubic-bezier(.22,.61,.36,1);

  --bg: #0B0C0F;
  --bg-elev: #111318;
  --surface: #14161C;
  --text: #F2F3F5;
  --text-2: rgba(242,243,245,.66);
  --text-3: rgba(242,243,245,.42);
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.14);
  --accent: #0A84FF;
  --accent-soft: rgba(10,132,255,.12);
  --shadow: 0 24px 64px rgba(0,0,0,.5);

  /* Per-app brand accent (Kindbloom coral). Used sparingly for identity. */
  --brand: #FF5A4D;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F7F7F8;
    --bg-elev: #FFFFFF;
    --surface: #FFFFFF;
    --text: #16181D;
    --text-2: rgba(22,24,29,.66);
    --text-3: rgba(22,24,29,.45);
    --line: rgba(22,24,29,.09);
    --line-strong: rgba(22,24,29,.16);
    --accent: #0066DD;
    --accent-soft: rgba(0,102,221,.08);
    --shadow: 0 24px 64px rgba(22,24,29,.10);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Nav — a slim bar matching the main site's logo treatment. */
.nav {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(140%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 20px;
}
.logo { font-family: var(--font-display); font-weight: 600; font-size: 17px;
  letter-spacing: -.01em; color: var(--text); }
.logo span { color: var(--accent); }
/* Back link leads on the left; the logo sits after it, pushed to the right. */
.nav-back {
  font-size: 14px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.nav-back:hover { color: var(--text); text-decoration: none; }
.nav-inner .logo { margin-left: auto; }

.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* Headings */
h1 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.1; margin: 0 0 6px; }
h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em;
  font-size: 1.25rem; margin: 40px 0 12px; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin: 0 0 10px; }
.updated { color: var(--text-3); font-size: .9rem; font-family: var(--font-mono); }

p, li { color: var(--text-2); }
strong { color: var(--text); font-weight: 600; }
ul { padding-left: 1.2em; } li { margin: 6px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 44px 0; }

/* Legal-page lead callout */
.lead {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 20px; margin: 22px 0 8px;
}
.lead p { margin: 0; color: var(--text); }

/* Footer — centred, links over a quiet copyright line. */
.foot {
  max-width: var(--max-w); margin: 0 auto; padding: 48px 24px;
  color: var(--text-3); font-size: .85rem;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; border-top: 1px solid var(--line);
}
.foot-links { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.foot-links a { color: var(--text-2); }
.foot-links a:hover { color: var(--text); }
.foot-copy { color: var(--text-3); }

/* ---- Landing page (minimal, hero-centric) ---- */
.hero {
  text-align: center;
  padding: clamp(64px, 12vh, 128px) 24px clamp(48px, 8vh, 80px);
}
/* The real app icon in an iOS-style rounded squircle, with layered depth:
   a soft ambient shadow, a longer directional drop, a hairline edge, and a
   crisp top highlight so it reads as a lifted physical tile. */
.app-icon {
  width: 120px; height: 120px; border-radius: 27px; margin: 0 auto 28px;
  display: block; position: relative;
  box-shadow:
    0 1px 1px rgba(255,255,255,.5) inset,
    0 0 0 1px rgba(0,0,0,.06),
    0 8px 16px -6px rgba(0,0,0,.24),
    0 30px 60px -14px rgba(0,0,0,.42);
}
/* A faint coloured glow beneath, tinted to the brand, for extra lift. */
.hero .app-icon {
  filter: drop-shadow(0 22px 34px color-mix(in srgb, var(--brand) 22%, transparent));
}
.hero h1 {
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 1.04; letter-spacing: -.03em; margin: 10px auto 0;
  max-width: 16ch;
}
.tagline {
  color: var(--text-2); font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  max-width: 44ch; margin: 20px auto 0; line-height: 1.55;
}
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin: 36px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 26px; border-radius: 999px; font-weight: 600; font-size: 1rem;
  border: 1px solid var(--line-strong); color: var(--text); background: var(--surface);
  transition: transform .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn.primary {
  background: var(--brand); border-color: var(--brand); color: #1a1a1f;
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--brand) 60%, transparent);
}
.btn.primary:hover { box-shadow: 0 14px 36px -8px color-mix(in srgb, var(--brand) 70%, transparent); }

/* App Store CTA — the familiar black pill with the Apple mark. Stays black in
   both themes; in dark mode a hairline keeps it distinct from the page. */
.btn.appstore {
  color: #fff; border-color: #000; padding-left: 22px; gap: 0;
  /* A subtle top-lit gradient plus a bright inner top edge give the pill a
     rounded, physical sheen rather than a flat black fill. */
  background: linear-gradient(180deg, #2a2a2e 0%, #000 62%);
  box-shadow:
    0 1px 0 rgba(255,255,255,.16) inset,
    0 10px 22px -8px rgba(0,0,0,.55),
    0 2px 5px rgba(0,0,0,.35);
}
/* Hover choreography: the Apple mark leads on the left and, on hover, slides
   out to the left (collapsing its width) while a forward arrow slides in on the
   right of the label. The label stays put; only the flanking glyphs move.
   Spacing is on the glyphs' margins (gap is 0) so both can collapse to nothing. */
.btn.appstore .apple {
  width: 18px; height: 18px; fill: currentColor; flex: none;
  margin: -2px 8px 0 0; opacity: 1;
  transition: width .32s var(--ease), opacity .26s var(--ease),
    transform .32s var(--ease), margin .32s var(--ease);
}
.btn.appstore .arrow {
  width: 0; height: 18px; stroke: currentColor; flex: none; opacity: 0;
  margin-left: 0; transform: translateX(-6px);
  transition: width .32s var(--ease), opacity .26s var(--ease),
    transform .32s var(--ease), margin .32s var(--ease);
}
.btn.appstore:hover .apple {
  width: 0; opacity: 0; margin-right: 0; transform: translateX(-6px);
}
.btn.appstore:hover .arrow {
  width: 18px; opacity: 1; margin-left: 8px; transform: translateX(0);
}
@media (prefers-reduced-motion: reduce) {
  .btn.appstore .apple, .btn.appstore .arrow { transition: none; }
}
.btn.appstore:hover {
  box-shadow:
    0 1px 0 rgba(255,255,255,.2) inset,
    0 16px 30px -8px rgba(0,0,0,.6),
    0 3px 7px rgba(0,0,0,.4);
}
@media (prefers-color-scheme: dark) {
  .btn.appstore { border-color: rgba(255,255,255,.24); }
  .btn.appstore:hover { border-color: rgba(255,255,255,.38); }
}
.sub-cta { margin: 18px 0 0; font-size: .9rem; color: var(--text-3); }
.sub-cta a { color: var(--text-2); }

/* ---- Device showcase: gallery centred, editor + palette flanking it, the
   whole cluster tilting toward the pointer in real 3D (see the script). ---- */
.showcase {
  padding: clamp(32px, 6vh, 80px) 24px clamp(56px, 10vh, 104px);
  overflow: visible;
  perspective: 1400px;              /* the depth the parallax tilts within */
}
/* A soft brand-tinted floor glow so the devices feel lit, not pasted on. */
.showcase::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: 50%; top: 46%; transform: translate(-50%, -50%);
  width: min(720px, 82vw); aspect-ratio: 1;
  background: radial-gradient(circle at center,
    color-mix(in srgb, var(--brand) 20%, transparent) 0%, transparent 62%);
  filter: blur(18px);
}
.stage {
  position: relative; z-index: 1;
  height: clamp(420px, 52vw, 620px);
  max-width: 900px; margin: 0 auto;
  transform-style: preserve-3d;
  transition: transform .6s var(--ease);   /* eases home on pointer-leave */
  will-change: transform;
}
.stage.is-live { transition: transform .08s linear; }  /* tracks the pointer live */

/* One phone: a titanium bezel wrapping the live screenshot. Positioned
   absolutely and centred; each variant offsets from the middle. --px/--py are
   the per-phone parallax shift the script feeds in. */
.phone {
  --w: clamp(180px, 25vw, 288px);
  --px: 0px; --py: 0px;
  position: absolute; left: 50%; bottom: 0; margin: 0;
  width: var(--w);
  border-radius: calc(var(--w) * .16);
  padding: calc(var(--w) * .028);
  background: linear-gradient(145deg, #3a3a3e, #101014 46%, #2c2c30);
  box-shadow:
    0 2px 3px rgba(255,255,255,.14) inset,
    0 0 0 1px rgba(0,0,0,.6),
    0 40px 70px -24px rgba(0,0,0,.6);
  transition: transform .6s var(--ease);
}
.stage.is-live .phone { transition: transform .08s linear; }
.phone-screen {
  position: relative; overflow: hidden;
  border-radius: calc(var(--w) * .135);
  background: #000; aspect-ratio: 1206 / 2622;
}
.phone-screen img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
/* Dynamic Island drawn over the shot so the status bar edge is masked cleanly. */
.phone-screen::before {
  content: ""; position: absolute; top: calc(var(--w) * .035); left: 50%;
  transform: translateX(-50%);
  width: 34%; height: calc(var(--w) * .085);
  background: #000; border-radius: 999px; z-index: 2;
}

/* Composition: gallery leads, centred and largest; editor tucks behind-left,
   palette behind-right — both lifted, tilted, and pushed back in Z so the
   centre phone reads as nearest. The parallax shift (--px/--py) rides on top. */
.phone--c {
  z-index: 3;
  transform: translate(-50%, 0) translate3d(var(--px), var(--py), 60px);
}
.phone--l {
  z-index: 2;
  transform: translate(-50%, 0)
    translate3d(calc(var(--px) - 62%), calc(var(--py) - 34px), -40px)
    rotate(-9deg);
}
.phone--r {
  z-index: 2;
  transform: translate(-50%, 0)
    translate3d(calc(var(--px) + 62%), calc(var(--py) - 34px), -40px)
    rotate(9deg);
}

@media (max-width: 720px) {
  /* On phones, drop the 3D cluster to a clean scrollable row of upright
     devices — gallery first so the centrepiece leads. */
  .showcase { perspective: none; }
  .showcase::before { top: 30%; }
  .stage {
    height: auto; display: flex; gap: 16px; overflow-x: auto;
    padding-bottom: 10px; -webkit-overflow-scrolling: touch;
    transform: none !important;
  }
  .phone {
    position: relative; left: auto; bottom: auto; flex: none;
    --w: 210px; --px: 0px; --py: 0px;
    transform: none !important;
  }
  .phone--c { order: -1; }   /* gallery first in the row */
}

/* Feature section — centred heading + a balanced grid of value cards. */
.features-section {
  padding: clamp(48px, 9vh, 96px) 0 clamp(40px, 7vh, 80px);
  border-top: 1px solid var(--line);
}
.eyebrow.center { text-align: center; }
.section-title {
  text-align: center; font-family: var(--font-display); font-weight: 600;
  letter-spacing: -.02em; font-size: clamp(1.5rem, 3.6vw, 2.2rem);
  line-height: 1.15; margin: 0 auto clamp(36px, 6vh, 56px); max-width: 20ch;
}
.features {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.feature {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px 24px 28px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.feature:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.feat-icon {
  width: 52px; height: 52px; margin-bottom: 16px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
}
.feat-icon svg { width: 24px; height: 24px; display: block; }
.feature h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.12rem;
  margin: 0 0 8px; color: var(--text); letter-spacing: -.01em; }
.feature p { margin: 0; font-size: .95rem; }
