/* ════════════════════════════════════════════════════════════════════════════
   Kwarka design system — implements the Kwarka Brand Guide.
   Type: Space Grotesk (display/body) · IBM Plex Mono (the machine voice).
   Colour: Ink / Pulse / Mint / Slate / Paper.
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  /* Brand palette */
  --ink:    #101522;
  --pulse:  #2F6BFF;
  --pulse-700: #2154d6;
  --mint:   #3DF2C8;
  --slate:  #7E8AA3;
  --paper:  #F3F6FB;
  --surface:#EEF2F9;
  --white:  #ffffff;

  /* Support tones derived from the guide */
  --line:     #E1E7F2;
  --line-2:   #D5DDEC;
  --body:     #54607a;
  --body-2:   #2c3550;
  --muted:    #a3aec4;
  --good:     #1aa37e;
  --warn:     #c06a6a;
  --pulse-tint: #E7EEFF;

  /* Type */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  /* Shape & motion */
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-pill: 999px;
  --shadow: 0 1px 3px rgba(16,21,34,.06), 0 8px 30px rgba(16,21,34,.06);
  --shadow-lg: 0 24px 60px rgba(16,21,34,.14);
  --ease: cubic-bezier(.2,.7,.2,1);
  --maxw: 1080px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-display);
  color: var(--ink);
  background: var(--surface);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--pulse); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.section--tight { padding: 48px 0; }
section[id] { scroll-margin-top: 84px; }

/* ── Type helpers ───────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pulse);
  margin-bottom: 18px;
}
.mono { font-family: var(--font-mono); }
.h1 { font-weight: 700; font-size: clamp(40px, 6vw, 68px); letter-spacing: -.03em; line-height: 1.02; }
.h2 { font-weight: 700; font-size: clamp(28px, 4vw, 40px); letter-spacing: -.025em; line-height: 1.1; }
.h3 { font-weight: 600; font-size: 22px; letter-spacing: -.01em; }
.lead { font-size: clamp(17px, 2vw, 20px); color: var(--body); line-height: 1.55; }
.muted { color: var(--slate); }
.text-body { color: var(--body); }
.center { text-align: center; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}
.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}.mb-4{margin-bottom:32px}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  --bg: var(--pulse); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 15.5px;
  padding: 14px 24px; border-radius: var(--r-pill);
  background: var(--bg); color: var(--fg);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), filter .2s var(--ease);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(47,107,255,.28); filter: saturate(1.05); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--pulse) 45%, white); outline-offset: 2px; }
.btn--lg { padding: 17px 30px; font-size: 16.5px; }
.btn--ghost { --bg: transparent; --fg: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn--ghost:hover { background: var(--white); box-shadow: var(--shadow); }
.btn--dark { --bg: var(--ink); --fg: #fff; }
.btn--dark:hover { box-shadow: 0 8px 22px rgba(16,21,34,.3); }
.btn--mint { --bg: var(--mint); --fg: var(--ink); }
.btn--mint:hover { box-shadow: 0 8px 22px rgba(61,242,200,.4); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn--block { width: 100%; }

/* ── Cards & surfaces ───────────────────────────────────────────────────── */
.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 32px;
}
.card--ink { background: var(--ink); color: var(--paper); border-color: transparent; }
.card--pulse { background: var(--pulse); color: #fff; border-color: transparent; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }

/* ── Header / nav ───────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; font-size: 23px; letter-spacing: -.03em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 27px; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a { color: var(--body-2); font-size: 15px; font-weight: 500; padding: 8px 14px; border-radius: var(--r-pill); }
.nav-links a:hover { background: var(--white); text-decoration: none; color: var(--ink); }
.nav-cta { margin-left: 8px; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer { background: var(--ink); color: var(--paper); padding: 64px 0 40px; margin-top: 80px; }
.site-footer a { color: var(--paper); opacity: .8; }
.site-footer a:hover { opacity: 1; color: var(--mint); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; }
.footer-grid h4 { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); margin-bottom: 16px; font-weight: 500; }
.footer-grid ul { list-style: none; display: grid; gap: 10px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 48px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1); font-family: var(--font-mono); font-size: 12px; color: var(--slate); }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero { padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.hero h1 { margin: 14px 0 0; }
.hero .accent { color: var(--pulse); }
.hero-sub { margin-top: 22px; max-width: 30ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.hero-trust { display: flex; gap: 24px; margin-top: 34px; flex-wrap: wrap; }
.hero-trust div { font-family: var(--font-mono); font-size: 12.5px; color: var(--slate); }
.hero-trust strong { display: block; font-family: var(--font-display); font-size: 24px; color: var(--ink); font-weight: 700; }

/* Floating quote chip (the machine voice) */
.quote-chip {
  font-family: var(--font-mono); font-size: 15px; color: var(--mint);
  background: var(--ink); border-radius: var(--r-md); padding: 14px 18px;
  display: inline-flex; gap: 10px; align-items: center;
}
.quote-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(61,242,200,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(61,242,200,.5)} 70%{box-shadow:0 0 0 10px rgba(61,242,200,0)} 100%{box-shadow:0 0 0 0 rgba(61,242,200,0)} }

/* ── Steps / how it works ───────────────────────────────────────────────── */
.steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.step { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; position: relative; }
.step .n { font-family: var(--font-mono); font-size: 12px; color: var(--pulse); letter-spacing: .1em; }
.step h3 { margin: 14px 0 8px; }
.step p { color: var(--body); font-size: 15px; }

/* ── Material cards ─────────────────────────────────────────────────────── */
.mat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 16px; }
.mat { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; transition: border-color .2s, transform .2s var(--ease); }
.mat:hover { border-color: var(--pulse); transform: translateY(-2px); }
.mat .swatches { display: flex; gap: 6px; margin-bottom: 16px; }
.mat .sw { width: 18px; height: 18px; border-radius: 6px; border: 1px solid rgba(16,21,34,.12); }
.mat h3 { font-size: 19px; }
.mat p { color: var(--body); font-size: 14px; margin-top: 8px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label { font-size: 14px; font-weight: 600; color: var(--body-2); }
.field .hint { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.input, .textarea, .select {
  font-family: var(--font-display); font-size: 15.5px; color: var(--ink);
  background: var(--white); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 13px 15px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--pulse); box-shadow: 0 0 0 4px var(--pulse-tint); }
.textarea { resize: vertical; min-height: 120px; }
.field.invalid .input, .field.invalid .textarea { border-color: var(--warn); }
.field .error { color: var(--warn); font-size: 12.5px; min-height: 1em; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Choice chips / segmented controls */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span {
  display: inline-flex; flex-direction: column; gap: 2px;
  padding: 11px 16px; border: 1px solid var(--line-2); border-radius: var(--r-md);
  font-size: 14.5px; font-weight: 600; cursor: pointer; transition: all .15s var(--ease); background: var(--white);
}
.choice span small { font-family: var(--font-mono); font-weight: 400; font-size: 11px; color: var(--muted); }
.choice input:checked + span { border-color: var(--pulse); background: var(--pulse-tint); color: var(--pulse-700); box-shadow: 0 0 0 1px var(--pulse) inset; }
.choice input:focus-visible + span { outline: 3px solid var(--pulse-tint); }

/* ── Tags / pills ───────────────────────────────────────────────────────── */
.tag { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .03em; padding: 5px 11px; border-radius: var(--r-pill); background: var(--surface); color: var(--body); border: 1px solid var(--line); }
.tag--mint { background: color-mix(in srgb, var(--mint) 18%, white); color: var(--good); border-color: color-mix(in srgb, var(--mint) 40%, white); }
.tag--warn { background: #fbeeee; color: var(--warn); border-color: #f0d6d6; }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.hr { height: 1px; background: var(--line); border: 0; margin: 28px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero-grid, .grid-2, .form-row { grid-template-columns: 1fr; }
  .steps, .grid-3 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--white); border-bottom: 1px solid var(--line); padding: 8px; box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 16px; border-radius: var(--r-md); }
  .nav-toggle { display: inline-flex; }
  .nav-cta { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; scroll-behavior: auto !important; } }

/* ════════════════════════════════════════════════════════════════════════════
   Instant-quote app
   ════════════════════════════════════════════════════════════════════════════ */
.quote-layout { display: grid; grid-template-columns: 1.25fr .95fr; gap: 24px; align-items: start; }
.quote-main { display: grid; gap: 20px; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--line-2); border-radius: var(--r-lg); background: var(--white);
  padding: 44px 28px; text-align: center; transition: all .2s var(--ease); cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--pulse); background: var(--pulse-tint); }
.dropzone .dz-icon { width: 52px; height: 52px; margin: 0 auto 16px; color: var(--pulse); }
.dropzone h3 { font-size: 20px; }
.dropzone p { color: var(--body); font-size: 14.5px; margin-top: 6px; }
.dropzone .formats { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-top: 14px; }

/* File list */
.files { display: grid; gap: 12px; }
.file-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.file-thumb { width: 64px; height: 64px; border-radius: var(--r-sm); background: var(--ink); overflow: hidden; position: relative; }
.file-thumb canvas { width: 100%; height: 100%; display: block; }
.file-thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--slate); font-family: var(--font-mono); font-size: 10px; }
.file-meta .name { font-weight: 600; font-size: 15px; word-break: break-all; }
.file-meta .spec { font-family: var(--font-mono); font-size: 12px; color: var(--slate); margin-top: 4px; }
.file-price { text-align: right; font-family: var(--font-mono); }
.file-price .p { font-size: 16px; font-weight: 600; color: var(--ink); }
.file-price .q { font-size: 11px; color: var(--muted); }
.file-remove { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px; }
.file-remove:hover { color: var(--warn); }

/* Big 3D viewer */
.viewer { background: var(--ink); border-radius: var(--r-lg); aspect-ratio: 16/10; position: relative; overflow: hidden; border: 1px solid var(--line); }
.viewer canvas { width: 100%; height: 100%; display: block; }
.viewer .v-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--slate); font-family: var(--font-mono); font-size: 12px; text-align: center; padding: 20px; }
.viewer .v-hint { position: absolute; bottom: 10px; left: 12px; font-family: var(--font-mono); font-size: 10.5px; color: var(--slate); }

/* Options */
.opt-group { margin-bottom: 22px; }
.opt-group > .lbl { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); margin-bottom: 12px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-md); overflow: hidden; }
.qty button { background: var(--white); border: 0; width: 42px; height: 44px; font-size: 20px; cursor: pointer; color: var(--ink); }
.qty button:hover { background: var(--surface); }
.qty input { width: 64px; height: 44px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-family: var(--font-mono); font-size: 16px; }

/* Price panel (sticky) */
.price-panel { position: sticky; top: 88px; }
.price-head { display: flex; justify-content: space-between; align-items: baseline; }
.price-total { font-family: var(--font-display); font-weight: 700; font-size: 46px; letter-spacing: -.03em; line-height: 1; }
.price-total .cur { font-size: 22px; color: var(--slate); font-weight: 600; vertical-align: super; }
.price-sub { font-family: var(--font-mono); font-size: 12px; color: var(--slate); }
.breakdown { font-family: var(--font-mono); font-size: 12.5px; color: var(--body); display: grid; gap: 7px; margin: 18px 0; }
.breakdown .li { display: flex; justify-content: space-between; }
.breakdown .li.total { color: var(--ink); font-weight: 600; border-top: 1px solid var(--line); padding-top: 9px; margin-top: 3px; }
.price-mono { font-family: var(--font-mono); font-size: 13px; color: var(--mint); background: var(--ink); border-radius: var(--r-md); padding: 12px 14px; word-break: break-all; }

/* Loading shimmer */
.is-loading { position: relative; color: transparent !important; }
.is-loading::after { content:""; position:absolute; inset:0; border-radius:8px; background: linear-gradient(90deg, var(--surface), #e4ebf6, var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 13px 20px; border-radius: var(--r-pill); font-size: 14.5px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .3s var(--ease); z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #5c2b2e; }

@media (max-width: 860px) {
  .quote-layout { grid-template-columns: 1fr; }
  .price-panel { position: static; }
}


/* ── "Describe it" mode ──────────────────────────────────── */
.mode-toggle { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px; margin-bottom: 18px; }
.mode-btn { border: 0; background: transparent; font-family: var(--font-display); font-weight: 600; font-size: 14.5px; padding: 9px 18px; border-radius: var(--r-pill); cursor: pointer; color: var(--body-2); display: inline-flex; align-items: center; gap: 7px; transition: all .15s var(--ease); }
.mode-btn:hover { color: var(--ink); }
.mode-btn.is-active { background: var(--white); color: var(--ink); box-shadow: var(--shadow); }
.mode-btn .spark { color: var(--pulse); }

.describe-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.thread { display: grid; gap: 10px; max-height: 360px; overflow-y: auto; padding: 2px; margin-bottom: 14px; }
.bubble { max-width: 90%; padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.bubble.bot { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; justify-self: start; color: var(--body-2); }
.bubble.me { background: var(--pulse); color: #fff; border-bottom-right-radius: 4px; justify-self: end; }
.bubble.ok { background: color-mix(in srgb, var(--mint) 16%, white); border-color: color-mix(in srgb, var(--mint) 40%, white); color: var(--ink); }
.bubble .assum { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line-2); font-family: var(--font-mono); font-size: 11.5px; color: var(--slate); display: grid; gap: 3px; }
.bubble.typing { color: var(--slate); font-family: var(--font-mono); font-size: 13px; }
.bubble.typing .d { display: inline-block; animation: blink 1.2s infinite both; }
.bubble.typing .d:nth-child(2) { animation-delay: .2s; }
.bubble.typing .d:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.design-input { display: flex; gap: 8px; align-items: flex-end; }
.design-input textarea { flex: 1; min-height: 46px; }
.design-hint { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
