/* Colors mirror the app's asset catalog. */
:root {
  color-scheme: light dark;
  --background: #f5f3ee;
  --surface: #fffefd;
  --surface-secondary: #eeece7;
  --text: #17212b;
  --text-secondary: #5f646c;
  --progress: #3db86b;
  --bezel: #0b0c0e;
  /* Fine paper grain, tinted with the ink color. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.09 0 0 0 0 0.13 0 0 0 0 0.17 0.16 0 0 0 -0.04'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23g)'/%3E%3C/svg%3E");
  --serif: "Instrument Serif", "Instrument Serif Fallback", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0f1012;
    --surface: #1b1c1f;
    --surface-secondary: #2a2b2f;
    --text: #f2f1ee;
    --text-secondary: #9a9da3;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.95 0 0 0 0 0.93 0.16 0 0 0 -0.04'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23g)'/%3E%3C/svg%3E");
  }
}

/* Georgia scaled to Instrument Serif's width and vertical metrics (measured: 75.3% width, 0.99 / 0.31 em). */
@font-face {
  font-family: "Instrument Serif Fallback";
  src: local("Georgia");
  size-adjust: 75.3%;
  ascent-override: 131.5%;
  descent-override: 41.2%;
  line-gap-override: 0%;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grain) var(--background);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3, p { margin: 0; }

/* Accessibility helpers */

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

.skip {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--background);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus { transform: none; }

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

.cta:focus-visible { border-radius: 14px; outline-offset: 4px; }

section { padding: 0 20px; }

/* Navigation: logo and name on the left; language, App Store and QR at the far right. */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 28px;
  text-decoration: none;
}

.brand img { width: 36px; height: 36px; border-radius: 9px; }

.nav nav { display: flex; align-items: center; gap: 12px; font-size: 14px; }

.nav nav a:not(.qr) { padding: 8px 4px; }

.nav nav a { color: var(--text-secondary); text-decoration: none; }
.nav nav a:hover { color: var(--text); }

.qr {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 1px dashed var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

/* Hero */

.hero {
  padding-top: 96px;
  text-align: center;
}

h1 {
  max-width: 11em;
  margin: 0 auto;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(48px, 9vw, 112px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h1 em { color: var(--text-secondary); }

/* Hand-drawn green underline under the key words, drawn in on load. */
.mark { position: relative; z-index: 0; white-space: nowrap; }

.swoosh {
  position: absolute;
  left: -2%;
  bottom: 0.02em;
  z-index: -1;
  width: 104%;
  height: 0.16em;
  overflow: visible;
  fill: none;
  stroke: var(--progress);
  stroke-width: 18;
  opacity: 0.5;
  stroke-linecap: butt;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 0.25s ease-out 0.1s forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .swoosh { animation: none; stroke-dashoffset: 0; }
}

.sub {
  margin-top: 28px;
  font-size: clamp(17px, 2vw, 20px);
  text-wrap: balance;
  color: var(--text-secondary);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 36px;
  padding: 18px 34px;
  border-radius: 14px;
  /* Primary green from the app. Ink text in both themes: white on this green is too low-contrast. */
  background: var(--progress);
  color: #17212b;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--progress) 35%, transparent);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--progress) 45%, transparent);
}

.cta-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cta:hover .cta-arrow { animation: nudge 0.6s ease-in-out infinite; }

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(2.5px); }
}

@media (prefers-reduced-motion: reduce) {
  .cta:hover .cta-arrow { animation: none; }
}

/* Tour: the phone stays pinned while its screens change on scroll.
   Each callout sits in the left half and draws a line to a spot on the phone. */

.tour {
  /* Phone size: as large as possible while fitting the viewport. */
  --ph: min(1300px, calc(100svh - 96px));
  --pw: calc(var(--ph) * 9 / 19.5);
  /* Distance from the phone's left edge back to where the callout text starts. */
  --reach: calc(50vw - var(--pw) / 2 - 5vw);
  position: relative;
  height: calc(var(--steps) * 100svh);
  margin-top: 40px;
}

.stage {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  place-items: center;
}

.device {
  position: relative;
  width: var(--pw);
  height: var(--ph);
  border-radius: calc(var(--pw) * 0.16);
  background: var(--bezel);
  outline: 1px solid var(--surface-secondary);
  box-shadow: 0 40px 100px rgb(0 0 0 / 0.16);
}

.screen {
  position: absolute;
  inset: calc(var(--pw) * 0.037);
  display: grid;
  /* Label sits low so it never hides a callout dot. */
  place-items: end center;
  padding-bottom: 14%;
  border-radius: calc(var(--pw) * 0.125);
  background: var(--surface-secondary);
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.screen.is-active { opacity: 1; }

/* Dynamic Island */
.screen::before {
  content: "";
  position: absolute;
  top: 2.4%;
  left: 50%;
  width: 30%;
  height: 4.4%;
  border-radius: 999px;
  background: var(--bezel);
  transform: translateX(-50%);
}

.callout {
  position: absolute;
  top: calc(var(--y) * 1%);
  left: calc(-1 * var(--reach));
  width: calc(var(--reach) + var(--x) * var(--pw) / 100);
  display: flex;
  align-items: center;
  transform: translateY(-50%);
  pointer-events: none;
}

.callout-text {
  flex: none;
  width: min(320px, calc(var(--reach) - 40px));
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.callout-text h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
}

.callout-text p { margin-top: 8px; font-size: 16px; color: var(--text-secondary); }

.callout-line {
  flex: 1;
  height: 1px;
  margin-left: 24px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.6s ease 0.1s;
}

.callout-dot {
  position: absolute;
  right: 0;
  width: 12px;
  height: 12px;
  margin-right: -6px;
  border-radius: 50%;
  background: var(--progress);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--progress) 30%, transparent);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Every other callout mirrors to the right half. */
.callout-right {
  left: calc(var(--x) * var(--pw) / 100);
  width: calc(var(--reach) + (100 - var(--x)) * var(--pw) / 100);
  flex-direction: row-reverse;
}

.callout-right .callout-line { margin: 0 24px 0 0; transform-origin: left; }
.callout-right .callout-dot { right: auto; left: 0; margin: 0 0 0 -6px; }

.callout.is-active .callout-text { opacity: 1; transform: none; }
.callout.is-active .callout-line { transform: none; }
.callout.is-active .callout-dot { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .screen, .callout-text, .callout-line, .callout-dot { transition: none; }
}

/* Mission */

.mission { padding-top: 160px; }

.mission p {
  max-width: 20em;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.12;
  text-align: center;
}

/* Features: four short blocks, two by two. */

.features {
  max-width: 1080px;
  margin: 0 auto;
  padding-top: 160px;
}

.features ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px 80px;
  text-align: center;
}

.features h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 42px);
  line-height: 1.05;
}

.features li p {
  max-width: 26em;
  margin: 8px auto 0;
  font-size: 17px;
  color: var(--text-secondary);
}

/* FAQ */

.faq {
  max-width: 760px;
  margin: 0 auto;
  padding-top: 160px;
}

.faq h2 {
  margin-bottom: 32px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  text-align: center;
}

.faq details { border-top: 1px solid var(--surface-secondary); }
.faq details:last-of-type { border-bottom: 1px solid var(--surface-secondary); }

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1.2;
  cursor: pointer;
  list-style: none;
}

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

.faq summary::after {
  content: "+";
  flex: none;
  font-family: var(--sans);
  font-size: 24px;
  font-weight: 300;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

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

.faq details p {
  padding-bottom: 24px;
  max-width: 40em;
  font-size: 17px;
  color: var(--text-secondary);
}

/* Closing */

.closing {
  padding-top: 176px;
  text-align: center;
}

.closing h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 7vw, 88px);
  line-height: 1;
}

/* Footer */

footer {
  margin-top: 160px;
  overflow: hidden;
  text-align: center;
}

/* Same width as the main content (see .features). */
.footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: left;
}

.footer-meta p { text-wrap: balance; }
.nowrap { white-space: nowrap; }

.footer-meta nav { display: flex; gap: 16px; }
.footer-meta nav a { padding: 6px 4px; }
.footer-meta nav a { text-decoration: none; }
.footer-meta nav a:hover { color: var(--text); }

.heart {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin: 0 0.1em;
  vertical-align: -0.12em;
  fill: #e5383b;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.3); }
  30% { transform: scale(1); }
  45% { transform: scale(1.18); }
}

@media (prefers-reduced-motion: reduce) {
  .heart { animation: none; }
}

/* Spans 90% of the viewport (Instrument Serif sets "Reliure" 2.414em wide)
   and sits flush on the bottom edge: the negative margin cancels the space below the baseline. */
.footer-mark {
  margin: 48px 0 -0.15em;
  font-family: var(--serif);
  font-size: 37.3vw;
  line-height: 1;
  color: var(--surface-secondary);
  opacity: 0.5;
  user-select: none;
}

/* Medium and small screens: text above the phone, dot on the spot, no line. */

@media (max-width: 1000px) {
  .tour { --ph: min(1300px, calc(100svh - 220px), 190vw); }
  .stage { place-items: end center; padding-bottom: 24px; }
  .callout, .callout-right { inset: 0; width: auto; transform: none; display: block; }
  .callout-text {
    position: absolute;
    bottom: calc(100% + 24px);
    left: 50%;
    width: min(420px, 90vw);
    /* Centered on the phone: pull back by half its own width. */
    margin-left: calc(min(420px, 90vw) / -2);
    text-align: center;
  }
  .callout-text h3 { font-size: 28px; }
  .callout-text p { font-size: 15px; }
  .callout-line { display: none; }
  .callout .callout-dot { left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); right: auto; margin: -6px 0 0 -6px; }
}

/* Small screens */

@media (max-width: 760px) {
  .qr { display: none; }
  .nav nav { gap: 14px; }
  .hero { padding-top: 56px; }
  .mission, .features, .faq, .closing { padding-top: 112px; }
  .cta { padding: 16px 22px; font-size: 17px; gap: 8px; }
  .cta-icon { width: 20px; height: 20px; }
  .features ul { grid-template-columns: 1fr; gap: 48px; }
  footer { margin-top: 112px; }
  .footer-meta { flex-direction: column; gap: 12px; text-align: center; }
}

/* Smallest phones (iPhone SE 1st gen, 320 px): keep the nav on one line and the button on one line. */

@media (max-width: 380px) {
  .nav { padding: 16px; }
  .brand { gap: 8px; font-size: 24px; }
  .brand img { width: 30px; height: 30px; border-radius: 7px; }
  .nav nav { gap: 4px; }
  .cta { padding: 14px 18px; font-size: 15px; white-space: nowrap; }
}
