/* theodore studio: white walls and photographs. The logo's upside-down STUDIO is the picture a lens throws;
   every page under it is pictures and as few words as the visitor needs to find their way. */
:root {
  --bg: #ffffff;
  --surface: #f2f2f1;
  --ink: #111111;
  --muted: #6b6b6b;
  --reflect: #949494;          /* the grey of the logo's reflected STUDIO, nowhere else */

  --font: "Albert Sans", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-text: clamp(1rem, 0.96rem + 0.15vw, 1.0625rem);
  --step-menu: 2rem;           /* the phone menu */

  --m: clamp(1rem, 3vw, 2.75rem);
  --pad-l: max(var(--m), env(safe-area-inset-left, 0px));
  --pad-r: max(var(--m), env(safe-area-inset-right, 0px));
  --gap: clamp(0.75rem, 2.2vw, 2rem);
  --top: 6.5rem;               /* header height */

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --t-hover: 180ms;
  --t-ui: 240ms;

  color-scheme: light;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--step-text); line-height: 1.6;
  word-break: keep-all; overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, p, figure, ul { margin: 0; }
:where(ul[role="list"]) { padding: 0; list-style: none; }
img, video { display: block; max-width: 100%; height: auto; background: var(--surface); }
/* pictures cannot be dragged out, selected, or saved from the long-press menu on a phone */
img, video { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.nums { font-variant-numeric: tabular-nums; }
.wrap { padding-left: var(--pad-l); padding-right: var(--pad-r); }

.link { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.3em; text-decoration-thickness: 1px; transition: text-decoration-color var(--t-hover) ease; }
.link-u { text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; transition: color var(--t-hover) ease; }
@media (hover: hover) and (pointer: fine) {
  .link:hover { text-decoration-color: currentColor; }
  .link-u:hover { color: var(--muted); }
}

/* =====================================================================
   The logo, rebuilt in type: THEODORE over STUDIO turned 180°, both rows the same width.
   ===================================================================== */
.logo { display: block; width: 9.5rem; text-decoration: none; color: var(--ink); container-type: inline-size; }
.logo__mark { display: grid; row-gap: calc(100cqi / 6.4 * 0.42); font-family: "Albert Sans", system-ui, sans-serif; font-weight: 500; }
.logo__row {
  display: block; font-size: calc(100cqi / 6.4); line-height: 0.72;
  text-align: justify; text-align-last: justify; word-spacing: -0.22em;
  text-box: trim-both cap alphabetic;
}
@supports (text-box: trim-both cap alphabetic) { .logo__row { line-height: 1; } }
.logo__row--flip { rotate: 180deg; color: var(--reflect); }

/* =====================================================================
   Header and menus
   ===================================================================== */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 2rem;
  min-height: var(--top);
  padding: env(safe-area-inset-top, 0px) var(--pad-r) 0 var(--pad-l);
  background: var(--bg);
}
.top__logo { font-size: inherit; }
.menu { display: flex; align-items: center; gap: clamp(1.25rem, 2.6vw, 2.5rem); font-size: var(--step-small); }
.menu__item { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.4em; text-decoration-thickness: 1px; padding-block: 0.5rem; transition: text-decoration-color var(--t-hover) ease, color var(--t-hover) ease; }
.menu__item[aria-current="page"], .menu__toggle.is-current { text-decoration-color: currentColor; }
.menu__ig { color: var(--muted); }
.menu__group { position: relative; }
/* the genre list is not drawn at all while shut, and drops in when it opens */
.menu__drop {
  position: absolute; top: 100%; left: -1rem; z-index: 2;
  display: none; gap: 0.15rem; padding: 0.75rem 1rem 1rem; min-width: 7rem;
  background: var(--bg);
}
.menu__group:focus-within .menu__drop, .menu__toggle[aria-expanded="true"] + .menu__drop { display: grid; }
@media (hover: hover) and (pointer: fine) {
  .menu__group:hover .menu__drop { display: grid; }
  .menu__item:hover, .menu__sub:hover { text-decoration-color: currentColor; }
}
@media (prefers-reduced-motion: no-preference) {
  .menu__drop { animation: drop var(--t-ui) var(--ease-out); }
}
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
.menu__sub { display: block; padding-block: 0.3rem; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.4em; text-decoration-thickness: 1px; transition: text-decoration-color var(--t-hover) ease; }
.menu__sub[aria-current="page"] { text-decoration-color: currentColor; }
/* after a genre is chosen the list stays shut until the pointer leaves it */
.menu__group.is-suppressed .menu__drop { display: none; }

.burger { display: none; font-size: var(--step-small); min-height: 2.75rem; padding-inline: 0.25rem; }

/* the phone menu fills the screen */
.sheet-menu {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 5rem) var(--pad-r) calc(env(safe-area-inset-bottom, 0px) + 3rem) var(--pad-l);
  background: var(--bg);
}
.sheet-menu[hidden] { display: none; }
.sheet-menu__nav { display: grid; justify-items: center; gap: 0.6rem; font-size: var(--step-menu); line-height: 1.3; text-align: center; }
.sheet-menu__nav a { text-decoration: none; }
.sheet-menu__genres { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1.1rem; font-size: 1.0625rem; color: var(--muted); margin-bottom: 0.6rem; }
.sheet-menu__close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 1rem); right: calc(var(--pad-r) - 0.75rem); min-width: 2.75rem; min-height: 2.75rem; font-size: 2rem; line-height: 1; }

@media (max-width: 47.99em) {
  :root { --top: 4.75rem; }
  .logo { width: 7.5rem; }
  .menu { display: none; }
  .burger { display: block; }
}

/* =====================================================================
   Views: one page, several rooms. Without script every room is shown, one after another.
   ===================================================================== */
main { padding-top: var(--top); }
.view { padding-bottom: clamp(5rem, 10vw, 8rem); }
.view__title { font-size: var(--step-small); font-weight: 500; padding-top: 1.5rem; padding-bottom: 1.75rem; }
.js .view { display: none; }
.js .view:target, .js main:not(:has(.view:target)) #home { display: block; }
.view { scroll-margin-top: var(--top); }

/* =====================================================================
   Home: two columns of one width, the right one set lower; three picture shapes only
   ===================================================================== */
.wall {
  padding-top: clamp(1.5rem, 4vh, 3rem);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(2rem, 8vw, 9rem); align-items: start;
}
.wall__col { display: grid; row-gap: 12vh; }
.wall__col + .wall__col { margin-top: 18vh; }
.wall .frame img { width: 100%; object-fit: cover; }
.wall .is-tall img { aspect-ratio: 4 / 5; }
.wall .is-wide img { aspect-ratio: 3 / 2; }
.wall .is-square img { aspect-ratio: 1 / 1; }

/* narrower screens: one column in the original order, the pictures stepping left and right */
@media (max-width: 63.99em) {
  .wall { display: flex; flex-direction: column; gap: 5rem; }
  .wall__col { display: contents; }
  .wall .frame { width: 80%; }
  .wall .is-right { align-self: flex-end; }
}
@media (max-width: 47.99em) {
  .wall { gap: 3rem; }
  .wall .frame { width: 100%; }
}

/* =====================================================================
   사진 전체: four columns. Each place: three-column masonry.
   ===================================================================== */
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.grid4 img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.masonry { columns: 3; column-gap: var(--gap); }
.masonry .frame { break-inside: avoid; margin-bottom: var(--gap); }
.masonry img { width: 100%; }
@media (max-width: 47.99em) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .masonry { columns: 2; }
}

.frame { display: block; overflow: hidden; }
.frame img { transition: transform 700ms var(--ease-out), opacity 600ms ease; }
@media (hover: hover) and (pointer: fine) { .frame:hover img { transform: scale(1.02); } }

/* =====================================================================
   영상
   ===================================================================== */
.films { display: grid; row-gap: clamp(4rem, 10vh, 7rem); }
.film { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.film__name { grid-column: 1 / 5; font-size: var(--step-small); display: flex; gap: 0.75rem; }
.film__name span { color: var(--muted); }
.film__media { grid-column: 5 / 13; display: block; overflow: hidden; }
.film__media img, .film__media video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 700ms var(--ease-out); }
/* a YouTube film plays right here, at the same 16:9 as the stills */
.film__media iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; background: var(--surface); }
@media (hover: hover) and (pointer: fine) { .film__media:hover img, .film__media:hover video { transform: scale(1.02); } }
@media (max-width: 47.99em) {
  .film { grid-template-columns: minmax(0, 1fr); row-gap: 0.6rem; }
  .film__name, .film__media { grid-column: 1; }
  .film__name { order: 2; }
}

/* =====================================================================
   글
   ===================================================================== */
.journal { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.rows { grid-column: 1 / 6; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; min-height: 2.6rem; padding-block: 0.3rem; text-decoration: none; transition: opacity var(--t-hover) ease; }
.row time { font-size: var(--step-small); color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .rows:has(.row:hover) .row:not(:hover) { opacity: 0.4; } }
.rows:has(.row:focus-visible) .row:not(:focus-visible) { opacity: 0.4; }
.journal__frame { grid-column: 8 / 13; position: sticky; top: calc(var(--top) + 1rem); aspect-ratio: 4 / 5; overflow: hidden; }
.journal__frame img { width: 100%; height: 100%; object-fit: cover; transition: opacity var(--t-ui) ease; }
.journal__frame.is-swapping img { opacity: 0; }
@media (max-width: 47.99em) {
  .journal { display: block; }
  .row { min-height: 3rem; }
  .journal__frame { display: none; }
}

/* =====================================================================
   연락
   ===================================================================== */
.contact { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.contact__photo { grid-column: 1 / 5; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.contact__how { grid-column: 6 / 12; display: grid; gap: 1.25rem; }
.contact__links { display: grid; justify-items: start; gap: 0.3rem; }
@media (max-width: 47.99em) {
  .contact { grid-template-columns: minmax(0, 1fr); row-gap: 1.75rem; }
  .contact__photo, .contact__how { grid-column: 1; }
  .contact__photo { width: 70%; }
}

/* =====================================================================
   Footer: one line
   ===================================================================== */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.75rem 2rem;
  padding-top: 2rem; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 2rem);
  font-size: var(--step-small); color: var(--muted);
}
.foot__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; align-items: baseline; }
.foot__links a { color: var(--ink); }
.credits summary { cursor: pointer; list-style: none; text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
.credits summary::-webkit-details-marker { display: none; }
.credits p { max-width: 40rem; margin-top: 0.6rem; font-size: var(--step-text); line-height: 1.6; color: var(--ink); }
.credits a { color: var(--muted); }

/* =====================================================================
   The viewer: the photograph on white; its details, small, only here
   ===================================================================== */
.viewer { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--ink); overflow: hidden; }
.viewer::backdrop { background: var(--bg); }
.viewer[open] { display: grid; place-items: center; }
.viewer__figure { display: grid; justify-items: start; gap: 0.7rem; width: fit-content; max-width: calc(100vw - var(--pad-l) - var(--pad-r)); position: relative; z-index: 1; pointer-events: none; transition: opacity var(--t-ui) ease; }
.viewer__img {
  max-width: 100%; max-height: calc(100svh - 10rem);
  width: auto; height: auto; object-fit: contain; background: none;
}
.viewer.is-loading .viewer__figure { opacity: 0; }
/* the caption never makes the figure wider than the photograph */
.viewer__caption { width: 0; min-width: 100%; display: grid; gap: 0.15rem; font-size: 0.8125rem; line-height: 1.5; pointer-events: auto; }
.viewer__caption[hidden] { display: none; }
.viewer__meta { color: var(--muted); }
.viewer__desc:empty, .viewer__meta:empty { display: none; }
.viewer__zone { position: absolute; top: 4.5rem; bottom: 4.5rem; width: 50%; z-index: 0; }
.viewer__zone:focus { outline: none; }
.viewer__zone--prev { left: 0; cursor: w-resize; }
.viewer__zone--next { right: 0; cursor: e-resize; }
.viewer__btn, .viewer__close { min-width: 2.75rem; min-height: 2.75rem; display: inline-grid; place-items: center; font-size: 1.125rem; line-height: 1; transition: opacity var(--t-hover) ease, transform var(--t-press, 140ms) var(--ease-out); }
.viewer__close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 0.75rem); right: calc(var(--pad-r) - 0.75rem); z-index: 2; font-size: 2rem; font-weight: 400; }
.viewer__arrows { position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + 0.75rem); right: calc(var(--pad-r) - 0.75rem); z-index: 2; display: flex; gap: 0.5rem; }
@media (hover: hover) and (pointer: fine) { .viewer__btn:hover, .viewer__close:hover { opacity: 0.5; } }
.viewer__btn:active, .viewer__close:active { transform: scale(0.92); }

/* the line shown only when the photo list could not be read, or a genre is still empty */
.note { font-size: var(--step-small); color: var(--muted); }

/* in the browser that has unsaved changes from the editor */
.draft-bar {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem); z-index: 25; translate: -50% 0;
  display: flex; gap: 1rem; align-items: center; padding: 0.55rem 1rem;
  background: var(--ink); color: var(--bg); font-size: var(--step-small); white-space: nowrap;
}
.draft-bar[hidden] { display: none; }
.draft-bar a { color: var(--bg); }

/* =====================================================================
   Motion. With reduced motion everything below is simply the finished state.
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {
  /* the reflection turns over once: STUDIO is read upright for a moment, then the lens inverts it */
  .js .top .logo__row--flip { animation: invert 1400ms var(--ease-in-out) 600ms both; }
  /* a room fades in when you enter it */
  .js .view:target, .js main:not(:has(.view:target)) #home { animation: enter 600ms var(--ease-out) both; }
  /* each photograph rises into place as it comes into view, the way prints fade up on the references */
  .js [data-reveal] :is(img, video) { opacity: 0; transform: translateY(28px); transition: opacity 900ms ease, transform 1100ms var(--ease-expo); transition-delay: calc(var(--i, 0) * 120ms); }
  .js [data-reveal].is-in :is(img, video) { opacity: 1; transform: none; }
  @media (hover: hover) and (pointer: fine) { .js [data-reveal].is-in:hover :is(img, video) { transform: scale(1.02); transition-delay: 0ms; } }
  .sheet-menu:not([hidden]) .sheet-menu__nav > * { animation: rise 600ms var(--ease-out) both; }
  .sheet-menu__nav > :nth-child(2) { animation-delay: 50ms; } .sheet-menu__nav > :nth-child(3) { animation-delay: 100ms; }
  .sheet-menu__nav > :nth-child(4) { animation-delay: 150ms; } .sheet-menu__nav > :nth-child(5) { animation-delay: 200ms; }
  .sheet-menu__nav > :nth-child(6) { animation-delay: 250ms; }
}
@keyframes invert { from { rotate: 0deg; } to { rotate: 180deg; } }
@keyframes enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* if the animation clock never starts (some previews, thumbnail capture), show the finished state */
.motion-off .logo__row, .motion-off .view { animation: none !important; }
.motion-off [data-reveal] :is(img, video) { opacity: 1 !important; transform: none !important; transition: none !important; }
