/* Jost: open-source (SIL OFL) variable font, weights 100-900 */
@font-face {
  font-family: "Jost";
  src: url("fonts/jost-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Jost";
  src: url("fonts/jost-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #0b0b0b;
  --fg: #ececec;
  --muted: rgba(236, 236, 236, 0.55);
  --line: rgba(236, 236, 236, 0.2);
  --line-strong: rgba(236, 236, 236, 0.45);
  --bar-h: 56px;
  --pad: clamp(16px, 3vw, 40px);
  --gap: clamp(16px, 2vw, 32px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  --bg: #f3f2ee;
  --fg: #111111;
  --muted: rgba(17, 17, 17, 0.55);
  --line: rgba(17, 17, 17, 0.2);
  --line-strong: rgba(17, 17, 17, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
h1, h2, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

.label {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.label-row { display: flex; justify-content: space-between; align-items: baseline; flex: none; }

.link {
  display: inline-flex;
  gap: 0.5em;
  align-items: center;
  font-weight: 300;
  font-size: 15px;
  letter-spacing: 0.04em;
  padding-bottom: 3px;
  text-align: left;
  background: linear-gradient(var(--fg), var(--fg)) left bottom / 0 1px no-repeat;
  transition: background-size 0.45s var(--ease);
}
.link:hover { background-size: 100% 1px; }

.facts { flex: none; border-top: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: 9ch minmax(0, 1fr); padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.facts dt { color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; align-self: center; }
.facts a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* ============ SHELL ============ */
.shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  animation: fade-in 0.9s var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Top bar: two 50% halves ---------- */
.bar {
  position: relative;
  z-index: 2;
  flex: none;
  height: var(--bar-h);
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.seg {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  text-align: left;
  opacity: 0.7;
  transition: flex-grow 0.7s var(--ease), opacity 0.3s;
}
.seg--l { border-right: 1px solid var(--line); }
.seg:hover, .seg[aria-expanded="true"] { opacity: 1; }
.seg__in { display: flex; align-items: center; min-width: 0; padding: 0 var(--pad); }
.seg__name { font-size: 15px; font-weight: 400; letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg__icon { position: relative; flex: none; width: 11px; height: 11px; margin-left: 14px; }
.seg__icon::before, .seg__icon::after {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 100%; height: 1px;
  background: currentColor;
  transition: transform 0.45s var(--ease);
}
.seg__icon::after { transform: rotate(90deg); }
.seg[aria-expanded="true"] .seg__icon::after { transform: rotate(0deg); }
.seg::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.seg[aria-expanded="true"]::after { transform: scaleX(1); }

.tools {
  position: absolute;
  right: var(--pad);
  top: 0;
  height: 100%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
  letter-spacing: 0.06em;
}
.tools__time { font-variant-numeric: tabular-nums; color: var(--muted); }
/* the Showcase half is only 20% wide while RenSoo is open: keep the bar tidy */
.shell[data-focus="left"] .tools__time { display: none; }
.tools__theme { opacity: 0.65; transition: opacity 0.25s; }
.tools__theme:hover { opacity: 1; }

/* ---------- Content: two panels that share the width like the bar ---------- */
.stage { flex: 1 1 0; min-height: 0; display: flex; }
.panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: grid;
  overflow: hidden;
  transition: flex-grow 0.7s var(--ease);
}
.panel--l { border-right: 1px solid var(--line); }

/* click one half: it takes 80%, the other 20% (flex-grow 4 : 1) */
.shell[data-focus="left"] .seg--l,  .shell[data-focus="left"] .panel--l  { flex-grow: 4; }
.shell[data-focus="left"] .seg--r,  .shell[data-focus="left"] .panel--r  { flex-grow: 1; }
.shell[data-focus="right"] .seg--r, .shell[data-focus="right"] .panel--r { flex-grow: 4; }
.shell[data-focus="right"] .seg--l, .shell[data-focus="right"] .panel--l { flex-grow: 1; }

/* ---------- Faces: each panel shows one of several faces ---------- */
.face {
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: clamp(20px, 3.2vw, 48px) var(--pad);
  overflow-y: auto;               /* safety net only; content is sized to fit */
  scrollbar-width: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0s linear 0.25s;
}
.face::-webkit-scrollbar { display: none; }
.face.is-on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s var(--ease) 0.3s, visibility 0s;
}
.face__foot { flex: none; margin-top: auto; padding-top: 16px; display: flex; }

/* ---------- LEFT, default: vital information ---------- */
.vital__name {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  font-size: clamp(56px, min(13vw, 22dvh), 210px);
  font-weight: 100;
  line-height: 0.9;
  letter-spacing: -0.03em;
}
.vital__tag { flex: none; max-width: 28ch; font-size: clamp(17px, 1.7vw, 24px); font-weight: 200; line-height: 1.35; }
.face--vital .face__foot { margin-top: 0; padding-top: 0; }

/* ---------- LEFT, expanded: about + contact + résumé ---------- */
.lfull { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sec {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 var(--gap);
  border-left: 1px solid var(--line);
  overflow: hidden;
}
.sec:first-child { padding-left: 0; border-left: 0; }
.sec:last-child { padding-right: 0; }
.big { font-size: clamp(22px, min(2.4vw, 4.2dvh), 40px); font-weight: 200; line-height: 1.12; letter-spacing: -0.01em; }
.body { font-size: clamp(15px, 1.1vw, 18px); font-weight: 300; line-height: 1.5; }
.sec .facts { margin-top: auto; }
.contact__mail {
  width: fit-content;
  max-width: 100%;
  font-size: clamp(20px, min(2.2vw, 3.8dvh), 36px);
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.contact__mail:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.rows { margin-top: auto; border-bottom: 1px solid var(--line); }
.rows li { border-top: 1px solid var(--line); }
.rows a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(12px, 2dvh, 20px) 0;
  font-size: clamp(20px, min(1.7vw, 3.4dvh), 28px);
  font-weight: 200;
  transition: padding-left 0.45s var(--ease);
}
.rows a:hover { padding-left: 12px; }
.rows a span:last-child { font-size: 0.7em; color: var(--muted); }
.exp { border-bottom: 1px solid var(--line); }
.exp li { display: grid; gap: 1px; padding: 12px 0; border-top: 1px solid var(--line); }
.exp__when { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.exp__role { font-size: clamp(17px, 1.4vw, 21px); font-weight: 300; }
.exp__org { font-size: 14px; color: var(--muted); }
.sec__actions { margin-top: auto; display: flex; gap: 24px; flex-wrap: wrap; }
.face--full .dots { display: none; }

/* ---------- LEFT, while Showcase is open: project list ---------- */
.plist { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); }
.plist li { flex: 0 1 72px; min-height: 34px; border-top: 1px solid var(--line); }
.plist button {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 3.2ch minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  text-align: left;
  opacity: 0.5;
  padding-left: 0;
  transition: opacity 0.3s, padding-left 0.45s var(--ease);
}
.plist .t { font-size: clamp(17px, min(1.4vw, 3dvh), 22px); font-weight: 200; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist .no { font-size: 12px; color: var(--muted); letter-spacing: 0.1em; }
.plist button:hover, .plist button[aria-pressed="true"] { opacity: 1; }
.plist button[aria-pressed="true"] { padding-left: 12px; }
.plist button::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 1px; height: 0;
  background: var(--fg);
  transform: translateY(-50%);
  transition: height 0.45s var(--ease);
}
.plist button[aria-pressed="true"]::before { height: 40%; }

/* ---------- RIGHT, default: showreel teaser ---------- */
.reel-wrap { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; }
.reel {
  width: min(100%, calc((100dvh - var(--bar-h) - 270px) * 1.7778));
  aspect-ratio: 16 / 9;
}
.reel__corner { position: absolute; width: 14px; height: 14px; border: 0 solid var(--line-strong); }
.reel__corner--tl { top: 8px; left: 8px; border-width: 1px 0 0 1px; }
.reel__corner--tr { top: 8px; right: 8px; border-width: 1px 1px 0 0; }
.reel__corner--bl { bottom: 8px; left: 8px; border-width: 0 0 1px 1px; }
.reel__corner--br { bottom: 8px; right: 8px; border-width: 0 1px 1px 0; }

/* shared media frame (placeholder = thin crossed box) */
.media {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(to top right, transparent calc(50% - 0.5px), var(--line) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(to bottom right, transparent calc(50% - 0.5px), var(--line) 50%, transparent calc(50% + 0.5px));
}
.media__ph {
  position: relative;
  padding: 6px 14px;
  background: var(--bg);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.media video, .media img, .media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; background: var(--bg); }
.pg--hero .media video, .pg--hero .media img { object-fit: contain; }

/* ---------- RIGHT, expanded: project detail with circle pages ---------- */
.d__head { flex: none; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.d__id { display: grid; gap: 6px; min-width: 0; }
.d__title { font-size: clamp(26px, min(3vw, 5dvh), 48px); font-weight: 200; letter-spacing: -0.01em; line-height: 1.1; }
.d__tag { text-align: right; }

.d__pages { flex: 1 1 auto; min-height: 0; position: relative; }
.page {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(18px);
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease), visibility 0s linear 0.4s;
}
.page.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity 0.5s var(--ease) 0.15s, transform 0.6s var(--ease) 0.15s, visibility 0s; }

.pg { display: grid; gap: var(--gap); }
.pg--hero { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.pg--hero .pg__media { display: grid; min-height: 0; }
.pg--grid { grid-template-rows: minmax(0, 1fr) auto; }
.pg--grid .pg__media { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 16px; min-height: 0; }
.pg__text { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: hidden; }
.pg--hero .pg__text { align-self: end; }
.pg--grid .pg__text { flex-direction: row; gap: var(--gap); align-items: baseline; }
.pg--grid .pg__text .label { flex: none; }
.pg__body { max-width: 56ch; font-size: clamp(15px, 1.2vw, 18px); color: var(--muted); }

.d__foot { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding-top: 16px; border-top: 1px solid var(--line); min-height: 38px; }
.d__pt { justify-self: start; }
.d__dots { justify-self: center; }
.d__ct { justify-self: end; }

.dots { display: flex; align-items: center; gap: 14px; }
.dot {
  position: relative;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transition: background 0.3s, transform 0.3s var(--ease), border-color 0.3s;
}
.dot::before { content: ""; position: absolute; inset: -10px; }
.dot:hover { transform: scale(1.25); border-color: var(--fg); }
.dot[aria-current="true"] { background: var(--fg); border-color: var(--fg); }

/* ============ PHONES / NARROW: panels stack, 80/20 becomes top/bottom ============ */
@media (max-width: 860px) {
  .stage { flex-direction: column; }
  .panel--l { border-right: 0; border-bottom: 1px solid var(--line); }
  /* the top bar stays two equal halves (like two tabs) */
  .shell[data-focus] .bar .seg { flex-grow: 1; }
  .face { padding: 14px var(--pad); gap: 12px; }

  .reel { width: min(100%, calc((50dvh - 165px) * 1.7778)); }
  .vital__name { font-size: clamp(48px, min(18vw, 14dvh), 120px); }
  .face--vital .facts > div { padding: 8px 0; }

  /* expanded left: about / contact / résumé become swipeable pages with circles */
  .lfull { position: relative; display: block; }
  .sec { position: absolute; inset: 0; padding: 0; border: 0; opacity: 0; visibility: hidden; transition: opacity 0.4s var(--ease), visibility 0s linear 0.4s; }
  .sec.is-active { opacity: 1; visibility: visible; transition: opacity 0.5s var(--ease) 0.1s, visibility 0s; }
  .face--full .dots { display: flex; justify-content: center; flex: none; padding-top: 4px; }
  .big { font-size: clamp(22px, min(7.4vw, 5dvh), 38px); }
  .contact__mail { font-size: clamp(22px, 7.4vw, 40px); }
  .rows a { padding: 10px 0; font-size: 20px; }
  .exp li { padding: 9px 0; }

  /* Showcase open: the small top panel becomes a row of project numbers */
  .face--list .plist { flex-direction: row; flex-wrap: wrap; gap: 10px; border: 0; }
  .face--list .plist li { flex: none; min-height: 0; border: 0; }
  .face--list .plist button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; padding: 0 !important; }
  .face--list .plist .t { display: none; }
  .face--list .plist .no { color: inherit; font-size: 12px; }
  .face--list .plist button::before { display: none; }
  .face--list .plist button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

  /* RenSoo open: the small bottom panel keeps just the teaser text */
  .shell[data-focus="left"] .face--teaser .reel-wrap { display: none; }

  .pg--hero { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .pg--hero .pg__text { align-self: start; }
  .pg--grid .pg__text { flex-direction: column; gap: 6px; }
  .pg__body { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
  .d__title { font-size: clamp(22px, min(7vw, 4.4dvh), 34px); }
  .d__head { align-items: flex-start; }
}
@media (max-width: 520px) { .tools__time { display: none; } }
@media (max-width: 860px) and (max-height: 700px) {
  .vital__tag { font-size: 15px; }
  .face--vital .facts > div:nth-child(n + 3) { display: none; }
  .body { font-size: 14px; line-height: 1.4; }
  .pg__body { -webkit-line-clamp: 2; }
  .facts > div { padding: 6px 0; font-size: 14px; }
}
@media (min-width: 861px) and (max-height: 720px) {
  .body { -webkit-line-clamp: 4; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .sec { gap: 12px; }
  .facts > div { padding: 9px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; transition-delay: 0s !important; animation: none !important; }
  .page { transform: none !important; }
}
