:root {
  --paper: #eef2f0;
  --ink: #151817;
  --signal: #ff3b30;
  --muted: #69716d;
  --line: rgba(21, 24, 23, .1);
  --panel: rgba(255, 255, 255, .68);
  --subpanel: rgba(255, 255, 255, .58);
  --subpanel-hover: rgba(255, 255, 255, .5);
  --media-surface: rgba(217, 225, 221, .54);
  --status-panel: rgba(255, 255, 255, .78);
  --viewer-panel: rgba(255, 255, 255, .9);
  --viewer-stage: #dfe7e4;
  --viewer-backdrop: rgba(238, 242, 240, .9);
  --dock-panel: rgba(255, 255, 255, .62);
  --dock-panel-fallback: rgba(255, 255, 255, .94);
  --dock-fade: rgba(255, 255, 255, .36);
  --dot: rgba(25, 31, 28, .16);
  --pad: clamp(16px, 2.6vw, 42px);
  --radius: clamp(24px, 2.8vw, 38px);
  --dock-height: 72px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #1d2220;
  --ink: #f3f5f4;
  --muted: #aeb7b2;
  --line: rgba(239, 245, 242, .14);
  --panel: rgba(43, 49, 46, .68);
  --subpanel: rgba(58, 65, 61, .6);
  --subpanel-hover: rgba(68, 76, 71, .7);
  --media-surface: rgba(55, 64, 60, .64);
  --status-panel: rgba(49, 56, 52, .84);
  --viewer-panel: rgba(38, 44, 41, .96);
  --viewer-stage: #303734;
  --viewer-backdrop: rgba(25, 30, 27, .92);
  --dock-panel: rgba(38, 44, 41, .66);
  --dock-panel-fallback: rgba(38, 44, 41, .94);
  --dock-fade: rgba(38, 44, 41, .4);
  --dot: rgba(231, 238, 234, .18);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--dock-height) + 36px); background: var(--paper); }
body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.25px);
  background-size: 18px 18px;
  background-attachment: fixed;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; width: 100%; }

.glass-panel,
.flat-panel {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: none;
}
.glass-panel::before,
.glass-panel::after {
  display: none;
}

.site-header {
  position: sticky;
  top: 10px;
  z-index: 30;
  display: flex;
  align-items: center;
  width: calc(100% - (var(--pad) * 2));
  height: var(--dock-height);
  margin: 10px var(--pad) 0;
  padding: 0 14px;
  border-radius: 24px;
  background: var(--dock-panel);
  -webkit-backdrop-filter: blur(24px) saturate(1.08);
  backdrop-filter: blur(24px) saturate(1.08);
}
.site-header::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 18px;
  right: 18px;
  bottom: -14px;
  display: block;
  height: 20px;
  border-radius: 0 0 24px 24px;
  background: linear-gradient(to bottom, var(--dock-fade), transparent);
  filter: blur(7px);
  pointer-events: none;
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header { background: var(--dock-panel-fallback); }
}
.brand { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 10px; margin-right: 12px; font-size: 15px; font-weight: 800; letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: var(--signal); font-size: 12px; }
.category-dock { flex: 1 1 auto; display: flex; align-items: center; gap: 5px; min-width: 0; padding: 5px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x proximity; }
.category-dock::-webkit-scrollbar { display: none; }
.dock-button { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 38px; padding: 0 13px; border-radius: 999px; color: var(--ink); font-size: 13px; font-weight: 750; white-space: nowrap; scroll-snap-align: center; transition: color .24s ease, background .24s ease, transform .24s ease; }
.dock-button:hover { background: var(--subpanel); }
.dock-button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.dock-button.is-active { color: #fff; background: var(--signal); }
.dock-button:active { transform: scale(.97); }
.header-contact { flex: 0 0 auto; display: flex; gap: 16px; margin-left: 12px; font-size: 13px; font-weight: 750; letter-spacing: .08em; }
.header-contact a { position: relative; }
.header-contact a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -5px; height: 1px; background: var(--signal); transition: right .25s ease; }
.header-contact a:hover::after { right: 0; }

.intro {
  margin: 18px var(--pad) 0;
  padding: clamp(25px, 3vw, 44px);
  border-radius: var(--radius);
}
.intro-index { margin-bottom: clamp(34px, 5vw, 78px); font-size: 12px; font-weight: 750; letter-spacing: .15em; }
.intro-copy { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 34%); align-items: end; gap: 40px; }
.intro h1 { margin: 0; font-size: clamp(4.4rem, 10vw, 10rem); line-height: .78; letter-spacing: -.075em; font-weight: 900; }
.intro-meta { padding-bottom: 4px; font-size: clamp(16px, 1.25vw, 19px); line-height: 1.55; }
.intro-meta p { margin: 0; }
.intro-meta .role { margin-bottom: 24px; color: var(--signal); font-weight: 800; }
.intro-contact { display: grid; gap: 8px; margin-top: 28px; }
.contact-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.intro-contact a,
.site-footer address a { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--subpanel); }
.contact-row > a { min-width: 0; }
.intro-contact a:hover,
.site-footer address a:hover { background: var(--subpanel-hover); }
.intro-contact span,
.site-footer address span { color: var(--signal); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.intro-contact strong,
.site-footer address strong { overflow-wrap: anywhere; font-size: clamp(14px, 1.1vw, 17px); }
.copy-contact { min-width: 68px; padding: 0 12px; border: 1px solid transparent; border-radius: 16px; color: #fff; background: var(--signal); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; transition: transform .18s ease, opacity .18s ease; }
.copy-contact:hover { transform: translateY(-1px); }
.copy-contact:active { transform: scale(.97); }
.copy-contact:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.copy-contact:disabled { opacity: .72; cursor: default; transform: none; }

.work-section { padding: 0 var(--pad) var(--pad); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding: clamp(52px, 7vw, 100px) 0 32px; }
.section-heading h2 { margin: 0; font-size: clamp(3rem, 7vw, 7rem); line-height: .82; letter-spacing: -.06em; }
.section-heading span { max-width: 180px; text-align: right; font-size: 12px; font-weight: 750; line-height: 1.4; letter-spacing: .13em; }
.portfolio-sections { display: grid; gap: clamp(70px, 9vw, 140px); }
.portfolio-category { scroll-margin-top: calc(var(--dock-height) + 32px); }
.category-heading { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 18px; margin-bottom: clamp(18px, 2.2vw, 30px); padding: clamp(18px, 2.2vw, 28px); border-radius: 24px; }
.category-heading .category-number { align-self: start; color: var(--signal); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
.category-heading h3 { margin: 0; font-size: clamp(2rem, 4.5vw, 5.4rem); line-height: .88; letter-spacing: -.055em; }
.category-heading div > span { display: block; margin-top: 10px; color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .14em; }
.category-heading > strong { align-self: start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--signal); background: var(--subpanel); font-size: 12px; letter-spacing: .08em; white-space: nowrap; }

.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 8px; column-gap: clamp(14px, 2vw, 28px); row-gap: clamp(14px, 2vw, 28px); align-items: start; }
.media-grid.masonry-fallback { grid-auto-rows: auto; }
.media-item { width: 100%; margin: 0; overflow: hidden; border-radius: var(--radius); }
.media-frame { position: relative; overflow: hidden; background: var(--media-surface); }
.media-frame img { height: auto; aspect-ratio: attr(width) / attr(height); }
.media-frame video { height: auto; max-height: 84vh; object-fit: contain; background: var(--media-surface); }
.media-status { position: absolute; top: 12px; right: 12px; z-index: 4; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--status-panel); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.media-item figcaption { display: flex; justify-content: space-between; gap: 24px; margin: 0; padding: 16px 18px 18px; border-top: 1px solid var(--line); background: var(--subpanel); font-size: 11px; font-weight: 750; line-height: 1.4; letter-spacing: .09em; }
.media-item figcaption span:first-child { overflow-wrap: anywhere; }
.media-item figcaption span:last-child { flex: 0 0 auto; color: var(--muted); }

button { font: inherit; }
.case-open { display: block; width: 100%; padding: 0; border: 0; color: inherit; background: transparent; cursor: zoom-in; text-align: left; }
.case-open:focus-visible { outline: 3px solid var(--signal); outline-offset: -3px; }
.case-hint { position: absolute; left: 14px; bottom: 14px; z-index: 4; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--status-panel); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.case-variants,
.viewer-variants { display: flex; gap: 7px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--subpanel); }
.variant-button { min-height: 36px; padding: 0 15px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--panel); cursor: pointer; font-size: 12px; font-weight: 800; }
.variant-button.is-active { border-color: var(--signal); color: #fff; background: var(--signal); }
.variant-button:focus-visible,
.viewer-close:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

body.viewer-open { overflow: hidden; }
.c4d-viewer { width: min(94vw, 1120px); max-width: none; max-height: 94vh; margin: auto; padding: 0; overflow: visible; border: 0; background: transparent; }
.c4d-viewer::backdrop { background: var(--viewer-backdrop); }
.viewer-shell { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; max-height: 94vh; padding: clamp(16px, 2.4vw, 28px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--viewer-panel); }
.viewer-header { grid-column: 1 / -1; display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.viewer-header span { display: block; margin-bottom: 7px; color: var(--signal); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.viewer-header h2 { margin: 0; font-size: clamp(2rem, 4.5vw, 4.5rem); line-height: .9; letter-spacing: -.045em; }
.viewer-close { min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--panel); cursor: pointer; font-size: 13px; font-weight: 800; white-space: nowrap; }
.viewer-variants { grid-column: 1 / -1; justify-content: center; padding: 0; border: 0; background: transparent; }
.viewer-variants[hidden] { display: none; }
.viewer-stage { --reveal-x: 50%; --reveal-y: 50%; --reveal-size: clamp(75px, 12vw, 150px); grid-column: 1 / -1; position: relative; width: 100%; height: min(72vh, 860px); overflow: hidden; border: 1px solid var(--line); border-radius: calc(var(--radius) - 10px); background: var(--viewer-stage); touch-action: none; }
.viewer-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer-render { z-index: 2; }
.viewer-stage.is-revealing .viewer-render { -webkit-mask-image: radial-gradient(circle var(--reveal-size) at var(--reveal-x) var(--reveal-y), transparent 0 86%, rgba(0,0,0,.35) 93%, #000 100%); mask-image: radial-gradient(circle var(--reveal-size) at var(--reveal-x) var(--reveal-y), transparent 0 86%, rgba(0,0,0,.35) 93%, #000 100%); }
.viewer-stage::after { content: ""; position: absolute; left: var(--reveal-x); top: var(--reveal-y); z-index: 4; width: calc(var(--reveal-size) * 2); height: calc(var(--reveal-size) * 2); border: 2px solid rgba(255,59,48,.86); border-radius: 50%; opacity: 0; pointer-events: none; transform: translate(-50%, -50%); }
.viewer-stage.is-revealing::after { opacity: 1; }
.viewer-hint { position: absolute; left: 16px; bottom: 16px; z-index: 5; padding: 9px 12px; border-radius: 999px; color: #fff; background: var(--signal); font-size: 12px; font-weight: 800; }

.site-footer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 390px); gap: clamp(32px, 4vw, 64px); min-height: 430px; margin: 18px var(--pad) var(--pad); padding: clamp(28px, 4vw, 52px); border-radius: var(--radius); }
.footer-lead { min-width: 0; }
.footer-lead > span { display: block; margin-bottom: 22px; color: var(--signal); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.footer-lead > strong { display: block; max-width: 100%; font-size: clamp(3.8rem, 6.4vw, 7.4rem); line-height: .8; letter-spacing: -.07em; }
.footer-actions { display: grid; align-content: start; gap: 14px; }
.resume-download { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 18px; padding: 20px; overflow: hidden; border-radius: 22px; transition: border-color .2s ease, transform .2s ease; }
.resume-download:hover { border-color: rgba(255,59,48,.45); transform: translateY(-2px); }
.resume-kicker { grid-column: 1 / -1; color: var(--signal); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.resume-download > strong { font-size: 25px; letter-spacing: -.03em; }
.resume-meta { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .1em; }
.resume-button { grid-column: 2; grid-row: 2 / 4; align-self: center; padding: 12px 15px; border-radius: 999px; color: #fff; background: var(--signal); font-size: 12px; font-weight: 800; white-space: nowrap; }
.site-footer address { display: grid; gap: 10px; font-style: normal; }
.footer-note { grid-column: 1 / -1; align-self: end; padding-top: 24px; border-top: 1px solid var(--line); font-size: 11px; letter-spacing: .12em; }

.theme-toggle { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 42; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; color: #fff; background: var(--signal); cursor: pointer; transition: transform .2s ease, opacity .2s ease; }
.theme-toggle:hover { transform: translateY(-2px); }
.theme-toggle:active { transform: scale(.96); }
.theme-toggle:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.theme-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-moon { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-moon { display: block; }
.viewer-open .theme-toggle { opacity: 0; pointer-events: none; transform: translateY(8px); }

.works-main,
.works-hero,
.media-list { min-height: 100vh; }
.back-link { font-size: 13px; font-weight: 750; }

@media (max-width: 1080px) {
  .header-contact { display: none; }
  .intro-index { margin-bottom: clamp(30px, 5vw, 48px); }
  .intro-copy { grid-template-columns: 1fr; gap: 28px; }
  .intro h1 { font-size: clamp(4.4rem, 16vw, 9rem); }
  .intro-meta { max-width: 620px; }
  .site-footer { grid-template-columns: 1fr; gap: 34px; min-height: 470px; }
  .footer-lead > strong { width: min-content; font-size: clamp(4.2rem, 11.5vw, 7rem); }
  .footer-actions { max-width: 620px; }
  .footer-note { grid-column: auto; }
}

@media (max-width: 900px) {
  .media-grid { grid-template-columns: 1fr; row-gap: 18px; }
}

@media (max-width: 760px) {
  :root { --radius: 25px; --dock-height: 62px; }
  .site-header { top: 8px; margin-top: 8px; padding: 0 9px; border-radius: 20px; }
  .brand { gap: 8px; margin-right: 7px; font-size: 14px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .category-dock { gap: 3px; padding: 4px; }
  .dock-button { min-height: 36px; padding: 0 11px; font-size: 12px; }
  .intro { min-height: auto; margin-top: 12px; padding: 22px; }
  .intro-index { margin-bottom: 28px; }
  .intro-copy { gap: 24px; }
  .intro h1 { font-size: clamp(3rem, 15.4vw, 4.3rem); }
  .intro-meta { padding-bottom: 0; }
  .intro-contact a { grid-template-columns: 46px minmax(0, 1fr); padding: 10px 12px; }
  .copy-contact { min-width: 60px; padding: 0 9px; }
  .section-heading { align-items: start; }
  .section-heading h2 { font-size: clamp(3.3rem, 15.8vw, 4.6rem); }
  .section-heading span { writing-mode: vertical-rl; }
  .portfolio-sections { gap: 74px; }
  .category-heading { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 18px; }
  .category-heading h3 { font-size: clamp(2rem, 10vw, 3.2rem); }
  .category-heading > strong { grid-column: 2; justify-self: start; }
  .media-grid { row-gap: 16px; }
  .media-status { top: 8px; right: 8px; }
  .media-item figcaption { padding: 14px 15px 16px; }
  .case-hint { left: 10px; bottom: 10px; font-size: 10px; }
  .site-footer { padding: 24px; }
  .footer-lead > strong { font-size: clamp(3.05rem, 15.5vw, 4.35rem); }
  .resume-download { padding: 18px; }
  .resume-download > strong { font-size: 23px; }
  .resume-button { padding: 11px 13px; }
  .c4d-viewer { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .viewer-shell { max-height: calc(100vh - 20px); padding: 14px; border-radius: 22px; }
  .viewer-header h2 { font-size: clamp(1.8rem, 9vw, 2.7rem); }
  .viewer-close { min-height: 38px; padding: 0 13px; }
  .viewer-stage { height: min(72vh, 680px); border-radius: 16px; }
  .viewer-hint { left: 10px; bottom: 10px; }
  .theme-toggle { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
