/* junyeol.net
   Works are set on plates like objects on a table — never cropped — with a tag underneath.
   One tab bar on top, at every size.
   Theme is set in content/site.json: "white" | "grey" | "black" | "richblack". All neutral, no tint. */

:root,
[data-theme="white"] {
  --bg: #ffffff;
  --plate: #f1f1f1;       /* the surface a work sits on */
  --plate-hover: #e9e9e9;
  --ink: #0a0a0a;
  --mute: #8e8e8e;
  --line: #e3e3e3;
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.05), 0 10px 28px -8px rgba(0, 0, 0, 0.2);
  --shadow-lift: 0 2px 2px rgba(0, 0, 0, 0.05), 0 18px 36px -10px rgba(0, 0, 0, 0.28);
  --sans: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --fs: 13px;
  --g: 10px;              /* gutter */
  --bar-h: 36px;
  --cols: 4;
  --panel-w: 320px;
  --rail-w: 132px;
}

/* concrete grey: the page and plates are close in value, like a gallery wall */
[data-theme="grey"] {
  --bg: #cfcfcf;
  --plate: #c3c3c3;
  --plate-hover: #bababa;
  --ink: #0a0a0a;
  --mute: #6c6c6c;
  --line: #b7b7b7;
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.08), 0 12px 30px -8px rgba(0, 0, 0, 0.32);
  --shadow-lift: 0 2px 2px rgba(0, 0, 0, 0.08), 0 20px 40px -10px rgba(0, 0, 0, 0.42);
}

[data-theme="black"] {
  --bg: #000000;
  --plate: #121212;
  --plate-hover: #1a1a1a;
  --ink: #f2f2f2;
  --mute: #747474;
  --line: #242424;
  --shadow: 0 10px 28px -8px rgba(0, 0, 0, 0.9);
  --shadow-lift: 0 18px 36px -10px rgba(0, 0, 0, 1);
}

/* rich black: a deep, slightly cool black (like C60 M40 Y40 K100 on press), plates a step lighter */
[data-theme="richblack"] {
  --bg: #0b0c0e;
  --plate: #16181b;
  --plate-hover: #1d2024;
  --ink: #e9eaec;
  --mute: #6f7379;
  --line: #24272b;
  --shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.85);
  --shadow-lift: 0 20px 40px -10px rgba(0, 0, 0, 0.95);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--bar-h); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs) / 1.35 var(--sans);
  font-feature-settings: "tnum", "ss01";
  -webkit-font-smoothing: antialiased;
  word-break: keep-all; /* Korean names and words never split mid-word */
  overflow-wrap: anywhere;
}

h1, h2, p { margin: 0; font: inherit; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }

/* ───────── page transitions: pages cross-fade, the tab bar and rail stay put (browsers without support just navigate) */
@view-transition { navigation: auto; }
.menu { view-transition-name: menu; }
.rail { view-transition-name: rail; }
::view-transition-old(root) { animation: 0.22s ease both vt-out; }
::view-transition-new(root) { animation: 0.38s cubic-bezier(0.2, 0.7, 0.2, 1) both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* ───────── tab bar */
.menu {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: var(--bar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.menu a {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 var(--g);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.menu a + a { border-left: 1px solid var(--line); }
.menu .menu-name { flex-grow: 2; font-weight: 500; }
.menu .n { color: var(--mute); }
/* the fill appears only under the pointer — nothing is highlighted on arrival */
@media (hover: hover) { .menu a:hover { background: var(--ink); color: var(--bg); } }
.menu a:active { background: var(--ink); color: var(--bg); }

/* ───────── grid */
.grid-section { padding: var(--g) var(--g) 40px; }
.section-head {
  display: flex;
  justify-content: space-between;
  padding: 26px 0 10px;
  color: var(--mute);
}
.grid-section:first-child .section-head { padding-top: 14px; }
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 28px var(--g); grid-auto-flow: row dense; }
/* hero: one work set wide in the centre of the first row; the others fill in around it */
.tile-hero { grid-column: 2 / span 2; grid-row: 1; }
.tile-hero .plate { aspect-ratio: 8 / 5; }

.tile { display: block; }
.plate {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 5;
  padding: 11%;
  background: var(--plate);
  transition: background 0.25s ease;
}
.plate img, .plate video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  box-shadow: var(--shadow);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s ease, opacity 0.5s ease;
}
.tile:hover .plate { background: var(--plate-hover); }
/* Vimeo cover clip: sits exactly where the work sits, fades in once it is really playing */
.plate { position: relative; }
.cover-vid { position: absolute; inset: 11%; display: grid; place-items: center; container-type: size; pointer-events: none; }
.cv-box {
  position: relative;
  width: min(100cqw, calc(100cqh * var(--vr, 1.7778)));
  aspect-ratio: var(--vr, 1.7778);
  overflow: hidden;
  opacity: 0;
  box-shadow: var(--shadow);
  transition: opacity 0.6s ease, transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s ease;
}
.cv-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.plate.is-playing .cv-box { opacity: 1; }
.plate.has-vid > img { opacity: 0 !important; transition: opacity 0.6s ease; } /* video covers: nothing until the clip plays */
.plate.has-vid.show-poster:not(.is-playing) > img { opacity: 1 !important; } /* …unless the clip can't play */
.tile:hover .cv-box { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.tile:hover .plate img, .tile:hover .plate video { transform: translateY(-3px); box-shadow: var(--shadow-lift); }

.tag {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  min-height: calc(2 * 1.35em + 7px); /* two lines, so pictures line up even when a work has no subtitle */
  padding-top: 7px;
}
.t-s, .t-y { color: var(--mute); }
.t-s { grid-column: 1 / -1; grid-row: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one line, so every picture ends on the same line */
.t-y { grid-column: 2; grid-row: 1; }
.tag { transition: opacity 0.35s ease, filter 0.35s ease; }
/* hover: the caption dissolves instead of being underlined */
@media (hover: hover) { .tile:hover .tag { opacity: 0.25; filter: blur(3px); } }

/* images fade in as they arrive (only when JS is there to reveal them) */
/* the first images on a page show straight away; only lazy ones further down fade in */
/* images are never hidden while waiting to load — a slow or skipped load event must not leave a gap */
.js .m img { transition: opacity 0.5s ease; }

/* ───────── no plates (default): works stand on an invisible shelf — same grid, bottoms aligned, no boxes */
[data-plates="off"] .plate { background: transparent; padding: 0; display: block; aspect-ratio: auto !important; }
/* every picture runs the full width of its column, so its edges meet the title on the left and the year on the right */
[data-plates="off"] .plate > img { width: 100%; max-width: none; max-height: none; }
[data-plates="off"] .grid { align-items: end; }
[data-plates="off"] .plate img, [data-plates="off"] .plate video, [data-plates="off"] .cv-box { box-shadow: none; }
[data-plates="off"] .cover-vid { inset: 0; place-items: end center; }
[data-plates="off"] .tile:hover .plate { background: transparent; }
[data-plates="off"] .tile:hover .plate img, [data-plates="off"] .tile:hover .cv-box { transform: none; box-shadow: none; opacity: 0.82; }
[data-plates="off"] .rail-plate { background: transparent; padding: 0; align-items: flex-end; outline: 0; }
[data-plates="off"] .rail-plate img { box-shadow: none; opacity: 0.45; transition: opacity 0.2s ease; }
[data-plates="off"] .rail a:hover .rail-plate { background: transparent; }
[data-plates="off"] .rail a:hover .rail-plate img,
[data-plates="off"] .rail a[aria-current="page"] .rail-plate img { opacity: 1; }

/* ───────── shared: panels and small labels */
.panel { background: var(--plate); }
.panel .row { display: flex; justify-content: space-between; gap: 12px; padding: 6px var(--g) 5px; }
.panel .row + .row { border-top: 1px solid var(--line); }
.k { color: var(--mute); }
.chip {
  display: inline-block;
  max-width: 100%;
  padding: 4px 8px 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ───────── project */
.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--g);
  padding: var(--g);
}
.project-head .panel { width: var(--panel-w); }
.project-head h1 { font-weight: 500; }
.project-head .text { width: min(560px, 100%); padding: 6px var(--g) 8px; font-size: 14px; line-height: 1.4; }
.project-head .text p + p { margin-top: 0.7em; }
.project-head .text a, .project-head .panel a { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.project-head .panel a:hover { color: var(--mute); }

.project-media { display: flex; flex-wrap: wrap; justify-content: center; row-gap: var(--g); margin-top: 48px; }
.m { margin: 0; display: flex; justify-content: center; align-items: flex-start; }
.m-full { width: 100%; }
.m-half { width: 50%; }
.m-inset { width: 100%; padding: 60px 0; }
/* the image's own box: never taller than the screen, labels sit on it */
.mw { position: relative; display: block; width: min(100%, calc((100vh - var(--bar-h)) * var(--r, 1.5))); }
.m-inset .mw { width: min(50%, calc(80vh * var(--r, 1.5))); }
.m img, .m video { width: 100%; height: auto; background: var(--plate); }
.m figcaption { position: absolute; left: var(--g); bottom: var(--g); right: var(--g); }
/* Vimeo: holds its real proportions, shows the thumbnail until the player arrives */
.vimeo { position: relative; display: block; aspect-ratio: var(--r, 1.7778); background: var(--plate) center / cover no-repeat; }
.vimeo iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity 0.6s ease; }
.vimeo iframe.ok { opacity: 1; }
.vimeo.is-loop iframe { pointer-events: none; } /* a silent loop behaves like an image */
/* a full player keeps its controls clear: caption goes underneath */
.m:has(.vimeo:not(.is-loop)) figcaption { position: static; padding-top: 6px; }

.project-nav { display: flex; justify-content: space-between; gap: var(--g); padding: 80px var(--g) var(--g); }
.project-nav .chip:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ───────── rail: all works beside the project page */
body[data-page="project"] main { padding-right: var(--rail-w); }
.rail {
  position: fixed;
  z-index: 10;
  top: var(--bar-h);
  right: 0;
  bottom: 0;
  width: var(--rail-w);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background: var(--bg);
  border-left: 1px solid var(--line);
}
.rail::-webkit-scrollbar { display: none; }
.rail ol { list-style: none; margin: 0; padding: 8px var(--g) 40px; display: flex; flex-direction: column; gap: 12px; }
.rail-sec { color: var(--mute); padding-top: 6px; font-size: 11px; }
.rail a { display: block; color: var(--mute); }
.rail-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 5;
  padding: 12%;
  background: var(--plate);
  outline: 1px solid transparent;
  outline-offset: -1px;
  transition: outline-color 0.15s ease, background 0.2s ease;
}
.rail-plate img { width: auto; height: auto; max-width: 100%; max-height: 100%; box-shadow: var(--shadow); }
.rail-tag { display: flex; justify-content: space-between; gap: 4px; padding-top: 4px; font-size: 11px; line-height: 1.25; }
.rail-tag span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail a:hover { color: var(--ink); }
.rail a:hover .rail-plate { background: var(--plate-hover); }
.rail a[aria-current="page"] { color: var(--ink); }
.rail a[aria-current="page"] .rail-plate { outline-color: var(--ink); }

/* ───────── info */
.info {
  display: flex;
  flex-direction: column;
  gap: var(--g);
  width: min(620px, calc(100% - 2 * var(--g)));
  padding: var(--g) 0;
  margin-left: var(--g);
}
.info .bio { padding: 6px var(--g) 8px; font-size: 14px; line-height: 1.4; }
.info .bio p + p { margin-top: 0.7em; }
.info .row a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--mute); }
.info .row a:hover { text-decoration-color: currentColor; }
.info h2 { font-weight: 400; }

.notfound { padding: 30vh var(--g); }
.notfound a { text-decoration: underline; }

/* ───────── tablet */
@media (max-width: 1280px) { :root { --cols: 3; } .tile-hero { grid-column: 1 / -1; } .tile-hero .plate { aspect-ratio: 12 / 5; } }
@media (max-width: 900px) { :root { --cols: 2; } .tile-hero .plate { aspect-ratio: 8 / 5; } }

/* ───────── phone */
@media (max-width: 760px) {
  :root { --g: 8px; --bar-h: 40px; --panel-w: 100%; }
  .menu a { justify-content: center; padding: 0 6px; }
  .menu .menu-name { justify-content: flex-start; padding-left: var(--g); }
  .menu .n { display: none; }
  .grid { gap: 20px 6px; }
  .plate { padding: 9%; }
  .cover-vid { inset: 9%; }
  .tag { grid-template-columns: minmax(0, 1fr) auto; font-size: 12px; }
  .t-t { grid-column: 1; }
  .t-s { grid-column: 1; }
  .t-y { grid-column: 2; }
  .m-half { width: 100%; }
  .m-inset { padding: 40px 0; }
  .m-inset .mw { width: 80%; }
  /* rail becomes a strip you swipe, at the end of the project */
  body[data-page="project"] main { padding-right: 0; }
  .rail { position: static; width: auto; border-left: 0; border-top: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
  .rail ol { flex-direction: row; padding: 10px var(--g) 24px; gap: 8px; }
  .rail li { flex: 0 0 76px; }
  .rail-sec { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  * { transition: none !important; }
}
