/* Tsuin AI design system v0.2
   Convention borrowed from construction drawings:
   existing / delivered = solid line, proposed / available = dashed line. */
:root {
  --slate: #0a1018;
  --panel: #0f1721;
  --rule: #1f2b38;
  --rule-soft: #151f2a;
  --ink: #e7ecf1;
  --muted: #9aa6b2;
  --faint: #6a7784;
  --scan-blue: #2f6bff;
  --scan-cyan: #46d2e8;
  --scan-yellow: #f0d873;
  --on-cyan: #06222a;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wide: 108%;

  --max: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --r-sm: 4px;
  --r-md: 8px;

  /* type scale (1.25 ratio from 17px) */
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-lg: 1.25rem;
  --t-h3: 1.25rem;
  --t-h2: clamp(1.625rem, 2.8vw, 2.125rem);
  --t-h1: clamp(2.375rem, 5.4vw, 4.375rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--slate);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.6;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 {
  margin: 0;
  font-stretch: var(--wide);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.12;
  text-wrap: balance;
}
:focus-visible { outline: 2px solid var(--scan-cyan); outline-offset: 3px; border-radius: 2px; }

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

/* ---------- Line legend (solid = delivered, dashed = available) ---------- */
.line-key { display: inline-flex; align-items: center; gap: 10px; font-size: var(--t-sm); color: var(--muted); }
.line-key::before { content: ""; width: 24px; border-top: 1.5px solid var(--scan-cyan); }
.line-key.is-available::before { border-top: 1.5px dashed var(--scan-yellow); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 20px; border-radius: var(--r-sm);
  font-weight: 500; font-size: 0.9375rem; line-height: 1; font-stretch: var(--wide);
  border: 1px solid transparent; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--scan-cyan); color: var(--on-cyan); }
.btn-primary:hover { background: #7fe2f1; }
.btn-secondary { border-color: var(--rule); color: var(--ink); }
.btn-secondary:hover { border-color: var(--muted); }
.text-link { font-weight: 500; border-bottom: 1px solid var(--rule); padding-bottom: 2px; transition: border-color .15s; }
.text-link:hover { border-color: var(--scan-cyan); }

/* ---------- Header ---------- */
.site-header {
  position: absolute; inset: 0 0 auto 0; z-index: 20;
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-size: 1.0625rem; font-weight: 600; font-stretch: var(--wide); letter-spacing: -0.01em; }
.logo svg { width: 24px; height: 24px; }
.nav-links { display: flex; align-items: center; gap: 36px; font-size: 0.9375rem; color: var(--muted); }
.nav-links a:not(.btn):hover { color: var(--ink); }
.nav-links .btn { padding: 10px 16px; color: var(--on-cyan); }
.nav-toggle { display: none; background: none; border: 0; color: var(--ink); padding: 8px; margin-right: -8px; cursor: pointer; }

/* ---------- Hero: the scan viewer ---------- */
.hero { position: relative; min-height: max(640px, 100svh); display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; border-bottom: 1px solid var(--rule); }
.hero-viewer { position: absolute; inset: 0; }
.hero-viewer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 42% 48% at 70% 44%, rgba(70,210,232,.10), transparent 70%),
    radial-gradient(ellipse 30% 30% at 74% 60%, rgba(47,107,255,.10), transparent 70%),
    linear-gradient(rgba(70,210,232,.045) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(70,210,232,.045) 1px, transparent 1px) 0 0 / 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 68% 45%, #000 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 70% 80% at 68% 45%, #000 30%, transparent 85%);
}
.hero-viewer canvas { position: relative; }
.hero-viewer canvas, .hero-viewer video { width: 100%; height: 100%; object-fit: cover; }
.hero-viewer::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(10,16,24,.94) 0%, rgba(10,16,24,.7) 36%, rgba(10,16,24,0) 66%),
              linear-gradient(0deg, rgba(10,16,24,.9) 0%, rgba(10,16,24,0) 38%);
}
.hero-content { position: relative; z-index: 1; padding-bottom: clamp(56px, 9vh, 104px); }
.hero h1 { font-size: var(--t-h1); max-width: 9.5em; font-weight: 400; letter-spacing: -0.02em; line-height: 1.04; }
.hero .lede { margin-top: 28px; max-width: 34em; font-size: var(--t-lg); line-height: 1.55; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

.viewer-readout {
  position: absolute; z-index: 1; right: var(--gutter); bottom: 32px;
  display: flex; align-items: flex-end; gap: 16px; font-size: 0.8125rem; color: var(--faint); text-align: right;
}
.viewer-readout svg { width: 44px; height: 44px; flex: none; }

/* ---------- Delivered strip ---------- */
.delivered-strip { border-bottom: 1px solid var(--rule-soft); }
.delivered-strip .container { display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; padding-block: 22px; }
.delivered-strip p { color: var(--ink); }
.delivered-strip p span { color: var(--muted); }

/* ---------- Sheet layout: title column + content ---------- */
.sheet { padding-block: clamp(80px, 10vw, 128px); border-bottom: 1px solid var(--rule-soft); }
.sheet-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px clamp(32px, 5vw, 80px); }
.sheet-title h2 { font-size: var(--t-h2); }
.sheet-title p { margin-top: 18px; color: var(--muted); max-width: 30em; }
.sheet-title .legend { display: flex; flex-direction: column; gap: 10px; margin-top: 32px; }
.sheet-full { grid-column: 1 / -1; }

/* ---------- Before / after frames ---------- */
.frames { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.frame { margin: 0; }
.frame-art { aspect-ratio: 8 / 5; border: 1px solid var(--rule); border-radius: var(--r-md); background: rgba(255,255,255,.015); }
.frame-art svg { width: 100%; height: 100%; }
.frame-caption { padding: 16px 2px 0; }
.frame-caption h3 { font-size: 1.0625rem; letter-spacing: 0; }
.frame-caption p { margin-top: 4px; font-size: 0.9375rem; color: var(--muted); }
.frame.is-after .frame-art { border-color: rgba(70,210,232,.35); }

/* ---------- Capability schedule ---------- */
.schedule { width: 100%; border-collapse: collapse; }
.schedule th {
  text-align: left; font-weight: 500; font-size: var(--t-sm); color: var(--faint);
  padding: 0 16px 12px 0; border-bottom: 1px solid var(--rule);
}
.schedule td { padding: 22px 16px 22px 0; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.schedule tr:last-child td { border-bottom: 0; }
.schedule .phase { width: 92px; color: var(--muted); font-size: 0.9375rem; padding-top: 30px; }
.schedule .svc h3 { font-size: var(--t-h3); }
.schedule .svc p { margin-top: 8px; color: var(--muted); max-width: 34em; }
.schedule .svc .line-key { margin-top: 14px; }
.schedule .go { width: 1%; white-space: nowrap; padding-right: 0; padding-top: 30px; font-size: 0.9375rem; }

/* ---------- Process ---------- */
.process { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.process li { position: relative; padding: 36px 24px 0 0; }
.process li::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0;
  border-top: 1.5px solid var(--scan-cyan);
}
.process li.is-available::before { border-top: 1.5px dashed var(--scan-yellow); }
.process li::after {
  content: ""; position: absolute; left: 0; top: -6px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--slate); border: 2px solid var(--scan-cyan);
}
.process li.is-available::after { border-color: var(--scan-yellow); }
.process .n { display: block; font-size: var(--t-sm); color: var(--faint); margin-bottom: 10px; }
.process h3 { font-size: var(--t-h3); }
.process p { margin-top: 10px; font-size: 0.9375rem; color: var(--muted); }

/* ---------- Case ---------- */
.case-view { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--rule); border-radius: var(--r-md); background: rgba(255,255,255,.015); overflow: hidden; }
.case-view canvas { width: 100%; height: 100%; }
.case-view figcaption { position: absolute; left: 16px; bottom: 14px; font-size: 0.8125rem; color: var(--faint); }
.case-body h2 { font-size: var(--t-h2); }
.case-body > p { margin-top: 18px; color: var(--muted); max-width: 34em; }
.deliverables { width: 100%; border-collapse: collapse; margin: 32px 0 32px; }
.deliverables th { text-align: left; font-weight: 500; font-size: var(--t-sm); color: var(--faint); padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.deliverables td { padding: 14px 0; border-bottom: 1px solid var(--rule-soft); }
.deliverables td + td, .deliverables th + th { text-align: right; color: var(--muted); }
.case-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 72px); align-items: center; }

/* ---------- Closing: project inquiry form ---------- */
.closing { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule-soft); scroll-margin-top: 24px; }
.closing::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--rule-soft) 1px, transparent 1px), linear-gradient(90deg, var(--rule-soft) 1px, transparent 1px);
  background-size: 40px 40px; opacity: .9;
  mask-image: linear-gradient(90deg, #000 0%, transparent 45%);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, transparent 45%);
}
.closing .container { position: relative; padding-block: clamp(80px, 10vw, 128px); }
.closing-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px clamp(32px, 5vw, 80px); align-items: start; }
.closing h2 { font-size: clamp(1.875rem, 3.6vw, 2.75rem); max-width: 12em; }
.closing-intro > p { margin-top: 18px; color: var(--muted); max-width: 30em; }
.next-steps { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 14px; font-size: 0.9375rem; color: var(--muted); }
.next-steps li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; }
.next-steps li::before { content: ""; width: 14px; margin-top: 11px; border-top: 1.5px solid var(--scan-cyan); }

.inquiry { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 20px; align-items: start; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 0.875rem; color: var(--ink); }
.field label .opt { color: var(--faint); }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  background: rgba(255,255,255,.025); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 12px 14px; transition: border-color .15s, background-color .15s;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239aa6b2' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field select option { background: var(--slate); color: var(--ink); }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #33475a; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--scan-cyan); background: rgba(70,210,232,.04); }
.field .error { display: none; font-size: 0.8125rem; line-height: 1.3; color: #ff9b8a; }
.inquiry.was-submitted .field .error { display: block; visibility: hidden; min-height: 1.3em; margin-top: -2px; }
.inquiry.was-submitted .field.invalid .error { visibility: visible; }
.field.invalid input, .field.invalid select { border-color: #ff9b8a; }
.field.invalid .error { display: block; visibility: visible; }
.consent { grid-column: 1 / -1; display: grid; grid-template-columns: 18px 1fr; gap: 12px; font-size: 0.875rem; color: var(--muted); align-items: start; }
.consent input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--scan-cyan); }
.consent a { color: var(--ink); border-bottom: 1px solid var(--rule); }
.consent.invalid { color: #ff9b8a; }
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 4px; }
.form-actions .btn { border: 0; cursor: pointer; font-family: inherit; }
.form-actions .btn[disabled] { opacity: .6; cursor: progress; }
.form-status { font-size: 0.9375rem; color: var(--muted); }
.form-status.is-error { color: #ff9b8a; }
.form-done { grid-column: 1 / -1; border-left: 1.5px solid var(--scan-cyan); padding: 4px 0 4px 20px; }
.form-done h3 { font-size: var(--t-h3); }
.form-done p { margin-top: 8px; color: var(--muted); }
.hp { position: absolute; left: -9999px; }

/* ---------- Footer ---------- */
.site-footer { padding-block: 48px 40px; font-size: 0.9375rem; color: var(--faint); }
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-row + .footer-row { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--rule); font-size: var(--t-sm); }
.footer-row nav { display: flex; gap: 28px; flex-wrap: wrap; }
.footer-row nav a:hover { color: var(--ink); }
.site-footer .logo { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .sheet-grid, .case-grid, .closing-grid { grid-template-columns: 1fr; }
  .process { grid-template-columns: 1fr; gap: 0; }
  .process li { padding: 0 0 32px 32px; }
  .process li::before { left: 4px; right: auto; top: 6px; bottom: 0; border-top: 0; border-left: 2px solid var(--scan-cyan); }
  .process li.is-available::before { border-top: 0; border-left: 2px dashed var(--scan-yellow); }
  .process li::after { top: 0; }
  .process li:last-child::before { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 1rem; }
  .nav-links {
    display: none; position: absolute; top: 76px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--slate); border-block: 1px solid var(--rule); padding: 4px var(--gutter) 20px;
  }
  .nav-links.open { display: flex; }
  .nav-links a:not(.btn) { padding: 15px 0; border-bottom: 1px solid var(--rule-soft); color: var(--ink); }
  .nav-links .btn { margin-top: 18px; padding: 15px; }
  .nav-toggle { display: block; }
  .hero-viewer::after { background: linear-gradient(0deg, rgba(10,16,24,.98) 30%, rgba(10,16,24,.55) 60%, rgba(10,16,24,.1) 100%); }
  .hero-actions .btn { flex: 1 1 100%; }
  .viewer-readout { top: 92px; bottom: auto; }
  .frames { grid-template-columns: 1fr; gap: 32px; }
  .inquiry { grid-template-columns: 1fr; }
  .form-actions .btn { width: 100%; }
  .schedule thead { display: none; }
  .schedule tr { display: grid; grid-template-columns: 1fr auto; border-bottom: 1px solid var(--rule-soft); padding: 22px 0; }
  .schedule tr:last-child { border-bottom: 0; }
  .schedule td { border: 0; padding: 0; }
  .schedule .phase { grid-column: 1; padding: 0 0 6px; width: auto; font-size: var(--t-sm); }
  .schedule .go { grid-column: 2; grid-row: 1; padding: 0; }
  .schedule .svc { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .text-link { transition: none; }
}
