/* Base */
:root {
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --text: #111827;
  --muted: #4B5563;
  --accent: #2F5BEA;
  --accent-text: #FFFFFF;
  --plate-bg: #111827;
  --plate-text: #FFFFFF;
  --line: #E2E6F0;
  --radius: 20px;
  --radius-btn: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 12px 32px rgb(0 0 0 / .08);
  --shadow-soft: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px rgb(0 0 0 / .07);
  --font-heading: Optima, Candara, 'Segoe UI', 'Noto Sans', sans-serif;
  --font-body: Georgia, Cambria, 'Times New Roman', serif;
  --pad: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  line-height: 1.65;
  position: relative;
  min-height: 100vh;
}

/* Background layer */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(560px 460px at 12% 8%, rgb(47 91 234 / .18), transparent 70%),
    radial-gradient(640px 520px at 88% 34%, rgb(47 91 234 / .15), transparent 70%),
    radial-gradient(520px 480px at 22% 82%, rgb(47 91 234 / .13), transparent 70%),
    radial-gradient(460px 420px at 78% 92%, rgb(47 91 234 / .12), transparent 70%);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}
h1 { font-size: clamp(2.4rem, 4.6vw + 0.6rem, 4.6rem); line-height: 1.08; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.8rem, 2.6vw + 0.8rem, 3rem); }
h3 { font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem); }

p { margin: 0 0 16px; }
p:last-child { margin-bottom: 0; }

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

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

.c-skip {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  background: var(--surface);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow);
  font-family: var(--font-heading);
  text-decoration: none;
  transition: top .2s ease;
}
.c-skip:focus { top: 12px; }

/* Layout */
.l-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-inline: var(--pad);
}

.l-section {
  padding-block: clamp(64px, 9vw, 128px);
}
.l-section + .l-section { padding-top: 0; }
#how-it-runs { padding-top: clamp(64px, 9vw, 128px); }

.u-prose {
  max-width: 60ch;
  color: var(--muted);
}
.l-section h2 + .u-prose { margin-bottom: 32px; }

/* Topline */
.c-topline {
  background: var(--plate-bg);
  color: var(--plate-text);
  font-family: var(--font-heading);
  font-size: 14px;
}
.c-topline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 40px;
  padding: 10px 32px;
  flex-wrap: wrap;
}
.c-topline-note { margin: 0; }
.c-topline-mail { margin: 0; font-size: 15px; }
.c-topline-mail a { color: var(--plate-text); }

/* Header */
.l-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.l-header-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding-block: 12px;
}
.c-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 19px;
  color: var(--text);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}
p.c-logo { margin: 0 0 8px; }

.c-nav-list {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0; padding: 0;
}
.c-nav-group:last-of-type .c-nav-list { justify-content: flex-end; }

.c-nav-link {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  position: relative;
  padding-block: 6px;
}
.c-nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.c-nav-link:hover::after,
.c-nav-link:focus-visible::after,
.c-nav-link[aria-current="page"]::after { transform: scaleX(1); }
.c-nav-link:hover { color: var(--accent); }

/* Mobile nav */
.c-nav-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 10px;
  cursor: pointer;
}
.c-nav-toggle-bar {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  margin: 4px auto;
  transition: transform .25s ease, opacity .2s ease;
}
.c-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--surface);
  z-index: 30;
  padding: 96px var(--pad) 40px;
}
.c-nav-full-list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 8px;
}
.c-nav-full-list .c-nav-link {
  font-size: 28px;
  font-weight: 600;
  display: inline-block;
  padding-block: 10px;
}
.c-nav-toggle[aria-expanded="true"] .c-nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.c-nav-toggle[aria-expanded="true"] .c-nav-toggle-bar:nth-child(2) { opacity: 0; }
.c-nav-toggle[aria-expanded="true"] .c-nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.c-nav-toggle[aria-expanded="true"] { position: fixed; top: 12px; right: var(--pad); z-index: 40; }

/* Hero */
.l-hero-grid {
  display: grid;
  grid-template-columns: 55fr 45fr;
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
}
.l-hero-copy { min-width: 0; }
.l-hero-sub { max-width: 56ch; color: var(--muted); font-size: clamp(1.05rem, 1rem + 0.4vw, 1.3rem); margin-bottom: 32px; }
.l-hero-line { display: inline-block; }
.l-hero-media img { border-radius: var(--radius); aspect-ratio: 3 / 4; object-fit: cover; width: 100%; }
.u-accent {
  display: inline-block;
  font-size: clamp(2.6rem, 5.2vw + 0.8rem, 5.2rem);
  line-height: 1.05;
  color: var(--accent);
}
html.has-js .l-hero-line {
  animation: hero-rise .6s ease both;
}
html.has-js .l-hero-line:nth-child(1) { animation-delay: 0s; }
html.has-js .l-hero-line:nth-child(2) { animation-delay: .12s; }
html.has-js .l-hero-line:nth-child(3) { animation-delay: .24s; }
@keyframes hero-rise {
  from { transform: translateY(8px); }
  to { transform: translateY(0); }
}

/* Buttons */
.c-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 28px;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease, transform .1s ease;
}
.c-btn:hover { background: var(--plate-bg); color: var(--plate-text); }
.c-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.c-btn:active { transform: translateY(1px); }

.c-btn-quiet {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 8px;
  background: none;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  border: none;
  cursor: pointer;
  transition: color .2s ease;
}
.c-btn-quiet:hover { color: var(--accent); }
.c-btn-quiet:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.c-btn-quiet:active { transform: translateY(1px); }

/* Zigzag */
.l-zigzag {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  margin: 0;
}
.l-zigzag + .l-zigzag { margin-top: clamp(48px, 8vw, 96px); }
.l-zigzag.has-flip .l-zig-media { order: 2; }
.l-zig-media { max-width: 520px; }
.l-zig-media img { border-radius: 16px; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.l-zig-copy h3 { margin-top: 0; }

/* Mat frame */
.u-mat {
  padding: 12px;
  max-width: 520px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.u-mat img { border-radius: 16px; }

/* Cards */
.l-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}
.c-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 28px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.c-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.c-card h3 { margin-top: 0; }
.c-card p { color: var(--muted); margin: 0; font-size: 1rem; }

/* Tabs */
.c-tabs-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.c-tab {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #D3D9E3;
  border-radius: 999px;
  padding: 8px 20px;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.c-tab:hover { color: var(--accent); }
.c-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.c-tab-panel { margin-top: 8px; }
.c-tab-panel[hidden] { display: none; }

/* Gallery */
.l-frames {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}
.l-frame { margin: 0; }
.l-frame img { border-radius: 16px; aspect-ratio: 1 / 1; object-fit: cover; width: 100%; }
.l-frame-wide { grid-column: span 2; }
.l-frame-wide img { aspect-ratio: 16 / 9; }

/* FAQ */
.c-faq {
  display: grid;
  gap: 12px;
  margin-top: 32px;
  max-width: 760px;
}
.c-faq-item {
  background: var(--surface);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-soft);
  padding: 4px 24px;
}
.c-faq-item summary {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.1rem;
  padding: 18px 0;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 36px;
}
.c-faq-item summary::-webkit-details-marker { display: none; }
.c-faq-item summary::after {
  content: "+";
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 600;
  transition: transform .25s ease;
}
.c-faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.c-faq-item p { color: var(--muted); padding-bottom: 16px; margin: 0; }

/* Form */
.l-form-wrap { max-width: 720px; }
.c-form {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: clamp(24px, 4vw, 40px);
  margin-top: 24px;
  display: grid;
  gap: 20px;
}
.c-field { display: grid; gap: 8px; }
.c-label {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
}
.c-input {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 12px 16px;
  min-height: 48px;
}
.c-textarea { min-height: 120px; resize: vertical; }
.c-input::placeholder { color: #5B6472; opacity: 1; }
.c-input:focus { border-color: var(--accent); outline: none; }
.c-input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.is-invalid .c-input, .c-input.is-invalid { border-color: #B42318; }

.c-check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--muted); }
.c-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.c-check a { color: var(--accent); }

.c-form-note { font-size: 14px; color: var(--muted); margin: 0; }
.c-form-send { justify-self: start; }
.c-form-send.is-sending { opacity: .7; pointer-events: none; }

/* Plate */
.c-plate {
  background: var(--plate-bg);
  color: var(--plate-text);
  border-radius: var(--radius);
  padding: clamp(28px, 5vw, 56px);
  box-shadow: var(--shadow);
}
.c-plate h2 { color: var(--plate-text); }
.c-plate p { max-width: 68ch; color: #E5E7EB; }
.c-plate a { color: #A9C0FF; }

/* Footer */
.l-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: clamp(48px, 6vw, 80px) 0 24px;
  margin-top: clamp(64px, 9vw, 128px);
  font-size: 15px;
}
.l-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}
.l-footer-note { color: var(--muted); max-width: 40ch; }
.l-footer-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}
.l-footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.l-footer-links a { color: var(--muted); text-decoration: none; }
.l-footer-links a:hover { color: var(--accent); text-decoration: underline; }
.l-footer-col address { font-style: normal; color: var(--muted); }
.l-footer-col address p { margin: 0 0 4px; }
.l-footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.l-footer-col ul li span { color: var(--muted); }
.l-footer-owner {
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding-top: 24px;
  color: var(--muted);
}
.l-footer-owner address { font-style: normal; }
.l-footer-owner p { margin: 0 0 4px; }
.l-footer-bottom { margin-top: 24px; color: var(--muted); font-size: 14px; }
.l-footer-copy { margin: 0; }

/* Reveal */
html.has-js .c-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease;
}
html.has-js .c-reveal.is-revealed {
  opacity: 1;
  transform: none;
}

/* Inner pages */
.l-page-head { padding-top: clamp(40px, 6vw, 72px); }
.l-page-head h1 { margin-bottom: 24px; }

.u-prose h2 { margin-top: 40px; }
.u-prose h3 { margin-top: 32px; }
.u-prose ul, .u-prose ol { padding-left: 24px; color: var(--text); }
.u-prose li { margin-bottom: 8px; }
.u-prose table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-btn);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  margin: 24px 0;
  font-size: 16px;
}
.u-prose th, .u-prose td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.u-prose th {
  font-family: var(--font-heading);
  background: var(--bg);
}
.u-prose tr:last-child td { border-bottom: none; }
.u-prose blockquote {
  margin: 24px 0;
  padding: 16px 24px;
  background: var(--surface);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
  color: var(--muted);
}
.u-prose code {
  font-family: ui-monospace, monospace;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .92em;
}

/* TOC */
.l-toc {
  background: var(--surface);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-soft);
  padding: 20px 24px;
  margin-bottom: 32px;
}
.l-toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

/* Error pages */
.l-lost {
  text-align: center;
  padding-block: clamp(80px, 12vw, 160px);
}
.l-lost h1 { font-size: clamp(3rem, 8vw, 6rem); color: var(--accent); }

/* Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  html.has-js .c-reveal { opacity: 1; transform: none; }
}

/* Breakpoints */
@media (max-width: 1280px) {
  .l-frames { gap: 20px; }
  .l-cards { gap: 20px; }
}

@media (max-width: 1024px) {
  .l-hero-grid { grid-template-columns: 1fr 1fr; }
  .l-cards { grid-template-columns: repeat(2, 1fr); }
  .l-footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .c-nav-group, .l-header-row .c-nav { display: none; }
  .l-header-row { grid-template-columns: 1fr auto; }
  .c-logo { text-align: left; }
  .c-nav-toggle { display: inline-flex; flex-direction: column; justify-content: center; }
  .l-header.is-open .c-nav-overlay { display: block; }
  .c-nav-overlay { display: none; }
  html.has-js .c-nav-overlay.is-open { display: block; }
  .c-nav-overlay.is-open { display: block; }
  .c-nav-overlay:not(.is-open) { display: none; }
}

@media (min-width: 901px) {
  .c-nav-overlay { display: none !important; }
}

@media (max-width: 768px) {
  .l-zigzag + .l-zigzag { margin-top: 48px; }
  .l-zigzag { margin-bottom: 48px; }
  .l-zig-media { max-width: none; }
  .l-zig-media img { aspect-ratio: 4 / 3; height: auto; }
  .l-hero-grid { grid-template-columns: 1fr; }
  .l-hero-media { max-width: 480px; }
  .l-zigzag { grid-template-columns: 1fr; margin-top: 40px; }
  .l-zigzag.has-flip .l-zig-media { order: 0; }
  .l-frames { grid-template-columns: repeat(2, 1fr); }
  .l-frame-wide { grid-column: span 2; }
  .c-tabs-bar { gap: 8px; }
}

@media (max-width: 640px) {
  .l-cards { grid-template-columns: 1fr; }
  .l-footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .c-topline-row { justify-content: center; text-align: center; }
  .c-topline-note { display: none; }
}

@media (max-width: 480px) {
  .l-frames { grid-template-columns: 1fr; }
  .l-frame-wide { grid-column: auto; }
  .u-accent { font-size: clamp(2.4rem, 4.4vw + 0.8rem, 3.4rem); }
  .c-btn { width: 100%; max-width: 360px; padding: 14px 24px; margin: 32px 0 40px; }
  .c-form-send { justify-self: stretch; margin: 0; max-width: none; width: auto; }
}

/* Hero balance */
.l-hero { padding-block: clamp(48px, 6vw, 72px); }
.l-hero-media { display: flex; }
.l-hero-media img { flex: 1; min-height: 0; height: auto; max-height: 640px; }
@media (min-width: 769px) {
  .l-hero-media img { height: 100%; }
}
