/* ==========================================================================
   AwareFlow – Site Styles
   Token-first • BEM • Apple-aligned • No hardcoded values
   SnapHabit LLC © 2025–2026
   ========================================================================== */

/* ==========================================================================
   TOKENS
   ========================================================================== */

:root {

  /* Tell the UA we support both modes so native controls and scrollbars adapt. */
  color-scheme: light dark;

  /* ---------------- RAW TOKENS ---------------- */

  /* Brand */
  --color-brand-primary:       #46A0FB;
  --color-brand-primary-rgb:   70, 160, 251;
  --color-brand-primary-2:     #6BB8FC;
  --color-brand-accent:        #2D7CBF;
  --color-brand-accent-hover:  #1F6AA8;

  /* Base */
  --color-white-rgb:  255,255,255;
  --color-shadow-rgb: 11,20,32;

  /* Glass surface base color (inverts in dark mode) */
  --color-glass-rgb: 255, 255, 255;

  /* Ink */
  --color-ink-900: #0B1420;
  --color-ink-700: #253240;
  --color-ink-500: #54616E;
  --color-ink-400: #707E8C;

  /* Surfaces */
  --color-bg-page:         #F7F9FA;
  --color-bg-card:         #FAFCFF;
  --color-bg-subtle-hover: #F8FAFC;

  /* Borders */
  --color-border-subtle:       #E5E7EB;
  --color-border-subtle-hover: #CBD5E1;

  /* Focus */
  --color-focus: #FFA94D;

  /* ---------------- SEMANTIC TOKENS ---------------- */

  --brand-primary:       var(--color-brand-primary);
  --brand-accent:        var(--color-brand-accent);
  --brand-accent-hover:  var(--color-brand-accent-hover);

  /* Text */
  --text-primary:   var(--color-ink-900);
  --text-secondary: var(--color-ink-700);
  --text-muted:     var(--color-ink-500);

  /* Surfaces */
  --bg-page: var(--color-bg-page);
  --bg-card: var(--color-bg-card);
  --bg-hover: var(--color-bg-subtle-hover);

  /* Borders */
  --border-subtle: var(--color-border-subtle);

  /* Hero gradient */
  --hero-start: var(--brand-primary);
  --hero-end:   var(--brand-accent);

  /* Glass */
  --glass-bg:     rgba(var(--color-glass-rgb), 0.72);
  --glass-border: rgba(var(--color-glass-rgb), 0.45);

  /* Radius */
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 8px;

  /* Shadows */
  --shadow-sm:    0 1px 3px  rgba(var(--color-shadow-rgb), 0.08);
  --shadow-md:    0 4px 14px rgba(var(--color-shadow-rgb), 0.08);
  --shadow-hover: 0 6px 16px rgba(var(--color-shadow-rgb), 0.18);

  /* Motion */
  --transition-fast: 140ms ease;

  /* Layout */
  --container: 1020px;
  --reading:    72ch;
}

/* ==========================================================================
   DARK MODE
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-page:         #0E1114;
    --color-bg-card:         #141B24;
    --color-bg-subtle-hover: #1A2230;
    --color-border-subtle:   #273243;
    --color-ink-900:         #EAF2FF;
    --color-ink-700:         #C4D4EA;
    --color-ink-500:         #8DA3C8;
    --color-ink-400:         #7590B8;

    /* Brand accent stays blue in dark mode; lightened for contrast on dark surfaces */
    --color-brand-accent:       #5A94E0;
    --color-brand-accent-hover: #7AB0F0;

    /* Glass inverts: frosted dark panel instead of frosted white */
    --color-glass-rgb:  20, 27, 36;

    /* Shadows go pure black on dark so cards keep depth */
    --color-shadow-rgb: 0, 0, 0;
  }
}

/* ==========================================================================
   BASE
   ========================================================================== */

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ==========================================================================
   SKIP LINK (accessibility)
   ========================================================================== */

.skip-link {
  position: absolute;
  top: -9999px;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  color: var(--brand-accent);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
}

.skip-link:focus {
  top: 1rem;
  outline: 2px solid var(--color-focus);
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3 {
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
}

h1 { font-size: clamp(1.9rem, 3.5vw, 2.4rem); }
h2 { font-size: clamp(1.4rem, 3vw,   1.9rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.35rem); }

p {
  margin: 0.75rem 0 1rem;
}

a {
  color: var(--brand-accent);
  text-decoration: underline;
}

a:hover {
  color: var(--brand-accent-hover);
}

blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--brand-primary);
  background: var(--bg-hover);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-primary);
  font-style: italic;
}

address {
  font-style: normal;
}

ul li,
ol li {
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.content-container {
  max-width: var(--container);
  margin: 0 auto 3rem;
  padding: 0 1rem;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(var(--color-glass-rgb), 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  transition: backdrop-filter 180ms ease;
}

.header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: padding 180ms ease;
}

.header__logo {
  max-width: 140px;
  display: block;
  transition: max-width 180ms ease;
}

/*
 * W2 (2026-04-21): scroll-compression. The `.header--compact` class is
 * added by a small vanilla-JS listener in `scripts/main.js` once the
 * page has scrolled past 40px. Reduces vertical real estate so the
 * header stops "covering everything" per Build 5235 tester feedback.
 * Pure CSS fallback: without JS (rare, but e.g. reader-mode or
 * noscript users) the header stays at full size — still fine, just
 * not as polished. `prefers-reduced-motion` respected via the parent
 * transition rules degrading gracefully.
 */
.header--compact .header__inner {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.header--compact .header__logo {
  max-width: 108px;
}

/*
 * W2 (2026-04-21): render the dark-inked wordmark as white ink on the
 * dark-glass panel. `brightness(0)` forces every pixel to black, then
 * `invert(1)` flips black → white. The orange dot loses its color tint
 * in dark mode — acceptable versus shipping a new light-ink wordmark
 * asset, per the in-HTML explainer. `opacity: 0.9` softens the pure
 * white slightly so the wordmark feels painted-on rather than stamped-on.
 */
@media (prefers-color-scheme: dark) {
  .header__logo {
    filter: brightness(0) invert(1);
    opacity: 0.9;
  }
}

/* ==========================================================================
   NAV
   ========================================================================== */

.nav {
  display: flex;
  gap: 1.25rem;
}

.nav__link {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
}

.nav__link:hover {
  color: var(--text-primary);
}

.nav__link[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 600;
}

/* Mobile nav */
@media (max-width: 700px) {
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
  }

  .nav--open {
    display: flex;
  }
}

/* Toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle__bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  margin: 4px 0;
  border-radius: 1px;
}

@media (max-width: 700px) {
  .nav-toggle {
    display: flex;
    flex-direction: column;
  }
}

/* ==========================================================================
   HERO
   ========================================================================== */

.hero {
  padding: 3rem 1.5rem 2.5rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(170deg, var(--hero-start), var(--hero-end));
  text-align: center;
  margin-bottom: 2rem;
}

.hero__inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 2rem 1.75rem;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
}

.hero__inner > * + * {
  margin-top: 0.75rem;
}

.hero__inner h1 {
  margin-top: 0;
}

.hero__subtitle {
  color: var(--text-secondary);
  max-width: 46ch;
  margin-inline: auto;
  margin-bottom: 0.25rem;
}

.hero__meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* Hero logo (story / subscriptions / hrt pages) */
.hero__logo {
  max-width: 120px;
  margin: 0 auto 1rem;
  display: block;
}

/* ==========================================================================
   SECTION (content cards)
   ========================================================================== */

.section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  max-width: var(--reading);
  margin-left: auto;
  margin-right: auto;
}

.section h2:first-child,
.section h3:first-child {
  margin-top: 0;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  line-height: 1.4;
}

.btn--primary {
  background: var(--brand-accent);
  color: var(--bg-card);
  border-color: var(--brand-accent);
}

.btn--primary:hover {
  background: var(--brand-accent-hover);
  border-color: var(--brand-accent-hover);
  color: var(--bg-card);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn--ghost:hover {
  border-color: var(--color-border-subtle-hover);
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
  align-items: center;
}

/* Apple "Download on the App Store" badge.
   Native SVG is 120x40 (3:1). Sized for hero prominence without
   violating Apple identity rules (no recolor, rotate, shadow, gradient). */
.app-store-badge {
  height: 48px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}
.app-store-badge:hover {
  opacity: 0.92;
}
a:focus-visible .app-store-badge {
  outline: 2px solid var(--brand-accent, #2a7ae2);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ==========================================================================
   FAQ (accordion)
   ========================================================================== */

.faq {
  border-top: 1px solid var(--border-subtle);
}

.faq__item {
  border-bottom: 1px solid var(--border-subtle);
}

.faq__summary {
  padding: 1rem 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  font-weight: 500;
  color: var(--text-primary);
  gap: 1rem;
  user-select: none;
}

/* Remove default marker in WebKit */
.faq__summary::-webkit-details-marker {
  display: none;
}

.faq__summary::after {
  content: "+";
  font-size: 1.1rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.faq__item[open] > .faq__summary::after {
  content: "−";
}

.faq__content {
  padding-bottom: 1.25rem;
  color: var(--text-secondary);
}

.faq__content p:first-child {
  margin-top: 0;
}

/* ==========================================================================
   DIAGRAM (CSS-only flow — how-awareflow-works)
   ========================================================================== */

.diagram {
  margin: 1.5rem 0;
}

.diagram__subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.diagram__flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.diagram__node {
  width: 100%;
  max-width: 480px;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.diagram__node--wide {
  max-width: 560px;
}

.diagram__node--highlight {
  background: linear-gradient(135deg,
    rgba(var(--color-brand-primary-rgb), 0.08),
    rgba(var(--color-brand-primary-rgb), 0.05));
  border-color: rgba(var(--color-brand-primary-rgb), 0.3);
}

.diagram__node-title {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.diagram__node-sub {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.diagram__arrow {
  width: 2px;
  height: 2rem;
  background: var(--border-subtle);
  position: relative;
  flex-shrink: 0;
}

.diagram__arrow::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--color-border-subtle-hover);
}

/* ==========================================================================
   CTA BAR
   ========================================================================== */

.cta {
  background: linear-gradient(135deg,
    rgba(var(--color-brand-primary-rgb), 0.06),
    rgba(var(--color-brand-primary-rgb), 0.03));
  border: 1px solid rgba(var(--color-brand-primary-rgb), 0.18);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  margin: 2rem auto;
  max-width: var(--reading);
}

.cta p {
  margin: 0 0 0.5rem;
}

.cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.highlight {
  background: rgba(var(--color-brand-primary-rgb), 0.07);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  margin: 1rem 0;
}

.note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.center {
  text-align: center;
}

.muted {
  color: var(--text-muted);
}

::selection {
  background: rgba(var(--color-brand-primary-rgb), 0.2);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer {
  margin-top: 3rem;
  padding: 2rem 1rem 2.25rem;
  border-top: 1px solid var(--border-subtle);
}

.footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  text-align: center;
}

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem 1rem;
  margin-bottom: 1.25rem;
}

.footer__link {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer__link:hover {
  color: var(--brand-accent);
}

.footer__legal {
  max-width: 640px;
  margin: 0 auto;
}

.footer__legal-primary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 0.35rem;
}

.footer__legal-secondary {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ==========================================================================
   SNAPSHOT GRID (accessibility page)
   ========================================================================== */

.snapshot-grid {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.snapshot-grid li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 1rem;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 0;
}

.snapshot-grid li span {
  color: var(--text-muted);
  font-size: 0.825rem;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 700px) {

  .hero {
    padding: 2rem 1rem;
    border-radius: var(--radius-lg);
  }

  .hero__inner {
    padding: 1.5rem 1.25rem;
  }

  .section {
    padding: 1.5rem;
  }

  .cta {
    padding: 1.5rem;
  }

  .btn-row {
    flex-direction: column;
  }

  .cta__actions {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .footer__nav {
    gap: 0.5rem 0.75rem;
  }

  .footer__link {
    font-size: 0.85rem;
  }

  .footer__legal-primary {
    font-size: 0.8rem;
  }

  .footer__legal-secondary {
    font-size: 0.75rem;
  }
}
