/* =========================================================
   Cascade Lab — site styles
   Palette: cool mineral paper, ink, deep basin teal, bright current
   Type:    Geologica (Latin) · Noto Sans SC (CJK) · DM Mono (labels)
   ========================================================= */

:root {
  --paper: #F3F6F5;
  --paper-2: #E8EEED;
  --ink: #0C1A22;
  --ink-2: #15262F;
  --slate: #5B6B72;
  --basin: #0E4B5A;
  --current: #2BB3C0;
  --line: #CAD5D3;
  --line-dark: rgba(243, 246, 245, 0.18);
  --paper-mute: rgba(243, 246, 245, 0.66);

  --font: "Geologica", "Noto Sans SC", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "DM Mono", "Noto Sans SC", ui-monospace, SFMono-Regular, Menlo, monospace;

  --nav-h: 4rem;
  --container: 76rem;
  --container-wide: 84rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --ease: cubic-bezier(0.6, 0, 0.2, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
svg { display: block; }

:focus-visible { outline: 2px solid var(--current); outline-offset: 3px; }
section[id] { scroll-margin-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px)); }

/* ---------- language switch ---------- */
html[data-lang="en"] .zh { display: none !important; }
html:not([data-lang="en"]) .en { display: none !important; }

/* ---------- utilities ---------- */
.wrap { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-wide { max-width: var(--container-wide); }
.mono { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em; }
.mono-label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--basin);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--basin);
  margin-bottom: 1.1rem;
}
.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; z-index: 100; border-radius: 2px;
}
.skip:focus { top: 1rem; }

h2 {
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  line-height: 1.12;
  font-weight: 500;
  letter-spacing: -0.02em;
}
h2 .zh, h1 .zh { font-weight: 600; }
h3 { font-weight: 500; }

.section { padding-block: clamp(4.5rem, 9vw, 8rem); }
.sec-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 4rem;
  align-items: end;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.sec-intro {
  color: var(--slate);
  font-size: 1.05rem;
  max-width: 34rem;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  border-radius: 3px;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.005em;
  line-height: 1;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-sm { padding: 0.6rem 1rem; font-size: 0.85rem; }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: var(--basin); border-color: var(--basin); }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-light { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-light:hover { background: var(--current); border-color: var(--current); }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0;
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: rgba(243, 246, 245, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background-color 0.3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); background: rgba(243, 246, 245, 0.88); }
.nav-row { display: flex; align-items: center; height: 100%; gap: 2rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 500; letter-spacing: -0.01em; }
.brand-mark { width: 1.35rem; height: 1.35rem; color: var(--ink); }
.brand-name { font-size: 1.05rem; }
.nav-links { display: flex; gap: 1.75rem; margin-left: auto; font-size: 0.92rem; }
.nav-links a { position: relative; padding: 0.3rem 0; color: var(--ink-2); }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1.5px; background: var(--current);
  transition: right 0.25s var(--ease);
}
.nav-links a:hover::after { right: 0; }
.nav-tools { display: flex; align-items: center; gap: 1rem; }
.lang-toggle {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em;
  padding: 0.45rem 0.6rem; border: 1.5px solid var(--line); border-radius: 3px;
  color: var(--ink-2);
  transition: border-color 0.2s;
}
.lang-toggle:hover { border-color: var(--ink); }
.nav-burger { display: none; width: 2.2rem; height: 2.2rem; position: relative; }
.nav-burger span {
  position: absolute; left: 0.45rem; right: 0.45rem; height: 1.5px; background: var(--ink);
  transition: transform 0.25s, top 0.25s;
}
.nav-burger span:nth-child(1) { top: 0.85rem; }
.nav-burger span:nth-child(2) { top: 1.3rem; }
.nav-burger[aria-expanded="true"] span:nth-child(1) { top: 1.07rem; transform: rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { top: 1.07rem; transform: rotate(-45deg); }

/* ---------- hero ---------- */
.hero {
  padding-top: calc(var(--nav-h) + clamp(3rem, 8vw, 6.5rem));
  padding-bottom: clamp(2rem, 4vw, 3rem);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
.hero-title {
  font-size: clamp(2.9rem, 6vw, 5.4rem);
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: -0.035em;
  margin: 0 0 1.75rem;
}
.h-line { display: block; white-space: nowrap; }
html:not([data-lang="en"]) .hero-title { font-size: clamp(3rem, 7.2vw, 6.4rem); }
.h-line:nth-child(2) { padding-left: 0.55em; }
.h-line:nth-child(3) { padding-left: 1.1em; }
.hero-sub { max-width: 32rem; color: var(--ink-2); font-size: 1.08rem; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.hero-fig { width: 100%; }
.cascade { width: 100%; height: auto; overflow: visible; }
.cascade-ground { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 2 6; }
.cascade-path {
  fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: miter;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: cascade-draw 2.2s var(--ease) 0.25s forwards;
}
.cascade-pulse {
  fill: none; stroke: var(--current); stroke-width: 3; stroke-linecap: butt;
  stroke-dasharray: 0.045 0.955; stroke-dashoffset: 1.045;
  opacity: 0;
  animation: cascade-flow 5.5s linear 2.4s infinite, cascade-fade 0.4s linear 2.4s forwards;
}
.cascade-src { fill: var(--current); }
.cascade-labels text {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.1em;
  fill: var(--basin);
}
.cascade-groundlabel { fill: var(--slate) !important; }

@keyframes cascade-draw { to { stroke-dashoffset: 0; } }
@keyframes cascade-flow { from { stroke-dashoffset: 1.045; } to { stroke-dashoffset: 0.045; } }
@keyframes cascade-fade { to { opacity: 1; } }

.hero-foot {
  display: flex; gap: 2rem; flex-wrap: wrap;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--slate);
}

/* hero load sequence: a settle, not a fade — the page is readable at rest */
.h-line, .hero-sub, .hero-actions, .hero-copy .eyebrow {
  transform: translateY(0.35em);
  animation: rise 0.9s var(--ease) forwards;
}
.hero-copy .eyebrow { animation-delay: 0.05s; }
.h-line:nth-child(1) { animation-delay: 0.15s; }
.h-line:nth-child(2) { animation-delay: 0.3s; }
.h-line:nth-child(3) { animation-delay: 0.45s; }
.hero-sub { animation-delay: 0.7s; }
.hero-actions { animation-delay: 0.85s; }
@keyframes rise { to { transform: none; } }

/* ---------- statement ---------- */
.statement { background: var(--paper-2); }
.statement-title {
  max-width: 24ch;
  font-size: clamp(1.7rem, 3.4vw, 2.7rem);
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
html[data-lang="en"] .statement-title { max-width: 30ch; }
.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
}
.principle { border-top: 1.5px solid var(--ink); padding-top: 1.25rem; }
.principle h3 { font-size: 1.2rem; line-height: 1.3; margin-bottom: 0.6rem; letter-spacing: -0.01em; }
.principle p { color: var(--slate); font-size: 1rem; }

/* ---------- services ---------- */
.svc {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.svc-tabs { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.svc-tab {
  position: relative;
  text-align: left;
  padding: 1.15rem 0 1.15rem 1.5rem;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--slate);
  transition: color 0.2s, padding-left 0.25s var(--ease);
}
.svc-tab::before {
  content: ""; position: absolute; left: 0; top: 1rem; bottom: 1rem; width: 3px;
  background: var(--current);
  transform: scaleY(0); transform-origin: top;
  transition: transform 0.3s var(--ease);
}
.svc-tab:hover { color: var(--ink); }
.svc-tab[aria-selected="true"] { color: var(--ink); }
.svc-tab[aria-selected="true"]::before { transform: scaleY(1); }
.svc-panels { position: relative; }
.svc-panel { animation: panel-in 0.4s var(--ease); }
.svc-panel[hidden] { display: none; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.svc-lede {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 1rem;
}
.svc-body { color: var(--ink-2); margin-bottom: 1.75rem; max-width: 36rem; }
.svc-deliv { border-top: 1px solid var(--line); padding-top: 1rem; }
.svc-deliv ul { margin-top: 0.6rem; display: grid; gap: 0.35rem; }
.svc-deliv li { position: relative; padding-left: 1.1rem; color: var(--ink-2); }
.svc-deliv li::before {
  content: ""; position: absolute; left: 0; top: 0.72em; width: 0.5rem; height: 1.5px;
  background: var(--current);
}

/* ---------- method: the staircase ---------- */
.method { padding-top: clamp(3rem, 6vw, 5rem); }
.tiers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(11rem, 1fr));
  position: relative;
}
.tiers-intro {
  grid-column: 3 / 6;
  grid-row: 1 / 3;
  padding-left: clamp(1rem, 3vw, 3rem);
  padding-bottom: 2rem;
  align-self: start;
}
.tiers-intro h2 { margin-bottom: 1rem; }
.tier {
  grid-column: var(--i);
  grid-row: var(--i);
  position: relative;
  border-top: 1.5px solid var(--ink);
  padding: 1rem 1.25rem 1.25rem 0;
  font-size: 0.95rem;
}
.tier + .tier::before {
  content: "";
  position: absolute;
  left: 0; bottom: 100%;
  height: 100%;
  border-left: 1.5px solid var(--ink);
}
.tier-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.tier-n { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; color: var(--basin); }
.tier-name { font-size: 1.4rem; letter-spacing: -0.015em; line-height: 1.1; }
.tier-dur { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--slate); margin-left: auto; }
.tier-body { color: var(--ink-2); line-height: 1.55; margin-bottom: 0.9rem; }
.tier-out { display: flex; flex-direction: column; gap: 0.15rem; color: var(--ink); font-weight: 500; line-height: 1.4; }
.tier-out .mono-label { font-size: 0.64rem; }
.tier-land .tier-name { color: var(--basin); }
.tier-land::before { border-left-color: var(--current) !important; border-left-width: 2.5px !important; }

/* the ground: a grid item made from ::after */
.tiers::after {
  content: attr(data-ground-zh);
  grid-column: 1 / -1;
  grid-row: 5;
  border-top: 2px solid var(--ink);
  background: repeating-linear-gradient(135deg, transparent 0 7px, rgba(12, 26, 34, 0.06) 7px 8px);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--slate);
  padding: 0.85rem 0 0 0;
  pointer-events: none;
}
html[data-lang="en"] .tiers::after { content: attr(data-ground-en); }
.tiers .tier:last-child { border-top-color: transparent; z-index: 1; }
.tiers .tier:last-child .tier-head { margin-top: 0.4rem; }

/* ---------- standard ---------- */
.standard { background: var(--ink); color: var(--paper); }
.standard .eyebrow { color: var(--current); }
.standard .sec-intro { color: var(--paper-mute); }
.standard-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.standard-copy { position: sticky; top: calc(var(--nav-h) + 2rem); }
.standard-copy h2 { margin-bottom: 1rem; }
.checks { display: grid; }
.checks li {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 1.1rem;
  align-items: start;
  padding: 1.35rem 0;
  border-top: 1px solid var(--line-dark);
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  line-height: 1.4;
  font-weight: 400;
}
.checks li:last-child { border-bottom: 1px solid var(--line-dark); }
.checks svg { width: 1.6rem; height: 1.6rem; margin-top: 0.15em; }
.checks rect { fill: none; stroke: var(--paper-mute); stroke-width: 1.5; }
.checks path { fill: none; stroke: var(--current); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 5rem);
}
.about-copy { display: grid; gap: 1.25rem; font-size: 1.1rem; color: var(--ink-2); max-width: 38rem; }
.facts {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 2.5rem;
  justify-content: start;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.facts dt { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--basin); margin-bottom: 0.25rem; }
.facts dd { margin: 0; font-weight: 500; color: var(--ink); font-size: 1rem; }

/* ---------- contact ---------- */
.contact { background: var(--basin); color: var(--paper); }
.contact .eyebrow { color: var(--current); }
.contact .sec-intro { color: var(--paper-mute); margin-bottom: 2rem; }
.contact h2 { margin-bottom: 1rem; }
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}
.contact-mail {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  border-bottom: 1.5px solid var(--current);
  padding-bottom: 0.15rem;
  transition: color 0.2s;
}
.contact-mail:hover { color: var(--current); }
.contact-form { display: grid; gap: 1.4rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-mute); }
.field input, .field textarea {
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--line-dark);
  padding: 0.55rem 0;
  color: var(--paper);
  border-radius: 0;
  resize: vertical;
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--current); }
.field input.is-invalid, .field textarea.is-invalid { border-bottom-color: #F2B8A0; }
.contact-form .btn { justify-self: start; margin-top: 0.5rem; }
.form-note { font-size: 0.85rem; color: var(--paper-mute); }

/* ---------- footer ---------- */
.footer { background: var(--ink); color: var(--paper); padding-block: 2.5rem; }
.footer-row { display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; }
.footer-brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 500; }
.footer-brand .brand-mark { color: var(--paper); }
.footer-tag { color: var(--paper-mute); font-weight: 400; font-size: 0.9rem; margin-left: 0.5rem; }
.footer-links { display: flex; gap: 1.5rem; font-size: 0.9rem; margin-left: auto; color: var(--paper-mute); }
.footer-links a:hover { color: var(--paper); }
.footer-copy { color: var(--paper-mute); }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .tiers { display: block; }
  .tiers-intro { padding-left: 0; padding-bottom: 2.5rem; }
  .tier { margin-left: calc((var(--i) - 1) * 0.9rem); padding-right: 0; }
  .tier + .tier::before { display: none; }
  .tier + .tier { margin-top: 1.25rem; }
  .tiers .tier:last-child { border-top-color: var(--ink); }
  .tiers::after {
    display: block; margin-top: 1.25rem; padding: 0.85rem 0 1.25rem 0;
    margin-left: calc(4 * 0.9rem);
  }
}

@media (max-width: 860px) {
  .nav-links {
    position: fixed; left: 0; right: 0; top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
    display: none; flex-direction: column; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1rem;
    font-size: 1.05rem;
  }
  .nav-links a { padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
  .nav-links a::after { display: none; }
  .nav.is-open .nav-links { display: flex; }
  .nav-tools { margin-left: auto; }
  .nav-tools .btn { display: none; }
  .nav-burger { display: block; }

  .hero-grid { grid-template-columns: 1fr; }
  .hero-fig { max-width: 34rem; }
  .sec-head { grid-template-columns: 1fr; align-items: start; }
  .principles { grid-template-columns: 1fr; gap: 1.75rem; }
  .svc { grid-template-columns: 1fr; gap: 1.5rem; }
  .svc-tabs {
    flex-direction: row; overflow-x: auto; border-top: 0; border-bottom: 1px solid var(--line);
    gap: 1.5rem; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .svc-tabs::-webkit-scrollbar { display: none; }
  .svc-tab {
    flex: 0 0 auto; padding: 0.8rem 0; border-bottom: 0; font-size: 1.05rem; white-space: nowrap;
  }
  .svc-tab::before {
    top: auto; bottom: -1px; left: 0; right: 0; width: auto; height: 2px;
    transform: scaleX(0); transform-origin: left;
  }
  .svc-tab[aria-selected="true"]::before { transform: scaleX(1); }
  .standard-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .standard-copy { position: static; }
  .footer-links { margin-left: 0; flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .hero-title, html:not([data-lang="en"]) .hero-title { font-size: clamp(2.6rem, 13vw, 3.6rem); }
  .h-line:nth-child(2) { padding-left: 0.4em; }
  .h-line:nth-child(3) { padding-left: 0.8em; }
  .hero-foot { gap: 1rem 1.5rem; }
  .facts { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
  .btn { padding: 0.8rem 1.15rem; }
  .cascade-labels text { font-size: 16px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cascade-path { animation: none; stroke-dashoffset: 0; }
  .cascade-pulse { animation: none; opacity: 0; }
  .h-line, .hero-sub, .hero-actions, .hero-copy .eyebrow { animation: none; transform: none; }
  .svc-panel { animation: none; }
  .nav-links a::after, .svc-tab::before, .btn { transition: none; }
}
