/* ------------------------------------------------------------------
   Jenna Choi — portfolio
   Layout: quiet text sidebar + two-column work grid (home);
   centered article column (project, About, Fun pages).
   Grid: 24 columns, 24px margins, 20px gutters. Sidebar = columns 1–6.
   ------------------------------------------------------------------ */
:root {
  --bg: #f7f7f7;
  --ink: #333333;
  --muted: #a3a3a3;
  --rule: #e2e2e2;
  --media-bg: #ececec;
  --accent: #51b7df;

  --margin: 24px;
  --gutter: 20px;
  --col: calc((100vw - 2 * var(--margin) - 23 * var(--gutter)) / 24);
  --side-w: calc(var(--col) * 6 + var(--gutter) * 5);
  --main-x: calc(var(--margin) + var(--side-w) + var(--gutter));

  --sans: "Fustat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --small: 13px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--small);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
ul, ol { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
h1, h2 { margin: 0; font-weight: 400; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.small { font-size: 12px; }

/* ------------------------------------------------------------------
   Shared bits
   ------------------------------------------------------------------ */
.clock { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ulink {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}
.ulink:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ------------------------------------------------------------------
   Home — top bar
   ------------------------------------------------------------------ */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px var(--margin) 0;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.mark {
  width: 24px;
  height: 12px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.mark:hover { border-color: var(--accent); background: var(--accent); }

/* ------------------------------------------------------------------
   Home — sidebar
   ------------------------------------------------------------------ */
.side {
  position: fixed;
  top: 52px;
  bottom: 20px;
  left: var(--margin);
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.side__intro {
  display: flex;
  flex-direction: column;
  gap: 1.4em;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.toc { display: flex; flex-direction: column; padding-top: 14px; }
/* Section labels: small and grey, like "Details" / "Overview" on article pages */
.toc__head { margin: 20px 0 3px; font-size: 12px; color: var(--muted); }
.toc__sec:first-child .toc__head { margin-top: 0; }
.toc__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  color: var(--ink);
  transition: color 0.2s ease;
}
.toc__item:hover { color: var(--accent); }
.toc__arrow { color: var(--muted); }
.toc__item:hover .toc__arrow { color: var(--accent); }
.side__foot { margin-top: auto; padding-top: 24px; }
.side__sep { color: var(--rule); }

/* ------------------------------------------------------------------
   Home — work grid (two columns, mixed heights)
   ------------------------------------------------------------------ */
.work {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  margin-left: var(--main-x);
  margin-right: var(--margin);
  padding-top: 52px;
}
.work__col { display: flex; flex-direction: column; gap: 28px; }

/* Filter pills above the grid */
.filters {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.pill {
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  background: #ececec;
  color: #777;
  font-size: var(--small);
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.pill:hover { background: #e2e2e2; color: var(--ink); }
.pill.is-active { background: var(--ink); color: #fff; }

/* 2 / 3 column switch, right end of the filter row */
.cols {
  margin-left: auto;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #ececec;
}
.cols__btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 24px;
  border-radius: 999px;
  color: #999;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.cols__btn:hover { color: var(--ink); }
.cols__btn.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.cols__icon { display: flex; gap: 2px; }
.cols__icon i { display: block; width: 4px; height: 11px; border-radius: 1px; background: currentColor; }
.cols__btn[data-cols="3"] .cols__icon i { width: 3px; }
.work--3 .card__desc { font-size: 12px; }
.card { animation: card-in 0.4s ease both; }
.card[hidden] { display: none; }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } }
.card__link { display: block; }
.card__media {
  position: relative;
  overflow: hidden;
  background: var(--media-bg);
}
.card__media--tall { aspect-ratio: 3 / 4; }
.card__media--wide { aspect-ratio: 10 / 7; }
.card__media--video { aspect-ratio: 16 / 9; }
.card__media img,
.card__media video,
.card__fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}
.card__cap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.card__title { font-weight: 500; }
.card__year { color: var(--muted); font-variant-numeric: tabular-nums; }
.card__desc { margin-top: 2px; color: var(--ink); }
.card__ext { color: var(--muted); }
.card__link:hover .card__title { color: var(--accent); }
.card--soon .card__media > * { opacity: 0.55; }
.card--soon .card__title { color: var(--muted); }

/* Bottom fade: projects soften and blur into the page as they scroll off */
.home::after {
  content: "";
  position: fixed;
  left: calc(var(--main-x) - var(--gutter));
  right: 0;
  bottom: 0;
  height: 110px;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(247, 247, 247, 0), var(--bg) 85%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 60%);
  mask-image: linear-gradient(to bottom, transparent, #000 60%);
}

.signoff {
  position: relative;
  z-index: 6;
  margin: 64px var(--margin) 20px var(--main-x);
  text-align: right;
}

/* ------------------------------------------------------------------
   Article pages — project, About, Fun
   ------------------------------------------------------------------ */
/* Clock stays top-right; "Back home" + section shortcuts stay top-left while scrolling */
.art-top {
  position: fixed;
  top: 18px;
  right: var(--margin);
  z-index: 10;
}
.agenda {
  position: fixed;
  top: 18px;
  left: var(--margin);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  width: calc((100% - 720px) / 2 - 2 * var(--margin));
  max-width: 220px;
}
/* Shortcuts sit in the margin just left of the article, level with the title */
.agenda__list {
  position: fixed;
  top: 128px;
  left: calc(50% - 360px - 220px);
  width: 180px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.agenda__item {
  margin-left: -10px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--muted);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.agenda__item:hover { color: var(--ink); }
.agenda__item.is-here { background: #ededed; color: var(--ink); }
.back { color: var(--ink); transition: color 0.2s ease; }
.back:hover { color: var(--accent); }

.art {
  width: min(720px, calc(100% - 2 * var(--margin)));
  margin: 0 auto;
  padding: 42px 0 0;
}
.art [id] { scroll-margin-top: 32px; }
.crumb { color: var(--ink); }
.crumb a { color: var(--muted); transition: color 0.2s ease; }
.crumb a:hover { color: var(--ink); }
.crumb span { color: var(--muted); margin: 0 2px; }

.art__title {
  margin-top: 72px;
  max-width: 600px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: -0.2px;
}
.art__h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 21px;
  line-height: 1.3;
}

.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
}
.two--intro { margin-top: 48px; }
.two__r { display: flex; flex-direction: column; gap: 1em; }
.two__r p, .two__r li { font-size: var(--small); line-height: 1.55; }
.two__l p + p { margin-top: 2px; }
.lbl { color: var(--muted); margin-bottom: 14px; }
.lbl-sub { margin-bottom: 10px; }
.two--intro .two__r .lbl { margin-bottom: 0; }
.k { color: var(--ink); font-weight: 500; }
.two__r ol { padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.flowline span { color: var(--muted); }

.hero { margin-top: 40px; }

.divider {
  position: relative;
  margin: 56px 0;
  height: 1px;
  background: var(--rule);
}
.divider span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 8px var(--bg);
  transform: translate(-50%, -50%);
}

.asec + .asec { margin-top: 80px; }
.asec > .two + .row { margin-top: 40px; }

.row { display: grid; gap: 12px; }
.row + .row { margin-top: 12px; }
.row--1 { grid-template-columns: 1fr; }
.row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fig { margin: 0; min-width: 0; }
.fig img, .fig video { width: 100%; height: auto; background: var(--media-bg); }
.fig figcaption { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.embed { position: relative; aspect-ratio: 16 / 9; background: #000; }
.embed--app { aspect-ratio: 4 / 3; background: var(--media-bg); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.plist { list-style: none; padding: 0; }
.plist li {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--rule);
}
.plist li:last-child { border-bottom: 1px solid var(--rule); }
.li__a { font-weight: 500; grid-column: 1; grid-row: 1; }
.li__b { grid-column: 1; grid-row: 2; }
.li__b:empty { display: none; }
.li__c { grid-column: 2; grid-row: 1; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.art-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 120px;
  padding: 0 var(--margin) 20px;
}

/* ------------------------------------------------------------------
   Tablet / mobile
   ------------------------------------------------------------------ */
@media (max-width: 900px) {
  :root { --margin: 20px; }
  .side {
    position: static;
    width: auto;
    margin: 56px var(--margin) 0;
    overflow: visible;
  }
  .side__foot { display: none; }
  .work { margin: 32px var(--margin) 0; padding-top: 0; }
  .signoff { margin-left: var(--margin); }
  .home::after { left: 0; height: 56px; }
  .work { --cols: 2 !important; }
  /* Index · Work · Links side by side instead of one long list */
  .toc {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--gutter);
  }
  .toc__sec .toc__head { margin-top: 0; }
}

/* Not enough room beside the column: shortcuts hide; "Back home" + clock
   stay pinned in a soft top bar so you can always get back */
@media (max-width: 1180px) {
  .agenda__list { display: none; }
  .agenda { width: auto; max-width: none; top: 0; padding-top: 14px; }
  .art-top { top: 14px; }
  .back { white-space: nowrap; }
  .article::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 56px;
    z-index: 9;
    background: linear-gradient(var(--bg) 72%, rgba(247, 247, 247, 0));
    pointer-events: none;
  }
  .art { padding-top: 46px; }
}

@media (max-width: 640px) {
  /* one column, back in reading order */
  .work { display: flex; flex-direction: column; gap: 28px; }
  .work__col { display: contents; }
  .card { order: var(--order); }
  .two { grid-template-columns: 1fr; gap: 20px; }
  /* Phone: Index + Links share a row, Work filters below; bigger tap targets */
  .side { margin-top: 52px; }
  .side__intro { gap: 1em; }
  .toc { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .cols { display: none; }
  /* filters scroll sideways in one row */
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    width: 100vw;
    max-width: 100vw;
    margin: 0 0 4px calc(-1 * var(--margin));
    padding: 0 var(--margin);
  }
  .filters::-webkit-scrollbar { display: none; }
  .toc__item { padding: 4px 0; }
      .art__title { margin-top: 48px; font-size: 26px; }
  .row--2, .row--3 { grid-template-columns: 1fr; }
  /* tablet prototype is too cramped on a phone — the "Open in new tab" link stays */
  .embed--app { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
}
