/* ─────────────────────────────────────────────────────────────────────
   KONZTRUCT — Specimen Documentation Site
   KZ-002 // K. obscurus // CLASSIFIED
   ───────────────────────────────────────────────────────────────────── */

:root {
  --bg:       #fefefe;
  --panel:    #fefefe;
  --panel-2:  #f4f6f6;
  --panel-3:  #eaeff0;
  --accent:   #0b6f7b;
  --accent-dim:  rgba(11, 111, 123, 0.38);
  --accent-glow: #0e8f9d;
  --border:   rgba(11, 90, 100, 0.30);
  --border-hi:rgba(11, 90, 100, 0.62);
  --fg:       #101617;
  --muted:    #4f6264;
  --mono:     'Space Mono', monospace;
  --sans:     'Space Grotesk', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── PANEL BASE ─────────────────────────────────────────────────────── */
.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 14px;
  position: relative;
}
.panel-label {
  font-size: 9px;
  letter-spacing: .18em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}
.panel-sub { color: var(--muted); font-size: 8px; letter-spacing: .1em; }
.sus { color: var(--muted); font-style: italic; font-size: 0.85em; }

/* ── NAVIGATION ─────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(254,254,254,.94);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
.nav-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-division { font-size: 9px; letter-spacing: .14em; color: var(--fg); text-transform: uppercase; }
.nav-sep { color: var(--accent); font-size: 10px; }
.nav-class { font-size: 9px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.nav-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.nav-link { font-size: 10px; letter-spacing: .1em; color: var(--muted); text-decoration: none; transition: color .2s; }
.nav-link:hover { color: var(--fg); }
.nav-link-cta { color: var(--accent); border: 1px solid var(--accent-dim); padding: 4px 10px; }
.nav-link-cta:hover { color: var(--accent-glow); border-color: var(--accent); }

/* ── SPECIMEN HEADER ─────────────────────────────────────────────────── */
.spec-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.spec-title { padding: 24px 28px; border-right: 1px solid var(--border); min-width: 280px; }
.spec-eyebrow { font-size: 10px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.spec-name {
  font-family: var(--mono);
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.spec-id { font-size: 14px; letter-spacing: .08em; color: var(--fg); margin-bottom: 8px; }
.id-slashes { color: var(--accent); }
.spec-subtitle { font-size: 10px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }

.spec-header-panels { display: grid; grid-template-columns: 1fr auto; }
.data-table { border-collapse: collapse; width: 100%; }
.data-table tr { border-bottom: 1px solid rgba(11,90,100,.16); }
.data-table tr:last-child { border-bottom: none; }
.dk { font-size: 10px; letter-spacing: .08em; color: var(--muted); padding: 5px 12px 5px 0; white-space: nowrap; text-transform: uppercase; }
.dv { font-size: 12px; color: var(--fg); padding: 5px 0; }

.phys-data { border-left: 1px solid var(--border); min-width: 160px; display: flex; flex-direction: column; }
.phys-item { padding: 16px; flex: 1; }
.phys-divider { border-top: 1px solid var(--border); }
.phys-label { font-size: 9px; letter-spacing: .15em; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.phys-val { font-size: 28px; font-weight: 700; color: var(--fg); line-height: 1; margin-bottom: 4px; }
.phys-sub { font-size: 11px; color: var(--muted); }
.phys-note { font-size: 9px; color: #566a6c; margin-top: 3px; font-style: italic; }

/* ── HERO SECTION ────────────────────────────────────────────────────── */
.spec-hero {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  border-bottom: 1px solid var(--border);
  min-height: 520px;
}

.hero-left {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.features-panel {
  border: none;
  background: var(--panel-2);
  padding: 18px 18px;
  flex: 1;
}
.feature-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(11,90,100,.14);
}
.feature-row:last-child { border-bottom: none; }
.feat-num { font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: .05em; min-width: 22px; padding-top: 1px; }
.feat-name { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--fg); margin-bottom: 3px; text-transform: uppercase; }
.feat-desc { font-size: 10px; color: var(--muted); line-height: 1.5; }

.hero-creature-wrap {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 12px;
  background: var(--panel);
  position: relative;
}
.hero-canvas { display: block; }

.measure-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: .06em;
  text-align: center;
}
.measure-h { margin-bottom: 8px; }
.measure-w { margin-top: 8px; border-top: 1px solid var(--accent-dim); padding-top: 6px; width: 100%; text-align: center; }

.hero-right {
  display: flex;
  flex-direction: column;
}
.detail-panels-v {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.detail-panel-v {
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.detail-panel-v:last-child { border-bottom: none; }
.detail-diagram {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.detail-diagram svg { width: 100%; height: 100%; }
.keyboard-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; }
.keyboard-wrap svg { width: 62%; flex-shrink: 0; }
.scale-creature { width: 34%; height: auto; }
.detail-measure { font-size: 8.5px; color: var(--accent); letter-spacing: .05em; margin-top: 5px; text-align: center; }

/* ── VIEWS ROW ───────────────────────────────────────────────────────── */
.spec-views-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}
.view-panel {
  border: none;
  border-right: 1px solid var(--border);
  background: var(--panel-2);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}
.view-panel:last-child { border-right: none; }
.view-panel .panel-label { align-self: flex-start; }

.view-canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.view-canvas-wrap canvas { display: block; }
.view-h { font-size: 9px; color: var(--accent); letter-spacing: .05em; margin-top: 4px; }

.view-placeholder {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(11,90,100,.28);
  margin: 6px 0;
  padding: 10px;
  gap: 5px;
}
.obs-text { font-size: 8px; letter-spacing: .15em; color: var(--accent); text-transform: uppercase; }
.silhouette-svg { width: 56px; height: 70px; opacity: .7; }
.view-h-label { font-size: 9px; color: var(--muted); }
.obs-note { font-size: 8px; letter-spacing: .1em; color: #566a6c; text-transform: uppercase; }
.view-measure { font-size: 9px; color: var(--accent); letter-spacing: .06em; margin-top: 6px; }

.proportions-diagram {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.proportions-diagram svg { width: 100%; height: 100%; max-height: 180px; }

/* ── ANATOMY ROW ─────────────────────────────────────────────────────── */
.spec-anatomy-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--border);
}
.anatomy-panel {
  border: none;
  border-right: 1px solid var(--border);
  background: var(--panel-2);
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.anatomy-panel:last-child { border-right: none; }
.anatomy-panel .panel-label { margin-bottom: 8px; }
.anatomy-diagram { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.anatomy-diagram svg { width: 100%; height: 100%; }

/* ── DATA ROWS ───────────────────────────────────────────────────────── */
.spec-data-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}
.data-panel-lg {
  border: none;
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 18px 20px;
}
.data-panel-lg:last-child { border-right: none; }

.dl-list { display: flex; flex-direction: column; gap: 6px; }
.dl-row { display: flex; gap: 10px; font-size: 12px; }
.dl-k { font-size: 10px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; white-space: nowrap; min-width: 110px; padding-top: 1px; }
.dl-v { color: var(--fg); }

.bullet-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.bullet-list li { font-size: 12px; color: var(--fg); padding-left: 12px; position: relative; }
.bullet-list li::before { content: '•'; color: var(--accent); position: absolute; left: 0; font-size: 10px; }

.diet-header { font-size: 12px; color: var(--fg); margin-bottom: 8px; }
.habitat-desc { font-size: 11px; color: var(--muted); font-style: italic; margin-bottom: 12px; line-height: 1.5; }
.habitat-confirmed { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.confirmed-tag { color: var(--accent); margin-right: 6px; }

/* ── HABITAT CTA ─────────────────────────────────────────────────────── */
.spec-habitat-cta {
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  padding: 40px 28px;
}
.habitat-cta-inner { max-width: 1200px; margin: 0 auto; }
.spec-habitat-cta .panel-label { font-size: 9px; letter-spacing: .18em; color: var(--accent); text-transform: uppercase; margin-bottom: 24px; display: block; }
.habitat-cta-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: start; }
.habitat-cta-title { font-family: var(--mono); font-size: clamp(18px, 3vw, 28px); font-weight: 700; letter-spacing: .04em; color: var(--fg); margin-bottom: 14px; }
.habitat-cta-body { font-family: var(--sans); font-size: 14px; color: var(--muted); line-height: 1.7; max-width: 560px; margin-bottom: 22px; }
.habitat-cta-btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: 12px 24px;
  text-decoration: none;
  border: 1px solid var(--accent);
  transition: background .2s, border-color .2s;
}
.habitat-cta-btn i { color: #dff5f7; font-style: normal; }
.habitat-cta-btn:hover { background: var(--accent-glow); }

.habitat-cta-data { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--border); background: var(--border); min-width: 280px; }
.habitat-stat { background: var(--panel); padding: 14px 16px; }
.hstat-label { font-size: 8.5px; letter-spacing: .15em; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
.hstat-val { font-size: 12px; color: var(--fg); font-weight: 700; }
.hstat-live { color: #0a7a2d; }

/* ── FOOTER ──────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.footer-div, .footer-conf, .footer-id { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.footer-div  { color: var(--fg); }
.footer-conf { color: var(--muted); }
.footer-id   { color: var(--accent); }
.footer-sep  { color: var(--accent); font-size: 10px; }
.footer-links { display: flex; align-items: center; gap: 18px; }
.footer-link { font-size: 9px; letter-spacing: .1em; color: var(--muted); text-decoration: none; transition: color .2s; }
.footer-link:hover { color: var(--fg); }

.websiites-badge {
  display: inline-block;
  font-family: 'Space Grotesk', var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  color: rgba(16,22,23,.72);
  text-decoration: none;
  transition: color .2s;
}
.websiites-badge i { color: var(--accent); font-style: normal; }
.websiites-badge:hover { color: rgba(16,22,23,.9); }

/* ── CHAT WIDGET ─────────────────────────────────────────────────────── */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 900;
  cursor: pointer;
  transition: transform .2s;
}
.chat-widget:hover {
  transform: translateY(-2px);
}
.chat-canvas { display: block; width: 84px; height: 84px; object-fit: cover; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 4px 18px rgba(10,50,55,.28); }

.chat-panel {
  position: fixed;
  bottom: 130px;
  right: 20px;
  width: 320px;
  background: #fff;
  border: 1px solid var(--border-hi);
  box-shadow: 0 10px 40px rgba(10,40,45,.18);
  z-index: 901;
  display: flex;
  flex-direction: column;
  max-height: 460px;
}
.chat-panel.hidden { display: none; }
.chat-panel-header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); flex-shrink: 0; }
.chat-mini-canvas { display: block; flex-shrink: 0; width: 44px; height: 44px; object-fit: cover; border-radius: 50%; background: #fff; border: 1px solid var(--accent); }
.chat-panel-title { flex: 1; }
.chat-name { display: block; font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--fg); }
.chat-status { display: block; font-size: 9px; color: var(--accent); letter-spacing: .08em; }
.chat-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 4px; transition: color .2s; }
.chat-close:hover { color: var(--fg); }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; scrollbar-color: var(--accent-dim) transparent; }
.chat-msg { display: flex; }
.konztruct-msg { justify-content: flex-start; }
.user-msg { justify-content: flex-end; }
.msg-bubble { display: inline-block; padding: 8px 12px; font-size: 12px; line-height: 1.5; max-width: 80%; }
.konztruct-msg .msg-bubble { background: #eef4f5; border: 1px solid rgba(11,111,123,.28); color: var(--fg); }
.user-msg .msg-bubble { background: #dcecee; border: 1px solid rgba(11,111,123,.4); color: var(--fg); }
.typing-bubble { display: inline-flex; align-items: center; gap: 4px; padding: 10px 14px; background: #eef4f5; border: 1px solid rgba(11,111,123,.22); }
.typing-dot { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; animation: typingPulse 1.2s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingPulse { 0%, 80%, 100% { opacity: .3; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }
.chat-input-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--panel-2); flex-shrink: 0; }
.chat-input { flex: 1; background: #fff; border: 1px solid var(--border); color: var(--fg); font-family: var(--mono); font-size: 12px; padding: 8px 10px; outline: none; transition: border-color .2s; }
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: #566a6c; }
.chat-send { background: var(--accent); border: none; color: #fff; font-size: 14px; width: 36px; height: 36px; cursor: pointer; transition: background .2s; display: flex; align-items: center; justify-content: center; }
.chat-send:hover { background: var(--accent-glow); }

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .spec-hero { grid-template-columns: 220px 1fr 240px; }
}
@media (max-width: 900px) {
  .spec-header { grid-template-columns: 1fr; }
  .spec-title { border-right: none; border-bottom: 1px solid var(--border); }
  .spec-header-panels { grid-template-columns: 1fr auto; }
  .spec-hero { grid-template-columns: 1fr; }
  .hero-left { border-right: none; border-bottom: 1px solid var(--border); }
  .hero-creature-wrap { border-right: none; border-bottom: 1px solid var(--border); }
  .detail-panels-v { flex-direction: row; flex-wrap: wrap; }
  .detail-panel-v { flex: 1; min-width: 140px; border-bottom: 1px solid var(--border); }
  .spec-views-row { grid-template-columns: 1fr 1fr; }
  .view-panel:nth-child(2n) { border-right: none; }
  .view-panel:nth-child(n+3) { border-top: 1px solid var(--border); }
  .spec-anatomy-row { grid-template-columns: repeat(3, 1fr); }
  .anatomy-panel:nth-child(3) { border-right: none; }
  .anatomy-panel:nth-child(n+4) { border-top: 1px solid var(--border); }
  .spec-data-row { grid-template-columns: 1fr 1fr; }
  .data-panel-lg:nth-child(2n) { border-right: none; }
  .data-panel-lg:nth-child(n+3) { border-top: 1px solid var(--border); }
  .habitat-cta-grid { grid-template-columns: 1fr; }
  .habitat-cta-data { min-width: auto; }
}
@media (max-width: 600px) {
  .nav { padding: 10px 14px; }
  .nav-class { display: none; }
  .spec-name { font-size: 44px; }
  .spec-title { padding: 18px 16px; min-width: auto; }
  .spec-header-panels { grid-template-columns: 1fr; }
  .phys-data { border-left: none; border-top: 1px solid var(--border); flex-direction: row; }
  .phys-item { flex: 1; }
  .phys-divider { display: none; }
  .spec-anatomy-row { grid-template-columns: 1fr 1fr; }
  .anatomy-panel:nth-child(2n) { border-right: none; }
  .anatomy-panel:last-child { grid-column: span 2; }
  .spec-data-row { grid-template-columns: 1fr; }
  .data-panel-lg { border-right: none; border-bottom: 1px solid var(--border); }
  .chat-panel { width: calc(100vw - 24px); right: 12px; }
  .chat-widget { bottom: 12px; right: 12px; }
  .footer { flex-direction: column; align-items: flex-start; }
  .footer-conf, .footer-sep { display: none; }
}

/* ── PHOTO LAYOUT (white theme) ─────────────────────────────────────── */
.hero-viewer { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hero-img { display: block; width: 400px; max-width: 100%; height: auto; transition: opacity .18s ease; }
.hero-img.swap { opacity: 0; }
.creature-img {
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 2%, #000 97%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 2%, #000 97%, transparent 100%);
  mask-composite: intersect;
}
.hero-tabs { display: flex; gap: 6px; margin: 0 0 6px; }
.hero-tab {
  font-family: var(--mono); font-size: 9px; letter-spacing: .16em;
  color: var(--accent); background: #fff; border: 1px solid var(--border);
  padding: 5px 9px; cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.hero-tab:hover { color: var(--accent-glow); border-color: var(--accent); }
.hero-tab.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.hero-tab:focus-visible { outline: 2px solid var(--accent-glow); outline-offset: 2px; }
.view-img { display: block; width: 100%; max-width: 210px; height: auto; margin: 8px auto 0; }
.crop { margin: 0; width: 100%; }
.crop img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; mix-blend-mode: multiply; border: 1px solid var(--border); }
.crop-wide img { aspect-ratio: 2 / 1; }
.hop { animation: kz-hop .55s ease-out; }
@keyframes kz-hop { 0%,100% { transform: translateY(0); } 35% { transform: translateY(-14px) scale(1.04); } 60% { transform: translateY(0) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .hop { animation: none; } }
::selection { background: rgba(11,111,123,.2); color: var(--fg); }
.panel-label, .measure-label, .detail-measure, .view-measure { font-weight: 700; }
.spec-habitat-cta { background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
@media (max-width: 600px) { .hero-img { width: min(100%, 340px); } .chat-canvas { width: 62px; height: 62px; } }

/* ── ACCESSIBILITY ───────────────────────────────────────────────────── */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 1000; background: #fff; color: var(--fg); border: 1px solid var(--border-hi); padding: 8px 12px; font-family: var(--mono); font-size: 11px; text-decoration: none; }
.skip-link:focus { top: 8px; }
h1, h2, h3 { font-weight: inherit; }
.panel-label, .habitat-cta-title, .feat-name { font-weight: 700; }

/* ── NAV WRAP (phones) ───────────────────────────────────────────────── */
@media (max-width: 600px) { .nav { flex-wrap: wrap; row-gap: 8px; } .nav-right { flex-wrap: wrap; gap: 10px; } }
