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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
  --header-h: 100px;
}
@media (max-width: 767.98px) {
  html { --header-h: 61px; }
}
@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 programmatically (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;
}

/* Layout: one centred 1248px container for every section */
.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); }

/* Arrow icon (Figma 95:156). Size is set where it is 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); }

/* Header (Figma 46:930 desktop, 59:158 mobile) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-light);
  border-bottom: 1px solid color-mix(in srgb, var(--text-primary) 14%, transparent);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 99px; /* 100px in Figma including the 1px border */
}
.site-header__nav ul {
  display: flex;
  gap: 40px;
}
.burger { display: none; }

@media (max-width: 767.98px) {
  .site-header {
    border-bottom-color: color-mix(in srgb, var(--text-primary) 10%, transparent);
  }
  .site-header__inner { height: 60px; }
  .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; }
}

/* 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 */
}

/* Section label (PROJECTS, ABOUT ME, CONTACT): Label/16 Regular */
.section-label { font: 400 16px/normal var(--font); }

/* Buttons (Figma 46:953, 46:958, 46:1059; states in 54:306) */
.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, border-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; } /* approved, see SPEC.md */

.btn--outline {
  padding: 0 20px;
  background: var(--bg-light);
  border: 1.5px solid color-mix(in srgb, var(--text-primary) 27%, transparent); /* #b0b0b0 in Figma */
  color: var(--text-muted);
  font-weight: 500; /* Label/16 Medium */
}
.btn--outline:hover { background: #e4e4e4; } /* approved, see SPEC.md */

.btn--light { background: var(--text-on-dark); color: var(--button-primary); }
.btn--light:hover { background: #d1d1d1; } /* Figma 54:316 */

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

/* One-line list with 1px vertical dividers (never "·") */
.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: var(--divider-color, currentColor);
}

/* 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;
}

/* 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;
  gap: 8px;
  padding: 48px var(--page-pad) 48px;
  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 { font: 400 40px/normal var(--font); color: var(--text-primary); }
.mobile-menu .btn-row { margin-top: auto; padding-top: 32px; }
@media (min-width: 768px) {
  .mobile-menu { display: none !important; }
}
