/* ============================================================
   LAFON SIMARD × DELORME-BOUCHARD — portfolio
   Cinematic editorial hybrid. Three themes via data-theme.
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --fg: #f2efe8;
  --accent: #e24d2b;
  --muted: #6e6a62;
  --rule: rgba(242,239,232,0.14);
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans:  "Inter", "Helvetica Neue", system-ui, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, monospace;
  --kr:    "Noto Serif KR", serif;
  --ease:  cubic-bezier(.2,.7,.1,1);
}


/* ---------- Reset ---------- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .6s var(--ease), color .6s var(--ease);
  line-height: 1.5;
  cursor: none;
}
html[data-lang="kr"] body { font-family: var(--kr), var(--sans); }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: none; }
::selection { background: var(--accent); color: var(--bg); }

/* ---------- WebGL background ---------- */
#fx-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .7;
  transition: opacity .6s var(--ease);
}

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 9998; pointer-events: none;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--fg); mix-blend-mode: difference;
  transform: translate(-50%,-50%);
  transition: width .3s var(--ease), height .3s var(--ease),
              background .3s var(--ease), transform .08s linear;
}
.cursor.hover { width: 48px; height: 48px; background: var(--accent); mix-blend-mode: normal; opacity: .6;}
.cursor.text  { width: 2px; height: 24px; border-radius: 1px; }
@media (hover: none) { .cursor { display: none; } body { cursor: auto; } button,a{cursor:pointer;} }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  padding: 24px 40px; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  mix-blend-mode: difference; color: #fff;
}
.nav-left  { display: flex; gap: 24px; align-items: center; }
.nav-right { display: flex; gap: 24px; align-items: center; }
.nav a { opacity: .6; transition: opacity .3s var(--ease); }
.nav a:hover { opacity: 1; }
.lang-switch { display: flex; gap: 12px; }
.lang-switch button { opacity: .4; transition: opacity .3s; }
.lang-switch button.active { opacity: 1; color: var(--accent); }
.lang-switch button:hover { opacity: 1; }

/* ---------- Layout ---------- */
.section {
  position: relative; z-index: 2;
  padding: 160px 40px 120px;
  max-width: 1680px; margin: 0 auto;
}
@media (max-width: 720px) { .section { padding: 100px 20px 80px; } }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 40px;
}

/* ---------- Hero (centred, Sejong-inspired typography) ---------- */
.hero {
  min-height: 100vh;
  padding: 120px 48px 96px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  text-align: center;
  gap: 48px;
}
.hero-mono {
  font-family: var(--mono); font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--muted);
  display: flex; gap: 40px; flex-wrap: wrap; justify-content: center;
}
.hero-title {
  font-family: var(--sans);
  font-weight: 300;
  font-size: clamp(54px, 8vw, 140px);
  line-height: .95; letter-spacing: -.025em;
  max-width: 18ch;
  margin: 0 auto;
  white-space: pre-line;
  text-align: center;
}
.hero-title .word { display: inline-block; }
.hero-title em { font-style: italic; color: var(--accent); font-family: var(--serif); font-weight: 400; }
.hero-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.hero-sub {
  max-width: 560px; font-size: 15px; line-height: 1.55;
  color: var(--fg); opacity: .8;
  margin: 0 auto;
  text-align: center;
}

@media (max-width: 720px) {
  .hero { padding: 96px 20px 64px; }
}

/* ---------- Works grid ---------- */
.works-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 60px; padding-bottom: 24px; border-bottom: 1px solid var(--rule);
}
.works-title {
  font-family: var(--serif); font-size: clamp(36px, 6vw, 80px);
  line-height: 1; letter-spacing: -.02em;
}
.works-count { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.works {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 40px 24px;
}
.work {
  position: relative;
  cursor: none;
  transform: translateY(24px);
  opacity: 0;
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.work.in { opacity: 1; transform: translateY(0); }

/* varied spans for editorial rhythm */
.work:nth-child(7n+1) { grid-column: span 7; }
.work:nth-child(7n+2) { grid-column: span 5; margin-top: 120px; }
.work:nth-child(7n+3) { grid-column: span 5; }
.work:nth-child(7n+4) { grid-column: span 7; margin-top: 80px; }
.work:nth-child(7n+5) { grid-column: span 6; }
.work:nth-child(7n+6) { grid-column: span 6; margin-top: 60px; }
.work:nth-child(7n+7) { grid-column: span 12; }
@media (max-width: 900px) {
  .work, .work:nth-child(n) { grid-column: span 12; margin-top: 0; }
}

.work-cover {
  position: relative; overflow: hidden; background: var(--muted);
  aspect-ratio: 16/10;
}
.work-cover.tall { aspect-ratio: 4/5; }
.work-cover img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.02);
  transition: transform 1.2s var(--ease), filter .8s var(--ease);
  filter: saturate(.85) brightness(.78);
}
.work:hover .work-cover img {
  transform: scale(1.06); filter: saturate(1) brightness(1);
}
.work-cover::after {
  /* hover reveal wipe */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.8) 100%);
  opacity: .5;
  transition: opacity .6s var(--ease);
  pointer-events: none;
}
.work:hover .work-cover::after { opacity: .2; }

.work-meta {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 16px; align-items: baseline;
  margin-top: 16px;
  padding-top: 12px; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase;
}
.work-year { color: var(--accent); }
.work-title {
  font-family: var(--serif); font-size: clamp(22px, 2.2vw, 34px);
  letter-spacing: -.01em; text-transform: none; line-height: 1.05;
  margin-top: 8px; grid-column: 1 / -1;
}
html[data-lang="kr"] .work-title { font-family: var(--kr); font-weight: 600; }
.work-disc { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: none; margin-top: 4px; grid-column: 1 / -1; font-family: var(--sans); }

/* ---------- About ---------- */
.about-grid {
  display: grid; grid-template-columns: 5fr 7fr; gap: 80px;
  align-items: start;
}
.about-grid h2 {
  font-family: var(--serif); font-size: clamp(40px, 6vw, 84px);
  line-height: 1; letter-spacing: -.02em;
}
.about-body p {
  font-size: 17px; line-height: 1.6; margin-bottom: 1em;
  max-width: 600px;
}
.bios {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px;
  margin-top: 80px; padding-top: 40px; border-top: 1px solid var(--rule);
}
.bio h3 { font-family: var(--serif); font-size: 28px; font-weight: 400; line-height: 1.1; margin-bottom: 8px; }
.bio .bio-role { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; }
.bio p { color: var(--muted); font-size: 15px; line-height: 1.5; }
@media (max-width: 900px) { .about-grid, .bios { grid-template-columns: 1fr; gap: 40px; } }

/* ---------- Contact ---------- */
.contact {
  text-align: center; padding: 180px 40px;
  border-top: 1px solid var(--rule);
}
.contact h2 {
  font-family: var(--serif); font-size: clamp(56px, 10vw, 160px);
  line-height: .95; letter-spacing: -.03em;
}
.contact a.mail {
  display: inline-block; margin-top: 40px;
  font-family: var(--serif); font-size: clamp(24px, 3vw, 40px);
  border-bottom: 1px solid var(--rule);
  padding: 4px 0;
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
.contact a.mail:hover { color: var(--accent); border-color: var(--accent); }
.contact p { color: var(--muted); max-width: 480px; margin: 24px auto 0; }

/* ---------- Footer ---------- */
.footer {
  padding: 40px; font-family: var(--mono); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  border-top: 1px solid var(--rule);
}

/* ---------- Project modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.92);
  display: none;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.modal.open { display: block; }
.modal-inner { max-width: 1400px; margin: 100px auto; padding: 40px; }
.modal-close {
  position: fixed; top: 24px; right: 24px; z-index: 201;
  font-family: var(--mono); font-size: 12px; letter-spacing: .16em;
  text-transform: uppercase; color: #fff;
  border: 1px solid rgba(255,255,255,.3); padding: 10px 16px;
  transition: background .3s, color .3s;
}
.modal-close:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.modal h2 { font-family: var(--serif); color: #fff; font-size: clamp(40px, 6vw, 80px); line-height: 1; letter-spacing: -.02em; margin-bottom: 24px; }
.modal .modal-meta { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.5); display: flex; gap: 24px; margin-bottom: 40px; }
.modal .modal-meta .ac { color: var(--accent); }
.modal .modal-body { color: rgba(255,255,255,.8); font-size: 18px; line-height: 1.6; max-width: 720px; margin-bottom: 60px; }
/* ---------- Galerie du modal — mise en page éditoriale artistique ----------
   Cycles de 5 images : hero plein champ → paire 50/50 (2ème décalée) →
   paire asymétrique 66/33 (3ème décalée). Puis recommence.
   Chaque image conserve son ratio naturel (object-fit: contain), respiration
   généreuse entre les pièces, révélation progressive au scroll. */

.modal-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 64px 24px;
  padding: 0 clamp(16px, 4vw, 48px);
  align-items: flex-start;
  margin-top: 56px;
}

.gal-item {
  position: relative;
  margin: 0;
  width: 100%;
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.9s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 0.04s);
}
.gal-item.in { opacity: 1; transform: none; }

.gal-item img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 92vh;
  object-fit: contain;
}

.gal-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.32);
  text-transform: uppercase;
  margin-top: 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gal-num .gal-sep {
  display: inline-block;
  width: 12px;
  text-align: center;
  opacity: 0.5;
}

/* Positions 1, 6, 11 ... : hero pleine largeur */
.modal-gallery .gal-item:nth-child(5n+1) { width: 100%; }
.modal-gallery .gal-item:nth-child(5n+1) img { max-height: 94vh; }

/* Positions 2+3 : paire symétrique 50/50, la 2ème décalée vers le bas */
.modal-gallery .gal-item:nth-child(5n+2) { width: calc(50% - 12px); }
.modal-gallery .gal-item:nth-child(5n+3) {
  width: calc(50% - 12px);
  margin-top: 88px;
}
.modal-gallery .gal-item:nth-child(5n+2) img,
.modal-gallery .gal-item:nth-child(5n+3) img { max-height: 82vh; }

/* Positions 4+5 : paire asymétrique 66/33, la plus petite décalée */
.modal-gallery .gal-item:nth-child(5n+4) { width: calc(66.666% - 12px); }
.modal-gallery .gal-item:nth-child(5n+5) {
  width: calc(33.333% - 12px);
  margin-top: 64px;
}
.modal-gallery .gal-item:nth-child(5n+4) img,
.modal-gallery .gal-item:nth-child(5n+5) img { max-height: 82vh; }

/* Galerie courte (2 images) : les deux en pleine largeur */
.modal-gallery .gal-item:first-child:nth-last-child(2),
.modal-gallery .gal-item:first-child:nth-last-child(2) ~ .gal-item {
  width: 100%;
  margin-top: 0;
}

/* Mobile : tout stack, respirations réduites */
@media (max-width: 760px) {
  .modal-gallery {
    gap: 28px;
    padding: 0 12px;
    margin-top: 32px;
  }
  .modal-gallery .gal-item {
    width: 100% !important;
    margin-top: 0 !important;
  }
  .modal-gallery .gal-item img { max-height: 80vh !important; }
}

/* Réduire les animations pour qui préfère */
@media (prefers-reduced-motion: reduce) {
  .gal-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Admin bar ---------- */
#admin-bar {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  background: var(--fg); color: var(--bg);
  padding: 10px 14px; font-family: var(--mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
  border-radius: 100px;
  opacity: .4; transition: opacity .3s var(--ease);
}
#admin-bar:hover { opacity: 1; }

/* ---------- Admin panel (loaded via admin.html) ---------- */
.admin-panel { font-family: var(--sans); }

/* ---------- Reveal animations ---------- */
.reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }

