/* ============================================================
   HORACE COMPONENTS — 共用積木箱
   ============================================================
   Canonical: horace-portfolio-cf/components.css
   Copy to:   horace-music/components.css (同步)

   點用:
     1. 每個 site 先 link tokens.css（顏色/字體/間距 token）
     2. 再 link components.css（呢個 — 所有積木）
     3. HTML 用下面嘅 class 砌頁面，唔好自己發明樣式

   改法:
     - 改 brand 色 → tokens.css（淨係嗰度）
     - 改積木形狀 → 呢度（一次改，所有 site 跟住變）
     - 新積木 → 喺對應 section 加，喺 showcase.html 加示範

   依賴: tokens.css（必須先 load）
   ============================================================ */

/* ── 0. Base ──────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--px-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--bg); }

/* ── 1. Layout primitives ─────────────────────────────────── */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 28px; }
.section { padding: 120px 0; border-top: 1px solid var(--line); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 64px; gap: 24px; }
.sec-head h2 {
  font-size: var(--px-2xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 1;
  text-wrap: balance;
}
.sec-head .idx { color: var(--accent); }

/* ── 2. Type helpers ──────────────────────────────────────── */
.mono {
  font-family: var(--font-mono);
  font-size: var(--px-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.accent { color: var(--accent); }

/* ── 3. Actions / buttons ─────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 16px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: var(--px-sm);
  letter-spacing: 0.04em;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn-solid:hover { background: transparent; color: var(--accent); }

/* ── 4. Navigation ────────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 28px;
  background: linear-gradient(to bottom, rgba(13,13,15,0.9), rgba(13,13,15,0));
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
nav.scrolled { border-bottom: 1px solid var(--line); }
nav .logo { font-weight: 700; letter-spacing: 0.06em; text-decoration: none; color: var(--text); font-size: var(--px-sm); text-transform: uppercase; }
nav .links a { color: var(--muted); text-decoration: none; font-size: var(--px-sm); margin-left: 32px; letter-spacing: 0.04em; transition: color 0.2s; position: relative; }
nav .links a:hover { color: var(--accent); }
nav .links a::after { content: ""; position: absolute; left: 0; bottom: -4px; width: 0; height: 1px; background: var(--gold); transition: width 0.3s; }
nav .links a:hover::after { width: 100%; }

/* ── 5. Hero ──────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
  padding: 140px 0 80px;
  overflow: hidden;
}
.hero .bg-glow {
  position: absolute; inset: -20%;
  background:
    radial-gradient(ellipse 60% 50% at 75% 20%, rgba(224,92,60,0.10), transparent 60%),
    radial-gradient(ellipse 50% 40% at 15% 75%, rgba(242,239,233,0.06), transparent 60%);
  z-index: 0;
  transform: translateY(0);
  will-change: transform;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(50% 40% at 30% 25%, rgba(217,164,65,0.16), transparent 65%),
    radial-gradient(45% 35% at 75% 80%, rgba(217,164,65,0.10), transparent 65%);
  animation: drift 16s ease-in-out infinite;
}
.hero > * { position: relative; z-index: 1; }
.hero .tag { margin-bottom: 44px; }
.hero h1 {
  font-size: var(--px-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.9;
  text-transform: uppercase;
  text-wrap: balance;
  background: linear-gradient(110deg, var(--paper) 25%, var(--gold) 50%, var(--paper) 75%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  animation: shine 7s linear infinite;
}
.hero h1 .line2 { color: var(--muted); }
.hero .sub { max-width: 620px; color: var(--muted); font-size: var(--px-lg); margin-top: 44px; line-height: 1.45; }
.hero .sub strong { color: var(--text); font-weight: 600; }
.hero .quote { font-family: 'Archivo', sans-serif; font-size: var(--px-xl); font-weight: 500; font-style: normal; line-height: 1.25; letter-spacing: -0.015em; max-width: 600px; margin-top: 40px; color: var(--text); }
.hero .ctas { margin-top: 48px; display: flex; gap: 16px; flex-wrap: wrap; }
.hero-proof { margin-top: 36px; font-size: var(--px-sm); letter-spacing: 0.14em; color: var(--muted); }
.hero-proof .dot { color: var(--accent); margin: 0 8px; }
@supports not (background-clip: text) {
  .hero h1 { color: var(--text); -webkit-text-fill-color: initial; background: none; animation: none; }
  .hero h1 .line2 { color: var(--muted); -webkit-text-fill-color: initial; }
}

/* ── 6. Track list (two-column editorial) ─────────────────── */
.tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.track { border-top: 1px solid var(--line); padding-top: 28px; }
.track .num { color: var(--accent); margin-bottom: 16px; }
.track h3 { font-size: var(--px-xl); font-weight: 600; text-transform: uppercase; letter-spacing: 0.01em; margin-bottom: 14px; }
.track p { color: var(--muted); margin-bottom: 28px; max-width: 46ch; }
.track ul { list-style: none; }
.track li { padding: 16px 0; border-bottom: 1px solid var(--line); font-size: var(--px-base); display: flex; justify-content: space-between; gap: 16px; }
.track li .lbl { color: var(--text); }
.track li .lvl { color: var(--muted); font-family: var(--font-mono); font-size: var(--px-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lvl.hi { color: var(--accent); }

/* ── 7. Work list (editorial rows + media) ────────────────── */
.work-group { margin-bottom: 56px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 0 10px; border-top: 2px solid var(--text); margin-bottom: 4px; }
.group-name { font-family: var(--font-mono); font-size: var(--px-sm); letter-spacing: 0.16em; color: var(--accent); }
.group-desc { color: var(--muted); font-size: var(--px-sm); }
.work-list { border-top: 1px solid var(--line); }
.work-item { border-bottom: 1px solid var(--line); }
.work-row {
  display: grid; grid-template-columns: 72px 1.6fr 1fr auto;
  gap: 24px; align-items: baseline;
  padding: 32px 0;
  text-decoration: none; color: var(--text);
  transition: padding-left 0.3s ease;
}
.work-item:hover .work-row { padding-left: 16px; }
.work-row .idx { font-family: var(--font-mono); color: var(--muted); font-size: var(--px-sm); }
.work-row .title { font-size: var(--px-lg); font-weight: 600; letter-spacing: -0.01em; }
.work-item:hover .work-row .title { color: var(--gold); transition: color 0.25s; }
.work-row .title .field { display: block; color: var(--muted); font-size: var(--px-sm); font-weight: 400; font-family: var(--font-mono); margin-top: 6px; letter-spacing: 0.08em; text-transform: uppercase; }
.work-row .desc { color: var(--muted); font-size: var(--px-base); }
.work-row .metric { font-family: var(--font-mono); font-size: var(--px-sm); color: var(--accent); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Media panel */
.media {
  position: relative;
  height: 180px;
  border-radius: var(--radius-sm);
  margin: 4px 0 24px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: var(--px-sm);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(242,239,233,0.55);
  background:
    linear-gradient(145deg, rgba(217,164,65,0.10) 0%, transparent 55%),
    linear-gradient(145deg, #1b1b1f, #121214);
  border: 1px solid var(--line);
  overflow: hidden;
}
.media .lbl { opacity: 1; transition: color 0.3s; }
.media:hover .lbl { color: var(--accent); }
.media.has-thumb { background-size: cover; background-position: center; }
.media.no-link { opacity: 0.5; }
.media.no-link .lbl { opacity: 1; }
.media.no-link:hover { opacity: 0.75; }
.media::before {
  content: ""; position: absolute; inset: -40%;
  background: linear-gradient(115deg, transparent 32%, rgba(242,239,233,0.07) 46%, transparent 60%);
  transform: translateX(-65%); transition: transform 1.1s ease;
  pointer-events: none;
}
.media:hover::before { transform: translateX(65%); }
.media:hover { border-color: var(--gold-soft); transform: translateY(-2px); transition: transform 0.3s, border-color 0.3s; }

/* ── 8. Notes (curator / exhibit) ─────────────────────────── */
.curator-note { border-left: 2px solid var(--accent); padding: 8px 0 8px 24px; margin-bottom: 64px; max-width: 640px; }
.curator-note .quote { font-family: 'Archivo', sans-serif; font-size: var(--px-lg); font-weight: 500; font-style: normal; line-height: 1.4; letter-spacing: -0.01em; margin-top: 14px; }
.exhibit-note { margin-bottom: 18px; }
.exhibit-label { color: var(--accent); font-size: var(--px-sm); letter-spacing: 0.14em; margin-bottom: 6px; }
.exhibit-note p { color: var(--muted); font-size: var(--px-base); line-height: 1.55; max-width: 60ch; }

/* ── 9. Contact ───────────────────────────────────────────── */
.contact { padding: 160px 0; border-top: 1px solid var(--line); }
.contact .mono { margin-bottom: 28px; }
.contact h2 { font-size: var(--px-2xl); font-weight: 600; text-transform: uppercase; line-height: 0.95; letter-spacing: -0.01em; max-width: 14ch; text-wrap: balance; }
.contact .email { display: inline-block; margin-top: 48px; color: var(--accent); text-decoration: none; font-size: var(--px-lg); border-bottom: 1px solid var(--accent); padding-bottom: 4px; }
.contact .socials { margin-top: 28px; color: var(--muted); }
.contact .socials a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.contact .socials a:hover { color: var(--accent); border-color: var(--accent); }

/* ── 10. Motion ───────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }
.scroll-hint { position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%); font-size: var(--px-sm); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); animation: pulse 2.4s ease-in-out infinite; }

@keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes drift { 0%,100% { transform: translate(0,0); } 50% { transform: translate(4%, -3%); } }
@keyframes shine { 0% { background-position: 200% center; } 100% { background-position: -200% center; } }

/* ── 11. Modal (case study) ───────────────────────────────── */
.modal { display: none; position: fixed; inset: 0; z-index: 200; align-items: center; justify-content: center; padding: 24px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(13,13,15,0.85); backdrop-filter: blur(6px); }
.modal-panel {
  position: relative; z-index: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  max-width: 720px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  padding: 48px;
}
.modal-close { position: absolute; top: 16px; right: 20px; background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.modal-close:hover { color: var(--accent); }
