/* ==========================================================
   Taeseong Eom — portfolio
   All spacing uses 8px steps (8, 16, 24, 32 ...).
   ========================================================== */

:root {
  --ink: #242424;          /* main text colour from Figma */
  --black: #000000;
  --footer-bg: #e3e3e3;
  --header-bg: rgba(255, 255, 255, 0.8);

  --side: 80px;            /* page left/right margin (header, footer, home) */
  --content-side: 320px;   /* wider left/right margin for content pages */
  --col: 544px;            /* main text column width */
  --col-half: 272px;       /* second column starts here */
  --header-h: 120px;
  --top-gap: 120px;        /* space between header and first content */
  --footer-h: 160px;

  /* Futura PT from Adobe Fonts (Book 400, Medium 500, Demi 600) */
  --font: "futura-pt", Futura, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  /* always keep room for the scrollbar, so the header sits in exactly the
     same place on pages that scroll and pages that don't (home) */
  scrollbar-gutter: stable;
  /* keep scrolled-to items out from under the sticky header */
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  line-height: 1.3;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }

/* ---------- Text styles (Futura PT Book / Medium / Demi) ---------- */
.t-20 { font-size: 15px; font-weight: 400; }
.t-20-demi { font-size: 15px; font-weight: 600; }
.t-24-med { font-size: 18px; font-weight: 500; }
.t-24-demi { font-size: 18px; font-weight: 600; }
.black { color: var(--black); }
.u { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-h);
  padding: 48px var(--side) 0;
  background: var(--header-bg);
  display: flex;
  justify-content: space-between;
  align-items: baseline;   /* logo and menu share one text line */
}
.site-header a {
  position: relative;
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
/* logo is bolder than the menu (Bold vs Demi) */
/* logo: same weight as the menu (Demi), one step larger */
.site-header > a:first-child { font-size: 20px; }
.site-nav { display: flex; gap: 216px; }
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--black);
}
.site-header a:hover { opacity: 0.6; }

/* ---------- Footer ---------- */
.site-footer {
  height: var(--footer-h);
  padding: 0 var(--side) 40px;
  background: var(--footer-bg);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
}
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { margin: 0 4px; }

/* ---------- Main + column ---------- */
main {
  padding: var(--top-gap) var(--content-side) var(--end-gap, 320px);
}
/* home page keeps the normal page margin */
.home main { padding-inline: var(--side); }
.col {
  width: min(var(--col), 100%);
  margin-inline: auto;
}
.two-col {
  display: grid;
  grid-template-columns: var(--col-half) 1fr;
}

/* vertical rhythm: each block gets its own gap from the Figma layout */
.flow > * { margin-top: calc(var(--gap, 0) * 1px); }
.flow > *:first-child { margin-top: 0; }

/* ---------- Home ----------
   The whole home page fits in one screen: header + picture + grey footer,
   no scrolling. The picture shrinks (keeping its proportions) to fit. */
body.home {
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
}
body.home .site-header,
body.home .site-footer { flex-shrink: 0; }
.home main {
  flex: 1 1 auto;
  min-height: 0;
  padding-block: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}
.plan {
  position: relative;
  margin: 0;
  /* as wide as possible, but never taller than the free space */
  width: min(926px, 100cqw, calc(100cqh * 926 / 608));
}
/* white box from Figma that hides the drawing's title block */
.plan::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 30%;
  height: 7%;
  background: #fff;
}

/* intro splash (Figma frame "Taeseong Eom" 64px) */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 600;
  color: var(--ink);
  transition: opacity 0.6s ease;
  cursor: pointer;
}
.intro.is-hidden { opacity: 0; pointer-events: none; }

/* ---------- Works list ---------- */
.works-list .group + .group { margin-top: 80px; }
.works-list .titles { display: flex; flex-direction: column; gap: 16px; }
.works-list a:hover { opacity: 0.6; }
/* Client Works: just the title in its grid position.
   Underline on hover, click to unfold the list below. */
.works-list .client-head { margin-top: 80px; }
.client-toggle {
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  color: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
}
.client-toggle:hover,
.client-toggle:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.client-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s ease;
}
.client-panel.is-open { grid-template-rows: 1fr; }
.client-inner {
  overflow: hidden;
  min-height: 0;
  visibility: hidden;
  transition: visibility 0s linear 0.4s;
}
.client-panel.is-open .client-inner { visibility: visible; transition-delay: 0s; }
.client-inner > .group:first-child { padding-top: 48px; }

/* line breaks follow the Figma text exactly on larger screens */
@media (min-width: 768px) {
  .about-section > p,
  .project-head .two-col > p { white-space: nowrap; }
}

/* ---------- About ---------- */
.about-section { border-top: 1px solid var(--black); padding-top: 8px; }
.about-section a { text-decoration: underline; text-underline-offset: 3px; }


/* ---------- Project pages ---------- */
.project-head .two-col { margin-top: 32px; }

/* figure positioned like Figma: width (--w) and horizontal offset from centre (--dx) */
.fig {
  --ew: min(calc(var(--w) * 1px), 100%);
  position: relative;
  width: var(--ew);
  margin-inline: auto;
  left: clamp(calc((var(--ew) - 100%) / 2), calc(var(--dx, 0) * 100vw / 1920), calc((100% - var(--ew)) / 2));
}
.fig img { width: 100%; }

/* several images in one row */
.stage { aspect-ratio: var(--ar); }
.stage > img {
  position: absolute;
  left: var(--l);
  top: var(--t);
  width: var(--iw);
}

.caption-center { text-align: center; }

/* ---------- Previous / next project ---------- */
.project-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}
.project-nav a { color: var(--ink); }
.project-nav a:hover { color: #a3a3a3; }
.project-nav a[rel="next"] { text-align: right; }

/* ---------- Pictures fade in softly ---------- */
img.will-fade {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
img.will-fade.is-in { opacity: 1; transform: none; }
/* light grey placeholder while a picture is still loading */
main img { background: #f2f2f2; }
.plan img { background: none; }

/* ---------- Lightbox (click a picture to see it large) ---------- */
img.zoomable { cursor: zoom-in; }
img.zoomable:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.no-scroll { overflow: hidden; overscroll-behavior: none; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  /* room for the X on top and the counter at the bottom */
  padding: var(--header-h) var(--side);
  background: rgba(255, 255, 255, 0.97);
  cursor: zoom-out;
  overscroll-behavior: contain;
  touch-action: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lightbox button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.lightbox button:hover { color: #a3a3a3; }
.lightbox button:focus { outline: none; }
.lightbox button:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }   /* keyboard users: thin line in the site style */
/* X sits where "About" sits in the header (right edge, same height) */
.lightbox-close {
  position: absolute;
  top: 44px;
  right: calc(var(--side) - 16px);
  width: 48px;
  height: 32px;
  justify-content: flex-end !important;
  padding-right: 16px !important;
}
/* < 3/12 > centred at the bottom, on the footer text line */
.lightbox-bar {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lightbox-bar.is-single button { visibility: hidden; }
.lightbox-prev, .lightbox-next { width: 32px; height: 32px; }
.lightbox-count { min-width: 40px; text-align: center; }

/* ---------- Works list: hover a title to preview its picture ---------- */
.works-preview { display: none; }
@media (min-width: 1280px) and (hover: hover) {
  .works-preview {
    display: block;
    position: fixed;
    top: 240px;
    right: var(--side);
    width: 240px;
    pointer-events: none;
  }
  .works-preview img {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .works-preview img.is-active { opacity: 1; }
}
@media (min-width: 1440px) and (hover: hover) {
  .works-preview { width: 320px; }
}

/* ---------- Grey dot cursor (mouse / trackpad only) ---------- */
html.has-dot,
html.has-dot * { cursor: none !important; }
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  pointer-events: none;
  will-change: transform;
}
.cursor-dot::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8e8e8e;
  opacity: 0;
  transform: scale(1);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.cursor-dot.is-visible::before { opacity: 1; }
.cursor-dot.is-link::before { transform: scale(2.4); opacity: 0.4; }   /* over links: bigger, softer */
.cursor-dot.is-down::before { transform: scale(0.7); }                 /* pressing: a small squeeze */
.cursor-dot.is-link.is-down::before { transform: scale(2); }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1439px) {
  :root { --content-side: 240px; }
}

@media (max-width: 1279px) {
  .site-nav { gap: 64px; }
}

@media (max-width: 1023px) {
  :root { --content-side: 120px; }
  :root { --top-gap: 80px; }
  .flow > * { margin-top: calc(var(--gap-m, var(--gap, 0)) * 1px); }
  main { padding-bottom: var(--end-gap-m, 160px); }
  .fig { left: 0; }
}

@media (max-width: 767px) {
  :root {
    --side: 24px;
    --content-side: 40px;
    --header-h: 80px;
    --top-gap: 48px;
    --footer-h: 120px;
    --col-half: 112px;
  }
  .site-header { padding-top: 24px; }
  .site-header a { font-size: 16px; }
  .site-header > a:first-child { font-size: 18px; }
  .site-nav { gap: 24px; }
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
    padding-bottom: 24px;
    font-size: 12px;
  }
  .home main { padding-block: 32px; }
  .lightbox-close { top: 20px; }
  .lightbox-bar { bottom: 16px; font-size: 14px; }
  .project-nav { flex-direction: column; gap: 16px; }
  .project-nav a[rel="next"] { text-align: left; }
  .intro { font-size: 32px; }

  .t-24-med, .t-24-demi { font-size: 17px; }
  .t-20, .t-20-demi { font-size: 14px; }

  .project-head .two-col { grid-template-columns: 1fr; gap: 24px; }

  /* side-by-side images stack on phones (unless they overlap on purpose) */
  .stage:not(.overlap) { aspect-ratio: auto; display: flex; flex-direction: column; gap: 16px; }
  .stage:not(.overlap) > img { position: static; width: 100%; }
}
