/* ============================================================
   PillRem — shared subpage stylesheet
   Imported by privacy.html, terms.html, security.html,
   about.html, blog.html, press.html
   Matches the Calm Apothecary design tokens from the iOS app.
   ============================================================ */

:root {
  /* Canvas */
  --bg:               #FAF7F2;
  --bg-dim:           #F2EEE4;
  --surface:          #FFFFFF;
  --surface-soft:     #F5F0E6;

  /* Editorial spread swatches — sampled from the ASO screen tiles
     so the website and the marketing screenshots speak the same
     color language. Each screen sits in a block tinted to match
     the screen's baked-in background. */
  --c-sand:           #EFE7D7;
  --c-sky:            #D8DCE7;
  --c-sage:           #C8D5C5;
  --c-tan:            #E5D2B9;
  --c-blush:          #E5C5C5;
  --c-cream:          #EBE4D2;

  /* Brand */
  --primary:          #3B6AA0;
  --primary-dark:     #2A4E7A;
  --primary-soft:     #E8EFF7;
  --primary-muted:    #C7D6E8;

  /* Accents */
  --sage:             #7BA088;
  --sage-soft:        #E4EEE7;
  --peach:            #E8C4A0;
  --peach-soft:       #FBF1E6;
  --amber:            #D4A574;
  --amber-soft:       #FAF2E6;
  --rose:             #C17B7B;
  --rose-soft:        #F7E8E8;
  --lavender:         #9B8FB5;
  --lavender-soft:    #EFEBF5;

  /* Editorial ink colors that work against the swatches above.
     Brown is used on blush/tan to feel warm; navy on cream/sky
     for clinical clarity. */
  --ink-navy:         #1F3A5C;
  --ink-brown:        #3A2A22;

  /* Text */
  --text:             #2A3142;
  --text-secondary:   #7A8094;
  --text-tertiary:    #A8ADBD;

  /* Hairlines */
  --hairline:         #EFE8DD;
  --hairline-strong:  #E2D9CB;

  /* Shadows */
  --shadow-soft:      0 2px 12px rgba(0,0,0,0.05);
  --shadow-raised:    0 4px 20px rgba(0,0,0,0.07);
  --shadow-floating:  0 10px 32px rgba(0,0,0,0.10);

  /* Type */
  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-body:    "DM Sans", ui-sans-serif, system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- base reset ---------- */
*, *::before, *::after { 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: 17px;
  line-height: 1.65;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--primary-dark); }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

/* subtle grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.12'/></svg>");
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 2;
}
.container-narrow {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 2;
}
@media (max-width: 640px) {
  .container, .container-narrow { padding: 0 24px; }
  body { font-size: 16px; }
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 242, 0.82);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.nav.scrolled { border-bottom-color: var(--hairline); }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.logo:hover { color: var(--text); }
.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(255,255,255,0.06);
  transition: transform .35s var(--ease-out);
}
.logo:hover .logo-mark { transform: rotate(-6deg) scale(1.06); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
}
.nav-links a {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
}
.nav-links a:hover { color: var(--primary); }

.nav-cta {
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform .2s var(--ease-out), box-shadow .2s ease, background .2s ease;
  box-shadow: 0 2px 10px rgba(59, 106, 160, 0.25);
}
.nav-cta:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 6px 18px rgba(59, 106, 160, 0.35);
  color: #fff;
}
@media (max-width: 820px) {
  .nav-links { display: none; }
}

/* ---------- page hero ---------- */
.page-hero {
  padding: 72px 0 48px;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -160px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(59, 106, 160, 0.14), transparent 60%);
  filter: blur(60px);
  z-index: 0;
}
.page-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 820px;
}
.page-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  padding: 6px 12px;
  background: var(--primary-soft);
  border-radius: 999px;
  margin-bottom: 24px;
}
.page-title {
  font-size: clamp(40px, 5.4vw, 72px);
  font-weight: 400;
  letter-spacing: -0.032em;
  line-height: 1.02;
}
.page-title em {
  font-style: italic;
  color: var(--primary);
}
.page-lead {
  font-size: clamp(17px, 1.4vw, 20px);
  color: var(--text-secondary);
  max-width: 620px;
  margin-top: 28px;
  line-height: 1.55;
}
.page-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--text-tertiary);
  font-family: var(--font-body);
}
.page-meta strong { color: var(--text-secondary); font-weight: 500; }

/* ---------- prose / long-form content ---------- */
.prose {
  padding: 48px 0 96px;
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
}
.prose h2 {
  font-size: clamp(24px, 2.4vw, 30px);
  font-weight: 500;
  margin: 56px 0 16px;
  letter-spacing: -0.02em;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
  font-size: 20px;
  font-weight: 500;
  margin: 36px 0 12px;
  font-family: var(--font-display);
}
.prose p { margin: 0 0 20px; color: var(--text); }
.prose p.muted { color: var(--text-secondary); }
.prose ul, .prose ol {
  margin: 0 0 24px;
  padding-left: 24px;
  color: var(--text);
}
.prose li { margin-bottom: 10px; }
.prose li::marker { color: var(--primary); }
.prose strong { color: var(--text); font-weight: 600; }
.prose a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: var(--primary-muted);
  text-underline-offset: 3px;
}
.prose a:hover { text-decoration-color: var(--primary); }
.prose blockquote {
  margin: 32px 0;
  padding: 24px 32px;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 16px 16px 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  color: var(--text);
}
.prose hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 56px 0;
}
.prose code {
  background: var(--surface-soft);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
  color: var(--primary-dark);
}
.prose .callout {
  padding: 24px 28px;
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
  border-radius: 0 14px 14px 0;
  margin: 32px 0;
  font-size: 15px;
  color: var(--text);
}
.prose .callout strong { color: var(--text); }

/* ---------- table of contents ---------- */
.toc {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 28px 32px;
  margin-bottom: 48px;
  box-shadow: var(--shadow-soft);
}
.toc h3 {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 16px;
}
.toc ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: toc;
}
.toc li {
  counter-increment: toc;
  margin-bottom: 8px;
  padding-left: 36px;
  position: relative;
  font-size: 15px;
}
.toc li::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--primary);
  font-size: 13px;
}
.toc a { color: var(--text-secondary); }
.toc a:hover { color: var(--primary); }

/* ---------- card grids (about, press, blog) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 48px 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 32px;
  transition: transform .4s var(--ease-out), box-shadow .3s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-raised); }
.card h3 {
  font-size: 19px;
  margin-bottom: 10px;
}
.card p {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0;
  line-height: 1.6;
}
.card .card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 24px;
}
.card .card-icon svg { width: 22px; height: 22px; }

@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr; }
}

/* ---------- CTA strip ---------- */
.cta-strip {
  padding: 72px 0 120px;
}
.cta-box-small {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  border-radius: 28px;
  padding: 56px 48px;
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-box-small::before {
  content: "";
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.1), transparent 60%);
}
.cta-box-small > * { position: relative; }
.cta-box-small h2 {
  color: #fff;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 400;
  max-width: 620px;
  margin: 0 auto 24px;
  letter-spacing: -0.025em;
}
.cta-box-small h2 em { color: var(--peach); font-style: italic; }
.cta-box-small p {
  opacity: 0.85;
  margin: 0 auto 32px;
  max-width: 480px;
}

.app-store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  color: var(--text);
  padding: 14px 22px 14px 18px;
  border-radius: 14px;
  transition: transform .25s var(--ease-out), box-shadow .25s ease;
  box-shadow: var(--shadow-raised);
}
.app-store-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-floating); color: var(--text); }
.app-store-btn svg { width: 28px; height: 28px; }
.app-store-btn .labels { display: flex; flex-direction: column; line-height: 1; gap: 3px; }
.app-store-btn .tiny { font-size: 10px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; }
.app-store-btn .big { font-size: 17px; font-weight: 600; font-family: var(--font-display); letter-spacing: -0.01em; }

/* ---------- footer (shared) ---------- */
.footer {
  padding: 72px 0 40px;
  border-top: 1px solid var(--hairline);
  background: var(--bg-dim);
}
.footer-top {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 64px;
}
.footer-about .logo { margin-bottom: 16px; }
.footer-about p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 340px;
  margin: 0;
}
.footer-col h4 {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}
.footer-col ul {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.footer-col a {
  font-size: 14px;
  color: var(--text-secondary);
}
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--text-tertiary);
}
@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}

/* ---------- press-specific bits ---------- */
.fact-table {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 32px;
  margin: 32px 0 48px;
  padding: 28px 32px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
}
.fact-table dt {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}
.fact-table dd {
  margin: 0;
  padding: 10px 0;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--hairline);
}
.fact-table dt:last-of-type, .fact-table dd:last-of-type { border-bottom: none; }

/* ============================================================
   EDITORIAL SHOWCASE — sand → sky → sage → tan → blush spreads.
   Each spread is a full-bleed color block hosting one ASO screen
   tile beside copy. Section colors are sampled from the screens
   themselves so the device "sits into" the page rather than
   floating on a separate canvas. Used by index.html and press.html.
   ============================================================ */
.spread {
  position: relative;
  padding: 96px 0 112px;
  overflow: hidden;
}
.spread + .spread { margin-top: 0; }

.spread-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
  position: relative;
  z-index: 2;
}

.spread--reverse .spread-inner { grid-template-columns: 1fr 1fr; }
.spread--reverse .spread-text { order: 2; }
.spread--reverse .spread-figure { order: 1; }

/* Section color variants (swatches sampled from each ASO tile) */
.spread--sand   { background: var(--c-sand); }
.spread--sky    { background: var(--c-sky); }
.spread--sage   { background: var(--c-sage); }
.spread--tan    { background: var(--c-tan); }
.spread--blush  { background: var(--c-blush); }
.spread--cream  { background: var(--c-cream); }

/* Section-specific ink color (warm brown on blush/tan, navy elsewhere) */
.spread--blush .spread-text,
.spread--tan   .spread-text {
  color: var(--ink-brown);
}
.spread--sand  .spread-text,
.spread--sky   .spread-text,
.spread--sage  .spread-text,
.spread--cream .spread-text {
  color: var(--ink-navy);
}

/* Chapter label — tracked-out micro-caps with a roman numeral */
.spread-chapter {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 28px;
  opacity: 0.55;
}
.spread-chapter::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: currentColor;
  vertical-align: middle;
  margin-right: 14px;
  opacity: 0.55;
}

.spread-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 24px;
  color: inherit;
}
.spread-title em {
  font-style: italic;
  /* a touch of optical adjustment for Fraunces italic */
  font-feature-settings: "ss01";
}

.spread-lead {
  font-family: var(--font-body);
  font-size: clamp(16px, 1.15vw, 18px);
  line-height: 1.62;
  max-width: 460px;
  margin: 0;
  opacity: 0.85;
}

.spread-figure {
  position: relative;
  display: flex;
  justify-content: center;
}
.spread-figure img {
  width: 100%;
  max-width: 460px;
  height: auto;
  display: block;
  /* The ASO tile is the entire visual — no extra frame.
     A whisper-soft shadow grounds it on the color block. */
  filter:
    drop-shadow(0 2px 6px rgba(0,0,0,0.06))
    drop-shadow(0 18px 38px rgba(0,0,0,0.10));
}

/* Subtle decorative marginalia — small dot pair, like a copy mark */
.spread-figure::after {
  content: "";
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.18;
  top: 50%;
  right: -8px;
}
.spread--reverse .spread-figure::after {
  right: auto;
  left: -8px;
}

/* The editorial pull-quote variant — used between spreads as a
   chapter break. */
.spread-quote {
  padding: 80px 0;
  text-align: center;
  background: var(--bg);
  position: relative;
}
.spread-quote::before,
.spread-quote::after {
  content: "";
  display: block;
  width: 36px;
  height: 1px;
  background: var(--hairline-strong);
  margin: 0 auto 24px;
}
.spread-quote::after {
  margin: 24px auto 0;
}
.spread-quote-body {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 32px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
  max-width: 760px;
  margin: 0 auto;
  color: var(--text);
  letter-spacing: -0.012em;
}
.spread-quote-attr {
  margin-top: 18px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

@media (max-width: 900px) {
  .spread { padding: 64px 0 80px; }
  .spread-inner { grid-template-columns: 1fr; gap: 40px; }
  .spread--reverse .spread-text { order: 1; }
  .spread--reverse .spread-figure { order: 2; }
  .spread-figure::after { display: none; }
}

/* ============================================================
   PRESS KIT — 10-up image gallery using the same swatches.
   Each tile is presented as-is (already a marketing composition),
   placed on a soft sand background with a "polaroid" foot label.
   ============================================================ */
.pk-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin: 48px 0 16px;
}
.pk-tile {
  display: block;
  background: var(--bg-dim);
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  padding: 0;
  transition: transform .35s var(--ease-out), box-shadow .3s ease;
  box-shadow: var(--shadow-soft);
}
.pk-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-raised);
}
.pk-tile img {
  width: 100%;
  height: auto;
  display: block;
}
.pk-tile-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 16px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  border-top: 1px solid var(--hairline);
  background: var(--surface);
}
.pk-tile-meta .num {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: -0.005em;
}
.pk-tile-meta .download {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
}

@media (max-width: 720px) {
  .pk-gallery { grid-template-columns: 1fr; gap: 20px; }
}

/* ============================================================
   PAGE-LOAD + SCROLL ANIMATION
   ============================================================ */
/* Gentle entrance so pages settle in rather than snapping on. */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
body {
  animation: pageIn .6s var(--ease-out) both;
}

/* Reading-progress bar — CSS-only via a scroll-driven timeline.
   Browsers without scroll-timeline simply leave it hidden. */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--primary), var(--sage) 70%, var(--peach));
  z-index: 60;
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  @keyframes growProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .scroll-progress {
    animation: growProgress linear both;
    animation-timeline: scroll(root block);
  }
}

/* Reveal content as it scrolls into view — CSS-only via view().
   Falls back to fully visible where unsupported. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    main > section,
    main.prose > h2,
    main.prose > h3,
    .cards .card,
    .faq-item {
      animation: revealUp .8s var(--ease-out) both;
      animation-timeline: view();
      animation-range: entry 0% cover 20%;
    }
    @keyframes revealUp {
      from { opacity: 0; transform: translateY(26px); }
      to   { opacity: 1; transform: none; }
    }
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  body { opacity: 1 !important; transform: none !important; }
  .scroll-progress { display: none !important; }
}
