/* ===== Tokens ===== */
:root {
  --bg: #0a0a0b;
  --surface: #131315;
  --surface-2: #1b1b1e;
  --line: #2a2825;
  --text: #f3efe6;
  --muted: #a39d92;
  --gold: #c9a45c;          /* gold on dark */
  --gold-bright: #e3c37f;
  --gold-btn: #c9a45c;
  --on-gold: #0a0a0b;
  --gold-grad: linear-gradient(135deg, #e7cb8a 0%, #c9a45c 45%, #9e7a36 100%);
  --header-bg: rgba(10, 10, 11, .86);
  --map-filter: grayscale(.5) invert(.9) hue-rotate(180deg);
  --shadow: 0 18px 40px -24px rgba(0,0,0,.8);
  --radius: 4px;
  --max: 1180px;
  --font-display: "Cormorant Garamond", "Noto Serif SC", Georgia, serif;
  --font-body: "Manrope", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --surface-2: #f0e9db;
  --line: #e1d6c1;
  --text: #1a1712;
  --muted: #6b6255;
  --gold: #8a6a2b;          /* darker gold for text contrast on ivory */
  --gold-bright: #a27c33;
  --gold-btn: #c9a45c;
  --on-gold: #1a1712;
  --header-bg: rgba(247, 243, 234, .9);
  --map-filter: grayscale(.3);
  --shadow: 0 18px 40px -26px rgba(60,45,20,.35);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f3ea; --surface: #fffdf8; --surface-2: #f0e9db; --line: #e1d6c1;
    --text: #1a1712; --muted: #6b6255; --gold: #8a6a2b; --gold-bright: #a27c33; --gold-btn: #c9a45c;
    --on-gold: #1a1712; --header-bg: rgba(247, 243, 234, .9); --map-filter: grayscale(.3);
    --shadow: 0 18px 40px -26px rgba(60,45,20,.35);
    color-scheme: light;
  }
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; padding-bottom: 76px;
  transition: background-color .25s, color .25s;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: .005em; }
:lang(zh-Hans) h1, :lang(zh-Hans) h2 { letter-spacing: .04em; font-weight: 700; }
::selection { background: var(--gold-btn); color: #0a0a0b; }

/* ===== Header ===== */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 14px; }
.logo { display: flex; align-items: center; text-decoration: none; flex: none; }
.logo-img { height: 32px; width: auto; }
:root[data-theme="light"] .logo-img { filter: invert(1); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .logo-img { filter: invert(1); } }
.logo-text, .banner-fallback { font-family: "Alfa Slab One", Georgia, serif; color: var(--text); line-height: 1; letter-spacing: .01em; }
.logo-text { font-size: 1.4rem; }
.logo-text i, .banner-fallback i { font-style: normal; }
.logo-img + .logo-text { display: none; }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { text-decoration: none; color: var(--muted); font-size: .9rem; letter-spacing: .02em; }
.nav a:hover { color: var(--text); }
.nav .member-link { color: var(--gold); font-weight: 700; }
.tools { display: flex; align-items: center; gap: 8px; flex: none; }
.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang-switch button { border: 0; background: none; color: var(--muted); font: 600 .78rem var(--font-body); padding: 5px 9px; border-radius: 999px; cursor: pointer; letter-spacing: .04em; }
.lang-switch button[aria-pressed="true"] { background: var(--gold-btn); color: #0a0a0b; }
.theme-toggle { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--text); cursor: pointer; display: grid; place-items: center; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .moon { display: none; }
}
@media (max-width: 1020px) { .nav a:not(.member-link) { display: none; } }
@media (max-width: 520px) { .nav { display: none; } .logo-text { font-size: 1.2rem; } }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 26px; border-radius: var(--radius);
  font: 700 .92rem var(--font-body); letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  border: 1px solid transparent; cursor: pointer; transition: filter .15s, background .15s, border-color .15s, color .15s;
}
:lang(zh-Hans) .btn { letter-spacing: .08em; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-gold { background: var(--gold-grad); color: #0a0a0b; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-outline { border-color: var(--gold); color: var(--text); background: transparent; }
.btn-outline:hover { background: color-mix(in srgb, var(--gold-btn) 12%, transparent); }
.btn-sm { padding: 11px 16px; font-size: .8rem; }

/* ===== Hero ===== */
.hero { padding: 0 0 64px; }
.hero-banner { position: relative; max-width: 1440px; margin: 0 auto; aspect-ratio: 16 / 9; max-height: 70vh; overflow: hidden; background: #000; }
.hero-banner img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 59%; }
.hero-banner::after { content: ""; position: absolute; inset: auto 0 0 0; height: 32%; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.banner-fallback { display: none; }
.hero-banner.missing img { display: none; }
.hero-banner.missing .banner-fallback {
  display: flex; align-items: center; justify-content: center; position: absolute; inset: 0;
  color: #f3efe6; font-size: clamp(2.6rem, 11vw, 8rem);
  background: radial-gradient(55% 60% at 75% 35%, rgba(227,195,127,.22), transparent 60%), #000;
}
.hero-copy { position: relative; margin-top: 8px; }
.eyebrow { display: inline-flex; align-items: center; gap: 12px; color: var(--gold); font: 700 .74rem var(--font-body); letter-spacing: .22em; text-transform: uppercase; margin-bottom: 18px; }
.eyebrow::before { content: ""; width: 36px; height: 1px; background: var(--gold); }
.hero h1 { font-size: clamp(2.2rem, 5.4vw, 4.2rem); line-height: 1.06; margin: 0 0 12px; max-width: 18ch; }
.hero .h1-sub { font-family: var(--font-display); font-style: italic; font-size: clamp(1.1rem, 2.2vw, 1.5rem); color: var(--gold); margin: 0 0 22px; }
.hero p.lead { max-width: 60ch; font-size: 1.05rem; color: var(--muted); margin: 0 0 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-meta { margin-top: 26px; color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.hero-meta a { color: var(--text); text-decoration-color: var(--gold); }

.brands { margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--line); }
.brand-list { list-style: none; margin: 14px 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 0; }
.brand-list li { font-family: var(--font-display); font-size: clamp(1.15rem, 2.2vw, 1.5rem); color: var(--muted); padding: 0 18px; border-left: 1px solid var(--line); line-height: 1.2; }
.brand-list li:first-child { padding-left: 0; border-left: 0; }
.brand-list li.hl { color: var(--gold); font-weight: 700; }
.brands .hint { font-size: .74rem; }

/* ===== Sections ===== */
section.block { padding: 84px 0; border-top: 1px solid var(--line); }
.sec-head { margin-bottom: 34px; }
.sec-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); margin: 6px 0 8px; line-height: 1.12; }
.sec-head p { margin: 0; color: var(--muted); max-width: 64ch; }
.kicker { color: var(--gold); font: 700 .72rem var(--font-body); letter-spacing: .22em; text-transform: uppercase; }

/* ===== Parts finder ===== */
.finder { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; }
@media (max-width: 900px) { .finder { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 26px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 14px; font-size: 1.35rem; }
.step { color: var(--gold); margin-right: 8px; font-style: italic; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: 8px 14px; border-radius: 999px; font: 500 .88rem var(--font-body); cursor: pointer; }
.chip small { color: var(--muted); margin-left: 5px; }
.chip:hover { border-color: var(--gold); }
.chip[aria-pressed="true"] { background: var(--gold-btn); color: #0a0a0b; border-color: var(--gold-btn); font-weight: 700; }
.chip[aria-pressed="true"] small { color: #3a3020; }
.field { margin-top: 16px; }
.field label { display: block; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 4px; padding: 12px; font: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.summary { margin-top: 18px; background: var(--bg); border: 1px dashed var(--line); border-radius: 4px; padding: 12px 14px; font-size: .88rem; color: var(--muted); white-space: pre-line; }
.finder-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }

/* ===== Parts catalog (uploaded) ===== */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.catalog { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1000px) { .catalog { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .catalog { grid-template-columns: repeat(2, 1fr); } }
.part { padding: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; overflow: hidden; cursor: pointer; text-align: left; color: var(--text); font: inherit; display: flex; flex-direction: column; }
.part:hover { border-color: var(--gold); }
.part img { aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--surface-2); }
.part span { display: block; padding: 10px 12px 2px; font-weight: 600; font-size: .9rem; line-height: 1.35; }
.part small { display: block; padding: 0 12px 12px; color: var(--gold); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
.catalog-empty { grid-column: 1 / -1; padding: 48px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; }
dialog.lightbox { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 0; border-radius: 8px; max-width: min(920px, calc(100vw - 24px)); width: 100%; }
dialog.lightbox::backdrop { background: rgba(0,0,0,.78); }
.lightbox img { width: 100%; max-height: 70vh; object-fit: contain; background: #000; }
.lb-body { padding: 18px 20px 20px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; }
.lb-body h3 { margin: 0; font-size: 1.4rem; }
.lb-body p { margin: 2px 0 0; color: var(--gold); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.lb-close { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.3rem; cursor: pointer; }

/* ===== Workshop & cars showcase ===== */
.showcase { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 220px; gap: 10px; }
.showcase .part { border-radius: 4px; }
.showcase .part img { aspect-ratio: auto; height: 100%; }
.showcase .part:first-child { grid-column: span 2; grid-row: span 2; }
@media (max-width: 800px) { .showcase { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 160px; } }

/* ===== Customer gallery ===== */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .gallery { grid-template-columns: 1fr; } }
.case { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.case-img { aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--surface-2), var(--bg) 75%); position: relative; }
.case-img img { width: 100%; height: 100%; object-fit: cover; }
.case-img .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .82rem; }
.tag { position: absolute; top: 12px; left: 12px; background: var(--gold-btn); color: #0a0a0b; font: 700 .72rem var(--font-body); letter-spacing: .06em; padding: 4px 9px; border-radius: 2px; }
.case-body { padding: 16px 18px 18px; }
.case-body h3 { margin: 0; font-size: 1.25rem; }

/* ===== Videos & social ===== */
.videos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .videos { grid-template-columns: 1fr; } }
.video { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.video-frame { aspect-ratio: 16 / 9; background: #000; position: relative; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-frame button { position: absolute; inset: 0; width: 100%; border: 0; cursor: pointer; background-size: cover; background-position: center; }
.video-frame .play { width: 62px; height: 62px; border-radius: 50%; background: var(--gold-grad); display: grid; place-items: center; margin: auto; }
.video-frame .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #77716a; font-size: .82rem; background: linear-gradient(135deg, #1a1a1d, #0b0b0c); }
.video h3 { margin: 0; padding: 14px 16px; font-size: 1.15rem; }
.socials { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.social { padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--surface); font-size: .88rem; }
.social:hover { border-color: var(--gold); }
.social.disabled { opacity: .5; }

/* ===== Members teaser ===== */
.members {
  border: 1px solid var(--gold); border-radius: 8px; padding: 38px;
  background: radial-gradient(80% 120% at 0% 0%, color-mix(in srgb, var(--gold-btn) 16%, transparent), transparent 60%), var(--surface);
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: center;
}
@media (max-width: 860px) { .members { grid-template-columns: 1fr; padding: 24px; } }
.members h2 { margin: 6px 0 12px; font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.members ul { margin: 0; padding-left: 18px; color: var(--muted); }
.members li::marker { color: var(--gold); }
.event { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 20px; }
.event .date { display: inline-block; color: var(--gold); border: 1px solid var(--gold); font: 700 .72rem var(--font-body); letter-spacing: .1em; text-transform: uppercase; padding: 3px 9px; border-radius: 2px; }
.event h3 { margin: 12px 0 4px; font-size: 1.35rem; }
.event p { margin: 0 0 16px; color: var(--muted); font-size: .9rem; }

/* ===== Store ===== */
.store { display: grid; grid-template-columns: 1fr 1.2fr; gap: 22px; }
@media (max-width: 860px) { .store { grid-template-columns: 1fr; } }
.info dl { margin: 0; display: grid; gap: 18px; }
.info dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: var(--gold); font-weight: 700; }
.info dd { margin: 3px 0 0; font-size: 1rem; }
.info dd small { color: var(--muted); }
.hours { border-collapse: collapse; }
.hours td { padding: 2px 18px 2px 0; }
.info .btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.map { border-radius: 6px; overflow: hidden; border: 1px solid var(--line); min-height: 320px; background: var(--surface); }
.map iframe { width: 100%; height: 100%; min-height: 320px; border: 0; filter: var(--map-filter); }

/* ===== Footer ===== */
footer { border-top: 1px solid var(--line); padding: 30px 0 38px; color: var(--muted); font-size: .84rem; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }

/* ===== Mobile action bar ===== */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: none; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--header-bg); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.action-bar .btn { padding: 13px 10px; }
@media (max-width: 860px) { .action-bar { display: grid; } }
@media (min-width: 861px) { body { padding-bottom: 0; } }

/* ===== Admin ===== */
.admin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 18px; }
.admin-item { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface-2); font-size: .82rem; }
.admin-item img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.admin-item div { padding: 8px 10px; }
.admin-item button { width: 100%; border: 0; border-top: 1px solid var(--line); background: none; color: #d4574e; padding: 8px; cursor: pointer; font: 600 .8rem var(--font-body); }
.status { margin-top: 12px; font-size: .88rem; min-height: 1.4em; }
.status.err { color: #e5675d; }
.status.ok { color: var(--gold); }
