@import url("./tokens.css");

/* ==========================================================================
   Lumina Optics — 광학 시험대. 색은 캔버스 안에서만.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--surface);
  color-scheme: dark;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

:where(h1, h2) {
  font-weight: 500;
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  overflow-wrap: break-word;
  text-wrap: balance;
}
h1 {
  font-size: var(--step-3);
}
h2 {
  font-size: var(--step-2);
}
:where(p, th, td, figcaption, li) {
  overflow-wrap: break-word;
  line-height: var(--leading-normal);
  text-wrap: pretty;
}

.lead {
  color: var(--ink-muted);
  max-width: 36em;
}
.muted {
  color: var(--ink-muted);
}
a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--surface);
  padding: var(--space-3) var(--space-4);
  z-index: 100;
}
.skip:focus {
  left: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.wrap {
  width: min(100% - 2 * var(--pad-inline), var(--container));
  margin-inline: auto;
}

/* ── 헤더 ─────────────────────────────────────────────────────────────── */

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.head-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
}
.wordmark {
  font-family: var(--font-mono);
  font-size: var(--step-1);
  font-weight: 500;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.wordmark-dot {
  color: var(--accent-stroke);
}
.nav {
  display: flex;
  gap: clamp(var(--space-3), 2vw, var(--space-5));
  font-size: var(--step--1);
}
.nav a {
  text-decoration: none;
  color: var(--ink-muted);
  padding-block: 2px;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-quick) var(--ease-soft),
    border-color var(--dur-quick) var(--ease-soft);
}
.nav a:hover {
  color: var(--ink);
  border-color: var(--accent-stroke);
}

/* ── 시험대(히어로) — 캔버스와 본문은 세로로 완전히 분리.
   R2 원칙(design.md): 3D 위에 본문을 얹지 않는다. ─────────────────────── */

.hero {
  border-bottom: 1px solid var(--line);
}
.bench-stage {
  position: relative;
  height: clamp(320px, 56vh, 560px);
  background:
    radial-gradient(80% 90% at 50% 30%, rgba(127, 185, 196, 0.05), transparent 60%),
    var(--surface);
  border-bottom: 1px solid var(--line);
}
#gl,
.bench-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#gl {
  cursor: grab;
}
#gl:active {
  cursor: grabbing;
}
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-5) var(--space-7);
  align-items: start;
  padding-block: var(--space-6);
}
.hero-kicker {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent-stroke);
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}
.hero .lead {
  margin-top: var(--space-3);
}
.hud {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: grid;
  gap: var(--space-3);
}
.hud-row label {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.hud-row output {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent-stroke);
}
.hud-note {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

/* ── 섹션 공통 ────────────────────────────────────────────────────────── */

.section {
  padding-block: var(--space-8);
}
.band {
  background: var(--surface-raised);
  border-block: 1px solid var(--line);
}

/* ── 단면 2단 ─────────────────────────────────────────────────────────── */

.two {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--space-6) var(--space-7);
  align-items: center;
}
.two-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.two-photo figcaption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  margin-top: var(--space-2);
}
.two-text p + p {
  margin-top: var(--space-4);
}

/* ── MTF ──────────────────────────────────────────────────────────────── */

.mtf-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-5) var(--space-7);
  align-items: center;
}
.mtf-text p {
  margin-top: var(--space-3);
  color: var(--ink-muted);
  max-width: 30em;
}
.mtf-legend {
  list-style: none;
  padding: 0;
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-4);
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.key {
  display: inline-block;
  width: 16px;
  height: 0;
  border-top: 2px solid var(--accent-stroke);
  margin-right: var(--space-2);
  vertical-align: middle;
}
.key-solid {
  border-top: 2.5px solid var(--accent-stroke);
}
.key-solid-m {
  border-top: 2.5px solid var(--ink-faint);
}
.key-dash {
  border-top: 2px dashed var(--accent-stroke);
}
.key-dash-m {
  border-top: 2px dashed var(--ink-faint);
}
.mtf-plot svg {
  display: block;
  width: 100%;
  height: auto;
}
.chart-grid line {
  stroke: var(--line);
  stroke-width: 1;
}
.chart-grid line:first-child,
.chart-grid line:nth-child(2) {
  stroke: var(--line-strong);
}
.axis-labels text {
  font-size: 12px;
  fill: var(--ink-faint);
}
.mtf {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.mtf-10s {
  stroke: var(--accent-stroke);
}
.mtf-10m {
  stroke: var(--ink-faint);
}
.mtf-30s {
  stroke: var(--accent-stroke);
  stroke-dasharray: 6 5;
}
.mtf-30m {
  stroke: var(--ink-faint);
  stroke-dasharray: 6 5;
}
.mtf-plot figcaption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  margin-top: var(--space-2);
}

/* ── 사양 표 ──────────────────────────────────────────────────────────── */

.table-wrap {
  margin-top: var(--space-4);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  text-align: left;
  font-weight: 500;
  font-size: var(--step--1);
  color: var(--ink-faint);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line-strong);
}
tbody th {
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
tbody td,
tbody th {
  padding: var(--space-3);
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}
tbody td:not(.num) {
  color: var(--ink-muted);
  font-size: var(--step--1);
}
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* ── 연락 ─────────────────────────────────────────────────────────────── */

.contact-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-4) var(--space-7);
  align-items: center;
}
.contact-grid p {
  color: var(--ink-muted);
  max-width: 34em;
}
.btn {
  display: inline-block;
  border: 1px solid var(--accent-stroke);
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  transition: background var(--dur-quick) var(--ease-soft),
    color var(--dur-quick) var(--ease-soft);
}
.btn:hover {
  background: var(--accent-stroke);
  color: var(--surface);
}

/* ── 푸터 ─────────────────────────────────────────────────────────────── */

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: var(--space-4);
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.foot-inner {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  flex-wrap: wrap;
}
.foot-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
}

/* ── 등장 모션 ────────────────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  translate: 0 12px;
  transition: opacity var(--dur-normal) var(--ease-soft),
    translate var(--dur-normal) var(--ease-soft);
  transition-delay: var(--delay, 0ms);
}
.reveal.is-in {
  opacity: 1;
  translate: 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    translate: 0 0;
    transition: none;
  }
}

/* ── 반응형 ───────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero-inner {
    position: static;
    grid-template-columns: 1fr;
    padding-block: var(--space-5);
  }
  .bench-stage {
    height: clamp(300px, 48vh, 460px);
  }
  .two,
  .mtf-grid,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
  .section {
    padding-block: var(--space-6);
  }
}
@media (max-width: 560px) {
  .head-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
  .nav {
    width: 100%;
    justify-content: space-between;
  }
}
