/* Base: reset, layout container, buttons, icons, header and mobile menu */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg-light);
  color: var(--text-primary);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font: inherit; } /* every heading gets its size from a Figma text style class */
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a, button { -webkit-tap-highlight-color: transparent; }
img, svg { display: block; max-width: 100%; }

/* Focus ring only for keyboard users (:focus-visible), never after a tap or a mouse click */
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}
[tabindex="-1"]:focus { outline: none; } /* containers that only receive focus from the script (mobile menu) */

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

/* One centred container for every block: 1240px, 40px side padding from 768px, 20px below */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--page-pad));
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

.section--light { background: var(--bg-light); color: var(--text-primary); }
.section--dark  { background: var(--bg-dark);  color: var(--text-on-dark); }

/* Icons from /assets/icons-v2.svg, colour follows the text (currentColor). Size is set where used. */
.icon { flex: none; width: 32px; height: 32px; fill: currentColor; }
.icon--right { transform: rotate(45deg); }   /* → */
.icon--up    { transform: rotate(-45deg); }  /* ↑ */
.icon--left  { transform: rotate(-135deg); } /* ← */

/* Buttons (Figma 553:23273 "Download CV", 59:607 "Get in touch") */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 43px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  font: 400 16px/normal var(--font); /* Label/16 Regular */
  white-space: nowrap;
  transition: background-color 300ms ease-out;
}
.btn .icon { width: 18px; height: 18px; }

.btn--primary { background: var(--button-primary); color: var(--surface-white); }
.btn--primary:hover { background: #3a3a3a; }

.btn--outline {
  padding: 0 20px;
  background: var(--bg-light);
  border: 1.5px solid #b0b0b0; /* Figma: solid #b0b0b0, not a variable */
  color: var(--text-muted);
  font-weight: 500; /* Label/16 Medium */
}
.btn--outline:hover { background: #e4e4e4; }

.btn-row { display: flex; flex-wrap: wrap; gap: 16px; }

/* ---------- Header (Figma 553:23264 desktop, 59:158 mobile) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-light);
  border-bottom: 1px solid #d0d0d0; /* Figma: solid #d0d0d0 */
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: calc(var(--header-h) - 1px);
}
.site-header__name { white-space: nowrap; }
.site-header__nav { display: flex; align-items: center; gap: 40px; }
.site-header__nav ul { display: flex; align-items: center; gap: 40px; white-space: nowrap; }

/* Active nav item while its section is in view */
.site-header__nav a[aria-current="true"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.burger { display: none; }

@media (max-width: 767.98px) {
  .site-header { border-bottom-color: color-mix(in srgb, var(--text-primary) 10%, transparent); } /* Figma: text/primary at 10% */
  .site-header__name { font-size: 14px; } /* Caption/14 Bold */
  .site-header__nav { display: none; }

  /* 24×24 icon from Figma inside a 44×44 tap area */
  .burger {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: -10px;
  }
  .burger__bars { display: flex; flex-direction: column; gap: 6px; }
  .burger__bars span { display: block; width: 24px; height: 1.5px; background: var(--text-primary); }
  .burger__close { display: none; width: 24px; height: 24px; color: var(--text-primary); }
  .burger[aria-expanded="true"] .burger__bars { display: none; }
  .burger[aria-expanded="true"] .burger__close { display: block; }
}

/* ---------- Mobile menu (Figma 59:595): full screen under the header ---------- */
.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  padding: 48px var(--page-pad) 48px; /* Figma: 8px gap + 40px spacer under the buttons */
  overflow-y: auto;
  background: var(--bg-light);
}
.mobile-menu[hidden] { display: none; }
.mobile-menu__links { display: flex; flex-direction: column; gap: 8px; }
.mobile-menu__links a { color: var(--text-primary); } /* Display/40 Regular */
.mobile-menu .btn-row { margin-top: auto; padding-top: 32px; }
@media (min-width: 768px) {
  .mobile-menu { display: none !important; }
}

/* One-line list with 1px vertical dividers, 12px each side (never "·"). Divider: text colour at 50%. */
.divided {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
}
.divided > li { display: inline-flex; align-items: center; }
.divided > li + li::before {
  content: "";
  width: 1px;
  height: var(--divider-h, 0.9em);
  margin-right: 12px;
  background: color-mix(in srgb, currentColor 50%, transparent);
}

/* Light button on dark (Figma 46:1059 "Send message") */
.btn--light { background: var(--text-on-dark); color: var(--button-primary); }
.btn--light:hover { background: #d1d1d1; }

/* ---------- Footer (Figma 54:355 desktop, 59:586 mobile) ---------- */
.site-footer { background: var(--bg-dark); color: var(--text-on-dark-muted); }
.site-footer__inner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "copy links top";
  align-items: center;
  column-gap: 24px;
  padding: 32px 0 40px;
  border-top: 1px solid color-mix(in srgb, var(--text-on-dark) 15%, transparent);
}
.site-footer__copy { grid-area: copy; color: color-mix(in srgb, var(--text-on-dark-muted) 60%, transparent); }
.site-footer__links { grid-area: links; display: flex; gap: 24px; }
.site-footer__top { grid-area: top; display: inline-flex; align-items: center; gap: 1px; }
.site-footer__top .icon { width: 1.15em; height: 1.15em; }

@media (max-width: 767.98px) {
  .site-footer__inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "links links"
      "copy  top";
    row-gap: 16px;
    padding: 24px 0 40px;
  }
  .site-footer__copy, .site-footer__top { font-size: 13px; } /* Caption/13 */
}

/* Arrow loop (Figma "Arrow / Loop" 55:347): 10px to the right and back, 900ms each way.
   Behance link on the home page, "Next project" on case pages. */
@keyframes arrow-nudge { to { translate: 10px 0; } }
.arrow-loop { animation: arrow-nudge 900ms ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .arrow-loop { animation: none; } }
