@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("assets/inter-tight-latin.woff2") format("woff2");
}

:root {
  --paper: #ece8e0;
  --sheet: #f3f0ea;
  --ink: #141414;
  --muted: #6d6a63;
  --cobalt: #1f3fb0;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --edge: 36px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .42 0 0 0 0 .38 0 0 0 .22 0'/%3E%3C/filter%3E%3Cpath d='M0 0h220v220H0z' filter='url(%23n)'/%3E%3C/svg%3E");
  font: 500 16px/1.45 "Inter Tight", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
body::after, .detail-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: var(--grain);
  mix-blend-mode: multiply;
  opacity: .6;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; touch-action: manipulation; cursor: pointer; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 4px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.label { font-size: 10.5px; font-weight: 650; line-height: 1.2; letter-spacing: .14em; }
.outline { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; border: 1px solid currentColor; color: var(--cobalt); }

.masthead, .credits {
  margin-inline: var(--edge);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--cobalt);
}
.masthead { height: 76px; border-bottom: 1px solid #1f3fb033; }
.brand { display: flex; align-items: center; min-height: 44px; gap: 16px; white-space: nowrap; }
.brand span { width: 40px; height: 1px; background: currentColor; }
.masthead-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.masthead-link:hover { text-decoration: underline; text-underline-offset: .28em; }
.credits { min-height: 54px; border-top: 1px solid #1f3fb033; }
.map-credit { color: var(--muted); font-size: 9px; letter-spacing: .04em; }

.archive {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: calc(100svh - 130px);
  min-height: 590px;
  overflow: clip;
}
.results { position: relative; grid-area: 1 / 1; z-index: 5; min-width: 0; overflow: auto; padding: 32px var(--edge); background: var(--paper); }
.collection { position: relative; max-width: 780px; margin-inline: auto; }
.collection-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 6px 12px; padding-bottom: 20px; color: var(--cobalt); }
.collection-head > :first-child { grid-column: 1 / -1; }
.collection-place { display: flex; align-items: center; gap: 10px; min-width: 0; }
.collection-title { font-size: clamp(32px, 4.5vw, 68px); line-height: 1.13; letter-spacing: -.045em; }
.collection-title:focus { outline: none; }
.collection-stamp { flex: none; width: clamp(32px, 9vw, 54px); height: clamp(26px, 7vw, 36px); fill: currentColor; }
.stamp-in-flight .collection-stamp { visibility: hidden; }
#collection-count { padding-bottom: 5px; }
.supplier-group { margin-bottom: 9px; color: var(--cobalt); }
.supplier-list + .supplier-group { margin-top: 25px; }
.supplier-list { margin: 0; padding: 0; border-top: 1px solid var(--cobalt); list-style: none; }
.supplier-list li { border-bottom: 1px solid #1f3fb050; }
.supplier-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 22%) 24px; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 16px 10px; background: #ece8e0d9; transition: background-color 180ms; }
.supplier-card:focus-visible { background: var(--sheet); }
.supplier-card:focus-visible { outline-offset: -2px; }
.supplier-info { display: grid; gap: 4px; }
.supplier-name { color: var(--cobalt); font-size: clamp(17px, 2vw, 24px); font-weight: 700; line-height: 1.25; }
.supplier-role, .supplier-site { font-size: 12px; color: var(--muted); }
.supplier-paper { display: grid; gap: 3px; color: var(--cobalt); font-size: 14px; }
.supplier-arrow { justify-self: end; color: var(--cobalt); }
#back-map { position: relative; margin-bottom: 18px; }
.halftone {
  position: absolute;
  writing-mode: vertical-rl;
  color: transparent;
  background: radial-gradient(circle, #40528c8c 36%, transparent 40%) 0 0 / 3px 3px, #6e7aa042;
  background-clip: text;
  font-size: min(19svh, 12.5vw);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: .02em;
  pointer-events: none;
  user-select: none;
}
.halftone-right { right: 2.4vw; top: 9%; }
.shelf {
  position: relative;
  height: calc(var(--shelf-height) + 62px);
  perspective: 1400px;
  touch-action: pan-y;
  user-select: none;
  overflow: clip;
  background: radial-gradient(ellipse 42% 17% at 50% 88%, #372b1f32, transparent);
}
.stage { position: absolute; left: 50%; top: 50%; transform-style: preserve-3d; }
.specimen { position: absolute; width: 0; height: 0; transform-style: preserve-3d; }
.face {
  position: absolute;
  display: block;
  top: calc(var(--shelf-height) / -2);
  height: var(--shelf-height);
  backface-visibility: hidden;
}
.face::after { content: ""; position: absolute; inset: 0; background: #15110b; opacity: var(--shade, 0); pointer-events: none; }
.specimen:focus-visible { outline: none; }
.specimen:focus-visible .face { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.spine {
  left: calc(var(--spine) / -2);
  width: var(--spine);
  transform: translateZ(calc(var(--cover) / 2));
  background: repeating-linear-gradient(90deg, #806444 0 1px, #d2b890 1px 3px);
}
.cover {
  left: calc(var(--cover) / -2);
  width: var(--cover);
  transform: rotateY(90deg) translateZ(calc(var(--spine) / 2));
  background: url("assets/paper-fibers.jpg") var(--crop) 50% / auto 100% no-repeat, #cbb38c;
  clip-path: polygon(2% 2%, 11% 1%, 29% 2%, 46% 0, 63% 2%, 79% 1%, 98% 2%, 99% 21%, 98% 38%, 100% 59%, 98% 80%, 99% 98%, 83% 99%, 67% 98%, 55% 100%, 36% 98%, 17% 99%, 2% 97%, 1% 77%, 2% 54%, 0 34%);
}
.material-caption { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; color: var(--cobalt); text-align: center; }
#sample-category { grid-column: 2; font-size: clamp(17px, 2.4vw, 28px); line-height: 1.2; font-weight: 700; }
.material-caption #next { grid-column: 3; grid-row: 1; }
.arrow { width: 44px; height: 44px; display: grid; place-items: center; }
.arrow[aria-disabled="true"] { color: var(--muted); cursor: default; }
dialog { margin: auto; padding: 0; border: 0; background: var(--sheet); color: var(--ink); }
.map-panel { position: relative; grid-area: 1 / 1; min-width: 0; min-height: 0; padding: 30px var(--edge) 22px; }
.map-frame { height: 100%; -webkit-tap-highlight-color: transparent; }
.map-content { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); grid-template-rows: minmax(0, 1fr); align-items: center; gap: 4vw; width: min(1080px, 100%); height: 100%; margin-inline: auto; }
.map-intro { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px 8px; align-content: start; }
.map-kicker { color: var(--cobalt); }
.map-intro h2 { font-size: clamp(42px, 5.8vw, 84px); letter-spacing: -.045em; line-height: 1.08; color: var(--cobalt); }
.map-intro h2 span { white-space: nowrap; }
.map-guide, #map-status { color: var(--muted); font-size: 13px; }
#map-status { min-block-size: 2.9em; }
.location-search { position: relative; z-index: 2; color: var(--cobalt); margin-top: 4px; }
.location-search:has(.location-menu:not([hidden])) { z-index: 3; }
.location-field { display: flex; align-items: center; min-height: 54px; border: 1px solid currentColor; border-radius: 4px; background: var(--sheet); }
.location-field:focus-within { outline: 1px solid var(--cobalt); }
.location-pin { flex: none; margin-inline: 11px 8px; }
.location-field input { flex: 1; min-width: 0; padding: 0; min-height: 52px; border: 0; background: transparent; outline: 0; font: inherit; font-size: max(16px, 1em); color: var(--ink); }
.location-field input::placeholder { color: var(--muted); }
.location-submit, .location-clear { display: grid; flex: 0 0 44px; height: 44px; place-items: center; }
.location-submit { border-left: 1px solid #1f3fb033; }
.location-submit:focus-visible, .location-clear:focus-visible { outline-offset: -3px; }
.location-menu, .county-options { position: absolute; inset: calc(100% + 4px) 0 auto; border: 1px solid #1f3fb066; border-radius: 4px; background: var(--sheet); box-shadow: 0 8px 16px #25211920; }
.location-menu ul { position: relative; max-height: min(220px, 33svh); margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; }
.location-menu li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 10px; min-height: 44px; padding: 6px 11px; font-size: 14px; cursor: pointer; }
.location-menu li + li { border-top: 1px solid #1f3fb033; }
.location-menu li[aria-selected="true"] { background: #1f3fb012; box-shadow: inset 2px 0 currentColor; }
.location-menu li span:last-child, .location-empty { color: var(--muted); font-size: 12px; }
.location-empty { padding: 12px; }
.county-field { position: relative; z-index: 2; min-width: 0; color: var(--cobalt); }
.county-field summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 11px; border: 1px solid #1f3fb066; border-radius: 4px; background: var(--sheet); list-style: none; cursor: pointer; touch-action: manipulation; }
.county-field summary::-webkit-details-marker { display: none; }
.county-field[open] summary { border-color: var(--cobalt); }
.county-field[open] summary svg { rotate: 180deg; }
.county-options { max-height: min(300px, 43svh); overflow-y: auto; overscroll-behavior: contain; }
.county-options h3 { padding: 10px 11px; background: #1f3fb00c; border-bottom: 1px solid #1f3fb033; }
.county-options button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 6px 11px; font-size: 14px; text-align: left; }
.county-options button + button { border-top: 1px solid #1f3fb033; }
.county-options button span:nth-child(2) { flex: none; color: var(--muted); font-size: 12px; }
.county-options button:focus-visible { outline-offset: -3px; background: #1f3fb012; }
.location-submit:active, .location-clear:active, .location-menu li:active, .county-field summary:active,
.county-options button:active, #back-map:active, .detail-close:active { background: #1f3fb018; }
.supplier-card:active { background: #1f3fb01c; transition-duration: 0ms; }
.atlas { display: grid; height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; align-items: center; }
.map-visual { position: relative; display: grid; grid-template-columns: 31% 69%; grid-template-rows: minmax(0, 1fr); height: 100%; max-width: 100%; aspect-ratio: 430 / 534; }
.taiwan-map { display: block; width: 100%; height: 100%; overflow: visible; }
.county-shape { fill: url(#map-dots); stroke: var(--paper); stroke-width: 1.15; stroke-linejoin: round; cursor: pointer; touch-action: manipulation; }
.county-shape[data-has-samples] { fill: #a6b0d4; }
.county-shape:focus { outline: none; }
.county-shape:active, .county-shape:focus-visible { fill: #8290bf; }
.county-shape[aria-pressed="true"] { fill: var(--cobalt); }
.county-shape:focus-visible { stroke: var(--ink); stroke-width: 2.4; }
#map-marker { pointer-events: none; }
.map-legend { display: grid; justify-items: center; gap: 8px; margin-top: 9px; color: var(--cobalt); text-align: center; }
.legend-mark { display: flex; gap: 8px; align-items: center; }
.legend-mark::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.islands { display: grid; grid-template-rows: repeat(3, minmax(min-content, 1fr)) 1fr; align-items: start; gap: 4px; height: 100%; padding-top: 8px; }
.island { --island-height: clamp(38px, 9vh, 72px); --island-scale: 1; display: grid; justify-items: start; gap: 5px; width: 78%; min-width: 44px; min-height: 44px; margin-left: 12%; padding: 4px; color: var(--cobalt); font-size: 11px; text-align: left; }
.island svg { display: block; width: min(calc(100% * var(--island-scale)), calc(var(--island-height) * var(--island-aspect) * var(--island-scale))); height: auto; fill: #c2c7d7; stroke: var(--paper); stroke-width: .1; pointer-events: none; }
.island[data-county="金門縣"] { --island-scale: .5; margin-left: 20%; }
.island[data-county="澎湖縣"] { --island-height: clamp(48px, 11vh, 88px); --island-scale: 1.5; width: 100%; margin-left: 0; }
.island[data-has-samples] svg { fill: #a6b0d4; }
.island:active svg, .island:focus-visible svg { fill: #8290bf; }
.island[aria-pressed="true"] svg { fill: var(--cobalt); }
.county-lift { position: absolute; z-index: 4; fill: var(--cobalt); overflow: visible; pointer-events: none; filter: drop-shadow(3px 8px 3px #2b25265c); }
.county-lift-docking { z-index: 6; transform-box: border-box; transform-origin: center; }
.svg-defs { position: absolute; width: 0; height: 0; pointer-events: none; }
.taiwan-map { filter: drop-shadow(5px 9px 5px #3b304e29); }

@media (min-width: 768px) {
  .county-options { inset: auto 0 calc(100% + 4px); }
}

@media (hover: hover) and (pointer: fine) {
  .location-submit:hover:not(:active), .location-clear:hover:not(:active),
  .location-menu li:hover, .county-options button:hover:not(:active) { background: #1f3fb012; }
  .supplier-card:hover:not(:active) { background: var(--sheet); }
  .county-shape:hover:not([aria-pressed="true"]), .island:not([aria-pressed="true"]):hover svg { fill: #8290bf; }
}

.detail { inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; overscroll-behavior: contain; }
.detail::backdrop { background: transparent; }
html:has(.detail[open]) { overflow: hidden; }
.detail-page {
  position: relative;
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, .84fr) minmax(0, 1.16fr);
  grid-template-rows: auto 1fr;
  align-items: center;
  gap: 24px clamp(28px, 5vw, 88px);
  max-width: 1560px;
  padding: 0 max(var(--edge), 5vw) 36px;
  margin-inline: auto;
}
.detail-top { position: sticky; top: 0; z-index: 6; grid-column: 1 / -1; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--cobalt); background: var(--sheet); border-bottom: 1px solid #1f3fb050; }
.detail-content { display: grid; gap: 16px; max-width: 520px; }
.detail-line > span { display: block; }
.detail-line > .detail-origin { display: inline-flex; align-items: center; gap: 10px; }
.detail-origin svg { width: 54px; height: 36px; fill: currentColor; }
.detail-content .label, #detail-title { color: var(--cobalt); }
#detail-title { font-size: clamp(29px, 3.9vw, 59px); font-weight: 650; line-height: 1.15; letter-spacing: -.035em; overflow-wrap: anywhere; }
.detail-description { font-size: 17px; max-width: 38ch; }
.detail-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 16px; margin: 0; padding-block: 12px; border-block: 1px solid #1f3fb050; font-size: 13px; line-height: 1.5; }
.detail-facts dt { color: var(--cobalt); font-weight: 650; }
.detail-facts dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.detail-facts a[href] { color: var(--cobalt); text-decoration: underline; text-underline-offset: .16em; }
.detail-note { color: var(--muted); font-size: 12px; }
.material-gallery {
  --shelf-height: min(37svh, 28vw, 350px);
  --spine: calc(var(--shelf-height) * .065);
  --cover: calc(var(--shelf-height) * .82);
  min-width: 0;
  padding-block: 12px;
  border-block: 1px solid var(--cobalt);
}
.material-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--cobalt); }
.material-head h3 { font-size: 17px; }
.material-options { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--cobalt); }
.material-gallery .shelf { margin-top: 8px; }
.material-options button { min-height: 44px; padding: 6px 9px; border: 1px solid #1f3fb050; font-size: 13px; text-align: left; }
.material-options button[aria-current="true"] { border-color: var(--cobalt); background: #1f3fb012; }
.material-options button, .material-caption .arrow {
  transition: transform 120ms var(--ease);
}
.material-options button:active,
.material-caption .arrow:active:not([aria-disabled="true"]) { background: #1f3fb018; }
@media (prefers-reduced-motion: no-preference) {
  .material-options button:active:not(:focus-visible),
  .material-caption .arrow:active:not(:focus-visible):not([aria-disabled="true"]) { transform: scale(.97); }
}

@media (max-width: 767px) {
  :root { --edge: 16px; }
  .masthead { height: 60px; }
  .brand { gap: 8px; }
  .brand span { width: 22px; }
  .archive { height: auto; min-height: calc(100svh - 124px); grid-template-rows: auto; }
  html:has(.results:not([hidden])) { overflow: hidden; }
  .results { position: fixed; inset: 0; padding-block: max(24px, env(safe-area-inset-top)) max(34px, env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  #back-map { position: sticky; top: 0; z-index: 1; background: var(--paper); }
  #back-map:active { background: #d9d8db; }
  .supplier-card { grid-template-columns: minmax(0, 1fr) 20px; gap: 7px 10px; padding: 13px 8px; }
  .supplier-paper { grid-column: 1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; }
  .supplier-arrow { grid-row: 1 / 3; grid-column: 2; }
  .map-panel { padding-block: 24px 48px; }
  .map-frame, .map-content { height: 100%; }
  .map-content { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
  .map-intro { gap: 7px; }
  .map-intro h2 { font-size: clamp(32px, 9vw, 58px); }
  .atlas { height: auto; grid-template-rows: auto auto; align-self: center; }
  .map-visual { height: clamp(242px, 41svh, 350px); }
  .island { --island-height: clamp(38px, 7svh, 52px); }
  .island[data-county="澎湖縣"] { --island-height: clamp(48px, 8.5svh, 64px); }
  .halftone { font-size: 22vw; opacity: .8; }
  .halftone-right { top: 11%; }
  .credits { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding-block: 10px max(10px, env(safe-area-inset-bottom)); font-size: 9px; }
  .map-credit { grid-column: 1 / -1; grid-row: 2; }
  .footer-en { display: none; }
  .detail-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; align-content: start; gap: 19px; padding: 0 var(--edge) 32px; }
  .detail-top { min-height: 62px; }
  .detail-content { gap: 11px; }
  .material-gallery { --shelf-height: min(54vw, 32svh, 260px); }
  .shelf { height: calc(var(--shelf-height) + 34px); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
