/* ==========================================================================
   unrhy.cc — The Experimental Side of UNRHY
   Engineering Workbench · Zero-Dependency Browser Utilities · Creative Coding
   ========================================================================== */

:root {
  --carbon: #141414;
  --carbon-2: #1A1A19;
  --carbon-3: #222220;
  --ivory: #F2F0EB;
  --alloy: #A6A6A0;
  --faint: #6E6E68;
  --stone: #D7D2C9;
  --lime: #D5FA38;
  --line: rgba(242, 240, 235, 0.12);
  --line-strong: rgba(242, 240, 235, 0.24);
  --line-light: rgba(20, 20, 20, 0.14);

  --sans: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --max: 1320px;
  --pad: clamp(18px, 4vw, 60px);
  --nav-h: 68px;
  --radius: 2px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--carbon); scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  background: var(--carbon);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.65;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
::selection { background: var(--lime); color: var(--carbon); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.wrap { width: min(var(--max), calc(100% - var(--pad) * 2)); margin-inline: auto; }
.mono { font-family: var(--mono); font-size: 11px; line-height: 1.4; letter-spacing: 0.13em; text-transform: uppercase; }

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 60;
  display: flex;
  align-items: center;
  background: rgba(20, 20, 20, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  width: min(var(--max), calc(100% - var(--pad) * 2));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-cc {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.brand-cc .ext { color: var(--lime); }
.brand-cc .tag {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--faint);
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.5vw, 32px);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--alloy);
}
.nav-links a:hover { color: var(--lime); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
}
.lang-toggle button { padding: 5px 8px; color: var(--alloy); border-radius: 1px; }
.lang-toggle button.is-active { background: var(--ivory); color: var(--carbon); font-weight: 500; }

.pill-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ivory);
  transition: border-color 0.2s, color 0.2s;
}
.pill-link:hover { border-color: var(--lime); color: var(--lime); }

.menu-btn {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  align-items: center; justify-content: center;
}
.menu-btn span { display: block; width: 15px; height: 1.5px; background: var(--ivory); position: relative; }
.menu-btn span::before, .menu-btn span::after { content: ''; position: absolute; left: 0; width: 15px; height: 1.5px; background: var(--ivory); }
.menu-btn span::before { top: -5px; }
.menu-btn span::after { top: 5px; }

.mobile-drawer {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: rgba(20, 20, 20, 0.98);
  border-bottom: 1px solid var(--line-strong);
  padding: 16px var(--pad) 24px;
  z-index: 55;
  flex-direction: column;
}
.mobile-drawer.open { display: flex; }
.mobile-drawer a { padding: 13px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 13px; }
.mobile-drawer-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; }

/* ==========================================================================
   HERO · ENGINEERING LAB
   ========================================================================== */
.hero {
  padding-top: var(--nav-h);
  border-bottom: 1px solid var(--line);
  background-image:
    linear-gradient(rgba(242, 240, 235, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 240, 235, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  padding: clamp(56px, 8vh, 96px) 0 clamp(48px, 6vh, 72px);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  background: var(--carbon-2);
  border-radius: var(--radius);
  color: var(--lime);
  margin-bottom: 24px;
}

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); display: inline-block; }

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero-desc {
  margin: 0 0 28px;
  font-size: 16px;
  line-height: 1.75;
  color: var(--alloy);
  max-width: 520px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-lime { background: var(--lime); color: var(--carbon); border: 1px solid var(--lime); }
.btn-lime:hover { background: #E2FF63; transform: translateY(-2px); }

.btn-ghost { border: 1px solid var(--line-strong); color: var(--ivory); }
.btn-ghost:hover { border-color: var(--ivory); background: rgba(242, 240, 235, 0.05); }

.btn-sm { min-height: 34px; padding: 0 12px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; }

.hero-canvas-card {
  border: 1px solid var(--line-strong);
  background: var(--carbon-2);
  border-radius: var(--radius);
  overflow: hidden;
}

.hero-canvas-bar {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--alloy);
}

#cc-hero-canvas {
  width: 100%;
  height: 300px;
  display: block;
}

.telemetry-strip {
  border-top: 1px solid var(--line);
  background: var(--carbon-2);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.telemetry-cell {
  padding: 14px 16px 14px 0;
  border-right: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  color: var(--alloy);
}
.telemetry-cell:not(:first-child) { padding-left: 16px; }
.telemetry-cell:last-child { border-right: 0; padding-right: 0; }
.telemetry-cell strong { color: var(--ivory); font-weight: 500; }

/* ==========================================================================
   SECTION 01 · LIVE INTERACTIVE WORKBENCH (4 REAL UTILITIES)
   ========================================================================== */
.section { padding: clamp(68px, 8.5vw, 118px) 0; }
.section-alt { background: var(--carbon-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  margin-bottom: 36px;
}

.section-h2 {
  margin: 10px 0 0;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.section-note { max-width: 400px; margin: 0; font-size: 14px; color: var(--alloy); }

.bench-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: var(--carbon-2);
}

.bench-tab {
  padding: 16px 18px;
  text-align: left;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  transition: background 0.2s, color 0.2s;
}
.bench-tab:last-child { border-right: 0; }
.bench-tab:hover { background: rgba(242, 240, 235, 0.04); }
.bench-tab.is-active {
  background: var(--carbon);
  border-bottom-color: var(--carbon);
  box-shadow: inset 0 2px 0 var(--lime);
}
.bench-tab .mono { color: var(--faint); display: block; margin-bottom: 5px; }
.bench-tab.is-active .mono { color: var(--lime); }
.bench-tab strong { font-size: 14px; font-weight: 500; color: var(--ivory); display: block; }

.bench-body {
  border: 1px solid var(--line-strong);
  border-top: 0;
  background: var(--carbon);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: clamp(20px, 3vw, 32px);
}

.tool-pane { display: none; }
.tool-pane.is-active { display: block; }

.tool-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: start;
}

.preview-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101010;
  overflow: hidden;
}

.preview-box svg,
.preview-box canvas { width: 100%; display: block; }

.code-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--carbon-2);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--alloy);
}

.code-box pre {
  margin: 0;
  padding: 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ivory);
  overflow-x: auto;
  max-height: 190px;
}

.ctrl-panel {
  border: 1px solid var(--line);
  background: var(--carbon-2);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 18px;
}

.ctrl-field { display: grid; gap: 8px; }
.ctrl-row { display: flex; justify-content: space-between; align-items: center; color: var(--alloy); }
.ctrl-row strong { color: var(--lime); font-family: var(--mono); font-size: 12px; font-weight: 500; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--line-strong);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--lime); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--lime); border: 0; cursor: pointer;
}

.seg-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-btn {
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--alloy);
}
.seg-btn.is-active { border-color: var(--lime); color: var(--lime); background: rgba(213, 250, 56, 0.08); }

/* Tool 02: WCAG Contrast Auditor */
.contrast-stage {
  padding: 36px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.contrast-ratio-big {
  font-family: var(--mono);
  font-size: clamp(42px, 5vw, 62px);
  font-weight: 500;
  line-height: 1;
}

.wcag-badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.wcag-badge {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--carbon-2);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
}

.wcag-badge .pass { color: var(--lime); }
.wcag-badge .fail { color: #FC4D26; }

.color-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-input-row input[type="color"] {
  width: 40px; height: 36px;
  border: 1px solid var(--line-strong);
  background: none;
  padding: 2px;
  cursor: pointer;
}

.color-input-row input[type="text"],
.ctrl-select {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  background: var(--carbon);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ivory);
}

.swatch-row { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 28px; height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  cursor: pointer;
}

/* Tool 03: Typographic Scale */
.scale-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--carbon-2);
  overflow: hidden;
}

.scale-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: baseline;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.scale-item:last-child { border-bottom: 0; }
.scale-item .mono { color: var(--alloy); }
.scale-sample {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

/* Tool 04: Vector Field */
#field-canvas {
  width: 100%;
  height: 360px;
  cursor: crosshair;
  display: block;
}

/* ==========================================================================
   SECTION 02 · EXPERIMENT LOG LEDGER
   ========================================================================== */
.log-table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--line-strong);
}

.log-table th, .log-table td {
  text-align: left;
  padding: 16px 14px 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.log-table th {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--faint);
  font-weight: 400;
}

.log-table td.col-id { font-family: var(--mono); font-size: 12px; color: var(--lime); }
.log-table td.col-muted { color: var(--alloy); }

.badge-live {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--lime);
  color: var(--lime);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  border-radius: var(--radius);
}

.badge-plan {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  color: var(--alloy);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  border-radius: var(--radius);
}

/* ==========================================================================
   SECTION 03 · LAB NOTES
   ========================================================================== */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.note-card {
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--carbon-2);
  border-radius: var(--radius);
}
.note-card .mono { color: var(--lime); display: block; margin-bottom: 12px; }
.note-card h3 { margin: 0 0 10px; font-size: 18px; font-weight: 500; }
.note-card p { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--alloy); }

/* ==========================================================================
   TRINITY BAND & FOOTER
   ========================================================================== */
.trinity-band {
  border-top: 1px solid var(--line);
  background: var(--carbon-2);
  padding: 44px 0;
}

.trinity-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.trinity-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
  border: 1px solid var(--line);
  background: var(--carbon);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.trinity-card:hover { border-color: var(--ivory); transform: translateY(-2px); }
.trinity-card.is-current { border-color: var(--lime); }
.trinity-card strong { font-family: var(--mono); font-size: 16px; display: block; margin-bottom: 4px; }
.trinity-card span { font-size: 13px; color: var(--alloy); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 34px;
  color: var(--faint);
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.footer-links { display: flex; gap: 20px; font-size: 13px; color: var(--alloy); }
.footer-links a:hover { color: var(--lime); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 980px) {
  .hero-grid, .tool-split, .notes-grid, .trinity-grid { grid-template-columns: 1fr; }
  .bench-tabs, .telemetry-grid { grid-template-columns: repeat(2, 1fr); }
  .wcag-badges { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-links, .nav-actions .pill-link, .brand-cc .tag { display: none; }
  .menu-btn { display: inline-flex; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .bench-tabs, .telemetry-grid { grid-template-columns: 1fr; }
  .telemetry-cell { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 0 !important; }
  .telemetry-cell:last-child { border-bottom: 0; }
}
