/* styles.css */

/* ---------- Theme tokens ---------- */
:root{
  /* Base */
  --bg: #fafafa;            /* softer than pure white */
  --text: #121212;
  --muted: #5a5a5a;
  --muted-2: #6a6a6a;
  --muted-3: #7a7a7a;
  --line: #e9e9e9;

  /* Accent (muted sage) — more perceptible without being loud */
  --accent: #8fcf9f;
  --accent-dark: #2d7a48;   /* WCAG AA compliant dark variant (4.5:1 contrast) for text/foreground */
  --accent-95: rgba(143, 207, 159, 0.95);
  --accent-85: rgba(143, 207, 159, 0.85);
  --accent-55: rgba(143, 207, 159, 0.55);
  --accent-45: rgba(143, 207, 159, 0.45);
  --accent-22: rgba(143, 207, 159, 0.22);
  --accent-12: rgba(143, 207, 159, 0.12);
  --accent-08: rgba(143, 207, 159, 0.08);

  /* Surfaces */
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --shadow: 0 10px 30px rgba(0,0,0,0.06);

  /* Layout */
  --max: 42rem;             /* ~672px base, expands on desktop */
  --pad-x: 24px;
  --pad-y: 64px;

  --section-gap: 96px;
  --section-pad: 48px;

  /* Radius */
  --radius: 16px;
  --radius-pill: 999px;

  /* Type rhythm */
  --lh: 1.6;
}

/* ---------- Base ---------- */
*{ box-sizing: border-box; }
html, body{ margin: 0; padding: 0; }
html{
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
}

body{
  background:
    radial-gradient(ellipse 80% 60% at 10% 15%, rgba(143,207,159,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 90% 55%, rgba(143,207,159,0.05) 0%, transparent 70%),
    radial-gradient(ellipse 70% 40% at 40% 85%, rgba(143,207,159,0.04) 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
               "Apple Color Emoji","Segoe UI Emoji";
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container{
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--pad-y) var(--pad-x);
}

/* Page rhythm */
.page{
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

.section{
  padding: var(--section-pad) 0;
}

/* Section separators: neutral hairline + tiny accent tick for brand */
.section + .section{
  border-top: 1px solid var(--line);
  padding-top: calc(var(--section-pad) + 12px);
  position: relative;
}
.section + .section::before{
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 1px;
  background: var(--accent-55);
}

/* Remove divider immediately after hero section (Option B) */
.section:first-of-type + .section{
  border-top: none;
  padding-top: var(--section-pad);
}
.section:first-of-type + .section::before{
  content: none;
}

/* Bridge spacing for the jump-links section (keeps it tight, not a full block) */
.jump-links-section{
  padding-top: 12px;
  padding-bottom: 12px;
  border-top: none;
}
.jump-links-section::before{
  content: none;
}

/* Simple vertical stack utility */
.stack{
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Stack gap variants */
.stack-tight{ gap: 10px; }
.stack-compact{ gap: 12px; }
.stack-comfortable{ gap: 14px; }
.stack-loose{ gap: 16px; }

/* Margin utilities */
.mt-xs{ margin-top: 8px; }
.mt-sm{ margin-top: 12px; }
.mt-md{ margin-top: 16px; }
.mt-lg{ margin-top: 24px; }

/* Tighten card stacking on homepage + most pages (keep start-page behavior separate) */
body:not(.start-page) .section .card{
  margin-bottom: 0;
}

/* ---------- Typography ---------- */
.h1{
  font-size: 2.15rem;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0;
}

.h2{
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}

/* Subhead */
.h3{
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  line-height: 1.25;
  margin: 0;
  color: var(--text);
  margin-top: 8px; /* slightly more air before subheads */
}

/* Lede (supporting line under H1) */
.lede{
  margin: 0;
  color: rgba(18,18,18,0.70);
  font-size: 1.08rem;
  line-height: 1.55;
  max-width: 38rem;
}
.lede + .p{
  margin-top: 14px;
}

/* Eyebrow / kicker line */
.eyebrow{
  text-transform: none;
  letter-spacing: 0.01em;
  color: rgba(18, 18, 18, 0.62); /* calmer base */
  opacity: 1;
}

/* On the first (hero) section, use the accent as a subtle ink */
.section:first-of-type .eyebrow{
  color: rgba(18, 18, 18, 0.60);
  border-left: 3px solid var(--accent-85);
  padding-left: 10px;
}

/* Slightly constrain hero headline for better mobile rhythm */
.section:first-of-type .h1{
  max-width: 32rem;
}

.p{
  margin: 0;
  color: var(--muted);
  max-width: 36rem;
}
.p + .p{
  margin-top: 12px;
}

.small{
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted-2);
}

/* De-emphasize hero secondary link slightly */
.section:first-of-type .link-soft{
  opacity: 0.75;
}

/* ---------- Links ---------- */
a{
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
a:hover{ opacity: 0.88; }

/* Secondary link style */
a.link-soft{
  text-decoration: none;
  color: var(--muted-2);
}
a.link-soft:hover{
  text-decoration: underline;
}

/* Focus indicators for keyboard navigation */
a:focus-visible,
.jump-link:focus-visible,
.accordion-summary:focus-visible,
.scroll-cue:focus-visible{
  outline: 3px solid var(--accent-dark);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Mobile tap highlight polish */
a, button, .button, .jump-link, .accordion-summary, .scroll-cue{
  -webkit-tap-highlight-color: var(--accent-22);
}

/* ---------- Buttons ---------- */
.button{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 15px 22px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0,0,0,0.10);

  background: #141414;
  color: #ffffff;

  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;

  width: fit-content;

  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, background 0.15s ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.10);

  margin-top: 8px; /* CTA authority */
}

.button:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.14);
  opacity: 0.98;
}

.button:active{
  transform: translateY(0px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.10);
}

.button:focus{
  outline: none;
}

.button:focus-visible{
  outline: 3px solid var(--accent-dark);
  outline-offset: 3px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.12);
}

/* On mobile, primary buttons should feel tap-native */
@media (max-width: 480px){
  .button{
    width: 100%;
    padding: 16px 22px;
  }

  /* Slightly more breathing room in cards on small screens */
  .card{
    padding: 22px;
  }

  .lede{
    font-size: 1.03rem;
  }
}

/* ---------- Jump links (TOC style) ---------- */
.jump-links{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
}

.jump-link{
  display: flex;
  align-items: center;
  justify-content: space-between;

  width: 100%;
  padding: 12px 14px;

  border-radius: 12px;
  border: 1px solid rgba(18, 18, 18, 0.06);
  background: rgba(255, 255, 255, 0.55);

  color: rgba(18, 18, 18, 0.82);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1;

  box-shadow: none;
}

/* Make jump links feel like navigation: down arrow instead of right arrow */
.jump-link::after{
  content: "↓";
  font-size: 0.95em;
  opacity: 0.75;
  color: var(--accent-dark);
  font-weight: 700;
  margin-left: 12px;
}

.jump-link:hover{
  background: rgba(255, 255, 255, 0.75);
  opacity: 1;
  text-decoration: none;
}

/* ---------- Accordion (details/summary) ---------- */
.accordion{
  border: 1px solid rgba(18, 18, 18, 0.06);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.6);
  padding: 12px 14px;
}

.accordion + .accordion{
  margin-top: 12px;
}

.accordion-summary{
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: rgba(18,18,18,0.85);
  padding: 4px 0; /* slightly larger tap target */
}

.accordion-summary::-webkit-details-marker{
  display: none;
}

/* More legible chevrons: slightly stronger, slightly larger, rotate on open */
.accordion-summary::after{
  content: "▾";
  color: var(--accent-dark);
  font-weight: 700;
  margin-left: 12px;
  font-size: 1.05em;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.accordion[open] .accordion-summary::after{
  transform: rotate(180deg);
}

.accordion-content{
  margin-top: 12px;
}

/* ---------- Sticky CTA (mobile only; JS controls visibility) ---------- */
.sticky-cta{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(250, 250, 250, 0.92);
  border-top: 1px solid rgba(18,18,18,0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateY(120%);
  transition: transform 0.2s ease;
  z-index: 50;
}

.sticky-cta.is-visible{
  transform: translateY(0);
}

.sticky-cta-inner{
  max-width: var(--max);
  margin: 0 auto;
}

.sticky-cta-button{
  width: 100%;
}

/* Hide sticky CTA on larger screens */
@media (min-width: 900px){
  .sticky-cta{
    display: none;
  }
}

/* ---------- Modern surfaces ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 8px; /* subtle closure between card blocks (overridden above for main pages) */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Subtle hover lift on devices with hover capability */
@media (hover: hover){
  .card:hover{
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(0,0,0,0.09);
  }
}

.embed-shell{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
}

/* Divider */
.divider{
  height: 1px;
  background: var(--line);
  width: 100%;
}

/* ---------- Lists ---------- */
.box{
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.ul{
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}
.ul li{ margin: 10px 0; }

.step-title{
  font-weight: 600;
  margin: 0;
}

/* Steps grid */
.steps{
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.grid-2{
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

/* ---------- Footer ---------- */
.footer{
  border-top: 1px solid var(--line);
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 64px; /* a touch more closure */
}

.footer .row{
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
}

.footer a{
  color: var(--muted-2);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}

/* Animated underline */
.footer a::after{
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: rgba(18,18,18,0.22);
  transition: width 0.25s ease;
}

.footer a:hover::after{
  width: 100%;
}

.copy{
  font-size: 0.9rem;
  color: var(--muted-3);
  margin-top: 6px;
}

/* ---------- Mobile tuning ---------- */
@media (max-width: 480px){
  :root{
    --pad-x: 20px;
    --pad-y: 44px;
    --section-gap: 56px;
    --section-pad: 28px;
  }

  /* Hero containment on mobile */
  .section#top{
    min-height: calc(100vh - 32px);
    display: flex;
    align-items: center;
    padding-bottom: 48px;
  }

  /* Global stack feels a bit airy on small screens */
  .stack{ gap: 18px; }

  /* Tighten stack spacing specifically inside cards on mobile */
  .card .stack{ gap: 16px; }

  .h1{
    font-size: 1.95rem;
    line-height: 1.1;
  }

  .p{
    max-width: 34rem;
  }

  .section:first-of-type .eyebrow{
    border-left-width: 3px;
    padding-left: 10px;
  }
}

/* ---------- Fade-in on scroll animation ---------- */
.fade-in-section{
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-section.is-visible{
  opacity: 1;
  transform: translateY(0);
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce){
  .fade-in-section{
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Desktop enhancement ---------- */
@media (min-width: 900px){
  :root{
    --max: 58rem;           /* ~928px - better laptop utilization */
    --pad-y: 96px;
    --section-gap: 120px;
  }

  .h1{ font-size: 2.7rem; }

  .grid-2{
    grid-template-columns: 1fr 1fr;
    gap: 56px;
  }

  .steps{
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 32px;
  }

  /* Drop card chrome on desktop — open editorial layout */
  .section > .card{
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }

  /* Nested cards (e.g. steps) keep their styling */
  .section > .card .card{
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 18px;
    border-radius: var(--radius);
  }
}

/* ---------- /start page tightening ---------- */
body.start-page .container{
  padding-top: 28px;
}

body.start-page .section{
  padding-top: 14px;
  padding-bottom: 14px;
}

body.start-page .stack{
  gap: 12px;
}

/* Legacy support */
body.start-page .box{
  padding-top: 0;
}

/* Optional mobile micro-tightening for jump links */
@media (max-width: 480px){
  .jump-link{
    padding: 11px 13px;
  }
}

/* ---------- Scroll cue visibility + tappable affordance ---------- */
.scroll-cue{
  display: flex;
  justify-content: center;
  margin-top: 28px;
  margin-bottom: 6px;

  /* make <a> feel tappable without looking like a button */
  text-decoration: none;
  padding: 8px 0; /* invisible hit area */
}

@media (hover: hover){
  .scroll-cue{ cursor: pointer; }
}

.scroll-cue:hover{ opacity: 0.9; }
.scroll-cue:active{ opacity: 0.75; }

.scroll-cue .chevron{
  font-size: 1.45rem;
  color: rgba(18, 18, 18, 0.55);
  display: inline-block;
  transform: translateY(0);
}

/* Keep hero cue subtly accent-tinted, but more visible */
.section:first-of-type .scroll-cue .chevron{
  color: var(--accent-dark);
}

/* Gentle motion that reads as "scroll" without being loud */
@media (prefers-reduced-motion: no-preference){
  .scroll-cue .chevron{
    animation: scrollCueBounce 1.6s ease-in-out infinite;
  }

  @keyframes scrollCueBounce{
    0%, 100%{ transform: translateY(0); opacity: 0.95; }
    50%{ transform: translateY(5px); opacity: 0.75; }
  }
}

/* ---------- Dashboard (Pattern D) ---------- */
body.dashboard-page .section{
  /* reduce vertical dead space on dashboard */
  padding-top: 22px;
  padding-bottom: 22px;
}

/* Keep the top card feeling like a single-screen entry */
body.dashboard-page .section:first-of-type{
  padding-top: 18px;
  padding-bottom: 18px;
}

/* Accordion summary: behave like a mobile list row */
body.dashboard-page .accordion-summary{
  padding: 10px 8px;
  border-radius: 12px;
}

/* Subtle hover/tap affordance */
@media (hover: hover){
  body.dashboard-page .accordion-summary:hover{
    background: var(--accent-08);
  }
}
body.dashboard-page .accordion-summary:active{
  background: var(--accent-12);
}

/* Summary line inside <summary>: prevent awkward wrapping */
body.dashboard-page .accordion-summary .small{
  margin: 0;
  color: rgba(18,18,18,0.60);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12rem; /* mobile-friendly */
}

/* On larger screens allow a bit more width for the summary line */
@media (min-width: 900px){
  body.dashboard-page .accordion-summary .small{
    max-width: 18rem;
  }
}