/* Hallmark · macrostructure: Split Studio · tone: 90s PC game magazine · anchor hue: riso orange
 * theme: Riso · genre: editorial · nav: N6 newspaper masthead · footer: Ft4 dense colophon
 * audience: 일본어판 DK4 를 가진 한국 이용자 · use: 패치 받기 + 설치법 확인
 * pre-emit critique: P5 H5 E4 S5 R4 V4
 */

/* ── tokens ─────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* paper — 갱지. 순백 금지(gate 7), 따뜻한 쪽으로 틴트 */
  --paper:        oklch(94.5% 0.014 85);
  --paper-2:      oklch(91%   0.018 82);
  --paper-3:      oklch(87%   0.022 80);

  /* ink — 순흑 금지. 잉크가 종이에 먹은 색 */
  --ink:          oklch(24%   0.016 62);
  --ink-2:        oklch(42%   0.014 65);
  --ink-3:        oklch(58%   0.012 68);

  /* accent — 리소 형광 주황. 화면의 5% 미만으로만 */
  --accent:       oklch(64%   0.202 44);
  --accent-deep:  oklch(48%   0.158 40);
  --accent-wash:  oklch(64%   0.202 44 / 0.13);

  --rule:         oklch(24% 0.016 62 / 0.22);
  --rule-hard:    oklch(24% 0.016 62 / 0.62);

  --font-display: "Pretendard Variable", Pretendard, "Noto Sans KR",
                  "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --font-body:    var(--font-display);
  --font-serif:   Georgia, "Noto Serif KR", "Apple SD Gothic Neo", serif;
  --font-mono:    "Cascadia Mono", Consolas, "D2Coding", ui-monospace, monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;
  --text-3xl:  2.25rem;
  --text-4xl:  3rem;
  --text-display-s: clamp(2.5rem, 7vw, 4.25rem);
  --text-display:   clamp(3rem, 11vw, 7rem);

  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-sm:  0.75rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:     cubic-bezier(0.7, 0, 0.84, 0);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 140ms;
  --dur-mid:  320ms;
  --dur-slow: 620ms;

  --radius-none: 0;
  --radius-sm:   2px;

  --shell: min(1080px, calc(100vw - 40px));
}

/* ── base ───────────────────────────────────────────────────────────── */
html, body { overflow-x: clip; }           /* gate 34 — hidden 은 금지 */
* { box-sizing: border-box; }

body.dk4-page {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* 갱지 결 — 가짜 텍스처 이미지 대신 순수 CSS */
  background-image:
    repeating-linear-gradient(0deg,
      oklch(24% 0.016 62 / 0.016) 0 1px, transparent 1px 3px);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.06;
  font-style: normal;                       /* 이탤릭 제목 금지 */
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
}
p { margin: 0; }
a { color: inherit; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: var(--space-sm) var(--space-md);
  font-weight: 700; z-index: 50;
}
.skip-link:focus-visible { left: var(--space-md); top: var(--space-md); }

:where(a, button, summary, input):focus-visible {
  outline: 3px solid var(--accent-deep);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
  /* 포커스 링은 절대 애니메이트하지 않는다 */
}

.shell { width: var(--shell); margin-inline: auto; }

/* ── N6 · 신문 머리글 ───────────────────────────────────────────────── */
.mast { border-bottom: 3px double var(--rule-hard); }

.mast-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  flex-wrap: wrap;
}
.mast-top a { text-decoration: none; font-weight: 700; white-space: nowrap; }
.mast-top a:hover { color: var(--accent-deep); }

.mast-body { padding: var(--space-xl) 0 var(--space-lg); }

.mast-kicker {
  display: inline-block;
  background: var(--accent);
  color: oklch(98% 0.01 85);
  font-weight: 800;
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  padding: 3px var(--space-sm);
  margin-bottom: var(--space-md);
}
.mast-title {
  font-size: var(--text-display);
  text-transform: none;
}
.mast-title .jp {
  display: block;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(0.95rem, 2.6vw, 1.35rem);
  letter-spacing: 0.02em;
  color: var(--ink-3);
  margin-top: var(--space-sm);
}
.mast-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.mast-meta span { white-space: nowrap; }

.status {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  font-family: var(--font-display);
  font-weight: 800; font-size: var(--text-sm);
  letter-spacing: 0;
  color: var(--accent-deep);
  background: var(--accent-wash);
  border: 1.5px solid var(--accent);
  padding: 2px var(--space-sm);
  white-space: nowrap;
}
.status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex: none;
}

/* ── 프로젝트 이동 ──────────────────────────────────────────────────── */
.switcher {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: var(--space-xs) var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--text-sm);
}
.switcher > span {
  font-family: var(--font-mono); color: var(--ink-3);
  font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase;
}
.switcher a {
  text-decoration: none; font-weight: 700; white-space: nowrap;
  padding-bottom: 1px;
  border-bottom: 2px solid transparent;
  transition: border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.switcher a:hover { border-bottom-color: var(--accent); }
.switcher a[aria-current="page"] { color: var(--accent-deep); border-bottom-color: var(--accent); }

/* ── 리드 ───────────────────────────────────────────────────────────── */
/* 표제 한 줄만 두면 오른쪽이 통째로 빈다.  잡지 오프닝처럼 왼쪽에 큰 표제,
   오른쪽에 본문을 놓아 폭을 다 쓴다. */
.lede {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--space-2xl);
  align-items: start;
  padding: var(--space-2xl) 0;
  border-bottom: 1px solid var(--rule);
}
/* 드롭캡은 쓰지 않는다 — 한글은 첫 글자 하나가 떨어져 나가면 단어가 깨진다
   ("2007년" -> "2 007년", "대사만" -> "대 사만"). */
.lede .standfirst {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 3vw, 2rem);
  line-height: 1.4;
}
.lede-body p { color: var(--ink-2); max-width: 46ch; }
.lede-body p + p { margin-top: var(--space-md); }
.lede-body strong { color: var(--ink); }

/* ── Split Studio · 교대 다이프틱 ───────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);   /* gate 50 */
  gap: var(--space-2xl);
  align-items: start;
  padding: var(--space-2xl) 0;
  border-bottom: 1px solid var(--rule);
}
/* 증거 그림이 없는 구역은 한 단으로 */
.split.solo { grid-template-columns: minmax(0, 1fr); }
.split.solo .split-text > p,
.split.solo .notes { max-width: 62ch; }

.split.flip > .split-text { order: 2; }
.split.flip > .split-proof { order: 1; }

.split h2 {
  font-size: clamp(1.75rem, 4.2vw, var(--text-3xl));
  margin-bottom: var(--space-md);
}
.split h2 mark {
  background: linear-gradient(transparent 62%, var(--accent-wash) 62%);
  color: inherit;
  padding: 0 2px;
}
.split-text > p { color: var(--ink-2); max-width: 46ch; }
.split-text > p + p { margin-top: var(--space-md); }

figure { margin: 0; }
figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--rule-hard);
  background: var(--paper-3);
}
figcaption {
  margin-top: var(--space-sm);
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  color: var(--ink-2);
  line-height: 1.5;
  border-left: 3px solid var(--accent);
  padding-left: var(--space-sm);
}

/* 자리 표시 — 아직 못 찍은 화면. 있는 척하지 않는다 */
.shot-todo {
  aspect-ratio: 4 / 3;
  display: grid; place-content: center; gap: var(--space-xs);
  text-align: center;
  border: 1.5px dashed var(--rule-hard);
  background: var(--paper-2);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-md);
}
.shot-todo strong { font-family: var(--font-display); font-size: var(--text-lg); color: var(--ink-2); }

/* ── 게임 화면 갤러리 ───────────────────────────────────────────────── */
/* 좌우로 자유롭게 미는 레일.  스냅은 쓰지 않는다 — 끈 만큼 그 자리에 선다.
   라디오 탭 방식은 초점이 옮겨갈 때 페이지가 튀어서(gate 53) 쓰지 않는다. */
.gallery {
  padding: var(--space-2xl) 0;
  border-bottom: 1px solid var(--rule);
}
.gallery h2 {
  font-size: clamp(1.75rem, 4.2vw, var(--text-3xl));
  margin-bottom: var(--space-2xs);
}
.gallery-hint {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: var(--space-lg);
}
.rail {
  display: flex;
  gap: var(--space-lg);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: var(--space-sm);
  /* 화면 끝까지 흘려보내되 본문 폭은 유지 */
  margin-inline: calc(var(--space-md) * -1);
  padding-inline: var(--space-md);
}
.rail:focus-visible { outline: 3px solid var(--accent-deep); outline-offset: 4px; }
/* 끌 수 있다는 표시. 스크립트가 없으면 손 모양도 안 나온다 (거짓말하지 않게) */
.rail.is-draggable { cursor: grab; }
.rail.is-dragging { cursor: grabbing; user-select: none; scroll-behavior: auto; }
.rail.is-dragging img { pointer-events: none; }
.rail > figure {
  flex: 0 0 min(560px, 84%);
  min-width: 0;
}
.rail > figure img { aspect-ratio: 4 / 3; object-fit: cover; }
.rail::-webkit-scrollbar { height: 8px; }
.rail::-webkit-scrollbar-track { background: var(--paper-2); }
.rail::-webkit-scrollbar-thumb { background: var(--rule-hard); }

/* ── 수치 ───────────────────────────────────────────────────────────── */
.counts {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0;
  border-top: 1px solid var(--rule);
}
.counts li {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--rule);
}
.counts dfn { font-style: normal; font-weight: 700; }
.counts b {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--accent-deep);
  white-space: nowrap;
}
.counts small { display: block; color: var(--ink-3); font-size: var(--text-xs); font-weight: 400; }

/* 엔진 손질 목록 — 수치가 아니라 문장이므로 counts 와 다른 리듬 */
.notes {
  list-style: none; margin: 0; padding: 0;
  border-top: 1px solid var(--rule);
}
.notes li {
  padding: var(--space-sm) 0 var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: var(--text-sm);
  position: relative;
}
.notes li::before {
  content: "";
  position: absolute; left: 0; top: 1.05em;
  width: var(--space-md); height: 2px;
  background: var(--accent);
}
.notes strong { color: var(--ink); }

/* ── 설치 단계 ──────────────────────────────────────────────────────── */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li {
  counter-increment: s;
  position: relative;
  padding: var(--space-md) 0 var(--space-md) 3.25rem;
  border-bottom: 1px solid var(--rule);
}
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: var(--space-md);
  font-family: var(--font-display);
  font-weight: 800; font-size: var(--text-2xl);
  line-height: 1;
  color: var(--accent);
  width: 2.25rem;
}
.steps strong { display: block; font-size: var(--text-lg); }
.steps p { color: var(--ink-2); font-size: var(--text-sm); margin-top: var(--space-2xs); }
code, kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--paper-3);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

/* ── 경고 ───────────────────────────────────────────────────────────── */
.warn {
  margin: var(--space-2xl) 0;
  padding: var(--space-lg);
  border: 2px solid var(--accent);
  background: var(--accent-wash);
}
.warn h2 { font-size: var(--text-xl); margin-bottom: var(--space-xs); }
.warn p { color: var(--ink-2); max-width: 62ch; }
.warn p + p { margin-top: var(--space-sm); }

/* ── 받기 ───────────────────────────────────────────────────────────── */
.get { padding: var(--space-2xl) 0; border-bottom: 1px solid var(--rule); }
.get h2 { font-size: var(--text-3xl); margin-bottom: var(--space-md); }

.dl {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}
.btn {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  font-family: var(--font-display);
  font-weight: 800; font-size: var(--text-lg);
  letter-spacing: -0.02em;
  padding: var(--space-sm) var(--space-lg);
  border: 2px solid var(--ink);
  background: var(--ink); color: var(--paper);
  text-decoration: none;
  white-space: nowrap;                                  /* gate 49 */
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
.btn:hover, .btn.is-hover { box-shadow: 5px 5px 0 var(--accent); transform: translate(-1px, -1px); }
.btn:active, .btn.is-active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--accent-deep); }
.btn[aria-disabled="true"],
.btn:disabled {
  background: transparent;
  color: var(--ink-3);
  border-color: var(--rule-hard);
  border-style: dashed;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn-note { font-size: var(--text-sm); color: var(--ink-2); max-width: 40ch; }

/* 받는 파일 정보 — 크기와 해시를 숨기지 않는다 */
.fileinfo {
  margin: var(--space-lg) 0 0;
  display: grid; gap: var(--space-2xs);
  font-size: var(--text-sm);
}
.fileinfo div { display: flex; gap: var(--space-sm); align-items: baseline; }
.fileinfo dt {
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
  flex: none; width: 5.5rem;
}
.fileinfo dd { margin: 0; color: var(--ink-2); min-width: 0; }
.fileinfo .hash {
  font-size: var(--text-xs);
  word-break: break-all;
  background: transparent; padding: 0; color: var(--ink-3);
}

.requires {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--rule);
  display: grid; gap: var(--space-sm);
}
.requires div { display: flex; gap: var(--space-sm); align-items: baseline; }
.requires dt {
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
  flex: none; width: 5.5rem;
}
.requires dd { margin: 0; color: var(--ink-2); font-size: var(--text-sm); }

/* 선택 항목 — 본 다운로드보다 한 단계 조용하게 */
.get.extra { border-bottom: none; padding-top: var(--space-xl); }
.get.extra h2 { font-size: var(--text-2xl); }
.opt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  border: 1px solid var(--rule-hard);
  padding: 1px 6px;
  margin-left: var(--space-xs);
  vertical-align: middle;
  white-space: nowrap;
}
.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-hard);
  font-size: var(--text-base);
}
.btn-quiet:hover, .btn-quiet.is-hover { background: var(--paper-2); box-shadow: 4px 4px 0 var(--rule-hard); }

/* ── Ft4 · 조판 콜로폰 ──────────────────────────────────────────────── */
.colophon {
  border-top: 3px double var(--rule-hard);
  margin-top: var(--space-lg);
  padding: var(--space-xl) 0 var(--space-2xl);
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.colophon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: var(--space-lg);
}
.colophon h3 {
  font-size: var(--text-xs); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: var(--space-xs);
}
.colophon ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2xs); }
.colophon a { text-decoration: none; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.colophon a:hover { border-bottom-color: var(--accent); color: var(--accent-deep); }
/* 잔글씨를 한 단으로 두면 오른쪽이 남는다.  조판 콜로폰답게 두 단으로 흘린다. */
.colophon-legal {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: var(--text-xs);
  line-height: 1.7;
  columns: 2;
  column-gap: var(--space-2xl);
  column-rule: 1px solid var(--rule);
}
@media (max-width: 760px) { .colophon-legal { columns: 1; column-rule: none; } }

/* ── 등장 ───────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .split-text, .split-proof {
    animation: rise var(--dur-slow) var(--ease-out) both;
    animation-timeline: view();
    animation-range: entry 0% entry 46%;
  }
  .split-proof { animation-delay: 90ms; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 140ms !important;
  }
  .split-text, .split-proof { animation: none; opacity: 1; transform: none; }
}

/* ── 반응형 · 320 / 375 / 414 / 768 검증 ────────────────────────────── */
@media (max-width: 860px) {
  .lede { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); padding: var(--space-xl) 0; }
  .split { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); padding: var(--space-xl) 0; }
  .split.flip > .split-text,
  .split.flip > .split-proof { order: 0; }
  .lede { padding: var(--space-xl) 0 var(--space-lg); }
}
@media (max-width: 560px) {
  :root { --shell: calc(100vw - 28px); }
  .mast-body { padding: var(--space-lg) 0 var(--space-md); }
  .mast-meta { font-size: var(--text-xs); gap: var(--space-2xs) var(--space-sm); }
  .counts li { flex-direction: column; align-items: flex-start; gap: var(--space-2xs); }
  .steps li { padding-left: 2.5rem; }
  .steps li::before { font-size: var(--text-xl); width: 1.75rem; }
  .requires div { flex-direction: column; gap: var(--space-2xs); }
  .requires dt { width: auto; }
  .btn { width: 100%; justify-content: center; }
  .lede .drop::first-letter { font-size: 2.8em; }
}
