/* =========================================================================
   DINGSTUDIO — portfolio
   Light by default; auto-switches to dark when the viewer's system is in
   dark mode (prefers-color-scheme). Swap the three typefaces in one place.
   ========================================================================= */

:root {
  /* ---- Type (swap here to restyle the whole site) ---- */
  --font-display: "Bricolage Grotesque", Georgia, serif;
  --font-body: "Schibsted Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* ---- Color: LIGHT (default) ---- */
  --bg: #f5f3ee;          /* warm near-white */
  --bg-elev: #eceae3;
  --line: #d8d4ca;
  --ink: #16140f;
  --ink-dim: #565249;
  --ink-faint: #9a948a;
  --grain-opacity: 0.022;
  --thumb-bright: 0.97;

  /* ---- Metrics ---- */
  --maxw: 2400px;
  --gut: clamp(24px, 3.5vw, 72px);   /* a little breathing room on the sides */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Color: DARK (auto, when the viewer's OS is in dark mode) ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0b0a;
    --bg-elev: #141311;
    --line: #2a2825;
    --ink: #f3efe6;
    --ink-dim: #a6a097;
    --ink-faint: #6c665d;
    --grain-opacity: 0.04;
    --thumb-bright: 0.85;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  min-height: 100vh;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--ink); color: var(--bg); }

/* ---------- Shell ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gut); }

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ---------- Header (left nav · center wordmark · right IG) ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 20px var(--gut);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  grid-column: 2;
  justify-self: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.05rem, 1.7vw, 1.45rem);
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}
.wordmark span { color: var(--ink-faint); }

.head-right { grid-column: 3; justify-self: end; display: flex; align-items: center; }
.ig {
  display: inline-flex;
  color: var(--ink-dim);
  transition: color 0.4s var(--ease), transform 0.4s var(--ease);
}
.ig:hover { color: var(--ink); transform: scale(1.08); }

.nav { display: flex; gap: clamp(14px, 2.4vw, 32px); }
.nav-left { grid-column: 1; justify-self: start; flex-wrap: wrap; }

@media (max-width: 640px) {
  .site-head {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand ig" "nav nav";
    row-gap: 13px;
  }
  .wordmark { grid-area: brand; grid-column: auto; justify-self: start; }
  .head-right { grid-area: ig; grid-column: auto; }
  .nav-left { grid-area: nav; }
}
.nav a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  position: relative;
  padding-bottom: 3px;
  transition: color 0.4s var(--ease);
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ---------- Page head (slim label above the wall) ---------- */
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(26px, 6vh, 60px) 0 clamp(22px, 4vh, 36px);
}
.page-head .label { color: var(--ink); }
.page-head .count { color: var(--ink-faint); white-space: nowrap; }

/* ---------- Film wall ---------- */
/* only set vertical padding here; horizontal padding comes from .wrap (--gut),
   using the `padding` shorthand would reset the side gutter to 0 */
.wall { padding-top: clamp(20px, 3.5vh, 40px); padding-bottom: clamp(50px, 10vh, 110px); }
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: clamp(14px, 1.6vw, 26px);
  row-gap: clamp(30px, 4vh, 52px);
}
@media (min-width: 720px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1080px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card { position: relative; display: block; }
.card .thumb {
  display: block;              /* block so aspect-ratio actually applies */
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;        /* every thumbnail is locked to 16:9 */
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.card .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;           /* full colour, fills the 16:9 frame */
  transform: scale(1.005);
  transition: transform 0.85s var(--ease);
}
.card:hover .thumb img { transform: scale(1.05); }   /* subtle zoom on hover */

.card .meta {
  display: block;
  text-align: center;
  padding: 16px 6px 0;
}
.card .meta .title {
  display: block;
  font-size: clamp(0.85rem, 0.95vw, 0.98rem);
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--ink);
}
.card .meta .cat {
  display: block;
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Social Reels (9:16 wall) ---------- */
.reelgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: clamp(12px, 1.4vw, 22px);
  row-gap: clamp(26px, 3.5vh, 46px);
}
@media (min-width: 720px)  { .reelgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1080px) { .reelgrid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1500px) { .reelgrid { grid-template-columns: repeat(5, 1fr); } }

.reel {
  display: block; width: 100%; text-align: center;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer;
}
.reel .thumb {
  display: block; position: relative; width: 100%;
  aspect-ratio: 9 / 16;               /* vertical frame */
  overflow: hidden; background: var(--bg-elev); border: 1px solid var(--line);
}
.reel .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;                  /* crops the 16:9 thumb to the clean centre */
  transform: scale(1.005);
  transition: transform 0.85s var(--ease);
}
.reel:hover .thumb img { transform: scale(1.05); }
.reel .play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; background: color-mix(in srgb, #000 42%, transparent);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.reel .play svg { margin-left: 3px; }
.reel:hover .play, .reel:focus-visible .play {
  opacity: 1; transform: translate(-50%, -50%) scale(1.06);
}
.reel .meta { display: block; text-align: center; padding: 12px 4px 0; }
.reel .meta .title {
  display: block; font-size: clamp(0.8rem, 0.9vw, 0.92rem);
  line-height: 1.3; color: var(--ink);
}
.reel .meta .cat {
  display: block; margin-top: 6px;
  font-family: var(--font-mono); font-size: 0.62rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint);
}

/* ---------- Reel lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; display: none; }
.lightbox.open { display: block; }
.lb-backdrop {
  position: absolute; inset: 0;
  background: color-mix(in srgb, #000 82%, transparent);
  backdrop-filter: blur(6px);
}
.lb-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px;
}
.lb-frame {
  position: relative;
  width: min(92vw, calc(82vh * 9 / 16));   /* height-bound on desktop, width-bound on mobile */
  aspect-ratio: 9 / 16;
  background: #000; border-radius: 5px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.lb-player, .lb-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lb-cap { display: flex; align-items: center; gap: 18px; max-width: 92vw; color: #f3efe6; }
.lb-title { font-family: var(--font-display); font-size: 1rem; letter-spacing: -0.01em; }
.lb-credits { color: #b9b3a8; white-space: nowrap; transition: color 0.3s var(--ease); }
.lb-credits:hover { color: #fff; }
.lb-close {
  position: absolute; top: 18px; right: 22px; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.3); color: #fff;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  transition: background 0.3s var(--ease);
}
.lb-close:hover { background: rgba(255, 255, 255, 0.15); }

/* ---------- Work (project) page ---------- */
/* grid wall stays full-bleed; the project page is constrained narrower */
.work {
  max-width: 1500px;
  margin-inline: auto;
  /* vertical padding only; horizontal comes from .wrap (--gut) so it isn't zeroed */
  padding-top: clamp(30px, 6vh, 64px);
  padding-bottom: clamp(60px, 12vh, 120px);
}
.back {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink-dim); margin-bottom: clamp(28px, 6vh, 56px);
  transition: gap 0.4s var(--ease), color 0.4s var(--ease);
}
.back:hover { color: var(--ink); gap: 16px; }

.work .tag { color: var(--ink-faint); margin-bottom: 18px; }
.work h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 5rem);
  line-height: 0.96;
  letter-spacing: -0.035em;
  max-width: 20ch;
  margin-bottom: clamp(30px, 6vh, 56px);
}
.player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
  overflow: hidden;
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player.vertical { aspect-ratio: 9 / 16; max-width: 420px; margin-inline: auto; }

.credits {
  margin-top: clamp(40px, 8vh, 80px);
  border-top: 1px solid var(--line);
  max-width: 720px;
}
.credits .row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.credits .row dt { color: var(--ink-faint); font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; padding-top: 2px; }
.credits .row dd { font-size: 1.02rem; }
@media (max-width: 560px) { .credits .row { grid-template-columns: 1fr; gap: 4px; } }

.pager {
  margin-top: clamp(50px, 10vh, 96px);
  display: flex; justify-content: space-between; gap: 20px;
  border-top: 1px solid var(--line); padding-top: 26px;
}
.pager a { color: var(--ink-dim); transition: color 0.4s var(--ease); max-width: 45%; }
.pager a:hover { color: var(--ink); }
.pager .lab { display: block; margin-bottom: 6px; }
.pager .t { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: -0.02em; }
.pager .next { text-align: right; margin-left: auto; }

/* ---------- Contact ---------- */
.contact { padding: clamp(56px, 14vh, 170px) 0; }
.contact .eyebrow { color: var(--ink-faint); margin-bottom: 30px; }
.contact h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 7rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
  margin-bottom: clamp(40px, 8vh, 70px);
}
.clist { display: grid; gap: 0; max-width: 640px; border-top: 1px solid var(--line); }
.clist a, .clist span {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 20px 0; border-bottom: 1px solid var(--line);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  transition: padding-left 0.45s var(--ease), color 0.4s var(--ease);
}
.clist a .k, .clist span .k { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.clist a:hover { padding-left: 14px; color: var(--ink); }

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 40px var(--gut);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  color: var(--ink-faint);
}

/* ---------- Load reveal ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal { opacity: 0; animation: rise 0.9s var(--ease) forwards; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; }
}

.note { color: var(--ink-faint); padding: 40px 0; font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.05em; }
