/* ===== Tokens ===== */
:root {
  --bg: #0a0a0b;
  --bg-alt: #131316;
  --bg-card: #17181b;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f1ece2;
  --text-muted: #a9a49b;
  --text-dim: #706b63;
  --accent: #d8a457;
  --accent-soft: rgba(216, 164, 87, 0.35);
  --sunset: #e2703f;

  --serif: "Playfair Display", "Noto Serif KR", serif;
  --sans: "Pretendard", -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;

  --container: 1180px;
  --gutter: clamp(20px, 5vw, 64px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent-soft); color: var(--text); }

/* film grain overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== Reveal animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1.1s cubic-bezier(.16,.84,.44,1), transform 1.1s cubic-bezier(.16,.84,.44,1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Nav ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px var(--gutter);
  transition: background .4s ease, padding .4s ease, backdrop-filter .4s ease;
}
.nav.is-scrolled {
  padding: 16px var(--gutter);
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav__brand {
  font-family: var(--serif);
  letter-spacing: 0.12em;
  font-size: 1.05rem;
}
.nav__links {
  display: flex;
  gap: 40px;
}
.nav__links a {
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  position: relative;
  padding-bottom: 4px;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width .3s ease;
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { width: 100%; }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav__toggle span {
  width: 22px; height: 1px;
  background: var(--text);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  height: 100vh;
  min-height: 560px;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: 0;
}
.hero__bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  animation: heroZoom 18s ease-out forwards;
}
@keyframes heroZoom {
  to { transform: scale(1); }
}
.hero__scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,10,11,.55) 0%, rgba(10,10,11,.25) 35%, rgba(10,10,11,.55) 70%, rgba(10,10,11,.95) 100%);
}
.hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 20px;
}
.hero__eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.4em;
  color: var(--accent);
  margin: 0 0 18px;
}
.hero__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(3rem, 9vw, 6.5rem);
  margin: 0;
  letter-spacing: 0.02em;
}
.hero__subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  color: var(--text-muted);
  margin: 6px 0 26px;
  letter-spacing: 0.15em;
}
.hero__tagline {
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: var(--text);
  font-weight: 300;
  max-width: 32em;
  margin: 0 auto;
}
.hero__scroll {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  color: var(--text-muted);
}
.hero__scroll-line {
  width: 1px; height: 40px;
  background: linear-gradient(180deg, var(--accent), transparent);
  overflow: hidden;
}
.hero__scroll-line::after {
  content: "";
  display: block;
  width: 100%; height: 100%;
  background: var(--text);
  animation: scrollLine 2.2s ease-in-out infinite;
}
@keyframes scrollLine {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* ===== Section shared ===== */
section {
  padding: 130px var(--gutter);
  max-width: var(--container);
  margin: 0 auto;
}
.section__eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.35em;
  color: var(--accent);
  margin: 0 0 14px;
}
.section__title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0 0 8px;
  font-weight: 600;
}
.section__head { margin-bottom: 56px; }

/* ===== About ===== */
.about {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(40px, 6vw, 90px);
  align-items: center;
}
.about__media img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: 2px;
  filter: saturate(0.92) contrast(1.03);
}
.about__name {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  margin: 0 0 6px;
  font-weight: 600;
}
.about__name span {
  display: block;
  font-size: 0.9rem;
  font-family: var(--sans);
  color: var(--text-dim);
  font-weight: 300;
  letter-spacing: 0.05em;
  margin-top: 6px;
}
.about__role {
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  margin: 0 0 22px;
}
.about__text {
  color: var(--text-muted);
  max-width: 42em;
}
.about__quote {
  margin: 34px 0;
  padding-left: 24px;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.08rem;
  color: var(--text);
}
.about__quote p { margin: 0 0 12px; }
.about__quote p:last-child { margin-bottom: 0; }
.about__links {
  font-size: 0.9rem;
  color: var(--text-dim);
}
.about__links a { color: var(--text-muted); }
.about__links a:hover { color: var(--accent); }
.dot { margin: 0 10px; color: var(--text-dim); }

/* ===== Works ===== */
.works__intro {
  color: var(--text-muted);
  max-width: 62em;
  margin: 0 0 16px;
}
.works__note {
  color: var(--text-muted);
  max-width: 56em;
  margin: 64px auto;
  text-align: center;
  font-size: 1.02rem;
}
.works__note em {
  color: var(--accent);
  font-style: italic;
}

.featured { display: flex; flex-direction: column; gap: 110px; margin-top: 90px; }
.featured__item {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: clamp(30px, 5vw, 70px);
  align-items: center;
}
.featured__item--reverse { direction: rtl; }
.featured__item--reverse > * { direction: ltr; }
.featured__media img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  filter: saturate(0.95) contrast(1.02);
  transition: transform .8s ease;
}
.featured__media { overflow: hidden; }
.featured__media:hover img { transform: scale(1.04); }
.featured__text h3 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin: 0 0 16px;
  font-style: italic;
}
.featured__text p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0 0 18px;
}
.featured__loc {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}

/* Gallery */
.gallery { margin-top: 90px; }
.gallery__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 40px;
}
.chip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  padding: 9px 20px;
  border-radius: 100px;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all .3s ease;
  font-family: var(--sans);
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0a0b;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.gallery__item {
  margin: 0;
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  cursor: pointer;
  background: var(--bg-alt);
  transition: opacity .4s ease, transform .4s ease;
}
.gallery__item.is-hidden {
  display: none;
}
.gallery__item img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.95);
  transition: transform .7s cubic-bezier(.16,.84,.44,1), filter .5s ease;
}
.gallery__item:hover img {
  transform: scale(1.08);
  filter: saturate(1.05) brightness(1.02);
}
.gallery__item::after {
  content: attr(data-title);
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 16px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--text);
  background: linear-gradient(0deg, rgba(0,0,0,.75), transparent);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease;
}
.gallery__item:hover::after { opacity: 1; transform: translateY(0); }

/* ===== Skills ===== */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 50px;
}
.skills__group h3 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--accent);
  margin: 0 0 26px;
  font-weight: 400;
}
.skill { margin-bottom: 22px; }
.skill__name {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.skill__bar {
  height: 2px;
  background: var(--line);
  position: relative;
}
.skill__bar i {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--accent);
  transition: width 1.4s cubic-bezier(.16,.84,.44,1);
}
.skills__group.is-visible .skill__bar i { width: var(--v); }

/* ===== Projects ===== */
.projects__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 20px;
}
.project {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  align-items: center;
  padding: 34px 0;
  border-top: 1px solid var(--line);
}
.projects__list .project:last-child { border-bottom: 1px solid var(--line); }
.project__media {
  aspect-ratio: 4/3;
  overflow: hidden;
}
.project__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.9);
  transition: transform .6s ease;
}
.project:hover .project__media img { transform: scale(1.06); }
.project--featured {
  grid-template-columns: minmax(360px, 1.35fr) 1fr;
  padding: 44px 0;
}
.project__media--collage {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  aspect-ratio: 16/9;
}
.project__media--collage img:first-child {
  grid-row: 1 / 3;
}
.project__period {
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  color: var(--accent);
}
.project h3 {
  font-family: var(--serif);
  font-size: 1.4rem;
  margin: 8px 0 12px;
  font-weight: 600;
  word-break: keep-all;
}
.project__description {
  max-width: 48em;
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.75;
}
.project__tags {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.project__tags span {
  font-size: 0.72rem;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 12px;
}
.project__link {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid transparent;
}
.project__link:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Contact ===== */
.contact { padding-bottom: 60px; }
.contact__inner { text-align: center; max-width: 760px; margin: 0 auto; }
.contact .section__eyebrow, .contact .section__title { }
.contact__text {
  color: var(--text-muted);
  margin: 0 auto 18px;
  max-width: 46em;
}
.contact__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 56px;
  text-align: left;
}
.contact__card {
  border: 1px solid var(--line);
  padding: 28px 24px;
  border-radius: 4px;
  background: var(--bg-card);
}
.contact__label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--accent);
  margin-bottom: 12px;
}
.contact__card p, .contact__card a {
  font-size: 0.95rem;
  color: var(--text-muted);
}
.contact__card a:hover { color: var(--accent); }

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 40px var(--gutter) 60px;
  color: var(--text-dim);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--line);
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(6, 6, 7, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
}
.lightbox.is-open { display: flex; }
.lightbox img {
  max-width: min(88vw, 1100px);
  max-height: 78vh;
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.lightbox__caption {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}
.lightbox__close {
  position: absolute;
  top: 26px; right: 34px;
  background: none; border: none;
  color: var(--text);
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text);
  font-size: 3rem;
  cursor: pointer;
  padding: 10px 20px;
  opacity: .7;
  transition: opacity .2s;
}
.lightbox__nav:hover { opacity: 1; color: var(--accent); }
.lightbox__prev { left: 6px; }
.lightbox__next { right: 6px; }

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .about { grid-template-columns: 1fr; }
  .about__media img { aspect-ratio: 16/10; }
  .featured__item, .featured__item--reverse { grid-template-columns: 1fr; direction: ltr; }
  .skills__grid { grid-template-columns: repeat(2, 1fr); }
  .gallery__grid { grid-template-columns: repeat(3, 1fr); }
  .project { grid-template-columns: 160px 1fr; gap: 24px; }
  .project--featured { grid-template-columns: 1fr; }
  .contact__cards { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  section { padding: 90px 20px; }
  .nav { padding: 20px 20px; }
  .nav__links {
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    width: min(78vw, 320px);
    background: rgba(10,10,11,0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 28px;
    padding: 40px;
    transform: translateX(100%);
    transition: transform .4s ease;
    border-left: 1px solid var(--line);
  }
  .nav__links.is-open { transform: translateX(0); }
  .nav__toggle { display: flex; }
  .gallery__grid { grid-template-columns: repeat(2, 1fr); }
  .skills__grid { grid-template-columns: 1fr; }
  .project { grid-template-columns: 1fr; }
  .project__media { aspect-ratio: 16/10; }
  .project__media--collage { aspect-ratio: 4/3; }
  .lightbox__nav { font-size: 2.2rem; padding: 6px 10px; }
}

/* ===== Mobile photo albums ===== */
.mobile-albums { display: none; }

@media (max-width: 768px), (max-width: 900px) and (pointer: coarse) {
  .gallery { display: none; }
  .mobile-albums {
    display: block;
    margin-top: 72px;
    scroll-margin-top: 84px;
  }
  .mobile-albums[hidden],
  .mobile-albums__home[hidden],
  .mobile-albums__detail[hidden],
  .mobile-albums__more[hidden] { display: none !important; }
  .mobile-albums__intro {
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
  }
  .mobile-albums__eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .2em;
  }
  .mobile-albums__intro h3,
  .mobile-albums__detail-head h3 {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.55rem;
    font-weight: 500;
  }
  .mobile-albums__intro > p:not(.mobile-albums__eyebrow) {
    max-width: 34em;
    margin: 10px 0 15px;
    color: var(--text-muted);
    font-size: .86rem;
    line-height: 1.7;
    word-break: keep-all;
  }
  .mobile-albums__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 14px;
  }
  .mobile-album-card {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font-family: var(--sans);
  }
  .mobile-album-card__stack {
    position: relative;
    margin: 8px 10px 14px 0;
  }
  .mobile-album-card__stack::before,
  .mobile-album-card__stack::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #19191b;
    pointer-events: none;
  }
  .mobile-album-card__stack::before { transform: translate(9px, -8px) rotate(2.2deg); opacity: .58; }
  .mobile-album-card__stack::after { transform: translate(5px, -4px) rotate(1deg); opacity: .88; }
  .mobile-album-card__frame {
    position: relative;
    z-index: 2;
    display: block;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 7px;
    background: #09090a;
    box-shadow: 0 13px 30px rgba(0,0,0,.3);
  }
  .mobile-album-card__frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #09090a;
    filter: saturate(.96);
  }
  .mobile-album-card__count {
    position: absolute;
    z-index: 3;
    right: 8px;
    bottom: 8px;
    padding: 5px 7px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    background: rgba(7,7,8,.78);
    color: #f2efe8;
    font-size: .58rem;
    letter-spacing: .08em;
    backdrop-filter: blur(8px);
  }
  .mobile-album-card__type {
    display: block;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: .59rem;
    font-weight: 600;
    letter-spacing: .14em;
  }
  .mobile-album-card h4 {
    margin: 0;
    overflow: hidden;
    font-family: var(--serif);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-album-card__open {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    color: var(--text-dim);
    font-size: .68rem;
  }
  .mobile-album-card__open b {
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 400;
    transition: transform .2s ease;
  }
  .mobile-album-card:active .mobile-album-card__open b { transform: translateX(3px); }
  .mobile-albums__detail-head {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 14px;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
  }
  .mobile-albums__detail-head .mobile-albums__eyebrow { margin-bottom: 4px; }
  .mobile-albums__detail-head > div > p:last-child {
    margin: 5px 0 0;
    color: var(--text-dim);
    font-size: .72rem;
  }
  .mobile-albums__back {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text);
    font-size: 1.15rem;
    cursor: pointer;
  }
  .mobile-albums__photos {
    columns: 2;
    column-gap: 8px;
  }
  .mobile-album-photo {
    display: inline-block;
    width: 100%;
    margin: 0 0 8px;
    padding: 0;
    overflow: hidden;
    break-inside: avoid;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #09090a;
    color: var(--text);
    text-align: left;
    cursor: zoom-in;
    font-family: var(--sans);
  }
  .mobile-album-photo img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #09090a;
  }
  .mobile-album-photo span {
    display: block;
    padding: 8px 9px 9px;
    color: var(--text-muted);
    font-size: .63rem;
    line-height: 1.45;
    word-break: keep-all;
  }
  .mobile-albums__more {
    width: 100%;
    margin-top: 14px;
    padding: 13px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--sans);
    font-size: .75rem;
    cursor: pointer;
  }
  body.is-editing .gallery { display: block; }
  body.is-editing .mobile-albums { display: none; }
}