:root {
  --bg: #050706;
  --panel: rgba(13, 18, 15, 0.84);
  --panel-strong: #0d120f;
  --ink: #f4f0e5;
  --muted: #a6aca4;
  --soft: #6f7a70;
  --line: rgba(216, 171, 90, 0.25);
  --gold: #d8ab5a;
  --green: #173f30;
  --blue: #315d75;
  --max: 1220px;
  --sans: "Noto Sans SC", system-ui, sans-serif;
  --serif: "Noto Serif SC", serif;
  --mono: "Space Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 72% 8%, rgba(49, 93, 117, 0.22), transparent 30%),
    radial-gradient(circle at 28% 2%, rgba(216, 171, 90, 0.17), transparent 28%),
    linear-gradient(180deg, #050706 0%, #0a0d0b 52%, #030403 100%);
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

body.light-mode {
  --bg: #ece9df;
  --panel: rgba(250, 247, 238, 0.9);
  --panel-strong: #f7f3e8;
  --ink: #111512;
  --muted: #58635d;
  --soft: #7d857d;
  --line: rgba(52, 63, 54, 0.22);
  --gold: #a46e2c;
  --green: #dbe8df;
  background: #ece9df;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
img, video { display: block; max-width: 100%; }

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  opacity: 0.15;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 3px 3px, 72px 72px;
  mix-blend-mode: screen;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px max(22px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 6, 0.82);
  backdrop-filter: blur(18px);
}

body.light-mode .topbar { background: rgba(236, 233, 223, 0.86); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
}

.brand span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold);
  font: 900 16px/1 var(--mono);
}

.topbar nav {
  display: flex;
  gap: 28px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.topbar nav a:hover { color: var(--ink); }

.mode-toggle {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(16px, 2.4vw, 22px) 60px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(460px, 1.08fr);
  gap: clamp(34px, 4vw, 54px);
  align-items: center;
  min-height: min(720px, calc(100vh - 76px));
  padding: clamp(34px, 5vw, 64px) 0;
  border-bottom: 1px solid var(--line);
}

.role-line,
.section-head p,
.netdisk-section p {
  margin: 0 0 14px;
  color: var(--gold);
  font: 700 12px/1.5 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(66px, 8vw, 124px);
  font-weight: 900;
  line-height: .9;
}

.hero h1 span { display: block; }

.hero-subtitle {
  margin: 24px 0 0;
  color: var(--gold);
  font-size: clamp(22px, 2.3vw, 31px);
  font-weight: 900;
}

.hero-intro {
  max-width: 690px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 2;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.button:hover { transform: translateY(-2px); border-color: var(--gold); }
.button.primary { background: var(--gold); color: #080806; }
.button.secondary { background: rgba(255,255,255,.035); }

.hero-cinema {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, .82fr);
  grid-template-rows: 1fr 1fr;
  gap: 18px;
  min-height: clamp(430px, 40vw, 510px);
}

.poster-main,
.poster-float {
  position: static;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 32px 90px rgba(0,0,0,.45);
}

.poster-main {
  grid-row: 1 / -1;
}

.poster-float.one {
  grid-column: 2;
  grid-row: 1;
}

.poster-float.two {
  grid-column: 2;
  grid-row: 2;
}

.timecode {
  position: absolute;
  left: 18px;
  bottom: 62px;
  padding: 8px 12px;
  background: rgba(0,0,0,.7);
  color: var(--gold);
  font: 700 13px/1 var(--mono);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 28px 0 0;
}

.filter-button,
.ai-tab {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.filter-button.active,
.filter-button:hover,
.ai-tab.active,
.ai-tab:hover {
  background: var(--gold);
  color: #080806;
}

.section {
  padding: 82px 0 0;
}

.portfolio-section[hidden] {
  display: none;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, .7fr) minmax(300px, .5fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 28px;
}

.section-head h2,
.netdisk-section h2 {
  grid-column: 1;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 4.5vw, 66px);
  line-height: 1.05;
}

.section-head span,
.netdisk-section span {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: transform .18s ease, opacity .22s ease, border-color .18s ease;
}

.project-card[hidden] { display: none; }
.project-card:hover { transform: translateY(-6px); border-color: var(--gold); }
.project-card.wide { grid-column: span 2; }

.project-card img,
.project-card video {
  width: 100%;
  aspect-ratio: 16 / 10;
  height: auto;
  min-height: 260px;
  object-fit: cover;
  background: #000;
}

.project-card.wide img {
  aspect-ratio: 16 / 8.8;
  height: auto;
  min-height: 390px;
}

.project-card div { padding: 20px; }
.project-card p,
.ai-copy p,
.detail-copy p:first-child {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.project-card h3,
.ai-copy h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.project-card span,
.ai-copy span {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.detail-button {
  margin-top: 18px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.detail-button:hover { background: var(--gold); color: #080806; }

.photo-strip,
.photo-wall,
.student-photo-strip {
  display: grid;
  gap: 12px;
}

.photo-strip {
  grid-template-columns: repeat(4, 1fr);
  margin-top: 16px;
}

.student-photo-strip {
  grid-template-columns: 1.18fr 1fr 1fr;
  margin-top: 16px;
}

.photo-strip img,
.photo-wall img,
.student-photo-strip img {
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: cover;
  border: 1px solid var(--line);
}

.ai-console {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(23,63,48,.7), var(--panel));
  padding: 16px;
}

.ai-tabs {
  display: grid;
  align-content: start;
  gap: 10px;
}

.ai-display {
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f5f7f4;
}

.ai-display img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.ai-copy {
  grid-column: 2;
  padding: 2px 6px 8px;
}

.photo-wall {
  grid-template-columns: repeat(4, 1fr);
  grid-auto-flow: dense;
}

.photo-wall .tall {
  grid-row: span 2;
  height: 100%;
  min-height: 512px;
}

.netdisk-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin-top: 86px;
  padding: 38px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 92% 18%, rgba(216,171,90,.18), transparent 28%),
    var(--panel);
}

.detail-dialog {
  width: min(980px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
}

.detail-dialog::backdrop {
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(8px);
}

.detail-dialog[open] {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
}

.dialog-media {
  min-height: min(62vh, 520px);
  background: #000;
}

.dialog-media img,
.dialog-media video {
  width: 100%;
  height: 100%;
  min-height: min(62vh, 520px);
  object-fit: contain;
  background: #000;
}

.dialog-copy {
  align-self: center;
  padding: 34px;
}

.dialog-copy h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 3.6vw, 48px);
  line-height: 1.16;
}

.dialog-copy p:last-child {
  color: var(--muted);
  line-height: 1.9;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.6);
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
}

@media (max-width: 980px) {
  .hero,
  .section-head,
  .ai-console,
  .netdisk-section,
  .detail-dialog[open] {
    grid-template-columns: 1fr;
  }
  .ai-copy { grid-column: auto; }
  .hero {
    min-height: auto;
    padding: clamp(44px, 7vw, 72px) 0;
  }
  .hero-cinema {
    min-height: 430px;
    max-width: 720px;
    width: 100%;
  }
  .project-grid,
  .photo-strip,
  .photo-wall,
  .student-photo-strip {
    grid-template-columns: 1fr 1fr;
  }
  .project-card.wide { grid-column: auto; }
}

@media (max-width: 860px) {
  .topbar {
    gap: 14px;
  }

  .topbar nav { display: none; }

  .section {
    padding-top: 64px;
  }

  .filters {
    padding-top: 22px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 12px 14px;
  }

  .brand strong { font-size: 14px; }
  .mode-toggle { display: none; }
  main { padding: 0 14px 44px; }

  .hero {
    gap: 28px;
    padding: 42px 0 34px;
  }

  .role-line {
    font-size: 10px;
    line-height: 1.6;
  }

  .hero h1 {
    font-size: clamp(50px, 17vw, 70px);
  }

  .hero-subtitle {
    margin-top: 18px;
    font-size: clamp(20px, 6vw, 25px);
  }

  .hero-intro {
    margin-top: 18px;
    font-size: 15px;
    line-height: 1.85;
  }

  .hero-actions {
    margin-top: 24px;
  }

  .button {
    width: 100%;
  }

  .hero-cinema {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    min-height: 0;
    max-width: none;
  }

  .poster-main,
  .poster-float {
    position: static;
    inset: auto;
    width: 100%;
    box-shadow: 0 18px 46px rgba(0,0,0,.34);
  }

  .poster-main {
    grid-column: 1 / -1;
    grid-row: auto;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .poster-float.one {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .poster-float.two {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .timecode {
    left: 10px;
    bottom: calc(50% + 18px);
    font-size: 11px;
  }

  .filters {
    gap: 8px;
  }

  .filter-button,
  .ai-tab {
    flex: 1 1 calc(50% - 8px);
    padding: 0 10px;
    font-size: 13px;
  }

  .project-grid,
  .photo-strip,
  .photo-wall,
  .student-photo-strip {
    grid-template-columns: 1fr;
  }

  .project-card img,
  .project-card video,
  .project-card.wide img,
  .photo-strip img,
  .photo-wall img,
  .student-photo-strip img,
  .photo-wall .tall {
    aspect-ratio: 4 / 3;
    height: auto;
    min-height: 0;
  }

  .project-card div {
    padding: 17px;
  }

  .project-card h3,
  .ai-copy h3 {
    font-size: 21px;
  }

  .section-head h2,
  .netdisk-section h2 {
    font-size: clamp(34px, 11vw, 48px);
  }

  .ai-tabs { grid-template-columns: 1fr 1fr; }
  .ai-console {
    padding: 12px;
  }

  .ai-display img {
    aspect-ratio: 16 / 10.5;
  }

  .netdisk-section { padding: 24px; }

  .dialog-media,
  .dialog-media img,
  .dialog-media video {
    min-height: 260px;
  }

  .dialog-copy {
    padding: 24px;
  }
}

@media (max-width: 420px) {
  .hero-cinema {
    min-height: 0;
  }

  .poster-main {
    height: auto;
  }

  .poster-float.one {
    height: auto;
  }

  .poster-float.two {
    height: auto;
  }
}

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