@font-face {
  font-family: "Archive Batang";
  src: url("media/fonts/gyeonggi-batang-bold.otf") format("opentype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #182233;
  --muted: #555b62;
  --night: #102038;
  --deep: #0b172a;
  --navy: #203956;
  --paper: #f5f0e5;
  --card: #fffaf0;
  --white: #fff8eb;
  --brass: #d6b371;
  --gold: #80571e;
  --rule: #d8cbb1;
  --display: "Archive Batang", "Noto Serif KR", "Batang", serif;
  --body: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --wrap: min(1280px, calc(100% - 88px));
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.68 var(--body); word-break: keep-all; }
a { color: inherit; text-underline-offset: .25em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.2; }
h1, h2 { font-family: var(--display); font-weight: 700; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #b37333; outline-offset: 4px; }
.wrap { width: var(--wrap); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 20; left: 12px; top: 12px; padding: .75rem 1rem; transform: translateY(-150%); background: var(--card); }
.skip-link:focus { transform: none; }

.site-header { background: var(--deep); color: var(--white); border-bottom: 1px solid #e2bd7136; position: sticky; top: 0; z-index: 15; }
.nav-shell { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 25px; }
.wordmark { display: inline-flex; flex-shrink: 0; align-items: center; gap: .85rem; text-decoration: none; font: 700 1.15rem/1 var(--display); }
.brand-glyph { display: grid; place-items: center; width: 37px; height: 37px; color: var(--brass); border: 1px solid #d6b3718a; transform: rotate(45deg) scale(.78); box-shadow: inset 0 0 0 3px var(--deep), inset 0 0 0 4px #d6b37165; }
.brand-glyph span { transform: rotate(-45deg); font: 1.25rem Georgia, serif; }
.primary-nav { display: flex; align-items: center; gap: clamp(.65rem, 2.4vw, 2.3rem); }
.primary-nav a { display: flex; min-height: 46px; align-items: center; color: #d8deeb; border-block: 2px solid transparent; text-decoration: none; font-size: .9rem; white-space: nowrap; }
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: var(--brass); border-bottom-color: var(--brass); }
.nav-toggle { display: none; background: transparent; color: var(--white); border: 1px solid #d6b37165; border-radius: 2px; padding: .48rem .75rem; }
.return-game { padding: .5rem .8rem; text-decoration: none; color: var(--brass); border: 1px solid #d6b37165; font-size: .85rem; white-space: nowrap; }
.return-game:hover { background: #d6b37116; }
.site-footer { color: #cbcbd0; background: var(--deep); padding: 37px 0 32px; margin-top: 72px; }
.footer-shell { display: grid; grid-template-columns: 1fr auto; gap: 18px 32px; align-items: start; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.3rem; font-size: .875rem; }
.footer-credit { grid-column: 1 / -1; border-top: 1px solid #d6b37135; padding-top: 12px; font-size: .82rem; }
.footer-credit a { color: #eee1c4; }

.button { display: inline-flex; width: fit-content; min-height: 46px; align-items: center; justify-content: center; padding: .58rem 1.1rem; border: 1px solid var(--navy); color: var(--white); background: var(--navy); text-decoration: none; border-radius: 2px; font-size: .875rem; font-weight: 700; }
.button:hover { background: #2d4e73; }
.button--secondary { background: transparent; color: var(--navy); }
.button--secondary:hover { background: #e8dfcd; }
.button--brass { background: #e4c587; color: #172337; border-color: #e4c587; }
.button--brass:hover { background: #f2d8a6; }
.button--on-dark { background: transparent; color: var(--white); border-color: #baa478a2; }
.button--on-dark:hover { background: #fff3d61c; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow { color: var(--gold); font-size: .83rem; font-weight: 750; letter-spacing: .12em; }
.text-link { color: var(--navy); font-size: .9rem; font-weight: 700; }
.section { margin-block: clamp(54px, 8vw, 105px); }
.section--first { margin-top: clamp(34px, 5vw, 70px); }
.section-title { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: .55rem 1.5rem; margin-bottom: 22px; }
.section-title h2 { font-size: clamp(1.95rem, 4vw, 3.3rem); letter-spacing: -.05em; }
.section-title p { color: var(--muted); }
.page-mast { border-bottom: 1px solid var(--rule); padding: clamp(42px, 7vw, 84px) 0 35px; }
.page-mast h1 { margin: .25rem 0 .55rem; font-size: clamp(2.5rem, 6.1vw, 5.25rem); letter-spacing: -.055em; }
.page-mast p:not(.eyebrow) { color: var(--muted); max-width: 64ch; }
.page-area { padding-top: 29px; }
.paragraphs { display: grid; gap: 1rem; overflow-wrap: anywhere; }

.hero { background: var(--night); color: var(--white); }
.hero-layout { display: grid; grid-template-columns: .92fr 1.28fr; min-height: clamp(475px, 48vw, 645px); max-width: 1600px; margin-inline: auto; position: relative; }
.hero-copy { z-index: 1; display: flex; flex-direction: column; justify-content: center; align-items: start; padding: 48px 20px 56px max(44px, calc((100vw - 1280px) / 2)); }
.hero-copy .eyebrow { color: var(--brass); margin-bottom: .8rem; }
.hero-copy h1 { font-size: clamp(3rem, 6.3vw, 6.2rem); letter-spacing: -.075em; line-height: 1.06; }
.hero-copy h1 span { display: block; }
.hero-copy > p:not(.eyebrow) { margin: 1.3rem 0 1.65rem; max-width: 30ch; color: #e0d9c9; }
.hero-art { position: relative; min-height: 100%; overflow: hidden; }
.hero-art img { position: absolute; width: 100%; height: 100%; object-fit: cover; object-position: 52% 50%; }
.hero-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--night), transparent 26%), linear-gradient(0deg, #0a1424ae, transparent 24%); pointer-events: none; }
.hero-credit { position: absolute; z-index: 1; bottom: 24px; right: 30px; color: #fff7e6; font-size: .86rem; text-shadow: 0 1px 12px #000; }
.archive-index { border-bottom: 1px solid var(--rule); }
.index-links { display: grid; grid-template-columns: repeat(4, 1fr); }
.index-links a { display: grid; gap: .1rem; min-height: 101px; align-content: center; padding: .85rem clamp(.55rem, 2vw, 1.7rem); border-inline-start: 1px solid var(--rule); text-decoration: none; }
.index-links a:last-child { border-inline-end: 1px solid var(--rule); }
.index-links strong { font: 700 clamp(1.02rem, 1.9vw, 1.42rem)/1.3 var(--display); }
.index-links span { color: var(--muted); font-size: .85rem; }
.index-links a:hover { background: #ebe1cc; }
.map-promo { display: grid; grid-template-columns: 1.4fr 1fr; border: 1px solid var(--rule); background: var(--card); min-height: 360px; }
.map-promo-image { aspect-ratio: 1.5; overflow: hidden; background: #857c62; position: relative; }
.map-promo-image img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform .35s ease; }
.map-promo-image:hover img { transform: scale(1.04); }
.map-promo-copy { padding: clamp(22px, 4.3vw, 57px); display: grid; align-content: center; gap: 14px; }
.map-promo-copy h3 { font: 700 clamp(1.5rem, 2.7vw, 2.3rem)/1.3 var(--display); }
.map-promo-copy p { color: var(--muted); }
.home-place-links { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--rule); border-top: 0; background: var(--card); }
.home-place-links a { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .6rem; padding: .85rem clamp(.68rem,1.7vw,1.2rem); text-decoration: none; }
.home-place-links a + a { border-inline-start: 1px solid var(--rule); }
.home-place-links strong { color: var(--navy); }
.home-place-links span { color: var(--muted); font-size: .875rem; }
.home-place-links a:hover { background: #eee3ce; }
.region-links { display: flex; flex-wrap: wrap; gap: 7px; }
.region-links a, .chip { color: #52504a; background: #f1e8d7; border: 1px solid #e2d3b5; border-radius: 2px; font-size: .875rem; padding: .23rem .56rem; text-decoration: none; }
.region-links a:hover, a.chip:hover { color: var(--navy); background: #e9dcbd; }
.portrait-rail { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; }
.portrait-tile { display: block; position: relative; aspect-ratio: .8; overflow: hidden; background: #d9cdb8; text-decoration: none; }
.portrait-tile img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; transition: transform .35s ease; }
.portrait-tile:hover img { transform: scale(1.04); }
.portrait-tile div { position: absolute; inset: auto 0 0; color: var(--white); padding: 2.7rem 1rem .85rem; background: linear-gradient(0deg,#0a172af2, transparent); }
.portrait-tile div strong { display: block; font: 700 clamp(1.15rem,2vw,1.55rem)/1.3 var(--display); }
.portrait-tile div span { color: #f0d8a3; font-size: .86rem; }
.home-guide-panel { display: grid; grid-template-columns: 1fr 1.15fr; align-items: center; gap: clamp(23px,5vw,62px); padding: clamp(24px,5vw,58px); background: var(--night); color: var(--white); }
.home-guide-copy h2 { font-size: clamp(1.95rem,4vw,3.3rem); letter-spacing: -.05em; }
.home-guide-copy p { margin: .72rem 0 1.1rem; color: #e0d9c9; }
.home-guide-links { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border-top: 1px solid #d6b37160; }
.home-guide-links a { display: flex; align-items: center; min-height: 46px; padding: .55rem .73rem; color: #f2e1bd; border-bottom: 1px solid #d6b37160; text-decoration: none; font-size: .92rem; }
.home-guide-links a:nth-child(odd) { border-inline-end: 1px solid #d6b37160; }
.home-guide-links a:hover { background: #fff3d61c; }
.home-bestiary-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; }
.home-bestiary-grid .record-image img { aspect-ratio: .94; }
.chronology { background: var(--night); color: var(--white); padding: clamp(28px,5vw,60px); display: grid; grid-template-columns: .52fr 1fr; gap: 35px; margin-top: 75px; }
.chronology h2 { font-size: clamp(2rem,4.2vw,3.2rem); margin: .28rem 0 .8rem; }
.chronology .eyebrow { color: var(--brass); }
.chronology ol { padding: 0; margin: 0; list-style: none; }
.chronology li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding: .85rem 0; border-top: 1px solid #d6b37155; }
.chronology li:last-child { border-bottom: 1px solid #d6b37155; }
.chronology time { color: var(--brass); font-weight: 750; }

.search-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 17px; }
.control { display: grid; gap: .27rem; color: var(--muted); font-size: .875rem; font-weight: 650; }
.control--search { width: min(100%, 350px); }
.control input, .control select { min-height: 46px; padding: .5rem .68rem; background: var(--card); border: 1px solid #b9a98a; color: var(--ink); border-radius: 2px; }
.control select { min-width: 126px; appearance: none; padding-right: 1.65rem; background-image: linear-gradient(45deg, transparent 49%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 51%); background-position: calc(100% - 13px) 51%, calc(100% - 8px) 51%; background-size: 5px 5px; background-repeat: no-repeat; }
.result-count { align-self: end; margin: 0 0 .6rem auto; color: var(--muted); font-size: .88rem; }
.empty { padding: 36px 19px; border: 1px dashed #b9a98a; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.record { background: var(--card); border: 1px solid var(--rule); min-width: 0; text-decoration: none; transition: border-color .18s ease, transform .18s ease; }
.record:hover { border-color: #a1844e; transform: translateY(-2px); }
.record-image { overflow: hidden; background: #dcd5ca; }
.record-image img { aspect-ratio: .84; width: 100%; object-fit: cover; object-position: center 21%; }
.record-image--wide img { aspect-ratio: 1.34; object-fit: contain; object-position: center; }
.record-copy { padding: .9rem 1rem 1rem; display: grid; gap: .25rem; }
.record-copy h2, .record-copy h3 { font: 700 1.33rem/1.3 var(--display); }
.record-copy p { color: var(--muted); font-size: .875rem; }
.record-copy .record-role { color: var(--gold); font-weight: 750; }
.detail { padding-block: 32px 0; }
.detail-lead { display: grid; grid-template-columns: minmax(220px,.72fr) minmax(0,1fr); align-items: start; gap: clamp(24px,5vw,76px); margin-top: 19px; }
.detail-image { background: #e3d7c4; border: 1px solid var(--rule); }
.detail-image img { max-height: 720px; width: 100%; object-fit: contain; }
.detail-copy { padding-top: clamp(2px,3vw,44px); }
.detail-copy h1 { font-size: clamp(2.65rem,6.3vw,5.65rem); letter-spacing: -.055em; margin: .22rem 0 .72rem; }
.detail-facts { list-style: none; padding: 0; margin: 0 0 1.2rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.detail-more { margin-top: 1.25rem; }
.record-nav { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--rule); margin-top: 29px; padding-top: 14px; }

.section-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; margin-bottom: 22px; }
.section-nav a { display: flex; align-items: center; min-height: 44px; padding: .46rem .8rem; background: var(--card); border: 1px solid var(--rule); text-decoration: none; font-size: .89rem; }
.section-nav a[aria-current="page"], .section-nav a:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }
.catalog-heading { font-size: clamp(1.72rem,4vw,2.55rem); margin-bottom: 12px; }
.catalog-group { margin-top: 25px; }
.catalog-group + .catalog-group { margin-top: 48px; }
.catalog-group > h3 { font: 700 1.47rem/1.3 var(--display); padding-bottom: .5rem; margin-bottom: 12px; border-bottom: 1px solid var(--rule); }
.record-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.record-list .record { display: block; }
.record-list .record-copy p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.prose-card { background: var(--card); border: 1px solid var(--rule); padding: clamp(20px, 4vw, 46px); }
.prose-card h3 { font: 700 1.64rem/1.25 var(--display); margin-bottom: .9rem; }
.prose-card + .prose-card { margin-top: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: .9rem; }
.backlink { margin-bottom: 12px; display: inline-block; }
.codex-detail { margin-top: 14px; max-width: 1050px; }
.codex-detail h2 { font-size: clamp(2rem,4.6vw,3.4rem); margin: 0 0 .7rem; }
.codex-detail .detail-lead { margin: 0; align-items: start; }
.codex-detail .detail-copy { padding: 0; }
.place-list { border-top: 1px solid var(--rule); display: grid; margin-top: 1.25rem; }
.place-list a { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; text-decoration: none; color: var(--navy); border-bottom: 1px solid var(--rule); padding: .65rem 0; font-weight: 700; }
.place-list a:hover { text-decoration: underline; }
.place-list small { color: var(--muted); font-size: .84rem; font-weight: 500; }

@media (max-width: 950px) {
  :root { --wrap: calc(100% - 52px); }
  .nav-shell { gap: 15px; }
  .primary-nav { gap: .75rem; }
  .hero-copy { padding-left: 26px; }
  .map-promo { min-height: initial; }
  .card-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 720px) {
  :root { --wrap: calc(100% - 32px); }
  html { scroll-padding-top: 70px; }
  .nav-shell { min-height: 60px; flex-wrap: wrap; padding-block: .4rem; gap: 9px; }
  .nav-toggle { display: block; margin-left: auto; }
  .nav-shell .return-game { display: none; }
  .primary-nav { display: none; width: 100%; flex-wrap: wrap; gap: 0 1rem; padding-bottom: .32rem; }
  .primary-nav[data-open="true"] { display: flex; }
  .hero-layout { min-height: auto; display: flex; flex-direction: column-reverse; }
  .hero-art { min-height: auto; aspect-ratio: 1.37; }
  .hero-art::after { background: linear-gradient(0deg, var(--night), transparent 30%); }
  .hero-credit { right: 17px; bottom: 14px; font-size: .82rem; }
  .hero-copy { padding: 0 16px 31px; margin-top: -9px; }
  .hero-copy h1 span { display: inline; }
  .hero-copy h1 { font-size: clamp(2.6rem, 9.8vw, 4.2rem); }
  .hero-copy > p:not(.eyebrow) { margin: .7rem 0 1rem; max-width: 42ch; }
  .index-links { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .index-links a { min-height: 74px; padding-inline: .6rem; border-bottom: 1px solid var(--rule); }
  .index-links a:nth-child(even) { border-inline-end: 1px solid var(--rule); }
  .index-links a:nth-last-child(-n+2) { border-bottom: 0; }
  .map-promo, .chronology { display: grid; grid-template-columns: 1fr; gap: 0; }
  .map-promo-image { aspect-ratio: 1.75; }
  .home-place-links { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .home-place-links a:nth-child(odd) { border-inline-start: 0; }
  .home-place-links a:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .home-guide-panel { grid-template-columns: 1fr; }
  .home-bestiary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
  .chronology { gap: 19px; }
  .chronology li { grid-template-columns: 6.6rem 1fr; gap: .45rem; }
  .portrait-rail { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .detail-lead { grid-template-columns: 1fr; }
  .detail-image { width: min(100%, 445px); }
  .detail-image img { max-height: min(66vh, 640px); }
  .result-count { margin-left: 0; }
  .site-footer { margin-top: 48px; }
  .footer-shell { grid-template-columns: 1fr; }
}

@media (max-width: 465px) {
  .card-grid, .record-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .home-bestiary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .record-copy { padding: .7rem; }
  .record-copy h2, .record-copy h3 { font-size: 1.13rem; }
  .hero-copy .actions { width: 100%; }
  .hero-copy .actions a { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
