/* ============================================================
   megan guo — portfolio
   black-and-white matte archive · typewriter · film grain
   ============================================================ */

:root {
  --bg: #F1F0EB;
  --ink: #141414;
  --muted: #6E6E6A;
  --hairline: rgba(20, 20, 20, 0.3);
  --hairline-strong: rgba(20, 20, 20, 0.4);
  --hairline-light: rgba(20, 20, 20, 0.15);
  --plate: rgba(241, 240, 235, 0.85);
  --plate-solid: rgba(241, 240, 235, 0.92);
  --placeholder: #E7E6E1;
  --mono: 'Courier Prime', 'Courier New', monospace;
  --display: 'Special Elite', 'Yuji Boku', 'Noto Serif SC', serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--bg); }

img { max-width: none; }

@keyframes heroIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* subpages fade in as a whole */
body.page-sub { animation: heroIn 1.2s ease both; }

/* ---- matte grain overlay (every page) ---- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDAiIGhlaWdodD0iMjQwIj48ZmlsdGVyIGlkPSJuIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC44NSIgbnVtT2N0YXZlcz0iMiIvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIyNDAiIGhlaWdodD0iMjQwIiBmaWx0ZXI9InVybCgjbikiLz48L3N2Zz4=');
}

/* ---- scroll reveals (one-shot, IntersectionObserver) ---- */
.js [data-rv] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1s ease, transform 1s ease;
}
.js [data-rv="slow"] { transition: opacity 1.2s ease, transform 1.2s ease; }
.js [data-rv].is-on { opacity: 1; transform: none; }

/* ============================================================
   landing — hero
   ============================================================ */

.hero {
  position: relative;
  height: 100vh;
  overflow: hidden;
  animation: heroIn 1.8s ease both;
}

.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: grayscale(1) contrast(1.04);
}

.name-plate {
  position: absolute;
  top: 34px;
  left: 40px;
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  background: var(--plate);
  padding: 8px 14px;
}

.hero-nav {
  position: absolute;
  top: 34px;
  right: 40px;
  display: flex;
  align-items: baseline;
  gap: 22px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: var(--plate-solid);
  padding: 10px 16px;
}
.hero-nav a { color: var(--ink); text-decoration: none; }
.hero-nav a:hover { text-decoration: underline; }

.hero-caption {
  position: absolute;
  left: 40px;
  bottom: 30px;
  display: flex;
  align-items: baseline;
  gap: 18px;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  background: var(--plate);
  padding: 8px 14px;
}
.hero-caption .muted { color: var(--muted); }

.hero-down {
  position: absolute;
  right: 40px;
  bottom: 30px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  background: var(--plate);
  padding: 8px 12px;
}

/* ---- index panel, left middle ---- */
.index-panel {
  position: absolute;
  left: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: 300px;
  background: var(--plate-solid);
  border-top: 2px solid var(--ink);
}

.index-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 26px;
}
.index-head .index-title {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.index-head .index-mark { font-size: 13px; color: var(--muted); }

.index-body { overflow: hidden; }
.index-rows {
  padding: 2px 26px 24px;
  display: flex;
  flex-direction: column;
}

/* collapsed by default when JS is running; no-JS users see it open */
.js .index-body { max-height: 0; }
.js .index-rows { opacity: 0; }
.js .index-panel.open .index-body { max-height: 460px; }
.js .index-panel.open .index-rows { opacity: 1; }
/* first expansion animates; afterwards the panel just appears */
.js .index-panel.anim .index-body {
  transition: max-height 2s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.js .index-panel.anim .index-rows {
  transition: opacity 1.4s ease 0.5s;
}

.index-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 15px 0;
  border-top: 1px solid var(--hairline-strong);
  color: var(--ink);
  text-decoration: none;
  transition: padding-left 0.4s ease;
}
a.index-row:hover { padding-left: 10px; }
.index-row .no {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.index-row .label {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.5;
}
.index-row .count {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   landing — about
   ============================================================ */

.about {
  min-height: 100vh;
  border-top: 2px solid var(--ink);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.about-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 34px;
  padding: 10vh 32px;
  border-right: 1px solid var(--ink);
}

.portrait {
  width: min(60%, 300px);
  aspect-ratio: 3 / 4;
  filter: grayscale(1) contrast(1.02);
  outline: 1px solid var(--ink);
  outline-offset: 12px;
}
.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.portrait-placeholder {
  width: 100%;
  height: 100%;
  background: var(--placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}
.contact-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
  transition: border-color 0.4s ease;
}
.contact-links a:hover { border-color: var(--ink); }

.about-right {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 10vh 56px;
  max-width: 480px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--muted);
}

.typed {
  margin: 0;
  font-size: 12.5px;
  line-height: 2;
  letter-spacing: 0.03em;
  white-space: pre-line;
}
.typed .cursor { animation: blink 0.9s step-end infinite; }
#typed-p1 { min-height: 100px; }
#typed-p2 { min-height: 150px; }
#typed-p3 { min-height: 150px; }

/* ============================================================
   subpages — header, title block, work sections
   ============================================================ */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 30px 40px;
  border-bottom: 2px solid var(--ink);
}
.site-header .wordmark {
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.site-header .back {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.site-header .back:hover { text-decoration: underline; }

.title-block {
  padding: 10vh 40px 7vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.title-block .eyebrow {
  font-size: 10px;
  letter-spacing: 0.3em;
}
.page-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(44px, 6vw, 84px);
  line-height: 1;
}
.title-block .subline {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.work {
  border-top: 1px solid var(--ink);
  padding: 9vh 40px 10vh;
}

.work-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 48px;
  align-items: stretch;
  min-height: 132px;
  box-sizing: content-box;
}
.work-head--film { padding-bottom: 44px; }
.work-head--gallery { padding-bottom: 10px; }

.work-no {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--muted);
}

.work-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 50px);
  line-height: 1.15;
}

/* video page: number on top, title centered in remaining space */
.title-cell--film { display: flex; flex-direction: column; }
.title-cell--film .work-title-wrap {
  flex: 1;
  display: flex;
  align-items: center;
}

/* image page: number pinned top-left, title centered */
.title-cell--gallery {
  position: relative;
  display: flex;
  align-items: center;
}
.title-cell--gallery .work-no {
  position: absolute;
  top: 0;
  left: 0;
}

/* info column */
.spec {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.spec--film { margin-top: 26px; }
.spec--gallery { align-self: center; width: 100%; }
.spec .row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0 6px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
}
.spec .row:last-child { border-bottom: none; padding-bottom: 0; }
.spec .key { white-space: nowrap; }
.spec .row--concept .key,
.spec .row--concept .val { line-height: 1.9; }
.spec .row--concept .val {
  text-transform: none;
  letter-spacing: 0.08em;
}
.spec .val--tools { text-transform: none; }

/* video embed */
.film { width: 100%; }
.film iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  background: var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 10px;
}

/* ============================================================
   image page — infinite drag strips
   ============================================================ */

.strip {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  cursor: grab;
}
.strip::-webkit-scrollbar { display: none; }
.strip.dragging { cursor: grabbing; }

.strip-track {
  display: flex;
  gap: 60px;
  width: max-content;
  padding: 26px 42vw 18px;
  align-items: center;
}

.strip figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  scroll-snap-align: center;
  transition: filter 0.25s linear, opacity 0.25s linear;
  will-change: transform, filter;
}

.strip .frame {
  height: 430px;
  outline: 1px solid rgba(20, 20, 20, 0.35);
  outline-offset: 8px;
}
.strip .frame img {
  display: block;
  height: 100%;
  width: auto;
  min-width: 240px;
  background: var(--placeholder);
}

.strip figcaption {
  display: flex;
  justify-content: center;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.4s ease;
}

.progress {
  margin-top: 22px;
  height: 1px;
  background: var(--hairline-light);
  position: relative;
}
.progress-bar {
  position: absolute;
  left: 0;
  top: -0.5px;
  height: 2px;
  width: 0%;
  background: var(--ink);
}

/* ============================================================
   footer
   ============================================================ */

.footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px 40px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 2px solid var(--ink);
}
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--ink); }

/* ============================================================
   mobile
   ============================================================ */

@media (max-width: 760px) {
  .name-plate { top: 20px; left: 20px; }
  .hero-nav { top: 20px; right: 20px; }
  .hero-caption { left: 20px; bottom: 20px; }
  .hero-down { right: 20px; bottom: 20px; }

  .index-panel { left: 20px; right: 20px; width: auto; }

  .about { grid-template-columns: 1fr; }
  .about-left {
    border-right: none;
    border-bottom: 1px solid var(--ink);
    padding: 8vh 24px;
  }
  .about-right { padding: 8vh 24px; max-width: none; }

  .site-header { padding: 24px 20px; }
  .title-block { padding: 8vh 20px 6vh; }
  .work { padding: 7vh 20px 8vh; }

  .work-head {
    grid-template-columns: 1fr;
    gap: 26px;
    min-height: 0;
  }
  .spec--film { margin-top: 0; }
  .title-cell--gallery { padding-top: 26px; }

  .strip-track { gap: 40px; padding: 26px 12vw 18px; }
  .strip .frame { height: 300px; }
  .strip .frame img { min-width: 180px; }

  .footer { padding: 18px 20px; }
}

/* ============================================================
   reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body.page-sub, .hero { animation: none; }
  .js [data-rv] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .js .index-panel.anim .index-body,
  .js .index-panel.anim .index-rows { transition: none; }
  .typed .cursor { animation: none; }
  .strip figure, .strip figcaption { transition: none; }
}
