/* Zima 3D landing. Concept: a workbench. Bench-grey ground, filament-orange parts,
   rounded system type that echoes the soft edges of printed plastic. */
:root {
  --bg: #eceee8;
  --surface: #f9faf6;
  --fg: #18201c;
  --muted: #56615a;
  --line: #d2d8cf;
  --accent: #d9501c;
  --accent-ink: #ffffff;
  --accent-soft: #f6dccf;
  --f-display: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", system-ui, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 16px;
  --max: 1080px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121714;
    --surface: #1a201c;
    --fg: #e7ece8;
    --muted: #9aa69e;
    --line: #2c3530;
    --accent: #ff7a45;
    --accent-ink: #1c0d05;
    --accent-soft: #3a2419;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121714;
  --surface: #1a201c;
  --fg: #e7ece8;
  --muted: #9aa69e;
  --line: #2c3530;
  --accent: #ff7a45;
  --accent-ink: #1c0d05;
  --accent-soft: #3a2419;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.55 var(--f-body);
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--f-display); margin: 0; line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 7vw, 3.6rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 4.5vw, 2.25rem); font-weight: 750; letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
a:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Header */
.top {
  max-width: none;
  margin: 0;
  padding: 16px max(var(--gutter), env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mark { display: inline-flex; align-items: center; text-decoration: none; color: var(--fg); }
.logo { display: block; width: 168px; height: auto; overflow: visible; }
.l3-front { stroke: var(--accent); }
.l3-depth { stroke: color-mix(in srgb, var(--accent) 50%, #000); }
.zi-claro { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .zi-claro { display: inline; }
  :root:not([data-theme="light"]) .zi-oscuro { display: none; }
}
:root[data-theme="dark"] .zi-claro { display: inline; }
:root[data-theme="dark"] .zi-oscuro { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.top-cta { font-weight: 600; font-size: 0.95rem; text-underline-offset: 4px; }

.foot { max-width: var(--max); margin: 0 auto; padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)); }
main > section { padding-block: 48px; }
main > section:not(.hero) { max-width: var(--max); margin-inline: auto; padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)); }
main > section:not(.hero) + section { border-top: 1px solid var(--line); }

/* Hero */
.hero { display: grid; gap: 20px; padding: 8px max(var(--gutter), env(safe-area-inset-left, 0px)) 40px; }
.hero-copy { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 52ch; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 1.05rem/1.2 var(--f-display);
  text-decoration: none;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 60%, #000);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 60%, #000); }

.stage {
  position: relative;
  margin: 0;
  min-width: 0;
  height: clamp(280px, 78vw, 440px);
  border-radius: 20px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
#gl { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
#gl:active { cursor: grabbing; }
.stage-fallback { position: absolute; inset: 0; display: block; width: 100%; height: 100%; padding: 24px 24px 48px; }
.fb-body { fill: var(--accent); }
.fb-lines line { stroke: color-mix(in srgb, var(--accent) 55%, #000); stroke-width: 1; opacity: 0.5; }
.dim {
  position: absolute;
  left: 16px;
  bottom: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.dim-bar {
  width: 48px;
  height: 10px;
  border: solid var(--muted);
  border-width: 0 1.5px;
  background: linear-gradient(var(--muted), var(--muted)) center / 100% 1.5px no-repeat;
  flex: none;
}

/* How it works */
.steps { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 28px; counter-reset: step; }
.steps li { counter-increment: step; display: grid; align-content: start; grid-template-columns: 48px minmax(0, 1fr); column-gap: 16px; row-gap: 6px; }
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--fg);
  font: 800 1.3rem/1 var(--f-display);
}
.steps p { color: var(--muted); max-width: 46ch; }

/* Parts */
.section-lead { color: var(--muted); margin-top: 8px; }
.part-list { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 4px; }
.part-list li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 16px; align-items: start; padding: 14px 0; }
.part-list li + li { border-top: 1px dashed var(--line); }
.part-list svg { width: 44px; height: 44px; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.part-list p { color: var(--muted); margin-top: 2px; max-width: 52ch; }

/* Coming soon */
.ways { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.ways li { background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ways svg { width: 36px; height: 36px; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.ways p { color: var(--muted); font-size: 0.95rem; }
.soon-item { margin-top: 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.soon-item p { color: var(--muted); }
.soon-item h3 { margin-bottom: 6px; }
.soon-art { display: flex; flex-direction: column; justify-content: center; gap: 8px; margin-bottom: 4px; }
.soon-chat .bubble { max-width: 85%; padding: 8px 14px; border-radius: 16px; font-size: 0.95rem; }
.soon-chat .me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.soon-chat .zima { align-self: flex-start; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.soon-item .soon-chat .me { color: var(--accent-ink); }
.soon-item .soon-chat .zima { color: var(--fg); }
.soon-note { color: var(--muted); margin-top: 20px; max-width: 60ch; }

/* Final call to action */
.final { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.final p { color: var(--muted); max-width: 52ch; font-size: 1.05rem; }

.final-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.text-link { font-weight: 600; text-underline-offset: 4px; padding-block: 12px; }
.soon-tag { font-weight: 600; color: var(--fg); }

/* Footer */
.foot { padding-block: 28px 40px; border-top: 1px solid var(--line); font-size: 0.95rem; }
.foot a { font-weight: 600; text-underline-offset: 3px; }
.foot-sub { color: var(--muted); margin-top: 4px; }

@media (min-width: 760px) {
  :root { --gutter: clamp(20px, 3vw, 48px); }
  .hero { grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); align-items: stretch; gap: 24px; height: max(560px, calc(100svh - 84px)); padding-block: 8px 24px; }
  .stage { height: auto; min-height: 0; }
  .chat { min-height: 0; }
  main > section { padding-block: 72px; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps li { grid-template-columns: minmax(0, 1fr); }
  .steps li::before { grid-row: auto; margin-bottom: 8px; }
  .part-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
  .part-list li + li { border-top: 0; }
  .part-list li { border-bottom: 1px dashed var(--line); }
  .soon-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 32px; padding: 24px 28px; }
  .soon-chat { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .icon-btn, .send { transition: none; }
  .bubble { animation: none !important; }
  html { scroll-behavior: auto; }
  .btn:hover, .btn:active { transform: none; }
}

/* Workshop: chat with Zima */
.chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.chat-log { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; scroll-behavior: smooth; overscroll-behavior: contain; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 18px; font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; animation: pop 0.22s ease-out; }
.bubble.zima { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; }
.bubble img { display: block; max-width: 160px; max-height: 120px; border-radius: 10px; margin-bottom: 6px; }
.bubble.note { align-self: center; max-width: 100%; background: none; border: 1px dashed var(--line); font-size: 0.9rem; color: var(--muted); }
.bubble.typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.bubble.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite ease-in-out; }
.bubble.typing i:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-quiet { background: transparent; color: var(--fg); border: 1.5px solid var(--line); box-shadow: none; }
.btn-quiet:hover { border-color: var(--accent); box-shadow: none; }
.btn-quiet:active { box-shadow: none; }
.chat-choices button.btn { cursor: pointer; border: 0; }

.composer { display: flex; flex-direction: column; gap: 8px; }
.composer-row { display: flex; align-items: center; gap: 6px; padding: 6px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--bg); }
.composer-row:focus-within { border-color: var(--accent); }
.msg { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: inherit; padding: 8px 8px 8px 12px; outline: none; }
.icon-btn, .send, .pause {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.icon-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--fg); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.send { background: var(--accent); color: var(--accent-ink); }
.send:hover { filter: brightness(1.08); }
.icon-btn svg, .send svg, .pause svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:focus-visible, .send:focus-visible, .pause:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.composer-note { font-size: 0.85rem; color: var(--muted); padding-inline: 6px; }
.attach-preview { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--muted); padding-inline: 6px; }
.attach-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.attach-preview button { border: 0; background: none; color: var(--fg); font: inherit; text-decoration: underline; cursor: pointer; padding: 8px; }

/* Viewer labels */
.stage .dim { color: var(--fg); font-weight: 600; }
.stage .dim span:last-child { transition: opacity 0.2s ease; }
.pause { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; background: var(--bg); border: 1px solid var(--line); }
.stage-fallback { transition: transform 0.4s ease; transform-origin: 50% 90%; transform: scale(var(--fb-scale, 1)); }

/* Expand button: only used on phones, where the viewer is a small window over the chat */
.expand { display: none; }
.expand svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.expand .ic-close { display: none; }
.expand[aria-expanded="true"] .ic-open { display: none; }
.expand[aria-expanded="true"] .ic-close { display: inline; }

@media (max-width: 759px) {
  body.viewer-open { overflow: hidden; }
  .hero { display: block; position: relative; height: max(520px, calc(100svh - 76px)); padding-block: 4px 12px; }
  .chat { height: 100%; padding: 12px; }
  .chat-log { padding-top: 112px; }
  .stage { position: absolute; top: 16px; left: calc(var(--gutter) + 12px); width: 100px; height: 100px; border-radius: 16px; box-shadow: 0 4px 14px rgb(0 0 0 / 0.25); z-index: 5; }
  .stage:not(.expanded) .dim, .stage:not(.expanded) .pause { display: none; }
  .stage .stage-fallback { padding: 10px 10px 14px; }
  .expand {
    display: grid; place-items: center; position: absolute; right: 4px; bottom: 4px; width: 32px; height: 32px; padding: 0;
    border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); cursor: pointer;
  }
  .expand:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
  .stage.expanded { position: fixed; inset: 0; left: 0; top: 0; width: auto; height: auto; border-radius: 0; border: 0; z-index: 50; box-shadow: none; }
  .stage.expanded .expand { right: 14px; bottom: auto; top: 14px; width: 44px; height: 44px; }
  .stage.expanded .pause { top: 14px; right: 70px; }
  .stage.expanded .dim { bottom: max(18px, env(safe-area-inset-bottom, 0px)); }
}

/* Zoom buttons and the phone caption next to the mini viewer */
.zoomctl { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.zoomctl button {
  width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer;
}
.zoomctl button:hover { border-color: var(--accent); }
.zoomctl button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.zoomctl svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.mini-label { display: none; }
#gl { touch-action: pan-y pinch-zoom; }
.stage .dim { right: 64px; }

@media (max-width: 759px) {
  .stage { left: auto; right: calc(var(--gutter) + 12px); }
  .stage:not(.expanded) .zoomctl { display: none; }
  .stage.expanded #gl { touch-action: none; }
  .mini-label {
    display: flex; flex-direction: column; gap: 2px; position: absolute; z-index: 4;
    top: 22px; left: calc(var(--gutter) + 24px); right: calc(var(--gutter) + 132px);
    font-size: 0.95rem; line-height: 1.3;
  }
  .mini-label span { color: var(--muted); font-size: 0.85rem; }
  .chat-log { padding-top: 108px; }
}
