/* ============================================
   初音設計 — Design System
   雜誌編輯風 / 黑灰白高級感
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;600;700;900&family=Noto+Serif+TC:wght@400;600;700&family=Inter:wght@300;400;500;600;700;800;900&family=Playfair+Display:wght@400;500;600;700;800;900&family=Cormorant+Garamond:wght@300;400;500;600;700&display=swap');

:root {
  /* ----- Colors: Black / Gray / White ----- */
  --c-bg: #FAFAF8;
  --c-bg-alt: #F2F2F0;
  --c-bg-dark: #0A0A0A;
  --c-bg-darker: #050505;
  --c-surface: #FFFFFF;
  --c-surface-2: #EFEFED;

  --c-ink: #0A0A0A;
  --c-ink-2: #1A1A1A;
  --c-ink-3: #3A3A3A;
  --c-muted: #5C5C5C;       /* WCAG AA on light bg */
  --c-muted-2: #757575;     /* AA on light bg, 4.6:1 */
  --c-line: #D8D8D6;
  --c-line-2: #E8E8E6;

  /* on-dark */
  --c-ink-on-dark: #FAFAF8;
  --c-muted-on-dark: #A8A8A6;
  --c-line-on-dark: #2A2A2A;

  /* ----- Accent (switchable: gold / copper / silver) ----- */
  --c-accent: oklch(0.75 0.11 85);  /* gold default */
  --c-accent-ink: #0A0A0A;

  /* ----- Type ----- */
  --f-sans: "Inter", "Noto Sans TC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-display: "Inter", "Noto Sans TC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-serif: "Playfair Display", "Cormorant Garamond", "Noto Serif TC", Georgia, serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* ----- Spacing scale (density-aware) ----- */
  --density: 1;
  --s-1: calc(4px * var(--density));
  --s-2: calc(8px * var(--density));
  --s-3: calc(12px * var(--density));
  --s-4: calc(16px * var(--density));
  --s-5: calc(24px * var(--density));
  --s-6: calc(32px * var(--density));
  --s-7: calc(48px * var(--density));
  --s-8: calc(64px * var(--density));
  --s-9: calc(96px * var(--density));
  --s-10: calc(128px * var(--density));
  --s-11: calc(160px * var(--density));

  /* ----- Layout ----- */
  --container-max: 1440px;
  --container-pad: clamp(20px, 4vw, 64px);
  --nav-h: 72px;

  /* ----- Motion ----- */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  --t-fast: 180ms;
  --t-med: 380ms;
  --t-slow: 700ms;
}

/* ----- Theme: dark ----- */
[data-theme="dark"] {
  --c-bg: #0A0A0A;
  --c-bg-alt: #121212;
  --c-bg-dark: #FAFAF8;
  --c-bg-darker: #FFFFFF;
  --c-surface: #141414;
  --c-surface-2: #1C1C1C;

  --c-ink: #FAFAF8;
  --c-ink-2: #EFEFED;
  --c-ink-3: #C8C8C6;
  --c-muted: #9A9A9A;
  --c-muted-2: #6B6B6B;
  --c-line: #2A2A2A;
  --c-line-2: #1F1F1F;

  --c-ink-on-dark: #0A0A0A;
  --c-muted-on-dark: #6B6B6B;
  --c-line-on-dark: #D8D8D6;
}

/* ----- Accent variants ----- */
[data-accent="gold"]   { --c-accent: oklch(0.75 0.11 85); }
[data-accent="copper"] { --c-accent: oklch(0.62 0.12 45); }
[data-accent="silver"] { --c-accent: oklch(0.78 0.01 250); }

/* ----- Density variants ----- */
[data-density="compact"]    { --density: 0.82; }
[data-density="comfortable"]{ --density: 1; }
[data-density="spacious"]   { --density: 1.18; }

/* ----- Font set variants ----- */
[data-fontset="modern"] {
  --f-sans: "Inter", "Noto Sans TC", "Helvetica Neue", sans-serif;
  --f-display: "Inter", "Noto Sans TC", "Helvetica Neue", sans-serif;
}
[data-fontset="editorial"] {
  --f-sans: "Inter", "Noto Sans TC", sans-serif;
  --f-display: "Playfair Display", "Noto Serif TC", serif;
}
[data-fontset="mixed"] {
  --f-sans: "Noto Sans TC", "Inter", sans-serif;
  --f-display: "Cormorant Garamond", "Noto Serif TC", serif;
}

/* ============================================
   RESET + BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.75;
  text-wrap: pretty;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--t-med) var(--ease), color var(--t-med) var(--ease);
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--c-ink); color: var(--c-bg); }

/* ============================================
   TYPOGRAPHY
   ============================================ */
.eyebrow {
  font-family: var(--f-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-muted);
}
.eyebrow-accent { color: var(--c-accent); }

.display-xxl {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(56px, 11vw, 200px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  margin: 0;
}
.display-xl {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(40px, 5.6vw, 88px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}
.display-l {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-wrap: balance;
  margin: 0;
}
.display-m {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(28px, 3.5vw, 48px);
  line-height: 1.25;
  letter-spacing: 0;
  text-wrap: balance;
  margin: 0;
}
.h1 { font-size: clamp(30px, 3.6vw, 48px); font-weight: 700; line-height: 1.25; letter-spacing: 0; text-wrap: balance; margin: 0; }
.h2 { font-size: clamp(22px, 2.4vw, 32px); font-weight: 600; line-height: 1.3; letter-spacing: 0; text-wrap: balance; margin: 0; }
.h3 { font-size: clamp(18px, 1.4vw, 22px); font-weight: 600; line-height: 1.4; margin: 0; }
.body-l { font-size: 17px; line-height: 1.85; letter-spacing: 0.02em; color: var(--c-ink-3); }
.body { font-size: 15px; line-height: 1.8; letter-spacing: 0.02em; color: var(--c-ink-3); }
.body-s { font-size: 14px; line-height: 1.7; letter-spacing: 0.01em; color: var(--c-muted); }
.serif { font-family: var(--f-serif); font-style: italic; }

/* 中文標題優先在標點處換行，真的放不下才拆字 */
.display-xxl, .display-xl, .display-l, .display-m, .h1, .h2 { word-break: keep-all; overflow-wrap: anywhere; }

.zh { font-family: "Noto Sans TC", var(--f-sans); }
.en { font-family: var(--f-sans); }

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}
.container-wide {
  max-width: 1680px;
  margin: 0 auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}
.section { padding: var(--s-10) 0; }
.section-sm { padding: var(--s-9) 0; }

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--s-5);
}

.divider { height: 1px; background: var(--c-line); border: 0; margin: 0; }
.divider-ink { height: 1px; background: var(--c-ink); border: 0; margin: 0; }

/* ============================================
   COMPONENTS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 28px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--c-ink);
  background: var(--c-ink);
  color: var(--c-bg);
  border-radius: 0;
  cursor: pointer;
  transition: all var(--t-med) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: transparent; color: var(--c-ink); }
.btn-outline { background: transparent; color: var(--c-ink); }
.btn-outline:hover { background: var(--c-ink); color: var(--c-bg); }
.btn-ghost { background: transparent; border-color: var(--c-line); color: var(--c-ink); }
.btn-ghost:hover { border-color: var(--c-ink); }
.btn-accent { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-accent-ink); }
.btn-accent:hover { background: transparent; color: var(--c-ink); border-color: var(--c-ink); }
.btn-sm { height: 38px; padding: 0 18px; font-size: 13px; }
.btn-lg { height: 56px; padding: 0 36px; font-size: 14px; }

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-ink);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--c-ink);
  cursor: pointer;
  transition: gap var(--t-med) var(--ease);
}
.btn-text:hover { gap: 16px; }

/* Tag / Pill */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--c-line);
  color: var(--c-muted);
  border-radius: 0;
  background: transparent;
}
.tag-solid { background: var(--c-ink); color: var(--c-bg); border-color: var(--c-ink); }
.tag-accent { background: var(--c-accent); color: var(--c-accent-ink); border-color: var(--c-accent); }

/* Card */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease);
}
.card:hover { border-color: var(--c-ink); }

/* Image placeholder treatment */
.img-wrap {
  position: relative;
  overflow: hidden;
  background: var(--c-surface-2);
}
.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow) var(--ease);
}
.img-wrap:hover img { transform: scale(1.04); }
.img-ratio-1\/1 { aspect-ratio: 1/1; }
.img-ratio-3\/4 { aspect-ratio: 3/4; }
.img-ratio-4\/5 { aspect-ratio: 4/5; }
.img-ratio-4\/3 { aspect-ratio: 4/3; }
.img-ratio-16\/9 { aspect-ratio: 16/9; }
.img-ratio-21\/9 { aspect-ratio: 21/9; }
.img-ratio-2\/3 { aspect-ratio: 2/3; }

/* Marquee */
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.marquee {
  display: flex;
  white-space: nowrap;
  animation: marquee 40s linear infinite;
}

/* Reveal */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
.fade-up { animation: fadeUp 800ms var(--ease) both; }

/* Form */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--c-ink-3);
}
.field-input,
.field-textarea,
.field-select {
  height: 52px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--c-line);
  color: var(--c-ink);
  font-size: 15px;
  outline: none;
  transition: border-color var(--t-fast) var(--ease);
  border-radius: 0;
}
.field-textarea { min-height: 140px; padding: 14px 16px; resize: vertical; }
.field-input:focus, .field-textarea:focus, .field-select:focus { border-color: var(--c-ink); }
.field-input:focus-visible,
.field-textarea:focus-visible,
.field-select:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
.field-input.has-error,
.field-textarea.has-error,
.field-select.has-error { border-color: oklch(0.55 0.2 27); }
.field-error {
  font-size: 12px;
  color: oklch(0.55 0.2 27);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* utility */
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); } .gap-5 { gap: var(--s-5); } .gap-6 { gap: var(--s-6); }
.text-muted { color: var(--c-muted); }
.text-accent { color: var(--c-accent); }
.text-center { text-align: center; }
.uppercase { text-transform: uppercase; letter-spacing: 0.18em; }
.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); }
.mt-7 { margin-top: var(--s-7); } .mt-8 { margin-top: var(--s-8); }

/* Scrollbar (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--c-bg); }
::-webkit-scrollbar-thumb { background: var(--c-line); }
::-webkit-scrollbar-thumb:hover { background: var(--c-muted); }

/* ============================================
   A11Y: focus-visible / sr-only / no-scroll lock
   ============================================ */
:where(button, a, .chip, .nav-link, .btn, .btn-text, .icon-btn, .product-add, .qty-btn,
       .product-card, .designer-card, .style-tile, .project-card, .quiz-option,
       .footer-list a, .mobile-nav-link):focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.icon-btn:focus-visible { outline-offset: -2px; }
button:disabled, [disabled] { cursor: not-allowed; }

/* Screen reader only */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Body scroll lock when drawer/menu open */
body.no-scroll { overflow: hidden; touch-action: none; }

/* Global toast */
.global-toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--c-ink);
  color: var(--c-bg);
  padding: 14px 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 9999;
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
  animation: toastIn 220ms var(--ease) both;
  pointer-events: none;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================
   A11Y: prefers-reduced-motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .marquee { animation: none !important; }
  .img-wrap:hover img,
  .style-tile:hover img,
  .svc-card:hover { transform: none !important; }
}
