/* ==========================================================================
   Sizewise — promotional website design system.
   Tokens below are copied from DESIGN.md — keep them in sync if design changes.
   ========================================================================== */

:root {
  /* Brand colors (from DESIGN.md `colors`) */
  --color-primary: #B84A28;
  --color-secondary: #C98A12;
  --color-tertiary: #6E5539;
  --color-neutral: #F8F1E4;
  --color-surface: #FFFCF5;
  --color-ink: #2B1D10;
  --color-ink-soft: #6E5539;

  /* Type (from DESIGN.md `typography`) */
  --font-heading: ui-rounded, "SF Pro Rounded", "SF Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: ui-rounded, "SF Pro Rounded", "SF Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Shape + spacing (from DESIGN.md `rounded` / `spacing`) */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;

  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.10);
  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-neutral);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap { width: min(1120px, 92vw); margin-inline: auto; }
.section { padding: clamp(3rem, 8vw, 6rem) 0; }
.section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  text-align: center;
  margin-bottom: var(--space-sm);
}
.section-sub {
  text-align: center;
  color: var(--color-ink-soft);
  max-width: 46ch;
  margin: 0 auto var(--space-lg);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-surface);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--color-ink); }
.brand img { width: 36px; height: 36px; border-radius: var(--radius-sm); box-shadow: var(--shadow-card); }
.brand-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; }
.nav-links { display: flex; align-items: center; gap: 1.6rem; }
.nav-links a { color: var(--color-ink-soft); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav-links a:hover { color: var(--color-primary); }
/* The nav link colour above would otherwise win over .btn and leave dark text on the terracotta button. */
.nav-links a.btn, .nav-links a.btn:hover { color: #fff; }

/* Hamburger button that reveals the full nav (links + language switcher) on
   mobile. Hidden on desktop, where the links are always visible inline. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle:hover, .nav-toggle:focus-visible { background: rgba(0, 0, 0, 0.05); }
.nav-toggle-bar { width: 22px; height: 2px; margin-inline: auto; background: var(--color-ink); border-radius: 2px; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  padding: 0.85rem 1.6rem;
  color: #fff;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16); }
.btn:active { transform: translateY(0); }
.btn--ghost { background: transparent; color: var(--color-primary); box-shadow: none; border: 1.5px solid var(--color-primary); }
.btn--lg { font-size: 1.1rem; padding: 1rem 2.1rem; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { padding: clamp(3rem, 9vw, 6rem) 0 clamp(2rem, 6vw, 4rem); }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
}
.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.1rem; }
.pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  background: var(--color-surface);
  color: var(--color-ink-soft);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}
.hero h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.05;
  margin-bottom: 1rem;
}
.hero .lede {
  color: var(--color-ink-soft);
  font-size: 1.1rem;
  max-width: 42ch;
  margin-bottom: 1.8rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-bottom: 0.9rem; }
.hero-note { color: var(--color-ink-soft); font-size: 0.85rem; opacity: 0.85; }
.hero-art { display: flex; justify-content: center; align-items: flex-end; gap: 1.2rem; }

/* --------------------------------------------------------------------------
   Phone frame — pure CSS bezel, no device-frame image asset required.
   The aspect-ratio lives on .phone-frame__screen (the content box holding the
   screenshot), NOT on the padded .phone-frame itself. With the global
   box-sizing: border-box reset above, an aspect-ratio on the padded frame is
   computed on the border-box, so the padded-out content area ends up a
   slightly different ratio than the real screenshot — object-fit: cover then
   crops the screenshot's left/right edges. Keeping the ratio on the inner
   screen element avoids that.
   -------------------------------------------------------------------------- */
.phone-frame {
  position: relative;
  width: 220px;
  background: linear-gradient(155deg, #4a4a4d, #232325 55%, #17171a);
  border-radius: 46px;
  padding: 6px;
  box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.phone-frame:nth-child(2) { transform: translateY(-18px); z-index: 2; width: 240px; }
.phone-frame:nth-child(1) { transform: rotate(-4deg); }
.phone-frame:nth-child(3) { transform: rotate(4deg); }
/* No CSS-drawn notch/Dynamic Island here: real device screenshots already
   render it, so a second CSS shape on top just doubles/mismatches it. */
.phone-frame__screen {
  width: 100%;
  aspect-ratio: 1206 / 2622; /* matches iPhone 17 Pro (and similar Pro-class) screenshot ratio */
  border-radius: 40px;
  overflow: hidden;
  background: var(--color-surface);
}
.phone-frame__screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.phone-frame__home {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  height: 3px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  z-index: 2;
  pointer-events: none;
}

.screens-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 2rem 0;
}

/* --------------------------------------------------------------------------
   Feature cards
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
}
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}
.card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-neutral);
  font-size: 1.4rem;
  margin-bottom: 0.9rem;
}
.card h3 { font-family: var(--font-heading); font-size: 1.1rem; margin-bottom: 0.4rem; }
.card p { color: var(--color-ink-soft); font-size: 0.95rem; }

/* --------------------------------------------------------------------------
   CTA band + footer
   -------------------------------------------------------------------------- */
.cta-band {
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding: clamp(3rem, 8vw, 5rem) 0;
}
.cta-band h2 { font-family: var(--font-heading); font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 1.4rem; }
.cta-band .btn { background: #fff; color: var(--color-primary); }
.cta-band .hero-note { color: rgba(255, 255, 255, 0.85); margin-top: 1rem; }

/* --------------------------------------------------------------------------
   App Store badge — official Apple artwork (assets/app-store-badge.svg),
   used per Apple's App Store Marketing Guidelines. Only size/wrap it here;
   never recolor, redraw, or otherwise alter the badge artwork itself.
   -------------------------------------------------------------------------- */
.app-store-badge-link { display: inline-block; line-height: 0; }
.app-store-badge { height: 44px; width: auto; display: block; }
.cta-band .app-store-badge { height: 64px; }

.site-footer { padding: var(--space-lg) 0; background: var(--color-surface); }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.footer-grid small { color: var(--color-ink-soft); display: block; margin-top: 0.3rem; }
.footer-links { display: flex; gap: 1.2rem; }
.footer-links a { color: var(--color-ink-soft); text-decoration: none; font-size: 0.9rem; }
.footer-links a:hover { color: var(--color-primary); }

/* --------------------------------------------------------------------------
   Legal pages (privacy.html / terms.html)
   -------------------------------------------------------------------------- */
.legal { padding: clamp(2.5rem, 6vw, 4rem) 0; }
.legal .wrap { max-width: 760px; }
.legal h1 { font-family: var(--font-heading); font-size: clamp(2rem, 4vw, 2.6rem); margin-bottom: 0.4rem; }
.legal .updated { color: var(--color-ink-soft); font-size: 0.9rem; margin-bottom: 2rem; }
.legal h2 { font-family: var(--font-heading); font-size: 1.3rem; margin: 2rem 0 0.7rem; }
.legal p, .legal li { color: var(--color-ink-soft); margin-bottom: 0.8rem; }
.legal ul { padding-left: 1.3rem; }

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; }

  .nav-toggle { display: flex; }

  /* Collapsed by default; .is-open (toggled by js/main.js) drops it down as
     a full-width panel so every nav option, including the language
     switcher, stays reachable on mobile. */
  .nav-links {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0 1rem;
    background: var(--color-surface);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-soft);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 0.8rem var(--space-md); }
  .nav-links a.btn { margin: 0.5rem var(--space-md) 0; justify-content: center; }
  .nav-links .lang-switcher { margin: 0.5rem var(--space-md) 0; width: auto; }
}

/* Language switcher (populated by js/main.js): a native <select> so it works
   the same way, as a dropdown, on every screen size. */
.lang-switcher {
  min-height: 44px;
  padding: 0 1.8rem 0 0.8rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-ink-soft);
  background: var(--color-neutral) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236E5539' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E") no-repeat right 0.6rem center;
  background-size: 0.7rem;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  appearance: none;
  cursor: pointer;
}
.lang-switcher:hover { color: var(--color-primary); }
.lang-switcher:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* CJK font stacks: keep the rounded Latin face, fall back to system CJK faces. */
:lang(zh-Hans) {
  --font-heading: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --font-body: var(--font-heading);
}
:lang(ja) {
  --font-heading: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans CJK JP", "Noto Sans JP", sans-serif;
  --font-body: var(--font-heading);
}

/* --------------------------------------------------------------------------
   Help page (help.html). Ported from the shared CFD web pattern.
   -------------------------------------------------------------------------- */
.help-hero {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
}
.help-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  margin-bottom: 0.75rem;
}
.help-hero .lede {
  color: var(--color-ink-soft);
  font-size: 1.1rem;
  max-width: 52ch;
  margin: 0 auto;
}
.help-toc {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-lg);
}
.help-toc h2 {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-soft);
  margin-bottom: 0.75rem;
}
.help-toc ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; padding: 0; }
.help-toc a { color: var(--color-primary); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.help-toc a:hover { text-decoration: underline; }

.help-section { padding: clamp(2rem, 5vw, 3.5rem) 0; scroll-margin-top: 4.5rem; }
.help-section--alt { background: var(--color-surface); }
.help-section .wrap { max-width: 820px; }
.help-section h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin-bottom: 0.6rem;
}
.help-section .section-intro { color: var(--color-ink-soft); margin-bottom: var(--space-lg); max-width: 62ch; }

.big-idea {
  background: linear-gradient(135deg, var(--color-primary), var(--color-tertiary));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-soft);
}
.big-idea p { color: rgba(255, 255, 255, 0.92); margin-bottom: 0.6rem; }
.big-idea p:last-child { margin-bottom: 0; }
.big-idea strong { color: #fff; }

.concept-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-md); }
.concept-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.help-section--alt .concept-card { background: var(--color-neutral); }
.concept-card .label {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  margin-bottom: 0.4rem;
}
.concept-card h3 { font-family: var(--font-heading); font-size: 1.15rem; margin-bottom: 0.5rem; }
.concept-card p { color: var(--color-ink-soft); font-size: 0.95rem; margin-bottom: 0; }
.concept-card p + p { margin-top: 0.5rem; }
.concept-card .where {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.85rem;
  color: var(--color-ink-soft);
}
.concept-card .where strong { color: var(--color-ink); }

.use-case {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.help-section--alt .use-case { background: var(--color-neutral); }
.use-case:last-child { margin-bottom: 0; }
.use-case h3 { font-family: var(--font-heading); font-size: 1.15rem; margin-bottom: 0.35rem; }
.use-case .tagline { color: var(--color-ink-soft); font-size: 0.9rem; margin-bottom: var(--space-md); }
.step-list { list-style: none; counter-reset: steps; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.step-list li {
  counter-increment: steps;
  position: relative;
  padding-left: 2.2rem;
  color: var(--color-ink-soft);
  font-size: 0.95rem;
}
.step-list li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 50%;
}
.step-list li strong { color: var(--color-ink); }

.priority-note {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-ink-soft);
  font-size: 0.9rem;
}
.help-section--alt .priority-note { background: var(--color-neutral); }

.help-cta { text-align: center; padding: clamp(2rem, 5vw, 3rem) 0; }
.help-cta h2 { font-family: var(--font-heading); font-size: clamp(1.5rem, 3.5vw, 2rem); margin-bottom: 0.6rem; }
.help-cta p { color: var(--color-ink-soft); margin-bottom: 0.75rem; }
.help-cta a { color: var(--color-primary); font-weight: 600; }

@media (max-width: 600px) {
  .help-toc ul { flex-direction: column; gap: 0.6rem; }
  .concept-grid { grid-template-columns: 1fr; }
  .use-case { padding: var(--space-md); }
}

/* --------------------------------------------------------------------------
   Gallery (landing pages) — phone frames with captions, responsive grid.
   Overrides the hero's tilted/staggered .phone-frame positioning.
   -------------------------------------------------------------------------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
  padding-top: var(--space-md);
}
.gallery-item { display: flex; flex-direction: column; align-items: center; text-align: center; }
.gallery-item .phone-frame:nth-child(n) { transform: none; width: 100%; max-width: 240px; }
.gallery-item figcaption { margin-top: var(--space-md); max-width: 30ch; }
.gallery-item h3 { font-family: var(--font-heading); font-size: 1.1rem; margin-bottom: 0.3rem; }
.gallery-item p { color: var(--color-ink-soft); font-size: 0.95rem; }
.gallery-item--wide { grid-column: 1 / -1; }
.gallery-pair { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-lg); }
.gallery-pair .phone-frame { flex: 0 1 240px; }
.gallery-item picture { display: block; width: 100%; height: 100%; }

/* --------------------------------------------------------------------------
   Responsive hardening — prevent horizontal overflow on phones.
   -------------------------------------------------------------------------- */
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
img, picture, svg { max-width: 100%; }
.hero-grid > *, .card-grid > *, .gallery > *, .concept-grid > * { min-width: 0; }
h1, h2, h3, p, li, a { overflow-wrap: anywhere; }
.nav-links a.btn { overflow-wrap: normal; }
.card-grid { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.gallery { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.concept-grid { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.site-header { position: sticky; }
.nav { position: relative; }

/* Hero phones shrink proportionally instead of overflowing. */
.hero-art { gap: clamp(0.4rem, 2vw, 1.2rem); max-width: 100%; }
.hero-art .phone-frame { flex: 0 1 220px; width: auto; min-width: 0; }
.hero-art .phone-frame:nth-child(2) { flex-basis: 240px; }
.screens-row .phone-frame { flex: 0 1 220px; width: auto; min-width: 0; }
.screens-row .phone-frame:nth-child(2) { flex-basis: 240px; }

@media (max-width: 820px) {
  .hero-art { padding-inline: 0.5rem; }
  .hero-copy { text-align: center; }
  .hero-copy .lede { margin-inline: auto; }
  .hero-copy .pill-row, .hero-copy .hero-cta { justify-content: center; }
}

@media (max-width: 600px) {
  .hero-art .phone-frame, .screens-row .phone-frame { border-radius: 26px; padding: 4px; }
  .hero-art .phone-frame .phone-frame__screen,
  .screens-row .phone-frame .phone-frame__screen { border-radius: 22px; }
  .hero-art .phone-frame:nth-child(2) { transform: translateY(-10px); }
  .screens-row { flex-wrap: nowrap; gap: 0.4rem; padding: 1.5rem 0; }
  .card { padding: var(--space-md); }
  .footer-grid, .footer-links { flex-direction: column; align-items: flex-start; }
  .footer-links { flex-wrap: wrap; flex-direction: row; gap: 0.6rem 1.2rem; }
  .help-toc { padding: var(--space-md); }
  .big-idea, .use-case { padding: var(--space-md); }
  .cta-band .app-store-badge { height: 56px; }
}
