/* Sofia Esther Bencsíková — portfolio
   Light editorial. Off-white paper, near-black type, images do the talking. */

:root {
  --bg: #f4f2ed;
  --bg-2: #ebe8e1;
  --fg: #141414;
  --fg-2: #6b6964;
  --line: #d6d3cb;
  --sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 3vw, 40px);
  --hdr: 56px;
  --max: 1600px;
}

/* dark projects (380-780, thermal vision): main.js flips data-theme after first paint, so this fades in */
:root[data-theme="dark"] { --bg: #000; --bg-2: #141414; --fg: #fff; --fg-2: #8a8a8a; --line: #2a2a2a; }
body, .hdr, .nav, .ftr, .card-img, img, .p-head, .credits, .pn, .list, .list .row, .sec-head, .about-grid, .contact, .focal button, .mono, .credits dt { transition: background-color 1.4s ease, color 1.4s ease, border-color 1.4s ease; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; padding-top: var(--hdr);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; background: var(--bg-2); }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
h1, h2, h3 { font-weight: 400; margin: 0; }
p { margin: 0 0 1em; }
figure { margin: 0; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--fg-2); }
.mono a { color: var(--fg); }

.skip { position: absolute; left: -999px; top: 0; background: var(--fg); color: var(--bg); padding: 8px 12px; }
.skip:focus { left: 8px; z-index: 100; }

/* ---------- header ---------- */
.hdr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: var(--hdr);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.nav { display: flex; gap: clamp(16px, 2.5vw, 40px); font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.nav a { color: var(--fg-2); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); text-decoration: none; }
.nav a[aria-current="page"] { border-bottom: 1px solid var(--fg); }
.menu { display: none; background: none; border: 0; padding: 8px; cursor: pointer; width: 40px; height: 40px; margin-right: -8px; }
.menu span { display: block; height: 1px; background: var(--fg); margin: 5px 0; transition: transform .2s; }
.menu[aria-expanded="true"] span:first-child { transform: translateY(3px) rotate(45deg); }
.menu[aria-expanded="true"] span:last-child { transform: translateY(-3px) rotate(-45deg); }

@media (max-width: 900px) {
  .menu { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: var(--hdr);
    flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav.open { display: flex; }
  .nav a { padding: 16px var(--gutter); border-top: 1px solid var(--line); font-size: 14px; }
  .nav a[aria-current="page"] { border-bottom: 0; }
}

main { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 80px; }

/* ---------- focal length = page zoom ----------
   Wide lens sees more (smaller, more columns), long lens sees less (bigger, fewer columns).
   ponytail: CSS zoom on main. Animates in Chromium/Safari, snaps in Firefox. */
:root { --zoom: 1; --cols-film: 3; --cols-photo: 4; }
:root[data-focal="14"]  { --zoom: .5;  --cols-film: 5; --cols-photo: 8; }
:root[data-focal="24"]  { --zoom: .65; --cols-film: 4; --cols-photo: 6; }
:root[data-focal="35"]  { --zoom: .82; --cols-film: 3; --cols-photo: 5; }
:root[data-focal="85"]  { --zoom: 1.35; --cols-film: 2; --cols-photo: 2; }
:root[data-focal="135"] { --zoom: 1.8; --cols-film: 1; --cols-photo: 1; }
main { zoom: var(--zoom); max-width: calc(var(--max) / var(--zoom)); padding-left: max(var(--gutter), calc(72px / var(--zoom))); padding-right: max(var(--gutter), calc(72px / var(--zoom))); transition: zoom .7s cubic-bezier(.3,.8,.2,1), max-width .7s cubic-bezier(.3,.8,.2,1); }
:root[data-focal="135"] .stills { grid-template-columns: 1fr; }
:root[data-focal="14"] .stills, :root[data-focal="24"] .stills { grid-template-columns: repeat(4, 1fr); }
:root[data-focal="14"] .stills .still:first-child, :root[data-focal="24"] .stills .still:first-child { grid-column: auto; }
:root[data-focal="14"] .photos { display: grid; grid-template-columns: repeat(3, 1fr); }
:root[data-focal="14"] .photos .photo { max-width: none; }

.focal {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 20;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px 0 8px 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
}
.focal-lbl { color: var(--fg-2); padding: 0 8px 6px; font-size: 9px; text-transform: uppercase; }
.focal button {
  background: none; border: 0; cursor: pointer; color: var(--fg-2);
  font: inherit; padding: 5px 8px; line-height: 1; display: flex; align-items: center; gap: 8px;
}
.focal button::before { content: ""; width: 6px; height: 1px; background: currentColor; transition: width .25s; }
.focal button:hover { color: var(--fg); }
.focal button[aria-pressed="true"] { color: var(--fg); }
.focal button[aria-pressed="true"]::before { width: 14px; }
@media (max-width: 900px) {
  .focal { display: none; }
  main { zoom: 1; padding-left: var(--gutter); padding-right: var(--gutter); }
  :root[data-focal] .stills { grid-template-columns: repeat(2, 1fr); }
  :root[data-focal] .stills .still:first-child { grid-column: 1 / -1; }
  :root[data-focal] .photos { display: flex; }
}
@media (max-width: 640px) { :root[data-focal] .stills { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { main { transition: none; } }

/* ---------- footer ---------- */
.ftr {
  display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between;
  padding: 20px var(--gutter) 28px;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-2);
  max-width: var(--max); margin: 0 auto;
}

/* ---------- home ---------- */
.intro { padding: clamp(48px, 10vh, 120px) 0 clamp(40px, 8vh, 96px); max-width: 1100px; }
.intro h1 { font-size: clamp(26px, 3.6vw, 52px); line-height: 1.12; letter-spacing: -0.015em; margin-bottom: 24px; text-wrap: balance; }
.index { margin-bottom: clamp(56px, 8vw, 120px); }
.sec-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--fg); padding: 10px 0 24px;
}
.sec-head h1, .sec-head h2 { color: var(--fg); }
.grid { display: grid; gap: clamp(20px, 3vw, 40px) clamp(16px, 2vw, 28px); }
.grid-2 { grid-template-columns: repeat(var(--cols-film), 1fr); }
.grid-3 { grid-template-columns: repeat(var(--cols-photo), 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card { display: block; }
.card:hover { text-decoration: none; }
.card-img { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--bg-2); }
.card-wide .card-img { aspect-ratio: 16 / 9; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1), opacity .4s; }
.card:hover .card-img img { transform: scale(1.025); }
.card-meta {
  display: grid; grid-template-columns: 2.4em 1fr auto; gap: 12px; align-items: baseline;
  padding-top: 10px;
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em;
}
.card-meta .n, .card-meta .y { color: var(--fg-2); }
.card:hover .card-meta .t { text-decoration: underline; text-underline-offset: .15em; }

/* ---------- project pages ---------- */
.project, .about { padding-top: clamp(32px, 6vh, 72px); }
.p-head { margin-bottom: clamp(24px, 4vw, 48px); border-top: 1px solid var(--fg); padding-top: 12px; }
.p-head h1 { font-size: clamp(32px, 5vw, 72px); line-height: 1.02; letter-spacing: -0.02em; margin-bottom: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.text { max-width: 720px; font-size: clamp(17px, 1.4vw, 21px); line-height: 1.45; margin-bottom: clamp(32px, 5vw, 64px); }

.video { aspect-ratio: 16 / 9; background: #000; margin-bottom: clamp(32px, 5vw, 64px); }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }

.stills { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(12px, 1.6vw, 24px); margin-bottom: clamp(48px, 7vw, 96px); }
.stills .still:first-child { grid-column: 1 / -1; }
@media (max-width: 640px) { .stills { grid-template-columns: 1fr; } }

.photos { display: flex; flex-direction: column; gap: clamp(24px, 5vw, 72px); margin-bottom: clamp(48px, 7vw, 96px); }
.photos .photo { max-width: 1400px; }
.photos .photo:nth-child(3n+2) { align-self: flex-end; max-width: 1000px; }
.photos .photo:nth-child(3n) { max-width: 1100px; align-self: center; }
.photos figcaption { padding-top: 8px; }
@media (max-width: 720px) {
  .photos .photo, .photos .photo:nth-child(3n+2), .photos .photo:nth-child(3n) { max-width: none; align-self: stretch; }
}

.lb { display: block; cursor: zoom-in; }

.credits-wrap { display: grid; grid-template-columns: 1fr 3fr; gap: 32px; margin-bottom: 40px; }
@media (max-width: 720px) { .credits-wrap { grid-template-columns: 1fr; } }
.credits { border-top: 1px solid var(--fg); padding-top: 12px; margin-bottom: 40px; }
.credits h2 { margin-bottom: 16px; color: var(--fg); }
.credits dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 6px 24px; }
.credits-wrap .credits:last-child dl { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 560px) { .credits-wrap .credits:last-child dl { grid-template-columns: 1fr; } }
.credits div { display: grid; grid-template-columns: 11em 1fr; gap: 12px; font-size: 14px; line-height: 1.4; }
.credits dt { color: var(--fg-2); }
.credits dd { margin: 0; }

.pn { display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 24px; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 80px); border-top: 1px solid var(--fg); padding-top: 12px; margin-bottom: clamp(56px, 8vw, 120px); }
@media (max-width: 800px) { .about-grid { grid-template-columns: 1fr; } }
.about-text h1 { font-size: clamp(28px, 3.4vw, 48px); line-height: 1.05; letter-spacing: -0.02em; margin-bottom: 28px; }
.about-text p { font-size: clamp(16px, 1.25vw, 19px); line-height: 1.5; max-width: 620px; }
.about-text .mono { margin-top: 32px; }
.about-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-content: start; }
.about-imgs figure:first-child { grid-column: 1 / -1; }

.list { border-top: 1px solid var(--fg); padding-top: 12px; margin-bottom: clamp(48px, 6vw, 96px); }
.list h2 { color: var(--fg); margin-bottom: 20px; }
.list .row {
  display: grid; grid-template-columns: 11em 1.4fr 1fr; gap: 16px 32px;
  padding: 14px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.45;
}
.list .row strong { font-weight: 500; }
.list .row > span:last-child { color: var(--fg-2); }
@media (max-width: 720px) { .list .row { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- contact ---------- */
.contact { padding: clamp(48px, 14vh, 160px) 0; border-top: 1px solid var(--fg); margin-top: clamp(32px, 6vh, 72px); }
.contact h1 { color: var(--fg); margin-bottom: 24px; }
.contact .big { display: inline-block; font-size: clamp(24px, 5vw, 72px); letter-spacing: -0.02em; line-height: 1.05; margin-bottom: 24px; word-break: break-all; }
.contact p { color: var(--fg-2); max-width: 520px; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: #141414;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox figure { max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lightbox img { max-width: calc(100vw - 48px); max-height: calc(100vh - 80px); width: auto; height: auto; object-fit: contain; background: none; }
.lightbox figcaption { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #bbb; }
.lightbox button {
  position: absolute; background: none; border: 0; color: #eee; cursor: pointer;
  font-family: var(--mono); font-size: 20px; padding: 16px; line-height: 1;
}
.lb-close { top: 8px; right: 8px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
@media (max-width: 720px) { .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card-img img, .menu span { transition: none; }
}
::selection { background: var(--fg); color: var(--bg); }
