/* 徐墅齋 — ink & paper */
:root {
  --paper: #faf8f4;
  --paper-2: #f2eee6;
  --ink: #171614;
  --ink-2: #4a4743;
  --ink-3: #8b8780;
  --rule: #d9d3c8;
  --seal: #b4211f;
  --serif: 'Noto Serif KR', 'Noto Serif TC', serif;
  --sans: 'Noto Sans KR', system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.75;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.locked { overflow: hidden; }

/* ── Header ────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--gutter);
  transition: background .4s, padding .4s, opacity .8s;
}
.header.is-solid { background: rgba(250, 248, 244, .92); backdrop-filter: blur(8px); padding-block: 14px; border-bottom: 1px solid rgba(0,0,0,.04); }
.header.is-hidden { opacity: 0; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 30px; width: auto; }
.brand__txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand__han { font-family: var(--serif); font-size: 17px; letter-spacing: .18em; font-weight: 500; }
.brand__en { font-size: 9.5px; letter-spacing: .38em; color: var(--ink-3); }
.nav { display: flex; gap: clamp(18px, 3vw, 40px); }
.nav a { font-size: 12px; letter-spacing: .26em; position: relative; padding: 4px 0; }
.nav a::after { content: ''; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: var(--ink); transition: right .4s var(--ease); }
.nav a:hover::after, .nav a[aria-current]::after { right: 0; }

/* ── Stage: 수묵화 → 흩어짐 → 집과 수평선 ── */
.stage { position: relative; height: 340vh; }
.stage__sticky {
  position: sticky; top: 0;
  height: 100vh; height: 100svh; min-height: 480px;
  overflow: hidden;
  background: var(--stage-bg, #e9e3d8);
}
.stage__canvas { position: absolute; inset: 0; width: 100%; height: 100%; visibility: hidden; }
.stage.is-loaded .stage__canvas { visibility: visible; animation: inkIn 1.6s var(--ease) backwards; }
@keyframes inkIn { from { opacity: 0; } }
.hero__line {
  position: absolute; left: 0; right: 0;
  top: 70%; height: clamp(10px, 1.3vw, 18px);
  background: url(../assets/brand/brush-line.png) center / 100% 100% no-repeat;
  opacity: 0;
  transform-origin: 50% 50%;
  will-change: transform, opacity, filter;
}
.hero__house {
  position: absolute;
  left: clamp(16px, 13vw, 260px);
  bottom: 30%;
  height: clamp(150px, 28vh, 300px);
  width: auto;
  transform-origin: 0 0;
  opacity: 0;
  will-change: transform, opacity;
}
.stage__hint {
  position: absolute; left: 50%; bottom: 28px;
  width: 1px; height: 56px; background: rgba(23,22,20,.35);
  transform-origin: top; animation: drip 2.4s infinite var(--ease);
}
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ── Sections ─────────────────────────── */
.section { padding: clamp(80px, 12vw, 160px) var(--gutter); }
.section__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  margin-bottom: 40px;
}
.eyebrow { font-size: 11px; letter-spacing: .4em; color: var(--ink-3); display: block; margin-bottom: 10px; }
.section__title { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 3vw, 40px); letter-spacing: .04em; margin: 0; }
.seal { display: inline-block; width: .5em; height: .5em; background: var(--seal); margin-left: .35em; vertical-align: .35em; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; font-size: 12.5px; letter-spacing: .08em; }
.filters button { color: var(--ink-3); padding: 4px 0; border-bottom: 1px solid transparent; transition: color .3s, border-color .3s; }
.filters button:hover { color: var(--ink); }
.filters button.is-on { color: var(--ink); border-bottom-color: var(--ink); }
.filters .sep { width: 1px; height: 12px; background: var(--rule); }
.view-toggle { display: flex; gap: 10px; }
.view-toggle button { width: 26px; height: 26px; display: grid; place-items: center; opacity: .35; transition: opacity .3s; }
.view-toggle button.is-on, .view-toggle button:hover { opacity: 1; }
.view-toggle svg { width: 16px; height: 16px; stroke: var(--ink); fill: none; stroke-width: 1.3; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 18px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 48px; }

/* grid view */
.works { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(28px, 4vw, 56px) clamp(16px, 2.4vw, 32px); }
.work { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.work.in { opacity: 1; transform: none; }
.work.is-filtered { display: none; }
.work__img { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--paper-2); }
.work__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease), filter 1s var(--ease); filter: saturate(.92); }
.work a:hover .work__img img { transform: scale(1.04); filter: saturate(1); }
.work__meta { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; margin-top: 14px; }
.work__year { font-size: 11px; color: var(--ink-3); letter-spacing: .1em; padding-top: 4px; }
.work__title { font-family: var(--serif); font-size: 17px; font-weight: 500; letter-spacing: .02em; }
.work__en { display: block; font-family: var(--sans); font-size: 11px; letter-spacing: .14em; color: var(--ink-3); font-weight: 300; text-transform: uppercase; }
.work__type { grid-column: 2; font-size: 11.5px; color: var(--ink-2); margin-top: 6px; }

/* list view */
.works.is-list { grid-template-columns: 1fr; gap: 0; }
.works.is-list .work a { display: grid; grid-template-columns: 160px 1fr; gap: 28px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.works.is-list .work__img { aspect-ratio: 16 / 10; }
.works.is-list .work__meta { margin: 0; grid-template-columns: 80px 1.3fr 1fr; align-items: baseline; }
.works.is-list .work__type { grid-column: auto; margin: 0; }

/* about */
.about { background: var(--paper-2); }
.about__txt p { font-family: var(--serif); font-size: clamp(17px, 1.6vw, 21px); color: var(--ink-2); margin: 24px 0 0; }

/* contact / footer */
.footer { padding: 72px var(--gutter) 40px; position: relative; }
.footer__line { height: 12px; background: url(../assets/brand/brush-line.png) center / 100% 100% no-repeat; margin: 0 calc(var(--gutter) * -1) 56px; }
.footer__grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 32px; font-size: 13px; color: var(--ink-2); }
.footer__grid h3 { font-size: 11px; letter-spacing: .3em; font-weight: 400; color: var(--ink-3); margin: 0 0 12px; }
.footer__grid p { margin: 0; }
.footer__copy { margin-top: 56px; font-size: 11px; color: var(--ink-3); letter-spacing: .1em; }
.footer .brand img { height: 44px; }

/* ── Project detail ───────────────────── */
.p-hero { position: relative; height: 100svh; min-height: 520px; background: #111; overflow: hidden; }
.p-hero__slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s var(--ease); }
.p-hero__slide.is-on { opacity: 1; }
.p-hero__slide img { width: 100%; height: 100%; object-fit: cover; }
.p-hero__shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.45), transparent 40%); pointer-events: none; }
.p-hero__title { position: absolute; left: var(--gutter); bottom: 48px; color: #fff; }
.p-hero__title h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 4.4vw, 60px); margin: 0; letter-spacing: .04em; line-height: 1.2; }
.p-hero__title span { font-size: 12px; letter-spacing: .3em; opacity: .85; text-transform: uppercase; }
.p-hero__ctrl { position: absolute; right: var(--gutter); bottom: 48px; display: flex; align-items: center; gap: 18px; color: #fff; font-size: 12px; letter-spacing: .2em; }
.p-hero__ctrl button { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; display: grid; place-items: center; transition: background .3s; }
.p-hero__ctrl button:hover { background: rgba(255,255,255,.15); }
.p-hero__ctrl svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 1.5; }
.header.on-dark:not(.is-solid) { color: #fff; }
.header.on-dark:not(.is-solid) .brand img { filter: invert(1) brightness(2); }
.header.on-dark:not(.is-solid) .brand__en { color: rgba(255,255,255,.7); }
.header.on-dark:not(.is-solid) .nav a::after { background: #fff; }

.p-info { display: grid; grid-template-columns: 300px 1fr; gap: clamp(32px, 7vw, 120px); padding: clamp(64px, 9vw, 120px) var(--gutter); }
.p-meta { font-size: 13px; }
.p-meta dl { margin: 0; display: grid; grid-template-columns: 90px 1fr; row-gap: 12px; border-top: 1px solid var(--ink); padding-top: 18px; }
.p-meta dt { color: var(--ink-3); font-size: 11px; letter-spacing: .2em; padding-top: 2px; }
.p-meta dd { margin: 0; }
.p-text .lead { font-family: var(--serif); font-size: clamp(19px, 1.9vw, 25px); line-height: 1.75; margin: 0 0 32px; }
.p-text p { color: var(--ink-2); max-width: 40em; }

.p-gallery { padding: 0 var(--gutter) 40px; display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(12px, 2vw, 24px); }
.p-gallery figure { margin: 0; cursor: zoom-in; overflow: hidden; background: var(--paper-2); }
.p-gallery figure.wide { grid-column: 1 / -1; }
.p-gallery img { width: 100%; height: auto; transition: transform 1.2s var(--ease); }
.p-gallery figure:hover img { transform: scale(1.02); }

.p-nav { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); margin-top: 80px; }
.p-nav a { padding: 40px var(--gutter); display: flex; flex-direction: column; gap: 6px; transition: background .4s; }
.p-nav a:hover { background: var(--paper-2); }
.p-nav a + a { text-align: right; border-left: 1px solid var(--rule); }
.p-nav small { font-size: 11px; letter-spacing: .3em; color: var(--ink-3); }
.p-nav strong { font-family: var(--serif); font-weight: 400; font-size: 20px; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 200; background: rgba(20,19,18,.96); display: none; align-items: center; justify-content: center; }
.lb.is-open { display: flex; }
.lb img { max-width: 92vw; max-height: 86vh; object-fit: contain; }
.lb button { position: absolute; color: #fff; font-size: 12px; letter-spacing: .3em; padding: 16px; }
.lb__close { top: 12px; right: 12px; }
.lb__prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb__next { right: 8px; top: 50%; transform: translateY(-50%); }
.lb__count { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.6); font-size: 11px; letter-spacing: .3em; }

/* ── Responsive ───────────────────────── */
@media (max-width: 1024px) {
  .works { grid-template-columns: repeat(2, 1fr); }
  .p-info { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .brand__txt { display: none; }
  .nav { gap: 18px; }
  .nav a { font-size: 11px; letter-spacing: .18em; }
  .works { grid-template-columns: 1fr; }
  .hero__house { left: 50%; margin-left: calc(-11vh / 0.86); height: 22vh; }
  .works.is-list .work a { grid-template-columns: 96px 1fr; gap: 16px; }
  .works.is-list .work__meta { grid-template-columns: 1fr; }
  .works.is-list .work__year { padding: 0; }
  .footer__grid { grid-template-columns: 1fr; }
  .p-gallery { grid-template-columns: 1fr; }
  .p-hero__ctrl { bottom: 20px; }
  .p-hero__title { bottom: 76px; }
  .p-nav strong { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}
