:root {
  color-scheme: light;
  --paper: #f2eee5;
  --ink: #13232a;
  --muted: #526061;
  --line: #d7dad1;
  --accent: #8d421f;
  --navy: #10272e;
  --gold: #e4ae7a;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", "MS PMincho", serif;
  --sans: "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", Meiryo, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.75 var(--sans); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #ad5b33; outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
img { display: block; width: 100%; }
.shell { width: min(1200px, calc(100% - 112px)); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 5; padding: 10px; background: white; }
.header { border-bottom: 1px solid var(--line); }
.kicker { color: var(--accent); font-size: .8125rem; font-weight: 700; letter-spacing: .065em; }
.archive { margin-top: 58px; scroll-margin-top: 102px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px; border-bottom: 1px solid var(--ink); padding-bottom: 13px; }
.section-heading h2 { font: 700 1.95rem/1.3 var(--serif); }
.section-en { color: var(--muted); font: 700 .7rem Arial, sans-serif; letter-spacing: .16em; }
.controls { display: flex; gap: 10px 20px; align-items: center; justify-content: space-between; margin-top: 17px; }
.topics { display: flex; flex-wrap: wrap; gap: 7px; }
.topics button, select, #load-more { padding: 7px 13px; border-radius: 3px; border: 1px solid #bfc7bf; color: var(--ink); background: transparent; font-size: .875rem; line-height: 1.55; }
.topics button:hover, #load-more:hover, select:hover { background: #e8eae1; }
.topics button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: white; }
.select-label { position: relative; display: inline-block; flex-shrink: 0; }
.select-label::after { content: ""; position: absolute; width: 6px; height: 6px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: rotate(45deg); right: 12px; top: 12px; pointer-events: none; }
select { appearance: none; padding-right: 30px; }
.results-count { font-size: .8125rem; color: var(--muted); margin: 11px 0 10px; }
.query-row { padding: 8px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.query-row button { padding: 1px 5px; color: var(--accent); background: none; border: 0; text-decoration: underline; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 22px; }
.card { border-bottom: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; border-radius: 3px 3px 0 0; }
.card-media { display: block; aspect-ratio: 1.85; overflow: hidden; background: #d4dcd3; }
.card-media img { height: 100%; object-fit: cover; transition: transform .24s ease; }
.card:hover img { transform: scale(1.035); }
.card-copy { padding: 14px 0 17px; flex: 1; display: flex; flex-direction: column; align-items: flex-start; }
.card h3 { font: 700 1.24rem/1.48 var(--serif); margin: 7px 0; text-wrap: pretty; }
.card p { font-size: .9375rem; color: var(--muted); margin-bottom: 9px; }
.card-meta { color: var(--muted); margin-top: auto; font-size: .8125rem; }
.load-row { display: grid; place-items: center; margin-top: 27px; }
#load-more { padding: 9px 25px; }
.empty { grid-column: 1 / -1; padding: 25px 0; color: var(--muted); }
.footer { margin-top: 64px; background: var(--navy); color: #d6dfdd; }
.footer .shell { min-height: 92px; display: flex; flex-wrap: wrap; gap: 10px 25px; align-items: center; justify-content: space-between; font-size: .875rem; }
.footer-brand { color: #fbf8ec; font: 700 1.25rem var(--serif); }
.footer a:hover { color: var(--gold); }
.article-view { width: min(1020px, calc(100% - 40px)); max-width: 1020px; margin: 32px auto 0; }
.breadcrumb { display: inline-block; text-decoration: underline; text-underline-offset: .25em; margin-bottom: 24px; color: var(--muted); font-size: .875rem; }
.article-heading { max-width: 810px; margin-inline: auto; }
.article-heading h1 { margin: 9px 0 14px; font: 700 clamp(2rem, 5vw, 3.55rem)/1.28 var(--serif); text-wrap: pretty; }
.article-heading .lead { color: var(--muted); font-size: 1.1rem; }
.article-heading .card-meta { margin-top: 14px; }
.article-photo { margin: 25px 0 0; }
.article-photo img { aspect-ratio: 2.4; object-fit: cover; border-radius: 3px; }
.article-photo figcaption { padding: 5px 0; color: var(--muted); font-size: .8125rem; text-align: right; }
.article-illustration { margin: 25px 0; }
.article-illustration img { width: auto; max-width: 100%; max-height: 540px; height: auto; object-fit: contain; margin-inline: auto; border-radius: 3px; }
.article-illustration figcaption { padding: 5px 0; color: var(--muted); font-size: .8125rem; text-align: center; }
.article-illustration a { text-decoration: underline; text-underline-offset: .18em; }
.article-table { width: 100%; border-collapse: collapse; margin-block: 1rem; font-size: .92rem; }
.article-table :is(th, td) { border: 1px solid var(--line); padding: .45rem .55rem; text-align: left; vertical-align: top; }
.article-table th, .article-concept { background: #e8eae1; }
.article-concept { margin: 1.2rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 3px; }
.article-concept figcaption { font-weight: 700; }
.article-concept ol { padding-left: 1.6rem; margin: .5rem 0; }
.article-concept li { margin: .35rem 0; }
.article-body { max-width: 720px; margin: 23px auto 49px; }
.article-body section { margin-bottom: 27px; }
.article-body h2 { font: 700 1.45rem/1.45 var(--serif); margin-bottom: 7px; }
.article-body p { line-height: 2; }
.references { border-top: 1px solid var(--line); padding-top: 20px; }
.references ul { margin: 0; padding-left: 1.2em; }
.references a { color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }
.related .cards { margin-top: 16px; }
dialog { width: min(520px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 4px; padding: 23px; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #10272eaa; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.dialog-head h2 { font: 700 1.35rem var(--serif); }
.close { background: none; border: 0; color: var(--ink); font-size: 1.6rem; line-height: 1.15; padding: 5px; }
#query { display: block; width: 100%; margin-bottom: 14px; padding: 12px; background: #fff; color: var(--ink); border: 1px solid #a5b0a7; border-radius: 3px; }
.submit-search { background: var(--navy); color: white; padding: 8px 16px; border: 0; border-radius: 3px; }
@media (max-width: 900px) {
  .shell { width: calc(100% - 56px); }
}
@media (max-width: 680px) {
  .shell { width: calc(100% - 34px); }
  .desktop-break { display: none; }
  .archive { margin-top: 39px; }
  .controls { align-items: flex-start; flex-direction: column; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 13px; }
  .card h3 { font-size: 1.07rem; }
  .card p { font-size: .875rem; }
}
@media (max-width: 360px) {
  .cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* 地図のページは暗色にし、読書ページは紙面の配色を引き継ぐ。 */
:root {
  --header-height: 79px;
  --map-height: max(540px, calc(100svh - var(--header-height)));
  --map-bg: #07181f;
  --map-text: #f6eee0;
  --map-gold: #ecc28b;
  --map-line: #87a6a354;
}
.header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: radial-gradient(ellipse at 55% 125%, #14272d 0%, #09171c 61%, #081217 100%);
  border-bottom: 1px solid var(--map-line);
  color: var(--map-text);
}
.masthead {
  width: 100%;
  padding-inline: clamp(18px, 2.25vw, 36px);
  display: flex;
  min-height: var(--header-height);
  align-items: center;
}
.brand { display: inline-flex; flex-shrink: 0; gap: 19px; align-items: center; color: var(--map-text); }
.brand strong { font: 700 clamp(1.45rem, 3vw, 2.55rem)/1.1 var(--serif); letter-spacing: .075em; }
.brand:hover { color: var(--map-gold); }
.globe-mark {
  position: relative;
  display: inline-block;
  width: clamp(34px, 4vw, 57px);
  aspect-ratio: 1;
  border: 1px solid #be9b67;
  border-radius: 50%;
  background:
    linear-gradient(transparent 48%, #be9b6790 49% 51%, transparent 52%),
    url('assets/world-relief.webp') center center / auto 100%;
  box-shadow: inset 0 0 13px #031219, 0 0 15px #b789451d;
  filter: saturate(.5);
}
.globe-mark::before, .globe-mark::after { content: ""; position: absolute; border: 1px solid #c4a572a0; border-radius: 50%; }
.globe-mark::before { inset: -1px 21%; transform: rotate(-16deg); }
.globe-mark::after { inset: 18% -1px; transform: rotate(-15deg); }
.nav { display: flex; gap: clamp(20px, 4vw, 65px); align-items: center; margin-inline-start: clamp(25px, 4vw, 69px); padding-inline-start: clamp(28px, 4vw, 68px); position: relative; }
.nav::before { content: ""; height: 32px; width: 1px; background: var(--map-line); position: absolute; left: 0; }
.nav a { position: relative; white-space: nowrap; color: var(--map-text); font: 700 clamp(1rem, 1.65vw, 1.45rem)/1.25 var(--serif); padding-block: 14px; }
.nav a:hover { color: var(--map-gold); }
.nav a[data-active]::after { content: ""; position: absolute; bottom: 0; left: -5px; right: -5px; height: 2px; background: var(--map-gold); }
.search-button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--map-text); margin-inline-start: auto; }
.search-button:hover { color: var(--map-gold); }
.search-icon { display: block; width: 22px; height: 22px; border: 2px solid currentColor; border-radius: 50%; position: relative; margin: -3px 3px 0 0; }
.search-icon::after { content: ""; position: absolute; width: 11px; height: 2px; background: currentColor; right: -8px; bottom: -4px; transform: rotate(48deg); }

.map-layout { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--map-bg); color: var(--map-text); }
.map-layout.has-selection { grid-template-columns: minmax(0, 1fr) clamp(285px, 25vw, 405px); }
.atlas-map { position: relative; min-width: 0; height: var(--map-height); overflow: hidden; isolation: isolate; }
#world-canvas { display: block; width: 100%; height: 100%; touch-action: none; background: #071c25; } /* 指の操作（ピンチ・移動）はすべて map.js で処理する */
#world-canvas.over-country { cursor: pointer; }
.atlas-map::after { content: ""; position: absolute; z-index: 1; inset: 0; box-shadow: inset 0 0 110px 20px #03131952; pointer-events: none; }
.map-heading { position: absolute; z-index: 2; inset: 27px auto auto clamp(19px, 2.3vw, 36px); border-left: 4px solid var(--map-gold); padding-left: 17px; pointer-events: none; text-shadow: 0 1px 6px #091416, 0 0 16px #091416; }
.map-heading h1 { font: 700 clamp(1.55rem, 3.15vw, 2.55rem)/1.18 var(--serif); letter-spacing: .04em; }
.map-heading p { margin-top: 5px; font: 500 clamp(.875rem, 1.57vw, 1.23rem)/1.35 var(--serif); letter-spacing: .075em; }
.country-picker { position: absolute; right: 18px; top: 21px; z-index: 3; }
.country-picker::after { content: ""; position: absolute; width: 6px; height: 6px; right: 14px; top: 13px; border-right: 1px solid; border-bottom: 1px solid; transform: rotate(45deg); pointer-events: none; }
.country-picker select { color: var(--map-text); border-color: #94a7a77d; background: #0a1c23ed; padding-block: 8px; max-width: 185px; }
.country-picker select:hover { background: #162e36; }
.country-picker option, .country-picker optgroup { background: #0a1c23; color: var(--map-text); }
.map-controls { position: absolute; z-index: 3; left: clamp(17px, 1.8vw, 29px); bottom: 55px; display: grid; gap: 5px; }
.map-controls button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #b7c5c47a; border-radius: 6px; background: #07181eea; color: var(--map-text); font: 400 1.52rem/1 Arial, sans-serif; }
.map-controls button:hover:not(:disabled) { color: var(--map-gold); background: #19333b; }
.map-controls button:disabled { opacity: .52; cursor: default; }
#map-reset { margin-top: 5px; }
.reset-icon { width: 17px; height: 17px; border: 1.5px solid currentColor; border-radius: 50%; display: grid; place-items: center; position: relative; }
.reset-icon::before { content: ""; position: absolute; width: 23px; height: 1px; background: linear-gradient(90deg, currentColor 0 22%, transparent 22% 78%, currentColor 78%); }
.reset-icon::after { content: ""; background: currentColor; width: 4px; height: 4px; border-radius: 50%; }
.map-key { position: absolute; z-index: 2; left: 15px; right: 15px; bottom: 12px; display: flex; justify-content: space-between; gap: 12px; font-size: .75rem; color: #ecdcc8; pointer-events: none; }
.map-key span, .map-key a { padding: 2px 6px; background: #07191cdd; border-radius: 3px; }
.map-key a { pointer-events: auto; }
.map-key a:hover { color: var(--map-gold); }
.map-key i { display: inline-block; width: 7px; height: 7px; margin-inline-end: 7px; border-radius: 50%; background: var(--map-gold); }
.map-tooltip { position: absolute; z-index: 4; pointer-events: none; background: #0b171cea; border: 1px solid #dfba7c8a; color: var(--map-text); padding: 3px 8px; border-radius: 4px; white-space: nowrap; font-size: .875rem; }
.country-inset { position: absolute; z-index: 2; right: 19px; bottom: clamp(47px, 6.8vh, 76px); width: min(43%, 455px); height: min(42%, 372px); border: 1.5px solid var(--map-gold); border-radius: 9px; overflow: hidden; box-shadow: 0 0 30px #041215c0; pointer-events: none; background: #061b23; }
#country-canvas { display: block; width: 100%; height: 100%; }
#inset-label { position: absolute; top: 11px; left: 19px; color: var(--map-text); font: 700 clamp(.9rem, 1.8vw, 1.52rem)/1.35 var(--serif); padding-bottom: 5px; border-bottom: 2px solid var(--map-gold); text-shadow: 0 0 7px black; }

.country-drawer { min-width: 0; min-height: var(--map-height); position: relative; border-left: 1px solid var(--map-line); padding: 33px 19px 24px; box-shadow: -8px 0 24px #02101630; background: radial-gradient(ellipse at 66% 28%, #18282b 0%, #0c191e 58%, #091419 100%); }
.country-drawer h2 { color: var(--map-text); font: 700 clamp(1.9rem, 3.65vw, 3.1rem)/1.2 var(--serif); margin-bottom: 16px; padding-inline-end: 30px; }
.country-drawer h2:focus { outline: none; }
.country-drawer h2::after { content: ""; display: block; width: 74px; height: 2px; margin-top: 11px; background: var(--map-gold); }
#close-country { background: transparent; color: var(--map-text); font: 400 1.9rem/1 Arial, sans-serif; position: absolute; right: 8px; top: 10px; display: grid; place-items: center; width: 40px; height: 40px; border: 0; }
#close-country:hover { color: var(--map-gold); }
.country-article { display: grid; grid-template-columns: minmax(78px, 38%) 1fr; align-items: center; gap: 15px; padding: 20px 0; border-bottom: 1px solid var(--map-line); color: var(--map-text); }
.country-article:first-child { border-top: 1px solid var(--map-line); }
.country-article span { overflow-wrap: anywhere; font: 700 clamp(1rem, 1.65vw, 1.43rem)/1.45 var(--serif); text-wrap: pretty; }
.country-article:hover { color: var(--map-gold); }
.country-article img { aspect-ratio: 1.32; height: auto; object-fit: cover; border-radius: 2px; }
.country-empty { font-size: .9375rem; color: #d6e0de; }
.drawer-archive { display: inline-block; margin-top: 13px; text-decoration: underline; text-underline-offset: .2em; color: var(--map-gold); }
.drawer-archive:hover { color: #ffe8c9; }
.breadcrumb-map { margin-left: 16px; }

@media (max-width: 860px) {
  :root { --header-height: 67px; }
  .brand { gap: 10px; }
  .nav { gap: 23px; margin-inline-start: 20px; padding-inline-start: 22px; }
}
@media (max-width: 690px) {
  :root { --header-height: 90px; --map-height: max(450px, 57svh); }
  .masthead { display: grid; grid-template-columns: 1fr auto; gap: 0; padding-block: 4px 0; }
  .nav { order: 3; grid-column: 1 / -1; margin: 0; padding: 0; gap: 25px; }
  .nav::before { display: none; }
  .nav a { padding-block: 7px 9px; }
  .nav a[data-active]::after { left: 0; right: 0; }
  .map-layout.has-selection { grid-template-columns: 1fr; }
  .has-selection .atlas-map { height: max(370px, 57svh); }
  .map-heading { top: 16px; padding-left: 10px; border-width: 2px; }
  .map-heading h1 { font-size: 1.4rem; }
  .country-picker { top: 15px; right: 13px; }
  .country-picker select { font-size: .8125rem; max-width: 140px; }
  .country-inset { width: min(58%, 310px); min-height: 138px; right: 12px; bottom: 43px; }
  #inset-label { top: 5px; left: 10px; }
  .map-controls { bottom: 50px; }
  .map-controls button { width: 36px; height: 36px; }
  .country-drawer { min-height: 0; border-left: 0; border-top: 1px solid var(--map-line); padding: 18px 18px 25px; }
  .country-drawer h2 { margin-bottom: 11px; }
  .country-article { grid-template-columns: 96px minmax(0, 1fr); padding-block: 13px; }
  .country-article span { font-size: 1.14rem; }
  .archive { scroll-margin-top: 105px; }
}
