/* ==========================================================================
   MacDau Museum — design system
   Apple-minimal: pure white, hairline dividers, generous whitespace.
   Mobile-first, touch-friendly, kiosk-capable.
   ========================================================================== */

/* ---- Fonts (original Apple display faces — item names only) ---- */
@font-face { font-family: "Apple Garamond";  src: url("../fonts/AppleGaramond-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; }
@font-face { font-family: "Apple Garamond";  src: url("../fonts/AppleGaramond-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; }
@font-face { font-family: "Motter Tektura";  src: url("../fonts/MotterTektura-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; }
@font-face { font-family: "Univers Condensed"; src: url("../fonts/UniversCondensed-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; }
@font-face { font-family: "Univers Condensed"; src: url("../fonts/UniversCondensed-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; }
@font-face { font-family: "Myriad Apple";    src: url("../fonts/MyriadApple-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; }
@font-face { font-family: "Gill Sans";       src: url("../fonts/GillSans-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; }
@font-face { font-family: "SF Pro";          src: url("../fonts/SF-Pro-Text-Regular.otf") format("opentype"); font-weight: 400; font-style: normal; }
@font-face { font-family: "SF Pro";          src: url("../fonts/SF-Pro-Text-Semibold.otf") format("opentype"); font-weight: 600; font-style: normal; }

/* ---- Design tokens ---- */
:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --ink: #1d1d1f;
  --ink-2: #515154;
  --secondary: #86868b;
  --faint: #aeaeb2;
  --hairline: #d2d2d7;
  --red: #a2231d;
  --max: 1200px;
  --nav-h: 52px;
  --radius: 18px;
  --radius-s: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang TC",
          "Microsoft JhengHei", "Noto Sans TC", "Segoe UI", Arial, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; padding: 0; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }

/* ---- Display fonts (item names) ---- */
.f-tektura    { font-family: "Motter Tektura", var(--sans); font-weight: 400; }
.f-univers-cn { font-family: "Univers Condensed", var(--sans); font-weight: 600; }
.f-myriad     { font-family: "Myriad Apple", var(--sans); font-weight: 600; }
.f-gill       { font-family: "Gill Sans", var(--sans); font-weight: 400; }
.f-next       { font-family: "Helvetica Neue", var(--sans); font-weight: 600; }
.f-garamond   { font-family: "Apple Garamond", Garamond, var(--sans); font-weight: 400; }
.f-sf-pro     { font-family: "SF Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 400; }

/* ---- Layout ---- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.section-sub { color: var(--secondary); font-size: 17px; max-width: 640px; }

/* ---- Nav ---- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: var(--max); margin: 0 auto;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px;
}
.brand { font-family: "Apple Garamond", var(--sans); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand small { color: var(--secondary); font-weight: 400; font-size: 13px; letter-spacing: 0.02em; }
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a, .nav-links button {
  padding: 8px 14px; font-size: 15px; color: var(--ink-2);
  border-radius: 8px; min-height: 40px; display: inline-flex; align-items: center;
}
.nav-links a:hover, .nav-links button:hover { background: var(--bg-subtle); color: var(--ink); }
.nav-links a.active { color: var(--ink); }
.lang-toggle {
  border: 1px solid var(--hairline) !important;
  border-radius: 999px !important;
  font-size: 13px !important; padding: 6px 12px !important; min-height: 34px !important;
  color: var(--ink-2) !important;
}
.lang-toggle:hover { background: var(--bg-subtle) !important; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: #fff;
  border-radius: 999px; padding: 12px 26px;
  font-size: 16px; font-weight: 500; min-height: 48px;
  transition: opacity 0.15s ease;
}
.btn:hover { opacity: 0.85; }
.btn.ghost { background: none; color: var(--ink); border: 1px solid var(--hairline); }
.btn.ghost:hover { background: var(--bg-subtle); opacity: 1; }

/* ---- Home hero ---- */
.hero { text-align: center; padding: 96px 0 64px; }
.hero .eyebrow {
  color: var(--red); text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 13px; font-weight: 600; margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 600; letter-spacing: -0.045em; line-height: 1.02;
  margin-bottom: 16px;
}
.hero .sub { color: var(--secondary); font-size: clamp(18px, 2.4vw, 24px); max-width: 680px; margin: 0 auto 32px; }
.hero .actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---- Stats ---- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--bg); padding: 28px 20px; text-align: center; }
.stat .n { font-size: clamp(28px, 4vw, 40px); font-weight: 600; letter-spacing: -0.03em; }
.stat .l { color: var(--secondary); font-size: 14px; margin-top: 2px; }
.stat--wide { grid-column: 1 / -1; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(5, 1fr); } .stat--wide { grid-column: auto; } }
.owners-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }

/* ---- Timeline ---- */
.timeline { border-left: 1px solid var(--hairline); margin-left: 8px; padding-left: 28px; }
.tl-item { position: relative; padding: 0 0 40px; }
.tl-item::before {
  content: ""; position: absolute; left: -34px; top: 6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ink);
}
.tl-item .years { color: var(--red); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 13px; }
.tl-item h3 { font-size: 22px; margin: 4px 0 4px; }
.tl-item p { color: var(--ink-2); margin: 0; }

/* ---- Cards grid (catalog) ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
@media (min-width: 720px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 28px; } }
.item-card { display: block; }
.item-card .thumb {
  background: var(--bg-subtle); border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.item-card .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.item-card .name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.item-card .meta { color: var(--secondary); font-size: 13px; margin-top: 3px; }
.item-card:hover .thumb img { transform: scale(1.03); }
.item-card .thumb img { transition: transform 0.3s ease; }

/* ---- Catalog controls ---- */
.toolbar { position: sticky; top: var(--nav-h); z-index: 50; background: var(--bg); border-bottom: 1px solid var(--hairline); padding: 14px 0; }
.search {
  width: 100%; padding: 12px 18px 12px 44px;
  border: 1px solid var(--hairline); border-radius: 999px;
  font-size: 17px; font-family: inherit; color: var(--ink); background: var(--bg-subtle);
  min-height: 48px; -webkit-appearance: none; appearance: none;
}
.search:focus { outline: none; border-color: var(--ink); background: #fff; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--secondary); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--hairline); border-radius: 999px;
  padding: 7px 15px; font-size: 14px; color: var(--ink-2); min-height: 36px;
  transition: all 0.12s ease;
}
.chip:hover { border-color: var(--secondary); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip-group-label { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; width: 100%; margin: 6px 0 2px; }
.result-count { color: var(--secondary); font-size: 14px; margin: 16px 0 0; }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.search-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--hairline); border-radius: 999px;
  padding: 10px 18px; font-size: 15px; font-weight: 500;
  color: var(--ink); background: var(--bg); min-height: 44px;
  cursor: pointer; transition: all 0.12s ease;
}
.search-toggle:hover { border-color: var(--ink); }
.search-toggle[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.toolbar-row .result-count { margin: 0; }
.search-panel { position: relative; margin-top: 14px; padding: 14px 16px 8px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--bg); }
.search-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.search-panel-title { font-size: 12px; font-weight: 600; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.1em; }
.search-close { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--hairline); border-radius: 50%; background: var(--bg); color: var(--secondary); cursor: pointer; transition: all 0.12s ease; }
.search-close:hover { border-color: var(--ink); color: var(--ink); }
.sort-row { margin-top: 12px; }
.sort-row label { display: flex; align-items: center; gap: 8px; color: var(--secondary); font-size: 14px; }
.sort-row select { font: inherit; padding: 8px 12px; border: 1px solid var(--hairline); border-radius: 999px; background: #fff; color: var(--ink); }
.cat-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--hairline); }
.cat-bar .chip-group-label { width: auto; margin: 0; margin-right: 4px; }

/* ---- Item detail ---- */
.crumb { padding: 20px 0 0; color: var(--secondary); font-size: 14px; }
.crumb a:hover { color: var(--ink); }
.detail-hero { display: grid; grid-template-columns: 1fr; gap: 32px; padding: 24px 0 40px; align-items: start; }
@media (min-width: 860px) { .detail-hero { grid-template-columns: 1.1fr 1fr; } }
.gallery-main {
  background: var(--bg-subtle); border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
  touch-action: pan-y;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; padding: 20px; user-select: none; -webkit-user-drag: none; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs button { flex: 0 0 64px; height: 64px; border-radius: var(--radius-s); overflow: hidden; background: var(--bg-subtle); border: 2px solid transparent; }
.gallery-thumbs button.on { border-color: var(--ink); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.detail-name { font-size: clamp(30px, 5vw, 44px); line-height: 1.05; margin-bottom: 8px; }
.detail-years { color: var(--secondary); font-size: 18px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 24px; }
.badge { border: 1px solid var(--hairline); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--ink-2); }
.badge .k { color: var(--faint); }

/* Card-style summary (mirrors the physical card) */
.sec-label {
  color: var(--red); text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 13px; font-weight: 700; margin: 28px 0 8px;
}
.summary .history { color: var(--ink-2); max-width: 640px; }
.summary .spec { color: var(--ink-2); line-height: 1.7; }
.summary .dyk { color: var(--ink-2); font-style: italic; max-width: 640px; }

/* Full spec table */
.spec-table { width: 100%; border-collapse: collapse; max-width: 720px; }
.spec-table th, .spec-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--hairline); font-size: 15px; vertical-align: top; }
.spec-table th { color: var(--secondary); font-weight: 500; width: 38%; }
.spec-table td { color: var(--ink); }

/* Prev / next */
.pager { display: flex; justify-content: space-between; gap: 16px; padding: 40px 0 72px; }
.pager a { flex: 1; border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px 20px; min-height: 76px; display: flex; flex-direction: column; justify-content: center; }
.pager a:hover { background: var(--bg-subtle); }
.pager .dir { color: var(--secondary); font-size: 13px; }
.pager .t { font-weight: 600; margin-top: 2px; }
.pager a.next { text-align: right; }

/* ---- Lightbox ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.92);
  display: none; align-items: center; justify-content: center; flex-direction: column;
  touch-action: none;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 82vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lightbox .lb-close {
  position: absolute; top: 18px; right: 18px; color: #fff; font-size: 15px;
  padding: 10px 16px; border: 1px solid rgba(255,255,255,0.3); border-radius: 999px; min-height: 44px;
}
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; font-size: 34px; padding: 16px 20px; min-width: 56px; }
.lightbox .lb-prev { left: 8px; }
.lightbox .lb-next { right: 8px; }
.lightbox .lb-count { color: rgba(255,255,255,0.7); margin-top: 14px; font-size: 14px; }

/* ---- Kiosk (attract) mode ---- */
.kiosk {
  position: fixed; inset: 0; z-index: 300; background: var(--bg);
  display: none; flex-direction: column;
}
.kiosk.open { display: flex; }
.kiosk-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: hidden; }
.kiosk-slide { display: none; width: 100%; height: 100%; text-align: center; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.kiosk-slide.active { display: flex; animation: kfade 0.6s ease; }
@keyframes kfade { from { opacity: 0; } to { opacity: 1; } }
.kiosk-slide img { max-width: 86vw; max-height: 62vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.kiosk-slide .k-name { font-size: clamp(28px, 5vw, 52px); letter-spacing: -0.02em; }
.kiosk-slide .k-meta { color: var(--secondary); font-size: 18px; }
.kiosk-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--hairline);
}
.kiosk-top .brand { font-size: 20px; }
.kiosk-close { border: 1px solid var(--hairline); border-radius: 999px; padding: 8px 16px; min-height: 44px; font-size: 15px; color: var(--ink-2); }
.kiosk-dots { display: flex; gap: 8px; justify-content: center; padding: 18px; }
.kiosk-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--hairline); }
.kiosk-dots span.on { background: var(--ink); }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--hairline); padding: 48px 0 64px; color: var(--secondary); font-size: 14px; }
.footer .wrap { display: flex; flex-direction: column; gap: 16px; }
.footer .brand { font-size: 20px; }
.footer a { color: var(--ink); }
.footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink); margin-bottom: 12px; }
.footer li { list-style: none; margin: 6px 0; }

/* ---- Utility ---- */
.hidden { display: none !important; }
.lang-zh { display: none; }
html[lang="zh-Hant"] .lang-en { display: none; }
html[lang="zh-Hant"] .lang-zh { display: revert; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
