/* ==========================================================================
   Base
   ========================================================================== */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* keeps anchored headings clear of the sticky header */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
}

h1,
h2,
h3 {
  color: var(--heading);
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

a {
  color: var(--brand);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

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

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

.container {
  width: min(100% - 2 * var(--gutter), var(--max-width));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--brand);
  color: var(--on-brand);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The app tagline style: small, tracked, terracotta */
.eyebrow {
  color: var(--accent-text);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.lead {
  color: var(--text-soft);
  font-size: var(--text-lg);
  max-width: var(--measure);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 3rem;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color var(--duration) var(--ease),
    color var(--duration) var(--ease),
    transform var(--duration) var(--ease);
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.button-primary:hover {
  background: var(--brand-strong);
  color: var(--on-brand);
}

.button-secondary {
  border-color: var(--line);
  color: var(--heading);
}

.button-secondary:hover {
  background: var(--bg-alt);
  color: var(--heading);
}

.button svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ==========================================================================
   Header and navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--brand);
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 500;
  text-decoration: none;
}

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

.brand img {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
}

.nav-toggle {
  display: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 0;
  list-style: none;
}

.nav-links a:not(.button) {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
}

.nav-links a:not(.button):hover,
.nav-links a[aria-current="page"] {
  color: var(--brand);
}

.nav-links .button {
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

/* Mobile menu: only collapses when JS is available to reopen it */
@media (max-width: 720px) {
  .js .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--heading);
    cursor: pointer;
  }

  .nav-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  .nav-toggle .icon-close,
  .nav-toggle[aria-expanded="true"] .icon-open {
    display: none;
  }

  .nav-toggle[aria-expanded="true"] .icon-close {
    display: block;
  }

  .nav-links {
    gap: var(--space-4);
  }

  .no-js .nav-links li:not(:last-child) {
    display: none;
  }

  .js .nav-links {
    position: absolute;
    inset: 100% 0 auto;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-2) var(--gutter) var(--space-5);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
  }

  .js .nav-links.is-open {
    display: flex;
  }

  .js .nav-links a:not(.button) {
    display: block;
    padding: var(--space-3) 0;
    font-size: var(--text-base);
  }

  .js .nav-links .button {
    width: 100%;
    margin-top: var(--space-3);
    min-height: 3rem;
  }
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  padding-block: var(--space-section);
}

.section-alt {
  background: var(--bg-alt);
}

.section-dark {
  background: var(--dark-bg);
  color: var(--dark-text);
}

.section-dark h2,
.section-dark h3 {
  color: var(--dark-heading);
}

.section-dark .lead,
.section-dark p {
  color: var(--dark-text-soft);
}

.section-dark .eyebrow {
  color: #dd9c88;
}

.section-header {
  display: grid;
  gap: var(--space-4);
  max-width: 44rem;
  margin-bottom: var(--space-7);
}

.section-header.centered {
  margin-inline: auto;
  text-align: center;
  justify-items: center;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 2rem + 5vw, 6.5rem) clamp(4rem, 3rem + 5vw, 7rem);
  background:
    radial-gradient(60rem 30rem at 85% 10%, color-mix(in srgb, var(--pool) 16%, transparent), transparent 70%),
    radial-gradient(40rem 26rem at 5% 95%, color-mix(in srgb, var(--copper) 14%, transparent), transparent 70%),
    var(--bg);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: var(--space-8);
}

.hero-copy {
  display: grid;
  gap: var(--space-5);
  justify-items: start;
}

.hero-copy h1 {
  max-width: 13ch;
}

.hero-note {
  color: var(--text-soft);
  font-size: var(--text-sm);
}

.hero-visual {
  position: relative;
  display: grid;
  justify-items: center;
  padding-top: 4.5rem; /* room for the steam to rise above the device */
}

.steam {
  position: absolute;
  top: 0;
  left: 50%;
  width: 7rem;
  transform: translateX(-50%);
  color: var(--steam);
  opacity: 0.55;
  pointer-events: none;
}

.steam path {
  animation: steam-rise 7s var(--ease) infinite;
  transform-origin: bottom center;
  transform-box: fill-box;
}

.steam path:nth-child(2) {
  animation-delay: -2.3s;
}

.steam path:nth-child(3) {
  animation-delay: -4.6s;
}

@keyframes steam-rise {
  0% {
    opacity: 0;
    transform: translateY(18px) scaleY(0.9);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-22px) scaleY(1.08);
  }
}

@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-7);
  }

  .hero-copy {
    justify-items: center;
    text-align: center;
  }

  .hero-copy .lead {
    margin-inline: auto;
  }

  .hero-copy .cta-row {
    justify-content: center;
  }
}

/* ==========================================================================
   Device frame (CSS only; no Apple frame assets needed)
   ========================================================================== */

.device {
  width: min(100%, 19rem);
  padding: 0.6rem;
  border-radius: 3.1rem;
  background: #0b0f11;
  box-shadow: var(--shadow-device), inset 0 0 0 1px rgb(255 255 255 / 0.08);
}

.device img {
  width: 100%;
  border-radius: 2.55rem;
}

.device-lg {
  width: min(100%, 21rem);
}

/* ==========================================================================
   Story
   ========================================================================== */

.story {
  display: grid;
  gap: var(--space-5);
  max-width: 42rem;
  margin-inline: auto;
  text-align: center;
}

.story p {
  color: var(--text-soft);
  font-size: var(--text-lg);
}

.story .story-quote {
  color: var(--heading);
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  line-height: 1.35;
}

/* ==========================================================================
   Chapters: alternating text and screenshot
   ========================================================================== */

.chapter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-8);
}

.chapter-reverse .chapter-media {
  order: -1;
}

.chapter-copy {
  display: grid;
  gap: var(--space-5);
  max-width: 32rem;
}

.chapter-media {
  display: grid;
  justify-items: center;
}

.detail-list {
  display: grid;
  gap: var(--space-4);
  padding: 0;
  list-style: none;
}

.detail-list li {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: var(--space-3);
  align-items: start;
}

.detail-list svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2rem;
  color: var(--accent);
}

.detail-list strong {
  display: block;
  color: var(--heading);
  font-weight: 600;
}

.detail-list span {
  color: var(--text-soft);
}

.section-dark .detail-list strong {
  color: var(--dark-heading);
}

.section-dark .detail-list span {
  color: var(--dark-text-soft);
}

@media (max-width: 860px) {
  .chapter {
    grid-template-columns: 1fr;
    gap: var(--space-7);
  }

  .chapter-reverse .chapter-media {
    order: 0;
  }

  .chapter-copy {
    margin-inline: auto;
  }
}

/* ==========================================================================
   Adventure mode: device flanked by annotated readouts
   ========================================================================== */

/* Deep teal echoes the app's terrain map; faint contour lines hint at orienteering. */
.section-topo {
  --contours: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400' fill='none' stroke='%23ffffff' stroke-opacity='0.07' stroke-width='1.2'%3E%3Cpath d='M200 40c95 0 165 60 160 150s-70 170-170 165S35 285 40 190 105 40 200 40z'/%3E%3Cpath d='M200 75c75 0 128 48 124 118s-58 132-136 128-122-60-118-132S125 75 200 75z'/%3E%3Cpath d='M202 110c55 0 92 36 89 86s-43 94-99 91-88-44-85-95 40-82 95-82z'/%3E%3Cpath d='M204 145c35 0 58 24 56 55s-28 60-63 58-55-28-53-60 25-53 60-53z'/%3E%3Cpath d='M206 178c16 0 27 11 26 26s-13 27-29 26-25-13-24-27 11-25 27-25z'/%3E%3C/svg%3E");
  background:
    var(--contours) no-repeat -8rem -6rem / 44rem,
    var(--contours) no-repeat calc(100% + 10rem) calc(100% + 8rem) / 52rem,
    linear-gradient(165deg, #1a4247 0%, #10272c 55%, #0c1b1f 100%);
}

.adventure-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-7);
}

.readouts {
  display: grid;
  gap: var(--space-7);
  padding: 0;
  list-style: none;
}

.readouts:first-child {
  justify-items: end;
  text-align: right;
}

.readout {
  display: grid;
  gap: var(--space-2);
  max-width: 19rem;
}

.readouts:first-child .readout {
  justify-items: end;
}

.readout-chip {
  justify-self: start;
  padding: 0.35rem 0.85rem;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.08);
  color: var(--dark-heading);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.readouts:first-child .readout-chip {
  justify-self: end;
}

.readout-chip-line {
  color: #f0a95b; /* the bearing line's orange in the app */
  letter-spacing: 0.08em;
}

.section-topo .readout strong {
  color: var(--dark-heading);
  font-size: 1.0625rem;
}

.section-topo .readout span:not(.readout-chip) {
  color: var(--dark-text-soft);
}

.safety-note {
  max-width: 40rem;
  margin: var(--space-8) auto 0;
  color: var(--dark-text-soft);
  font-size: var(--text-sm);
  text-align: center;
}

@media (max-width: 960px) {
  .adventure-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
  }

  .adventure-device {
    grid-column: 1 / -1;
    order: -1;
    display: grid;
    justify-items: center;
    margin-bottom: var(--space-4);
  }

  .readouts,
  .readouts:first-child,
  .readouts:first-child .readout {
    justify-items: start;
    text-align: left;
  }

  .readouts:first-child .readout-chip {
    justify-self: start;
  }
}

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

  .readouts {
    gap: var(--space-6);
  }
}

/* ==========================================================================
   Sharing and privacy
   ========================================================================== */

.pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
  padding: 0;
  list-style: none;
}

.pillar {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.pillar svg {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--brand);
}

.pillar h3 {
  font-size: 1.375rem;
}

.pillar p {
  color: var(--text-soft);
}

.section-dark .pillar {
  border-color: rgb(255 255 255 / 0.08);
  background: var(--dark-surface);
}

.section-dark .pillar svg {
  color: #dd9c88;
}

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

/* Ethos: two "is / isn't" cards, reusing pillar cards with a detail list inside */
@media (min-width: 861px) {
  .ethos-compare {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 56rem;
    margin-inline: auto;
  }
}

.ethos-compare .detail-list svg {
  width: 1.25rem;
  height: 1.25rem;
}

.manifesto {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  line-height: 1.35;
}

.section-dark .manifesto {
  color: var(--dark-heading);
}

.plain-talk {
  display: grid;
  gap: var(--space-3);
  max-width: 48rem;
  margin: var(--space-7) auto 0;
  padding: var(--space-6);
  border: 1px dashed rgb(255 255 255 / 0.18);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}

.plain-talk h3 {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.section-dark .plain-talk a {
  color: var(--dark-heading);
}

/* ==========================================================================
   Final call to action
   ========================================================================== */

.final-cta {
  display: grid;
  gap: var(--space-5);
  justify-items: center;
  text-align: center;
}

.final-cta img {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  padding-block: var(--space-7);
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  font-size: var(--text-sm);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--text);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.footer-legal {
  width: 100%;
  color: var(--text-soft);
  font-size: 0.8125rem;
}

/* ==========================================================================
   Content pages: legal, support, 404
   ========================================================================== */

.page-hero {
  padding-block: var(--space-8) var(--space-6);
}

.page-hero .container {
  max-width: 44rem; /* aligns with the .prose column below */
  display: grid;
  gap: var(--space-4);
}

.page-hero h1 {
  font-size: var(--text-2xl);
}

.prose {
  max-width: 44rem;
  padding-bottom: var(--space-section);
}

.prose h2 {
  margin-top: var(--space-7);
  margin-bottom: var(--space-3);
  font-size: var(--text-xl);
}

.prose p,
.prose ul {
  margin-bottom: var(--space-4);
}

.prose ul {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: var(--space-2);
}

.prose .caps {
  font-size: var(--text-sm);
}

.toc {
  margin-bottom: var(--space-6);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.toc h2 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.toc ol {
  margin: 0;
  columns: 2 14rem;
  column-gap: var(--space-6);
}

.faq {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-7);
}

.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  color: var(--heading);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

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

.faq summary::after {
  content: "+";
  flex: none;
  color: var(--accent-text);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
  transition: transform var(--duration) var(--ease);
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details > div {
  padding: 0 var(--space-5) var(--space-5);
  color: var(--text-soft);
}

.faq details > div p + p {
  margin-top: var(--space-3);
}

.contact-card {
  display: grid;
  gap: var(--space-4);
  justify-items: start;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
}

.license-name small {
  display: block;
  margin-top: var(--space-1);
  color: var(--text-soft);
  font-size: 0.8125rem;
  font-weight: 400;
}

/* License texts are verbatim and rely on their original line breaks and indentation. */
.licenses pre {
  max-height: 24rem;
  margin: 0 var(--space-5) var(--space-5);
  padding: var(--space-4);
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  color: var(--text-soft);
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.prose .contact-card h2,
.prose .contact-card p {
  margin: 0;
}

.not-found {
  display: grid;
  gap: var(--space-5);
  justify-items: center;
  min-height: 60vh;
  align-content: center;
  padding-block: var(--space-section);
  text-align: center;
}

.not-found img {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
}

/* ==========================================================================
   Reveal on scroll (progressive enhancement: only hidden when JS runs)
   ========================================================================== */

.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--duration-reveal) var(--ease),
    transform var(--duration-reveal) var(--ease);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
