/* ============================================================
   BOYEON KIM — STYLES
   Near-monochrome, monospace-everywhere editorial portfolio.
   Change the whole mood from the variables in :root below.
   ============================================================ */

:root {
  /* --- Color --- */
  --color-bg:         #ffffff;   /* page background        */
  --color-text:       #555555;   /* primary text           */
  --color-secondary:  #6e6e6e;   /* body copy              */
  --color-muted:      #9a9a9a;   /* captions, nav default  */
  --color-border:     #e2e2e2;   /* hairline dividers      */
  --color-accent:     #3a30e6;   /* the one indigo accent  */
  --color-accent-alt: #2a22cc;   /* accent · press         */
  --color-accent-wash:#e6e6f5;   /* selection / soft tint  */
  --color-tile-bg:    #f2f2f2;

  /* --- Type --- */
  --font-main: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Roboto Mono', Menlo, Consolas, monospace;
  /* Body-copy font. IBM Plex Sans (loaded from Google Fonts in index.html). */
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --weight-thin:    300;
  --weight-regular: 400;
  --weight-medium:  500;
  --weight-bold:    600;

  --size-display: 30px;
  --size-h1:      20px;
  --size-h2:      15px;
  --size-body:    13.5px;
  --size-small:   13px;
  --size-caption: 12px;
  --size-micro:   11px;
  --size-tiny:    10px;
  --size-nano:    9px;

  /* --- Layout --- */
  --max-width:     1280px;
  --sidebar-width: 176px;
  --page-pad:      40px;
  --column-gap:    40px;
  --grid-gutter:   2px;

  /* --- Motion --- */
  --ease-out: cubic-bezier(0.16, 1, 0.30, 1);
  --dur-fast: 180ms;
  --dur-base: 320ms;
  --dur-slow: 520ms;
  --dur-nav:  450ms;
}

/* ============================================================
   BASE
   ============================================================ */
* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-main);
  font-weight: var(--weight-thin);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--color-accent-wash); }

a { color: var(--color-accent); }
a:hover { color: var(--color-accent-alt); }

img { display: block; max-width: 100%; }

/* ============================================================
   LAYOUT — fixed index column + flowing main
   ============================================================ */
.layout {
  display: flex;
  gap: var(--column-gap);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-pad);
  align-items: flex-start;
  color: var(--color-text);
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  height: 100vh;
  padding: 40px 0 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar__top {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ---------- Wordmark ---------- */
.wordmark {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: var(--color-text);
}

.wordmark__name {
  font-size: var(--size-display);
  font-weight: var(--weight-bold);
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--color-text);
  /* nudge the cap-height up so it lines up with the tile's top edge
     (offset scales with line-height: (line-height − cap-height-ratio)/2 em) */
  margin-top: -0.225em;
}

.wordmark__role {
  font-size: var(--size-caption);
  font-weight: var(--weight-thin);
  line-height: 1.35;
  color: var(--color-muted);
}

/* ---------- Nav ---------- */
.nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav__lead {
  font-size: var(--size-small);
  color: var(--color-text);
  margin-bottom: 15px;
}

.nav__lead:empty { display: none; }

.nav-group { display: block; }

.nav__link {
  display: inline-block;
  width: fit-content;
  font-size: var(--size-small);
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--color-muted);
  transition: color var(--dur-fast) var(--ease-out);
  cursor: pointer;
}

.nav__link:hover,
.nav-group:hover .nav__link {
  color: var(--color-text);
}

.nav__link.is-active {
  color: var(--color-text);
  font-weight: var(--weight-bold);
}

.nav-children {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-nav) var(--ease-out);
}

.nav-group.is-expanded .nav-children {
  grid-template-rows: 1fr;
}

.nav-children__inner {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 0 14px;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out),
              padding-top var(--dur-nav) var(--ease-out),
              padding-bottom var(--dur-nav) var(--ease-out);
}

.nav-group.is-expanded .nav-children__inner {
  opacity: 1;
  padding-top: 8px;
  padding-bottom: 8px;
}

.nav__sub {
  width: fit-content;
  font-size: var(--size-caption);
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--color-muted);
  transition: color var(--dur-fast) var(--ease-out);
  cursor: pointer;
}

.nav__sub:hover { color: var(--color-text); }
.nav__sub.is-active { color: var(--color-accent); }

.copyright {
  font-size: var(--size-micro);
  color: var(--color-muted);
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  min-width: 0;
  padding: 40px 0 96px;
}

.view[hidden] { display: none; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   GALLERY — 3-column grid with 2×2 feature tiles
   ============================================================ */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gutter);
  max-width: 90%;
  animation: fadeUp var(--dur-slow) var(--ease-out) both;
}

/* aspect-ratio lives on the tile (grid item) so grid track sizing honors it.
   Frames simply fill the tile — otherwise the browser can under-size rows for
   multi-track items whose aspect-ratio is only declared on a descendant. */
.tile {
  margin: 0;
  padding: 0;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  min-width: 0;
}

.tile--big {
  grid-column: span 2;
  grid-row: span 2;
  /* 2×2 area is still square: (2W + gap) × (2W + gap). */
}

.tile--spacer {
  cursor: default;
  pointer-events: none;
}
.tile--spacer .tile__frame {
  background: var(--color-tile-bg);
}

.tile__frame {
  position: relative;
  overflow: hidden;
  background: var(--color-tile-bg);
  width: 100%;
  height: 100%;
}

.tile__inner {
  width: 100%;
  height: 100%;
  transition: transform var(--dur-slow) var(--ease-out),
              filter var(--dur-slow) var(--ease-out);
  filter: saturate(0.5);
}

.tile__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(var(--zoom, 1));
  transform-origin: center;
}

.tile__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: var(--size-caption);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tile:hover .tile__inner {
  filter: saturate(1);
  transform: scale(1.015);
}

.tile__overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 9px 10px 8px;
  font-size: var(--size-nano);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 15px;
  color: #ffffff;
  background: rgba(17, 17, 17, 0.28);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  text-decoration: none;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}

.tile:hover .tile__overlay {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ============================================================
   SHARED TEXT PRIMITIVES
   ============================================================ */
.eyebrow {
  margin: 0 0 28px;
  font-size: var(--size-tiny);
  font-weight: var(--weight-regular);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.text-link {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
.text-link:hover { color: var(--color-accent-alt); }

.text-link--muted { color: var(--color-muted); }
.text-link--muted:hover { color: var(--color-text); }

.text-link--arrow::after {
  content: " \2192";
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease-out);
}
.text-link--arrow:hover::after { transform: translateX(3px); }

/* ============================================================
   DETAIL VIEW — photo left, text right
   ============================================================ */
.detail__back {
  display: inline-block;
  margin-bottom: 26px;
  font-size: var(--size-caption);
  text-decoration: none;
  color: var(--color-muted);
  transition: color var(--dur-fast) var(--ease-out);
}
.detail__back:hover { color: var(--color-text); }

.detail {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 40px;
  align-items: flex-start;
  animation: fadeUp var(--dur-slow) var(--ease-out) both;
}

.detail__media {
  flex: 1 1 320px;
  min-width: 150px;
  max-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail__image {
  width: 100%;
  overflow: hidden;
  background: var(--color-bg);
}

.detail__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(var(--zoom, 1));
}

.detail__image.is-zoomed-out img {
  object-fit: contain;
}

.detail__placeholder {
  width: 100%;
  height: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: var(--size-caption);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail__text {
  flex: 1 1 360px;
  min-width: 280px;
  max-width: 540px;
  padding-top: 1px;
  color: var(--color-text);
}

.detail__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 9px;
}

.detail__meta {
  font-size: var(--size-tiny);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.detail__year {
  font-size: var(--size-caption);
  color: var(--color-muted);
  white-space: nowrap;
}

.detail__title {
  font-size: var(--size-h1);
  font-weight: var(--weight-medium);
  line-height: 1.4;
  margin: 0 0 8px;
  color: var(--color-text);
  text-wrap: pretty;
}

.detail__context {
  font-size: var(--size-caption);
  line-height: 1.6;
  color: var(--color-secondary);
  margin: 0 0 14px;
}

/* Body-copy paragraphs (project blurb, sub-section body, About).
   Uses the sans body font; everything else stays monospace. */
.detail__blurb,
.detail-section__body,
.prose p {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  font-style: normal;
  text-transform: none;
}

.detail__blurb {
  color: var(--color-text);
  margin: 0 0 14px;
  text-wrap: pretty;
}

/* Summary — bullet overview above the prose */
.detail__summary {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.detail__summary__item {
  position: relative;
  padding-left: 18px;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: var(--color-text);
  text-wrap: pretty;
}

.detail__summary__item::before {
  content: "·";
  position: absolute;
  left: 2px;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.4em;
  line-height: 1;
}

.detail-section {
  margin-top: 22px;
}

.detail-section__title {
  font-size: var(--size-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: var(--weight-medium);
  color: var(--color-text);
  margin-bottom: 6px;
}

.detail-section__body {
  color: var(--color-text);
  margin: 0;
  text-wrap: pretty;
}

.detail-section__body + .detail-section__body {
  margin-top: 10px;
}

.detail__links {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 12.5px;
}

/* ============================================================
   PUBLICATION LIST
   ============================================================ */
.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 720px;
}

.pub-item {
  display: flex;
  gap: 20px;
  padding: 0 0 30px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 30px;
}

.pub-item:last-child { margin-bottom: 0; border-bottom: none; }

.pub-item__num {
  flex: 0 0 auto;
  padding-top: 2px;
  font-size: var(--size-caption);
  color: var(--color-muted);
}

.pub-item__body {
  flex: 1;
  min-width: 0;
}

.pub-item__title {
  margin: 0 0 8px;
  font-size: var(--size-h2);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  color: var(--color-text);
  text-wrap: pretty;
}

.pub-item__authors {
  margin: 0 0 4px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--color-secondary);
}

.pub-item__venue {
  margin: 0;
  font-size: 12.5px;
  color: var(--color-text);
}

.pub-item__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 10px;
  font-size: var(--size-caption);
}

/* ============================================================
   ABOUT + CONTACT
   ============================================================ */
.prose {
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.prose p {
  margin: 0;
  color: var(--color-text);
  text-wrap: pretty;
}

.contact__line {
  max-width: 560px;
  margin: 0 0 26px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  text-wrap: pretty;
}

.contact__details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 32px;
}

#contact-email {
  font-size: 14px;
  width: fit-content;
}

.contact__location {
  font-size: var(--size-small);
  color: var(--color-muted);
}

/* ============================================================
   RESPONSIVE — stack the index column on small screens
   ============================================================ */
@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .tile--big {
    grid-column: span 2;
    grid-row: auto;
  }
}

@media (max-width: 720px) {
  :root { --page-pad: 20px; }

  .layout {
    flex-direction: column;
    gap: 32px;
  }

  .sidebar {
    position: static;
    width: 100%;
    flex: none;
    height: auto;
    padding: 28px 0 0;
  }

  .sidebar__top { gap: 24px; }

  .main { padding: 8px 0 64px; }

  .gallery { grid-template-columns: 1fr; gap: 2px; }
  .tile { aspect-ratio: 2 / 1; }
  .tile--big {
    grid-column: auto;
    grid-row: auto;
  }

  .detail { flex-direction: column; }
  .detail__media { max-width: 100%; }

  .pub-item { gap: 12px; }
}
