@import url("./tokens.css");

/* ==========================================================================
   무월 — quiet-commerce. 종이 원장의 문법.
   레이아웃 → 재질 → 모션 순서로 읽힌다.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--surface);
}
@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-family: var(--font-display);
  font-weight: 500;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
  text-wrap: balance;
}

:where(p, li, dd, dt, th, td, figcaption) {
  word-break: keep-all;
  overflow-wrap: break-word;
  line-height: 1.75;
  text-wrap: pretty;
}

h1 {
  font-size: var(--step-3);
}
h2 {
  font-size: var(--step-2);
}

.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;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.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) 88%, 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-display);
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.wordmark-han {
  color: var(--ink-muted);
  font-size: var(--step-0);
  margin-left: var(--space-1);
  font-weight: 400;
}

.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);
}

/* ── 히어로 ───────────────────────────────────────────────────────────── */

.hero {
  padding-block: var(--space-7);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-7) var(--space-6);
  align-items: start;
}

.hero-label {
  font-size: var(--step--1);
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-4);
}

.lead {
  max-width: 34em;
}

.hero-text .lead {
  margin-top: var(--space-4);
}

.hero-actions {
  margin-top: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hero-note {
  font-size: var(--step--1);
  color: var(--ink-faint);
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  transition: background var(--dur-quick) var(--ease-soft);
}
.btn:hover {
  background: var(--accent-hover);
}
.btn-inverse {
  background: var(--surface);
  color: var(--ink);
}
.btn-inverse:hover {
  background: var(--surface-bright);
}

.hero-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.hero-photo figcaption,
.recipe-photo figcaption,
.scale-plot figcaption {
  font-size: var(--step--1);
  color: var(--ink-faint);
  margin-top: var(--space-2);
}

/* 이번 주 원두 — 원장의 첫 두 줄 (카드 아님) */
.hero-beans {
  margin-top: var(--space-6);
  border-top: 1px solid var(--line);
}
.bean-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--line);
}
.bean-row dt {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-1);
}
.bean-origin {
  font-size: var(--step--1);
  color: var(--ink-muted);
  margin-top: 2px;
}
.bean-price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bean-price span {
  color: var(--ink-faint);
  margin-right: var(--space-2);
  font-size: var(--step--1);
}

/* ── 섹션 공통 ────────────────────────────────────────────────────────── */

.section {
  padding-block: var(--space-8);
}
.band {
  background: var(--surface-raised);
  border-block: 1px solid var(--line);
}

/* ── 척도(좌표 플롯) ──────────────────────────────────────────────────── */

.scale-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-6) var(--space-7);
  align-items: center;
}
.scale-text p + p {
  margin-top: var(--space-3);
}
.scale-legend {
  list-style: none;
  padding: 0;
  margin-top: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.key {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  margin-right: var(--space-1);
  vertical-align: baseline;
}
.key-b {
  background: var(--accent);
}
.key-c {
  background: var(--ink-faint);
}

.scale-plot svg {
  display: block;
  width: 100%;
  height: auto;
}
.scale-plot .grid line {
  stroke: var(--line);
  stroke-width: 1;
}
.scale-plot .grid line:first-child,
.scale-plot .grid line:nth-child(2) {
  stroke: var(--ink-faint);
  stroke-width: 1.25;
}
.axis-labels text {
  font-family: var(--font-body);
  font-size: 13px;
  fill: var(--ink-faint);
}
.points circle {
  fill: var(--ink);
}
.points .pt-b {
  fill: var(--accent);
}
.points .pt-c {
  fill: var(--ink-faint);
}
.points text {
  font-family: var(--font-body);
  font-size: 13px;
  fill: var(--ink-muted);
}

/* ── 원장(밴드) ───────────────────────────────────────────────────────── */

.ledger-head {
  max-width: 38em;
  margin-bottom: var(--space-5);
}
.ledger-head p {
  margin-top: var(--space-3);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step-0);
}
thead th {
  text-align: left;
  font-weight: 500;
  font-size: var(--step--1);
  color: var(--ink-muted);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--ink-faint);
}
tbody th {
  text-align: left;
  font-weight: 500;
}
tbody td,
tbody th {
  padding: var(--space-3);
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.ledger-note {
  margin-top: var(--space-3);
  font-size: var(--step--1);
}

/* ── 레시피 ───────────────────────────────────────────────────────────── */

.recipe-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-6) var(--space-7);
  align-items: center;
}
.recipe-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.recipe-text p + p {
  margin-top: var(--space-3);
}
.spec {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--space-3) var(--space-5);
}
.spec dt {
  font-size: var(--step--1);
  color: var(--ink-faint);
}
.spec dd {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--step-1);
  margin-top: var(--space-1);
}

/* ── 구독(반전 블록) ──────────────────────────────────────────────────── */

.plan {
  background: var(--surface-inverse);
  color: var(--ink-inverse);
}
.plan-note {
  color: var(--ink-inverse-muted);
}
.plan-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-6) var(--space-7);
  align-items: center;
}
.plan-text p {
  margin-top: var(--space-4);
  max-width: 34em;
}
.plan-list {
  margin-top: var(--space-4);
  padding: 0;
  list-style: none;
}
.plan-list li {
  padding-left: 1.25em;
  position: relative;
  color: var(--ink-inverse-muted);
}
.plan-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 1.5px;
  background: var(--ink-inverse-muted);
}
.plan-list li + li {
  margin-top: var(--space-2);
}
.plan-box {
  border: 1px solid var(--line-inverse);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: grid;
  gap: var(--space-4);
  justify-items: start;
}
.plan-price span:first-child {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
}
.plan-unit {
  display: block;
  font-size: var(--step--1);
  margin-top: var(--space-1);
  color: var(--ink-inverse-muted);
}
.plan-note {
  font-size: var(--step--1);
}

/* ── 푸터 ─────────────────────────────────────────────────────────────── */

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: var(--space-6);
  font-size: var(--step--1);
}
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  justify-content: space-between;
}

/* ── 등장 모션 — IO 1회, 유지 ─────────────────────────────────────────── */

.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-grid,
  .scale-grid,
  .recipe-grid,
  .plan-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
  .hero-photo,
  .recipe-photo {
    max-width: 26rem;
  }
  .hero {
    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;
  }
  .bean-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
  .plan-box {
    padding: var(--space-4);
  }
}
