/* ==========================================================================
   Tokens (from the Figma variables)
   ========================================================================== */
:root {
  --bg: #fffcdf;
  --fg: #e70000;
  --fg-dim: rgba(231, 0, 0, 0.3);
  --on-media: #ffffff;

  --serif: "Prata", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, sans-serif;

  --fs-xxs: 14px;
  --fs-xs: 16px;
  --fs-sm: 20px;
  --fs-base: 24px;
  --fs-lg: clamp(40px, 3.4vw, 58px);
  --fs-xl: clamp(88px, 8.7vw, 150px);
  --tracking: -0.02em;

  --space-xxxs: 4px;
  --space-xxs: 8px;
  --space-xs: 12px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-xxl: 64px;

  --radius: 12px;
  --radius-full: 80px;

  --margin: 24px;
  --content-top: 180px;
  --content-max: 970px;
  --sidebar-w: clamp(340px, calc(25vw - 6px), 426px);
  --topbar-h: 64px;
  --line: 1px solid var(--fg);
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--fs-xs);
  line-height: normal;
  letter-spacing: var(--tracking);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, ul { margin: 0; }
ul { padding: 0; list-style: none; }
h1, h2, h3 { font: inherit; }
button { font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

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

:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Type helpers */
.serif { font-family: var(--serif); font-weight: 400; }
.t-xxs { font-size: var(--fs-xxs); }
.t-sm { font-size: var(--fs-sm); }
.t-base { font-size: var(--fs-base); }
.t-lg { font-family: var(--serif); font-weight: 400; font-size: var(--fs-lg); line-height: 1.2; }

.prose p + p { margin-top: 1lh; }

.stack { display: flex; flex-direction: column; align-items: flex-start; }

/* ==========================================================================
   App shell (desktop): fixed to the window, sidebar + scrolling main + roller
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.topbar { display: none; }

.sidebar {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  padding: var(--margin) var(--margin) var(--space-xs);
  border-right: var(--line);
  overflow-y: auto;
  scrollbar-width: none;
}

.main {
  grid-column: 2;
  position: relative;
  grid-row: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--margin);
  container-type: inline-size;
}

.main--top { padding-top: var(--content-top); }

/* Header: name + menu */
.brand { display: flex; flex-direction: column; gap: var(--space-xs); }

.brand-name {
  align-self: flex-start;
  font-family: var(--serif);
  font-weight: 400;
  font-size: calc((var(--sidebar-w) - 2 * var(--margin)) / 6.76);
  line-height: 1.2;
  white-space: nowrap;
}

.nav {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
}

.nav a { position: relative; }

.nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 24px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  background: url("../images/icons/dot.svg") center / 4px 4px no-repeat;
  opacity: 0;
  transition: opacity .2s ease;
}

.nav a:hover::after,
.nav a[aria-current="page"]::after { opacity: 1; }

/* Sidebar body */
.sidebar-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--content-top) - var(--margin) - 104px);
}

.sidebar-lead { max-width: 386px; }

.sidebar-title { font-size: var(--fs-base); }

.back-link { display: inline-block; margin-top: var(--space-lg); width: 24px; }
.back-link img { width: 24px; height: 24px; transition: transform .25s ease; }
.back-link:hover img { transform: translateX(-4px); }

.sidebar-contact { margin-top: auto; padding-top: var(--space-xl); padding-bottom: 39px; }

.brands-title {
  display: flex;
  justify-content: space-between;
  padding-right: var(--space-xs);
  margin-top: var(--space-xl);
  max-width: 402px;
}

/* Arrow link (Link component) */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxxs);
  transition: gap .25s ease;
}
.arrow-link img { width: 22px; height: 22px; flex: none; }
.arrow-link:hover { gap: var(--space-xs); }

/* Scroll hint */
.scroll-hint {
  position: fixed;
  right: var(--margin);
  bottom: calc(var(--roller-h, 60px) + var(--margin));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xxxs);
  font-size: var(--fs-xxs);
  z-index: 5;
  transition: opacity .3s ease, transform .3s ease;
}
.scroll-hint img { width: 22px; height: 22px; transform: rotate(90deg); }
.scroll-hint:hover img { animation: nudge .8s ease infinite; }
.scroll-hint.is-hidden { opacity: 0; pointer-events: none; transform: translateY(8px); }

@keyframes nudge { 50% { translate: 0 4px; } }

/* ==========================================================================
   Client roller (bottom bar)
   ========================================================================== */
.roller {
  grid-column: 1 / -1;
  grid-row: 2;
  background: var(--bg);
  overflow: hidden;
}

.roller-inner {
  border-top: var(--line);
  padding: var(--space-sm) 0;
  overflow: hidden;
}

.roller-track {
  display: flex;
  width: max-content;
  animation: roll var(--roller-duration, 60s) linear infinite;
}

.roller:hover .roller-track { animation-play-state: paused; }

.roller-list {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding-right: var(--space-lg);
  white-space: nowrap;
}

.roller-item { display: flex; align-items: baseline; gap: var(--space-xxxs); }
.roller-item span:first-child { font-size: var(--fs-xxs); }
.roller-item span:last-child { font-family: var(--serif); font-weight: 400; font-size: var(--fs-sm); }

/* Offset by the page margin so the first brand starts in line with "Selected brands" */
@keyframes roll {
  from { transform: translateX(var(--margin)); }
  to { transform: translateX(calc(var(--margin) - 50%)); }
}

/* ==========================================================================
   Shared content pieces
   ========================================================================== */
.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding-bottom: var(--space-xxl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xxl);
}

/* 402 / 544 split used across About, Experience and case details */
.split {
  display: grid;
  grid-template-columns: minmax(0, 402fr) minmax(0, 544fr);
  column-gap: var(--space-md);
}

/* 260 / 544 split with the wide 166px gutter (case role text + steps) */
.split-wide {
  display: grid;
  grid-template-columns: minmax(0, 260fr) minmax(0, 544fr);
  column-gap: 17.11%;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xxxs) var(--space-xs);
  border: var(--line);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.tags { display: flex; flex-wrap: wrap; gap: var(--space-xxs); }

/* Media box with fixed aspect ratio; images use cover unless cropped like in Figma */
.media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: var(--ratio, 969 / 545);
  background: rgba(231, 0, 0, 0.04);
}
.media--square { --ratio: 1; }
.media--flat { border-radius: 0; }
.media--white { background: #fff; }

.media img,
.media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media .crop {
  inset: auto;
  left: var(--x, 0);
  top: var(--y, 0);
  width: var(--w, 100%);
  height: var(--h, 100%);
  max-width: none;
  object-fit: fill;
}

/* Framed screenshot on white (Wemo) */
.media--framed {
  display: grid;
  place-items: center;
  border-radius: 0;
  background: #fff;
}
.media--framed .frame {
  position: relative;
  width: 87.2%;
  aspect-ratio: 845 / 474;
  border: 1px solid #d5d5d5;
  border-radius: var(--radius);
  overflow: hidden;
}

/* On Running symbol overlay */
.symbols {
  position: absolute;
  left: 62.54%;
  top: 10.46%;
  width: 30.96%;
  height: 73.58%;
  background: #e5e5e5;
}
.symbols ul {
  position: absolute;
  left: 15.67%;
  top: 18.2%;
  width: 76.5%;
  height: 58.6%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8.5% 8.7%;
}
.symbols img { position: static; width: 100%; height: 100%; object-fit: contain; }

/* ==========================================================================
   Work list
   ========================================================================== */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding-bottom: var(--margin);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1 1 calc(50% - var(--space-md) / 2);
  height: clamp(420px, 33vw, 572px);
  padding: var(--space-xs);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--on-media);
  isolation: isolate;
}
.card--full { flex-basis: 100%; }

.card img,
.card video {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
  transform: scale(var(--zoom, 1));
  transform-origin: var(--pos, 50% 50%);
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.card:hover img,
.card:hover video { transform: scale(calc(var(--zoom, 1) * 1.03)); }

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.25);
  transition: background .4s ease;
}
.card:hover::after { background: rgba(0, 0, 0, 0.15); }

.card-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 50.9%;
}

.card-details { display: flex; gap: var(--space-md); font-size: var(--fs-xxs); }
.card-details > :first-child { width: 106px; flex: none; }

.card-title {
  max-width: 402px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-base);
}

/* ==========================================================================
   Case page
   ========================================================================== */
.case-intro { display: flex; flex-direction: column; gap: var(--space-xs); }

.case-details {
  display: grid;
  grid-template-columns: calc((100% - var(--space-md)) * 402 / 946) minmax(0, 1fr) max-content minmax(0, 118px);
  column-gap: var(--space-md);
  font-size: var(--fs-xxs);
}
.case-details > div:not(:first-child) { display: flex; flex-direction: column; gap: var(--space-xxs); }
.case-details > div:first-child { align-self: start; }
.case-details .tag { font-size: var(--fs-xs); }
.case-details > div:nth-child(3) { white-space: nowrap; }

.case-role { padding-top: var(--space-xxs); }
.case-role h2 { font-size: var(--fs-sm); }

.step { align-items: start; }

.step-number {
  position: sticky;
  top: 8px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-xl);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.step--reversed { grid-template-columns: minmax(0, 544fr) minmax(0, 260fr); }
.step--reversed .step-number { text-align: right; grid-column: 2; grid-row: 1; }
.step--reversed .step-body { grid-column: 1; grid-row: 1; }

.step-body { display: flex; flex-direction: column; gap: var(--space-md); }
.step-text { display: flex; flex-direction: column; gap: var(--space-xxs); }
.step-text h3 { font-size: var(--fs-sm); }

/* ==========================================================================
   Experience
   ========================================================================== */
.experience { display: flex; flex-direction: column; gap: var(--space-xl); }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-lg);
  line-height: 1.2;
}

.tab { color: var(--fg-dim); transition: color .25s ease; }
.tab:hover, .tab[aria-selected="true"] { color: var(--fg); }
.tab[aria-selected="true"] { cursor: default; }

.tab-panel { display: flex; flex-direction: column; gap: var(--space-xxl); }
.tab-panel[hidden] { display: none; }
.tab-panel:not([hidden]) { animation: fade-up .5s ease both; }

.job { display: flex; flex-direction: column; gap: var(--space-xs); }

.job-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); }
.job-head h2 { font-size: var(--fs-base); }

.roles { display: flex; flex-direction: column; gap: var(--space-xl); }
.role { display: flex; flex-direction: column; gap: var(--space-lg); }
.role-head { border-top: var(--line); padding-top: var(--space-xxs); }
.role-text { grid-column: 2; }

/* ==========================================================================
   About
   ========================================================================== */
.about { display: flex; flex-direction: column; gap: 54px; }
.about-intro { display: flex; flex-direction: column; gap: var(--space-xl); }
.about-meta { display: flex; flex-direction: column; gap: var(--space-lg); }

.competences { align-items: start; }
.competence-groups { display: flex; flex-direction: column; gap: var(--space-xxl); }
.competence { display: flex; flex-direction: column; gap: var(--space-sm); }

.competence-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-xs) 0;
  border-top: var(--line);
  border-bottom: var(--line);
}
.competence-head h3 { font-family: var(--serif); font-weight: 400; font-size: var(--fs-base); }

.competence-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--rows, 5), auto);
  column-gap: var(--space-xs);
}

/* ==========================================================================
   Motion
   ========================================================================== */
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } }

.main > * { animation: fade-up .6s cubic-bezier(.2, .7, .2, 1) both; }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .roller-inner { overflow-x: auto; }
  .roller-track { padding-left: var(--margin); }
}

/* ==========================================================================
   Narrow content column (small desktops, tablets, phones)
   ========================================================================== */
@container (max-width: 760px) {
  .content { gap: var(--space-xl); }

  .card { flex-basis: 100%; height: auto; aspect-ratio: 4 / 5; max-height: 640px; }

  .split, .split-wide, .step, .step--reversed { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-md); }

  .case-details { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto 1fr; row-gap: var(--space-md); }
  .case-details > div:first-child { grid-column: 1 / -1; }
  .case-details > div:nth-child(2) { grid-column: 1; grid-row: 2 / span 2; }
  .case-details > div:nth-child(3) { grid-column: 2; grid-row: 2; }
  .case-details > div:nth-child(4) { grid-column: 2; grid-row: 3; }

  .step-number { position: static; font-size: 88px; line-height: 1; }
  .step--reversed .step-number { text-align: left; grid-column: 1; grid-row: 1; }
  .step--reversed .step-body { grid-row: 2; }

  .role-head { grid-template-columns: minmax(0, 1fr) auto; }
  .role-head p:last-child { text-align: right; }
  .role { gap: var(--space-md); }
  .role-text { grid-column: 1; }

  .competences { row-gap: var(--space-md); }
}

@container (max-width: 480px) {
  .competence-list { grid-template-columns: minmax(0, 1fr); grid-auto-flow: row; grid-template-rows: none; }
  .role-head { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-xxxs); }
  .role-head p:last-child { text-align: left; }
}

/* ==========================================================================
   Mobile: normal page scroll, sidebar moves into a hamburger menu
   ========================================================================== */
@media (max-width: 900px) {
  :root { --fs-lg: clamp(36px, 9vw, 48px); --margin: 16px; --content-top: 40px; }

  html, body { height: auto; }

  .app { display: block; height: auto; overflow: visible; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 var(--margin);
    background: var(--bg);
  }
  .topbar::after {
    content: "";
    position: absolute;
    left: var(--margin);
    right: var(--margin);
    bottom: 0;
    border-bottom: var(--line);
  }

  .topbar-name { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1; }

  .menu-toggle {
    position: relative;
    width: 44px;
    height: 44px;
    margin-right: -10px;
  }
  .menu-toggle span:not(.visually-hidden) {
    position: absolute;
    left: 10px;
    right: 10px;
    height: 1.5px;
    background: var(--fg);
    transition: transform .3s ease, top .3s ease;
  }
  .menu-toggle span:nth-child(1) { top: 17px; }
  .menu-toggle span:nth-child(2) { top: 26px; }
  .menu-open .menu-toggle span:nth-child(1) { top: 21.5px; transform: rotate(45deg); }
  .menu-open .menu-toggle span:nth-child(2) { top: 21.5px; transform: rotate(-45deg); }

  .sidebar {
    position: fixed;
    z-index: 20;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    bottom: var(--roller-h, 56px);
    padding: var(--space-xl) var(--margin) var(--space-md);
    background: var(--bg);
    border-right: 0;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity .3s ease, transform .3s ease, visibility 0s .3s;
  }
  .menu-open .sidebar {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity .3s ease, transform .3s ease;
  }
  .menu-open { overflow: hidden; }

  .brand-name { display: none; }

  .nav {
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--space-xs);
    font-family: var(--serif);
    font-weight: 400;
    font-size: var(--fs-lg);
    line-height: 1.2;
  }
  .nav a { color: var(--fg-dim); align-self: flex-start; transition: color .2s ease; }
  .nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }
  .nav a::after { display: none; }

  .sidebar-body { flex: none; padding-top: var(--space-xl); border-top: var(--line); margin-top: var(--space-xl); }
  .sidebar-title, .back-link { display: none; }
  .sidebar-body:empty, .sidebar-body:not(:has(.sidebar-lead)) { display: none; }
  .sidebar-contact { margin-top: var(--space-lg); padding-top: 0; }
  .brands-title { display: none; }

  .main { overflow: visible; padding: var(--margin) var(--margin) calc(var(--roller-h, 56px) + var(--space-xl)); }
  .main--top { padding-top: var(--content-top); }

  .mobile-title { display: flex; width: fit-content; align-items: center; gap: var(--space-xs); margin-bottom: var(--space-md); font-size: var(--fs-base); }
  .mobile-title img { width: 24px; height: 24px; }

  .scroll-hint { display: none; }

  .case-details { grid-template-rows: auto 1fr; }
  .case-details > div:first-child { display: none; }
  .case-details > div:nth-child(2) { grid-row: 1 / span 2; }
  .case-details > div:nth-child(3) { grid-row: 1; }
  .case-details > div:nth-child(4) { grid-row: 2; }
  .case-role .tag { justify-self: start; margin-bottom: calc(var(--space-xs) - var(--space-md)); }

  .about-photo { --ratio: 1; }
  .about-photo img.crop { inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }

  .roller { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; }
  .roller-inner { padding: var(--space-xs) 0; }
  .roller-item span:last-child { font-size: 18px; }
}

@media (min-width: 901px) {
  .mobile-title, .mobile-only { display: none; }
}
