/* ==========================================================
   Roland Yang — Portfolio
   ========================================================== */
:root {
  --bg: #0b0b0d;
  --surface: #141417;
  --surface-2: #1c1c20;
  --line: rgba(255, 255, 255, 0.09);
  --text: #ececec;
  --muted: #8d8d96;
  --accent: #ff5b2e;
  --accent-soft: rgba(255, 91, 46, 0.14);
  --radius: 14px;
  --maxw: 1320px;
  --gutter: clamp(16px, 4vw, 48px);
  --font-display: "Space Grotesk", "Noto Sans TC", system-ui, sans-serif;
  --font-body: "Inter", "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: rgba(11, 11, 13, 0.72);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700;
}
.brand small { color: var(--muted); font-weight: 400; margin-left: 2px; }
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 8px 14px; border-radius: 999px; color: var(--muted); font-size: 15px;
  transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); background: var(--surface-2); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: min(88vh, 860px); display: flex; align-items: flex-end; overflow: hidden; margin-top: -68px; padding-top: 68px; }
.hero-media { position: absolute; inset: 0; z-index: -1; }
.hero-media video, .hero-media img { width: 100%; height: 100%; object-fit: cover; opacity: .42; }
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,11,13,.55) 0%, rgba(11,11,13,.15) 40%, rgba(11,11,13,.92) 88%, var(--bg) 100%),
    radial-gradient(ellipse at 20% 80%, rgba(255,91,46,.12), transparent 60%);
}
.hero .wrap { width: 100%; padding-bottom: clamp(48px, 8vh, 96px); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--accent); }
.hero h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(56px, 11vw, 168px); line-height: .92; letter-spacing: -.035em;
  margin: 18px 0 20px;
}
.hero h1 .zh { display: block; font-size: .3em; letter-spacing: .08em; color: var(--muted); font-weight: 400; margin-top: .45em; }
.roles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip {
  display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: 14px; color: var(--text);
}
.hero-bottom { display: grid; grid-template-columns: minmax(0, 620px) auto; gap: 32px; align-items: end; justify-content: space-between; }
.hero p.lead { font-size: clamp(16px, 1.6vw, 19px); color: #c9c9cf; margin: 0; max-width: 620px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 15px;
  transition: transform .2s, background .2s, border-color .2s; cursor: pointer;
}
.btn:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.22); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ff6d44; }
.btn svg { width: 16px; height: 16px; }

/* ---------- Work grid ---------- */
.section { padding: clamp(56px, 9vw, 120px) 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 36px; }
.section-head h2 { font-family: var(--font-display); font-size: clamp(32px, 4.4vw, 56px); line-height: 1; letter-spacing: -.02em; margin: 10px 0 0; font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: 14px; cursor: pointer; transition: all .2s;
}
.filters button:hover { color: var(--text); border-color: rgba(255,255,255,.2); }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filters .count { opacity: .55; margin-left: 4px; font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.8vw, 24px); }
.card { position: relative; display: block; border-radius: var(--radius); overflow: hidden; background: var(--surface); isolation: isolate; }
.card.hidden { display: none; }
.card .thumb { aspect-ratio: 1 / 1; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s cubic-bezier(.2,.7,.2,1), filter .5s; }
.card:hover .thumb img { transform: scale(1.05); filter: brightness(.7); }
.card .info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 22px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.82));
  display: flex; justify-content: space-between; align-items: end; gap: 12px;
}
.card h3 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.2; }
.card .meta { font-size: 13px; color: rgba(255,255,255,.7); margin-top: 4px; }
.card .arrow {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; transform: translateY(10px) scale(.8); opacity: 0; transition: all .35s;
}
.card:hover .arrow { transform: none; opacity: 1; }
.card .arrow svg { width: 16px; height: 16px; }

/* ---------- Strip (skills / clients) ---------- */
.strip { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.strip .wrap { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 36px 24px 36px 0; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat b { display: block; font-family: var(--font-display); font-size: clamp(32px, 4vw, 48px); font-weight: 600; line-height: 1; }
.stat span { color: var(--muted); font-size: 14px; }

/* ---------- Contact band ---------- */
.contact-band { text-align: left; }
.contact-band h2 { font-family: var(--font-display); font-size: clamp(40px, 7vw, 96px); line-height: .95; letter-spacing: -.03em; margin: 14px 0 28px; font-weight: 600; }
.contact-band h2 a { color: var(--accent); border-bottom: 2px solid transparent; transition: border-color .2s; }
.contact-band h2 a:hover { border-bottom-color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 18px; }
.site-footer a:hover { color: var(--text); }

/* ---------- Project page ---------- */
.project-hero { padding: clamp(40px, 7vw, 88px) 0 clamp(28px, 4vw, 48px); }
.back { display: flex; width: fit-content; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.back:hover { color: var(--text); }
.back svg { width: 16px; height: 16px; }
.project-hero h1 { font-family: var(--font-display); font-size: clamp(38px, 6.2vw, 88px); line-height: 1; letter-spacing: -.03em; margin: 14px 0 0; font-weight: 600; }
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: clamp(28px, 4vw, 48px);
}
.meta-grid div { padding: 18px 20px 18px 0; }
.meta-grid div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.meta-grid dt { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 4px; }
.meta-grid dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.meta-grid dd a { color: var(--accent); }
.meta-grid dd a:hover { text-decoration: underline; }

.prose { max-width: 760px; }
.prose p { margin: 0 0 1.1em; color: #cfcfd5; }
.prose p:lang(zh-Hant) { line-height: 1.9; letter-spacing: .02em; }
.intro-text { padding: clamp(24px, 3vw, 40px) 0 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; }
.intro-text .label { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); padding-top: 6px; }

.blocks { padding: clamp(24px, 4vw, 48px) 0 0; }
.blk { margin: 0 0 clamp(20px, 2.6vw, 32px); }
.blk-section { margin-top: clamp(56px, 7vw, 96px); padding-top: 28px; border-top: 1px solid var(--line); }
.blk-section h2 { font-family: var(--font-display); font-size: clamp(28px, 3.6vw, 44px); letter-spacing: -.02em; margin: 0 0 10px; font-weight: 600; line-height: 1.1; }
.blk-section p { margin: 0; color: var(--muted); max-width: 760px; }
.blk-label {
  margin-top: clamp(40px, 5vw, 72px);
  font-family: var(--font-display); font-size: clamp(20px, 2vw, 26px); font-weight: 600; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 14px;
}
.blk-label::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); flex: none; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags .chip { font-size: 13px; }

.media { border-radius: var(--radius); overflow: hidden; background: var(--surface); position: relative; }
.media img, .media video { width: 100%; height: auto; }
.media img { cursor: zoom-in; }
figure { margin: 0; }
figcaption { color: var(--muted); font-size: 14px; margin-top: 12px; max-width: 900px; white-space: pre-line; }
.gallery { display: grid; gap: clamp(10px, 1.4vw, 18px); grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); align-items: start; }
.gallery .media { height: 100%; }
.gallery .media img, .gallery .media video { height: 100%; object-fit: cover; }

.credits { columns: 2 280px; column-gap: 48px; font-size: 14px; color: #bdbdc4; }
.credits div { break-inside: avoid; padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.credits b { color: var(--muted); font-weight: 500; min-width: 140px; flex: none; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: clamp(64px, 9vw, 120px) 0 clamp(40px, 6vw, 80px); }
.pager a { display: block; padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); transition: border-color .2s, transform .2s; }
.pager a:hover { border-color: rgba(255,255,255,.22); transform: translateY(-2px); }
.pager small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; }
.pager strong { display: block; font-family: var(--font-display); font-size: clamp(18px, 2vw, 24px); font-weight: 600; margin-top: 6px; }
.pager .next { text-align: right; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(5,5,6,.95);
  display: none; align-items: center; justify-content: center; padding: 56px 16px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox button {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(20,20,23,.8); cursor: pointer; display: grid; place-items: center;
}
.lightbox button:hover { border-color: rgba(255,255,255,.3); }
.lightbox button svg { width: 20px; height: 20px; }
.lightbox .lb-close { top: 16px; right: 16px; }
.lightbox .lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Resume ---------- */
.resume-top { padding: clamp(40px, 6vw, 80px) 0 clamp(32px, 4vw, 56px); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: clamp(20px, 3vw, 40px); align-items: center; }
.avatar { width: clamp(96px, 12vw, 150px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); }
.resume-top h1 { font-family: var(--font-display); font-size: clamp(40px, 6vw, 80px); line-height: 1; letter-spacing: -.03em; margin: 0; font-weight: 600; }
.resume-top h1 small { font-size: .38em; color: var(--muted); font-weight: 400; letter-spacing: .04em; margin-left: .3em; }
.resume-top .headline { font-size: clamp(16px, 1.6vw, 20px); color: var(--accent); margin: 8px 0 12px; }
.contact-list { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 14px; list-style: none; padding: 0; margin: 0; }
.contact-list a:hover { color: var(--text); }
.contact-list li { display: inline-flex; align-items: center; gap: 6px; }
.contact-list svg { width: 15px; height: 15px; }

.rs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding: clamp(32px, 4vw, 52px) 0; border-top: 1px solid var(--line); }
.rs > h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-weight: 500; margin: 6px 0 0; }
.rs p { margin: 0 0 1em; color: #cfcfd5; }
.rs p:last-child { margin-bottom: 0; }
.job { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 18px; padding-bottom: 28px; }
.job + .job { padding-top: 28px; border-top: 1px dashed var(--line); }
.job:last-child { padding-bottom: 0; }
.logo { width: 52px; height: 52px; border-radius: 12px; background: #fff; object-fit: contain; padding: 4px; }
.job-head { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; align-items: baseline; }
.job h3 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.job h3 a:hover { color: var(--accent); }
.job .role { color: var(--accent); font-size: 15px; margin: 2px 0 10px; }
.job .when { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.job p { font-size: 15px; }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-clean li { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 16px; font-size: 15px; color: #cfcfd5; }
.list-clean li:first-child { padding-top: 0; }
.list-clean li b { color: var(--muted); font-weight: 500; }
.sub-h { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 28px 0 10px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sub-h:first-child { margin-top: 0; }
.sub-h span { color: var(--muted); font-size: 14px; font-weight: 400; font-family: var(--font-body); }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.skill { padding: 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.skill h3 { margin: 0 0 6px; font-size: 16px; font-family: var(--font-display); font-weight: 600; }
.skill p { margin: 0; font-size: 14px; color: var(--muted); }
.works { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.work-link { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 14px; align-items: center; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); transition: border-color .2s; }
.work-link:hover { border-color: rgba(255,255,255,.22); }
.work-link img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.work-link strong { display: block; font-size: 15px; line-height: 1.3; }
.work-link span { font-size: 13px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-bottom { grid-template-columns: 1fr; }
  .strip .wrap { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .brand small { display: none; }
  .nav a { padding: 8px 10px; }
  .intro-text, .rs { grid-template-columns: 1fr; gap: 14px; }
  .gallery { grid-template-columns: repeat(min(var(--cols, 3), 2), minmax(0, 1fr)); }
  .resume-top { grid-template-columns: auto minmax(0, 1fr); }
  .resume-top .actions { grid-column: 1 / -1; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .meta-grid div, .meta-grid div + div { padding: 14px 12px 14px 0; border-left: 0; }
  .meta-grid div:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--line); }
  .list-clean li { grid-template-columns: 1fr; gap: 2px; }
  .credits b { min-width: 110px; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .card .arrow { opacity: 1; transform: none; }
  .job { grid-template-columns: 40px minmax(0, 1fr); gap: 14px; }
  .logo { width: 40px; height: 40px; border-radius: 9px; }
}

/* ---------- Print (resume PDF) ---------- */
@media print {
  @page { margin: 14mm 14mm; }
  :root { --bg: #fff; --text: #111; --muted: #666; --line: #ddd; --surface: #fff; --surface-2: #f3f3f3; color-scheme: light; }
  body { background: #fff; color: #111; font-size: 11pt; line-height: 1.5; }
  .site-header, .site-footer, .no-print, .contact-band { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .rs p, .job p, .list-clean li, .credits { color: #222; }
  .rs { padding: 14pt 0; grid-template-columns: 120pt minmax(0, 1fr); gap: 16pt; break-inside: auto; }
  .job { break-inside: avoid; }
  .skill, .work-link { border-color: #ddd; break-inside: avoid; }
  .resume-top { padding: 0 0 14pt; }
  .resume-top h1 { font-size: 30pt; }
  a { color: inherit !important; }
  .works { display: none; }
}
