/* =============================================================
   Personal portfolio — static site
   Sections: variables / base / topbar / hero / contents /
             project page / modal / footer / responsive
   Edit colours and fonts in :root below.
   ============================================================= */

:root {
  --paper: #f1eee8;
  --paper-2: #e7e2d9;
  --ink: #151310;
  --ink-soft: #423d37;
  --muted: #8b8477;
  --rule: rgba(21, 19, 16, 0.14);
  --rule-strong: rgba(21, 19, 16, 0.34);
  --accent: #a8442a;

  --maxw: 1280px;
  --gutter: clamp(20px, 4.5vw, 72px);

  --font-display: "Newsreader", "Songti SC", "Times New Roman", serif;
  --font-body: "Inter", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
}

/* ---------- base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 350;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* faint paper grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
figure { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: 1.08; }
p { margin: 0 0 1em; }

::selection { background: var(--ink); color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- primitives ---------- */
.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.5;
}

.label--ink { color: var(--ink-soft); }

.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

.rule--strong { border-top-color: var(--rule-strong); }

/* arrow link */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--rule-strong);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), gap 0.3s var(--ease);
}

.arrow-link .arrow { transition: transform 0.35s var(--ease); }

.arrow-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  gap: 0.9em;
}

.arrow-link:hover .arrow { transform: translateX(3px); }

/* ---------- topbar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px var(--gutter);
  background: rgba(241, 238, 232, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.35s var(--ease), background 0.35s var(--ease);
}

.topbar.is-scrolled { border-bottom-color: var(--rule); }

.topbar__brand {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar__mid { flex: 1 1 auto; text-align: center; }

.topbar__nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
}

.topbar__nav a {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.topbar__nav a:hover { color: var(--ink); }

/* reading progress (project pages) */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  height: 2px;
  width: 0;
  background: var(--ink);
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: end;
  gap: clamp(28px, 4vw, 64px);
  padding: clamp(120px, 16vh, 172px) var(--gutter) clamp(40px, 6vh, 72px);
}

.hero__inner { max-width: 40ch; }

.hero__name {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 9.5vw, 8.4rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 18px 0 14px;
}

.hero__sub {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(24px, 5vh, 44px);
}

.hero__sub::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.hero__statement {
  font-size: clamp(0.95rem, 1.1vw, 1.06rem);
  color: var(--ink-soft);
  max-width: 46ch;
  margin-bottom: clamp(26px, 4vh, 40px);
}

.hero__figure {
  position: relative;
  overflow: hidden;
  background: var(--paper-2);
}

.hero__figure img {
  width: 100%;
  height: clamp(280px, 52vh, 560px);
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 1.2s var(--ease);
}

.hero__figure:hover img { transform: scale(1.05); }

.hero__figure figcaption {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 10px 14px;
  background: rgba(241, 238, 232, 0.86);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- ticker ---------- */
.ticker {
  overflow: hidden;
  border-block: 1px solid var(--rule-strong);
  padding: 11px 0;
  white-space: nowrap;
  background: var(--paper);
}

.ticker__track {
  display: inline-flex;
  gap: 48px;
  padding-right: 48px;
  animation: slide 38s linear infinite;
}

.ticker span {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

@keyframes slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- contents ---------- */
.contents { padding: clamp(64px, 12vh, 140px) 0 clamp(80px, 14vh, 160px); }

.contents__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule-strong);
}

.contents__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.4vw, 3.4rem);
  letter-spacing: -0.01em;
}

.work {
  display: grid;
  grid-template-columns: 56px 132px minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(16px, 2.6vw, 40px);
  padding: clamp(18px, 2.4vw, 28px) 0;
  border-bottom: 1px solid var(--rule);
  transition: background 0.4s var(--ease);
}

.work:hover { background: linear-gradient(90deg, transparent, rgba(21, 19, 16, 0.035), transparent); }

.work__num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.work:hover .work__num { color: var(--accent); }

.work__thumb {
  overflow: hidden;
  background: var(--paper-2);
  aspect-ratio: 4 / 3;
}

.work__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92);
  transition: transform 0.9s var(--ease), filter 0.9s var(--ease);
}

.work:hover .work__thumb img { transform: scale(1.07); filter: saturate(1); }

.work__title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 2.15rem);
  line-height: 1.06;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  transition: transform 0.45s var(--ease);
}

.work:hover .work__title { transform: translateX(6px); }

.work__actions { display: flex; align-items: center; gap: 18px; }

.watch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.watch::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 7px solid currentColor;
  border-block: 4.5px solid transparent;
}

.watch:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- project page ---------- */
.project { padding-top: 56px; }

.phero {
  position: relative;
  display: grid;
  align-content: end;
  min-height: clamp(400px, 78vh, 760px);
  background: var(--paper-2);
  overflow: hidden;
}

.phero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.phero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12, 11, 10, 0.34) 0%, rgba(12, 11, 10, 0.06) 38%, rgba(12, 11, 10, 0.72) 100%);
}

.phero__body {
  position: relative;
  z-index: 2;
  padding: clamp(28px, 6vh, 60px) var(--gutter);
  color: #f4f1ec;
}

.phero__num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: rgba(244, 241, 236, 0.72);
}

.phero__title {
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 6.4vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 14px 0 12px;
  max-width: 22ch;
}

.phero__sub {
  font-size: clamp(0.95rem, 1.2vw, 1.12rem);
  color: rgba(244, 241, 236, 0.82);
  max-width: 48ch;
}

.phero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 22px;
}

.phero__tags span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(244, 241, 236, 0.66);
}

/* meta grid */
.meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 40px);
  padding: clamp(28px, 5vh, 48px) 0;
  border-bottom: 1px solid var(--rule);
}

.meta__item .label { display: block; margin-bottom: 8px; }
.meta__item p { margin: 0; font-size: 0.92rem; color: var(--ink-soft); }

/* lead paragraph */
.lead {
  padding: clamp(48px, 9vh, 104px) 0;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: clamp(16px, 2.6vw, 40px);
  border-bottom: 1px solid var(--rule);
}

.lead p {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.1vw, 1.72rem);
  line-height: 1.42;
  color: var(--ink);
  max-width: 62ch;
  margin: 0 0 0.9em;
}

.lead p:last-child { margin-bottom: 0; color: var(--ink-soft); }

/* content blocks */
.block {
  display: grid;
  grid-template-columns: minmax(0, 0.34fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 64px);
  padding: clamp(48px, 9vh, 104px) 0;
  border-bottom: 1px solid var(--rule);
}

.block--flush { border-bottom: 0; }

.block__aside { position: sticky; top: 92px; align-self: start; }

.block__num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
}

.block__heading {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.6vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.block__text { max-width: 62ch; color: var(--ink-soft); }
.block__text p { margin-bottom: 1.1em; }
.block__text p:last-child { margin-bottom: 0; }

/* media */
.media-grid {
  display: grid;
  gap: clamp(12px, 1.6vw, 22px);
  margin-top: clamp(24px, 4vh, 40px);
}

.media-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.media { background: var(--paper-2); overflow: hidden; }

.media img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 1s var(--ease);
}

.media--wide img { aspect-ratio: 16 / 9; }
.media:hover img { transform: scale(1.04); }

.media figcaption {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 9px 2px 0;
}

/* quote */
.quote {
  border-left: 1px solid var(--rule-strong);
  padding-left: clamp(16px, 2vw, 26px);
  margin: 0 0 1.1em;
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  font-style: italic;
  color: var(--ink);
  max-width: 46ch;
}

.quote__who {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* video wall */
.videowall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 22px);
  margin-top: clamp(24px, 4vh, 40px);
}

.videowall button {
  position: relative;
  display: grid;
  place-items: center;
  gap: 10px;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 1px solid var(--rule);
  background: #17150f;
  color: #ded8cd;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.35s var(--ease), color 0.35s var(--ease);
}

.videowall button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.13), transparent 62%);
  opacity: 0.7;
  transition: opacity 0.4s var(--ease);
}

.videowall button:hover { border-color: var(--ink); color: #fff; }
.videowall button:hover::before { opacity: 1; }

.playdot {
  position: relative;
  z-index: 1;
  width: 46px;
  height: 46px;
  border: 1px solid currentColor;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.playdot::after {
  content: "";
  border-left: 10px solid currentColor;
  border-block: 6px solid transparent;
  margin-left: 4px;
}

/* pager */
.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-block: 1px solid var(--rule);
}

.pager a {
  padding: clamp(28px, 5vh, 52px) 0;
  display: block;
  transition: opacity 0.35s var(--ease);
}

.pager a + a {
  border-left: 1px solid var(--rule);
  padding-left: clamp(20px, 4vw, 56px);
  text-align: right;
}

.pager a:hover { opacity: 0.62; }

.pager__title {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.8rem);
  line-height: 1.1;
  margin-top: 10px;
}

/* ---------- footer ---------- */
.footer {
  padding: clamp(56px, 10vh, 120px) 0 clamp(32px, 6vh, 56px);
}

.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 64px);
  padding-bottom: clamp(32px, 6vh, 64px);
}

.footer__statement {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.6vw, 2.1rem);
  line-height: 1.22;
  max-width: 26ch;
}

.footer__col a { display: block; color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 8px; transition: color 0.3s var(--ease); }
.footer__col a:hover { color: var(--accent); }
.footer__col .label { margin-bottom: 12px; }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(11, 10, 9, 0.9);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}

.modal.is-open { opacity: 1; visibility: visible; }

.modal__box {
  width: min(1120px, 100%);
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  border: 1px solid rgba(244, 241, 236, 0.16);
  background: #100f0d;
  color: #b8b1a5;
}

.modal__box iframe,
.modal__box video { width: 100%; height: 100%; border: 0; }

.modal__title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 2.2rem);
  color: #f2efe9;
  max-width: 30ch;
}

.modal__hint {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  max-width: 44ch;
  line-height: 1.8;
}

.modal__close {
  position: absolute;
  top: 18px;
  right: 20px;
  padding: 10px 14px;
  border: 1px solid rgba(244, 241, 236, 0.22);
  background: transparent;
  color: #efeae1;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

.modal__close:hover { background: #efeae1; color: #100f0d; }

/* ---------- reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

.reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .block { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .block__aside { position: static; }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    padding-top: 108px;
    gap: 28px;
  }
  .hero__figure img { height: clamp(220px, 40vh, 340px); }

  .work { grid-template-columns: 40px minmax(0, 1fr); row-gap: 14px; }
  .work__thumb { grid-column: 2; max-width: 200px; }
  .work__body { grid-column: 2; }
  .work__actions { grid-column: 2; }

  .lead { grid-template-columns: minmax(0, 1fr); }
  .media-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager a + a { border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; text-align: left; }
  .footer__grid { grid-template-columns: minmax(0, 1fr); }
  .topbar__mid { display: none; }
}

@media (max-width: 560px) {
  .media-grid--2,
  .videowall { grid-template-columns: minmax(0, 1fr); }
  .meta { grid-template-columns: minmax(0, 1fr); }
  .topbar__nav a:not(:last-child) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .ticker__track { animation: none; }
  .hero__figure img { transition: none; }
}
