/* ---------- Design tokens ---------- */
:root {
  --bg: #F8F6F1;
  --ink: #131210;
  --muted: #6E6C64;
  --line: #DEDAD0;
  --surface: #EEEAE1;
  --surface-strong: #DFDACD;
  --edge: clamp(20px, 5vw, 56px);
  --max-width: 1180px;
  --font-display: 'Schibsted Grotesk', system-ui, sans-serif;
  --display-weight: 600;
  --font-body: 'Work Sans', system-ui, sans-serif;}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Hero (text left, photo right, fills the screen on load) ---------- */
.hero {
  height: 100vh;
  display: flex;
}

.hero-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 640px) minmax(300px, 1fr);
  align-items: stretch;
  min-width: 0;
}

.hero-content {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  row-gap: 24px;
  padding: 40px clamp(24px, 5vw, 64px) 40px var(--edge);
  min-height: 0;
}

.name-mark {
  align-self: start;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: var(--display-weight);
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.hero-headline {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1.8rem, 2.3vw + 0.9rem, 2.9rem);
  line-height: 1.14;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.hero-headline strong {
  font-weight: 600;
  font-style: normal;
  color: var(--ink);
}

.hero-headline em {
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
}

.hero-sub {
  max-width: 46ch;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
}

.hero-cv {
  display: inline-block;
  margin-top: 20px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ink);
  transition: opacity 0.2s ease;
}

.hero-cv:hover {
  opacity: 0.7;
}

.hero-photo {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  min-width: 0;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  transform: scale(1.05) translateX(2%);
}

/* ---------- Portfolio ---------- */
.portfolio {
  padding: 72px 32px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.category-card {
  display: block;
  color: inherit;
}

.category-thumb {
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  transition: transform 0.3s ease;
}

/* Each card image sets its own --focus point (in index.html) for when it's cropped */
.category-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
}

.category-card:hover .category-thumb {
  transform: scale(1.02);
}

.category-title {
  margin-top: 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 0.2s ease;
}

.category-card:hover .category-title {
  color: var(--ink);
}

.play-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
}

.play-icon svg {
  margin-left: 3px;
}

/* ---------- Detail page (category page: photo + description) ---------- */
.detail-header {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.back-link {
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.back-link:hover {
  color: var(--ink);
}

/* Wraps the header + photo/copy split so the photo's bottom edge lands on
   the viewport's bottom edge on load, like the homepage hero. */
.detail-viewport {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.detail-viewport .detail-header {
  flex: none;
  width: 100%;
}

.detail {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 24px 32px 0;
}

.detail-grid {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 56px;
  align-items: stretch;
  container-type: size;
}

/* Box is locked to the graphics' 4:5 shape: as wide as the column allows but
   never taller than the row (80cqh = 4:5 of the row height), pinned to the
   bottom so it still meets the bottom of the screen. */
.detail-carousel {
  position: relative;
  width: min(100%, 80cqh);
  aspect-ratio: 4 / 5;
  justify-self: start;
  align-self: end;
}

.carousel-viewport {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  touch-action: pan-y;
}

.carousel-track {
  height: 100%;
  display: flex;
  transition: transform 0.4s ease;
}

.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide img,
.carousel-slide video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--surface);
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(19, 18, 16, 0.15);
  transition: background 0.2s ease, color 0.2s ease;
  z-index: 2;
}

.carousel-btn.prev {
  left: 16px;
}

.carousel-btn.next {
  right: 16px;
}

.carousel-btn:hover {
  background: var(--ink);
  color: var(--bg);
}

/* Dots sit in a small pill in the top-left corner (opposite the full-screen
   button) so nothing covers the info graphics carry along their bottom edge. */
.carousel-dots {
  --dot-gap: 7px;
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: var(--dot-gap);
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(19, 18, 16, 0.55);
  z-index: 1;
}

/* Fingers need more room than a mouse pointer */
@media (pointer: coarse) {
  .carousel-dots {
    --dot-gap: 11px;
  }
}

.carousel-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(248, 246, 241, 0.4);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease;
}

/* Invisible tap area: reaches halfway into each gap so neighbouring dots'
   areas meet with no dead space, and well above and below the dot. */
.carousel-dot::after {
  content: '';
  position: absolute;
  top: -14px;
  bottom: -14px;
  left: calc(var(--dot-gap) / -2);
  right: calc(var(--dot-gap) / -2);
}

.carousel-dot.active {
  background: var(--bg);
}

.carousel-fs {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(19, 18, 16, 0.15);
  transition: background 0.2s ease, color 0.2s ease;
}

.carousel-fs:hover {
  background: var(--ink);
  color: var(--bg);
}

.carousel-fs .fs-exit,
.fs-on .carousel-fs .fs-enter {
  display: none;
}

.fs-on .carousel-fs .fs-exit {
  display: block;
}

/* Full screen: .fs-on is set for both the native Fullscreen API and the
   fixed-position fallback (iPhone Safari can't fullscreen a div). */
.detail-carousel.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
}

.detail-carousel.fs-on {
  aspect-ratio: auto;
  max-width: none;
  background: var(--ink);
}

.fs-on .carousel-viewport,
.fs-on .carousel-track,
.fs-on .carousel-slide {
  height: 100%;
  aspect-ratio: auto;
  background: var(--ink);
}

.fs-on .carousel-slide img {
  background: transparent;
}

.detail-copy {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(1.8rem, 1.2vw + 1.5rem, 2.4rem);
  letter-spacing: -0.01em;
}

.detail-desc {
  margin-top: 20px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 46ch;
}

.detail-desc strong {
  font-weight: 700;
  color: var(--ink);
}

.detail-desc em {
  font-style: italic;
}

.detail-meta {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.detail-meta a {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

.detail-meta a:hover {
  text-decoration-color: var(--ink);
}

.detail-meta-note {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- Format sections (Reels, Stories) ---------- */
.section-jump {
  margin-top: 32px;
  display: flex;
  gap: 24px;
}

.section-jump a {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s ease;
}

.section-jump a:hover {
  border-color: var(--ink);
}

.format-section {
  padding-top: 96px;
  scroll-margin-top: 24px;
}

.format-section:last-of-type {
  padding-bottom: 96px;
}

.format-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--ink);
}

.format-title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.8rem;
  letter-spacing: -0.01em;
}

.detail-page .detail-desc {
  max-width: 75ch;
}

.reels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}

.detail-page + .format-section {
  padding-top: 0;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 32px;
}

.poster-card img {
  width: 100%;
  aspect-ratio: 1414 / 2000;
  object-fit: cover;
  background: var(--surface);
}

.story-frame {
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: var(--surface);
}

.story-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-card {
  display: block;
}

.video-caption {
  margin-top: 14px;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 0.95rem;
}

.video-player {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  overflow: hidden;
  background: var(--ink);
}

.video-player video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* Non-vertical clips sit whole in the 9:16 frame instead of being cropped */
.video-player--square video {
  object-fit: contain;
}

.vp-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  padding: 0;
  background: rgba(19, 18, 16, 0.08);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.video-player.playing .vp-overlay {
  opacity: 0;
  pointer-events: none;
}

.vp-play-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
}

.vp-play-icon svg {
  margin-left: 2px;
}

.vp-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 12px;
  background: linear-gradient(to top, rgba(19, 18, 16, 0.8), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.video-player:hover .vp-controls,
.video-player:focus-within .vp-controls,
.video-player.playing .vp-controls {
  opacity: 1;
}

.vp-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--bg);
  padding: 2px;
  cursor: pointer;
}

.vp-icon-pause {
  display: none;
}

.video-player.playing .vp-icon-play {
  display: none;
}

.video-player.playing .vp-icon-pause {
  display: block;
}

.vp-icon-muted {
  display: none;
}

.video-player.muted .vp-icon-unmuted {
  display: none;
}

.video-player.muted .vp-icon-muted {
  display: block;
}

.vp-progress {
  flex: 1;
  height: 3px;
  background: rgba(248, 246, 241, 0.35);
  border-radius: 2px;
  cursor: pointer;
}

.vp-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--bg);
  border-radius: 2px;
}

.vp-time {
  flex: none;
  font-size: 0.7rem;
  color: var(--bg);
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Film (thumbnail grid, no carousel) ---------- */
.detail-page {
  padding: 48px 32px 96px;
}

.film-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 40px;
}

.film-card {
  display: block;
  color: inherit;
}

.film-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  transition: transform 0.3s ease;
}

.film-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.film-thumb .play-icon {
  position: relative;
  width: 48px;
  height: 48px;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.film-card:hover .film-thumb {
  transform: scale(1.02);
}

.film-card:hover .play-icon {
  opacity: 1;
  transform: scale(1.08);
}

.film-title {
  margin-top: 16px;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.05rem;
}

.film-meta {
  margin-top: 2px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- CV page ---------- */
.cv {
  padding: 48px 32px 96px;
}

.cv-intro {
  max-width: 75ch;
}

.cv-summary {
  margin-top: 20px;
  font-size: 1.1rem;
  line-height: 1.65;
}

.cv-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  font-size: 0.9rem;
  color: var(--muted);
}

.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: opacity 0.2s ease;
}

.cv-download:hover {
  opacity: 0.85;
}

.cv-link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

.cv-link:hover {
  text-decoration-color: var(--ink);
}

.cv-section {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--ink);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
}

.cv-heading {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.cv-body {
  max-width: 75ch;
  line-height: 1.6;
}

.cv-item + .cv-item {
  margin-top: 32px;
}

.cv-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.cv-role {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.05rem;
}

.cv-dates {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cv-org {
  margin-top: 2px;
  font-size: 0.95rem;
  color: var(--muted);
}

.cv-list {
  margin-top: 12px;
  padding-left: 1.1em;
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

.cv-body > .cv-list:first-child {
  margin-top: 0;
}

.cv-list li::marker {
  color: var(--muted);
}

.cv-footnote {
  margin-top: 64px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 56px 32px 48px;
  border-top: 1px solid var(--line);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-name {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.footer-contact {
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-contact a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.social-icons {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 16px;
}

.footer-cv {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--ink);
  transition: opacity 0.2s ease;
}

.footer-cv:hover {
  opacity: 0.7;
}

.social-link {
  color: var(--ink);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.social-link:hover {
  opacity: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root {
    --edge: 28px;
  }

  .portfolio {
    padding: 32px var(--edge) 48px;
  }

  .site-footer {
    padding: 40px var(--edge);
  }

  .category-grid {
    gap: 20px;
  }

  .reels-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .film-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-viewport {
    height: auto;
  }

  .detail {
    padding: 8px 32px 40px;
  }

  .detail-page,
  .cv {
    padding-top: 8px;
  }

  .detail-grid {
    height: auto;
    grid-template-columns: 1fr;
    gap: 28px;
    container-type: normal;
  }

  .detail-carousel {
    width: auto;
    aspect-ratio: auto;
    justify-self: stretch;
    align-self: auto;
  }

  .carousel-viewport {
    height: auto;
  }

  .carousel-track {
    height: auto;
  }

  .carousel-slide {
    height: auto;
    aspect-ratio: 4 / 5;
  }

  /* Description reads first on small screens, then the work */
  .detail-copy {
    order: -1;
    height: auto;
    justify-content: flex-start;
  }

  .hero {
    height: auto;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 20px 28px 24px var(--edge);
    order: 1;
    gap: 16px;
    min-height: 0;
  }

  .hero-headline {
    font-size: clamp(1.6rem, 6vw + 0.3rem, 2.2rem);
    line-height: 1.15;
  }

  .hero-sub {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .hero-cv {
    margin-top: 16px;
  }

  .hero-photo {
    order: 0;
    aspect-ratio: 4 / 3;
  }

  /* One shared side margin on small screens, on every page */
  .container {
    padding-left: var(--edge);
    padding-right: var(--edge);
  }
}

@media (max-width: 640px) {
  .category-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  /* Landscape crops so three stacked cards don't take a screen and a half */
  .category-thumb {
    aspect-ratio: 4 / 3;
  }

  /* No hover on phones, so labels start at full strength */
  .category-title {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--ink);
  }

  .reels-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .format-section {
    padding-top: 48px;
  }

  .film-grid {
    grid-template-columns: 1fr;
  }

  .poster-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .cv-section {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 48px;
  }

}
