/*
  HavvApps site styles. One file for every page.

  The site shell is neutral (stone + ink). Colour comes from the apps:
  each app card on the index and each app page sets the --app-* custom
  properties (inline style), and the shared components read them.
  Adding an app never needs a change in this file.
*/

/* ---------- Tokens ---------- */
:root {
  /* Shell (HavvApps) */
  --stone: #EBEBE6;        /* page background */
  --stone-deep: #E2E2DC;   /* footer band */
  --ink: #1C1D1F;          /* text, focus ring */
  --ink-2: #55585E;        /* secondary text */
  --line: #C9C9C2;         /* separators in data lists */

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* App defaults; every app overrides these inline */
  --app-bg: #FFFFFF;
  --app-surface: #FFFFFF;
  --app-ink: var(--ink);
  --app-ink-2: var(--ink-2);
  --app-link: var(--ink);
  --app-line: var(--line);
  --app-display: var(--font-sans);
  --app-body: var(--font-sans);

  /* Space and shape */
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --max: 72rem;
  --radius-panel: clamp(1.25rem, 3vw, 2rem);

  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
:where(ul[role="list"], ol[role="list"]) { list-style: none; padding: 0; }

a {
  color: inherit;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
  text-underline-offset: 0.15em;
}

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

svg { display: block; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--stone);
  border-radius: 0.5rem;
  font-weight: 600;
}
.skip:focus { top: 1rem; }

/* ---------- Wordmark ---------- */
.wordmark {
  font-family: var(--font-sans);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.9;
  text-decoration: none;
}

/* ---------- Index: masthead ---------- */
.masthead {
  padding-block: clamp(3rem, 10vw, 7.5rem) clamp(2.5rem, 6vw, 4.5rem);
}

.masthead h1 {
  font-size: clamp(3.5rem, 15vw, 9.5rem);
  /* the wordmark is the one loud element on the index */
}

.masthead .intro {
  margin-top: clamp(1.25rem, 3vw, 2rem);
  max-width: 34ch;
  font-size: clamp(1.1875rem, 2.4vw, 1.5rem);
  line-height: 1.35;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* ---------- Index: app list ---------- */
.apps {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  /* one app spans the full width; two or more share columns once there is room */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 32rem), 1fr));
  padding-bottom: clamp(4rem, 10vw, 7rem);
}

.app {
  container-type: inline-size;
  position: relative;
  background: var(--app-bg);
  color: var(--app-ink);
  font-family: var(--app-body);
  border-radius: var(--radius-panel);
  padding: clamp(1.5rem, 4vw, 3rem);
}

.app-body {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  grid-template-areas:
    "icon"
    "text"
    "meta";
}

.app-icon { grid-area: icon; }
.app-text { grid-area: text; }

/* one line of the app's own art on its card */
.app-art { display: flex; gap: 0.5rem; margin-top: 1rem; }
.app-art img { width: clamp(3rem, 10cqi, 4rem); height: auto; }
.app-meta { grid-area: meta; }

@container (min-width: 44rem) {
  .app-body {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "icon text meta";
    column-gap: clamp(1.5rem, 4cqi, 3rem);
    align-items: start;
  }
  .app-meta { justify-items: end; text-align: end; }
}

.icon-tile {
  width: clamp(4.5rem, 14cqi, 7.5rem);
  aspect-ratio: 1;
  border-radius: 22.4%;
  overflow: hidden;
  /* keeps the tile edge visible on a background of the same colour */
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--app-ink) 14%, transparent);
}
.icon-tile svg { width: 100%; height: 100%; }

.app-name {
  font-family: var(--app-display);
  font-weight: 600;
  font-size: clamp(2rem, 6cqi, 3rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.app-name a { text-decoration: none; }
.app-name a:hover,
.app:hover .app-name a { text-decoration: underline; text-decoration-thickness: 2px; }

/* the whole panel opens the app page */
.app-name a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-panel);
}
.app-name a:focus-visible { outline: none; }
.app-name a:focus-visible::after {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.app-line {
  margin-top: 0.75rem;
  max-width: 46ch;
  color: var(--app-ink-2);
  font-size: 1.0625rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.app-meta {
  display: grid;
  gap: 0.875rem;
  align-content: start;
}

/* plain text status: a bordered pill would read as a button */
.status {
  display: inline-block;
  justify-self: start;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
@container (min-width: 44rem) { .app-meta .status { justify-self: end; } }

.app-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.9375rem;
}
@container (min-width: 44rem) { .app-links { justify-content: flex-end; } }

.app-links a {
  position: relative; /* sits above the panel-wide link */
  z-index: 1;
  display: inline-block;
  padding-block: 0.6875rem; /* 44px touch height with line-height */
  color: var(--app-link);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, currentColor 40%, transparent);
}
.app-links a:hover { text-decoration-color: currentColor; }

/* ---------- Site bar (app pages) ---------- */
.site-bar {
  background: var(--stone);
  padding-block: 1rem;
}
.site-bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.75rem;
}
.site-bar .wordmark { font-size: 1.375rem; padding-block: 0.5rem; }
.site-bar .back {
  font-size: 0.9375rem;
  color: var(--ink-2);
  padding-block: 0.75rem;
}

/* ---------- App page ---------- */
.app-page {
  background: var(--app-bg);
  color: var(--app-ink);
  font-family: var(--app-body);
}

.app-page a { color: var(--app-link); }

.hero {
  display: grid;
  gap: 2.5rem;
  padding-block: clamp(2.5rem, 8vw, 6rem) clamp(3rem, 8vw, 6rem);
}
/* the mark stays wordmark-sized; the product visual carries the hero */
.hero-mark { width: clamp(3rem, 8vw, 3.75rem); margin-bottom: 1.25rem; margin-left: 0.375rem; /* optical: the slice's stem sits inside the viewBox */ }

@media (min-width: 56rem) {
  .hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: start;
    column-gap: 3rem;
  }
}

/* Product visual: serving shapes exported from the app's design file */
.serve {
  margin: 0;
  background: var(--app-surface);
  border-radius: var(--radius-panel);
  padding: clamp(1.25rem, 3vw, 2rem);
}
/* Real S13 capture (simulator), shown at phone scale above the shape strip */
.serve-shot {
  display: block;
  width: 100%;
  max-width: 16rem;
  height: auto;
  margin: 0 auto 1.25rem;
  border-radius: 1.75rem;
  border: 1px solid var(--app-line);
}
.serve-shapes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  text-align: center;
}
.serve-shapes img { width: 100%; max-width: 7.5rem; height: auto; margin-inline: auto; }
.serve-shapes span {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}
.serve figcaption {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--app-line);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--app-ink-2);
  text-wrap: pretty;
}

.hero h1 {
  font-family: var(--app-display);
  font-weight: 600;
  font-size: clamp(3.25rem, 10vw, 6.25rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
}

.tagline {
  margin-top: 1rem;
  max-width: 22ch;
  font-family: var(--app-display);
  font-size: clamp(1.5rem, 3.4vw, 2.125rem);
  line-height: 1.2;
  text-wrap: balance;
}

.lead {
  margin-top: 1.5rem;
  max-width: 60ch;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--app-ink-2);
  text-wrap: pretty;
}

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

/* a status, not a control: no border or pill until it becomes the App Store link */
.store-status {
  font-size: 1rem;
  line-height: 1.3;
  color: var(--app-ink);
  font-weight: 650;
}
a.store-status {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.625rem 1.125rem;
  border-radius: 999px;
  background: var(--app-ink);
  color: var(--app-bg) !important;
  text-decoration: none;
}

.availability .platform { color: var(--app-ink-2); font-size: 0.9375rem; }

/* One orchestrated moment: the app's mark lands on the page, as in its launch screen */
@media (prefers-reduced-motion: no-preference) {
  .hero-mark svg {
    animation: mark-land 900ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both;
    transform-origin: 40% 90%;
  }
  @keyframes mark-land {
    from { transform: translateY(-1.75rem) rotate(-9deg); }
    to   { transform: none; }
  }
}

/* Chapters: heading column + content column on wide screens */
.chapter {
  display: grid;
  gap: 1.25rem;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}
@media (min-width: 56rem) {
  .chapter {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    column-gap: 3rem;
  }
}

.chapter > h2 {
  font-family: var(--app-display);
  font-weight: 600;
  font-size: clamp(1.625rem, 3vw, 2.125rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
  max-width: 16ch;
}

.chapter-body { max-width: 40rem; }
.chapter-body > p + p,
.chapter-body > p + dl,
.chapter-body > dl + p,
.chapter-body > p + ul,
.chapter-body > ul + p { margin-top: 1rem; }

.chapter-body p { text-wrap: pretty; }
.chapter-body .small { font-size: 0.9375rem; color: var(--app-ink-2); }

/* Questions parents ask, answered */
.qa { display: grid; gap: 2.25rem; }
.qa h3 {
  font-family: var(--app-display);
  font-weight: 500;
  font-size: clamp(1.375rem, 2.6vw, 1.625rem);
  line-height: 1.25;
  text-wrap: balance;
}
.qa p { margin-top: 0.5rem; color: var(--app-ink-2); max-width: 58ch; }

/* Country to guidance body: tabular data, so separators are allowed */
.guidance {
  margin-block: 1.5rem;
  border-top: 1px solid var(--app-line);
}
.guidance div {
  display: grid;
  grid-template-columns: minmax(7.5rem, 1fr) minmax(0, 2fr);
  gap: 1rem;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--app-line);
}
.guidance dt { font-weight: 600; }
.guidance dd { color: var(--app-ink-2); }

.plain-list { display: grid; gap: 0.875rem; }
.plain-list li { max-width: 58ch; }
.plain-list b { font-weight: 650; color: var(--app-ink); }
.plain-list li { color: var(--app-ink-2); }

.languages { color: var(--app-ink-2); max-width: 58ch; }

.note {
  background: var(--app-surface);
  border-radius: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem);
}
.note p + p { margin-top: 0.875rem; }

.link-list { display: grid; gap: 0.25rem; }
.link-list a {
  display: inline-block;
  padding-block: 0.5rem;
  font-weight: 600;
}

/* ---------- Footer (identical on every page) ---------- */
.site-footer {
  background: var(--stone-deep);
  color: var(--ink);
  font-family: var(--font-sans);
  padding-block: clamp(2.5rem, 6vw, 4rem) 2rem;
  font-size: 0.9375rem;
}

.footer-grid {
  display: grid;
  gap: 2rem;
}
@media (min-width: 44rem) {
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
}

.site-footer .wordmark { font-size: 1.75rem; display: inline-block; padding-block: 0.25rem; }
.footer-tag { margin-top: 0.5rem; color: var(--ink-2); max-width: 28ch; }

.footer-apps {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}

.footer-app-name { font-weight: 700; font-size: 1rem; }
.footer-app-name a { text-decoration: none; display: inline-block; padding-block: 0.375rem; }
.footer-app-name a:hover { text-decoration: underline; }

.footer-app ul { margin-top: 0.25rem; display: grid; }
.footer-app li a {
  display: inline-block;
  padding-block: 0.375rem;
  color: var(--ink-2);
  text-decoration: none;
}
.footer-app li a:hover { color: var(--ink); text-decoration: underline; }

.footer-base {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}
