@charset "utf-8";

/* ---------- Tokens ---------- */
:root {
  --mask: #0f3b2e;
  --mask-deep: #0a2a21;
  --gold: #d9b44a;
  --on-mask: #e4efe8;

  --bg: #eef3ef;
  --ink: #10261d;
  --muted: #47604f;
  --rule: #b9c9be;
  --link: #0f5a43;

  --font-head: 'Familjen Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Literata', Georgia, 'Times New Roman', serif;

  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.75rem;
  --step-hero: clamp(2.5rem, 7.5vw, 5.25rem);

  --gutter: clamp(1.25rem, 5vw, 3rem);
  --nav-h: 3.5rem;
}

:root[data-theme="dark"] {
  --mask: #0a2a21;
  --mask-deep: #071c16;
  --bg: #0b1a14;
  --ink: #dce8e1;
  --muted: #94ab9e;
  --rule: #254236;
  --link: #d9b44a;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.7;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0 0 1em;
  max-width: 68ch;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 0.9rem;
  background: var(--gold);
  color: var(--mask-deep);
  font-family: var(--font-head);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.5rem;
}

/* ---------- Navigation ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--nav-h);
  padding: 0 var(--gutter);
  background: var(--mask-deep);
  color: var(--on-mask);
  font-family: var(--font-head);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--on-mask);
  text-decoration: none;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  border-bottom-color: var(--gold);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
  background: none;
  border: 0;
  color: var(--on-mask);
  font: 500 0.9rem var(--font-head);
  cursor: pointer;
}

.theme-toggle__track {
  position: relative;
  width: 2.5rem;
  height: 1.375rem;
  border-radius: 999px;
  background: #5b7466;
  transition: background-color 0.2s;
}

.theme-toggle__track::after {
  content: "";
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.theme-toggle[aria-pressed="true"] .theme-toggle__track {
  background: var(--gold);
}

.theme-toggle[aria-pressed="true"] .theme-toggle__track::after {
  transform: translateX(1.125rem);
  background: var(--mask-deep);
}

/* ---------- Hero ---------- */
.hero {
  background: var(--mask);
  color: var(--on-mask);
  padding: clamp(3rem, 9vw, 6rem) var(--gutter) 0;
  overflow: hidden;
}

.hero__inner {
  max-width: 62rem;
  margin: 0 auto;
}

.hero h1 {
  font-size: var(--step-hero);
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 14em;
}

.hero__role {
  margin: 1.25rem 0 0;
  font-size: var(--step-1);
  color: var(--on-mask);
  opacity: 0.85;
  max-width: 32em;
}

.trace {
  display: block;
  width: 100%;
  max-width: 62rem;
  height: auto;
  margin: clamp(1.5rem, 4vw, 3rem) auto 0;
  padding-bottom: 1.5rem;
  overflow: visible;
}

.trace__line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.trace__via {
  fill: var(--mask);
  stroke: var(--gold);
  stroke-width: 2;
}

.trace__pad {
  fill: var(--gold);
}

.trace__hole {
  fill: var(--mask);
}

/* The one moment of motion: the trace draws itself once on load. */
@media (prefers-reduced-motion: no-preference) {
  .trace__line {
    stroke-dashoffset: 1;
    animation: draw-trace 1.8s cubic-bezier(0.65, 0, 0.35, 1) 0.2s forwards;
  }

  .trace__via,
  .trace__pad,
  .trace__hole {
    opacity: 0;
    animation: show-pad 0.3s ease-out 1.6s forwards;
  }
}

@keyframes draw-trace {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes show-pad {
  to {
    opacity: 1;
  }
}

/* ---------- Sections ---------- */
.section {
  display: grid;
  gap: 1rem 3rem;
  max-width: calc(62rem + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) var(--gutter);
  border-bottom: 1px solid var(--rule);
}

.section:last-of-type {
  border-bottom: 0;
}

.section h2 {
  font-size: var(--step-2);
  color: var(--link);
}

.section__body > :last-child {
  margin-bottom: 0;
}

@media (min-width: 52rem) {
  .section {
    grid-template-columns: 11rem minmax(0, 1fr);
  }

  .section h2 {
    position: sticky;
    top: calc(var(--nav-h) + 1.5rem);
    align-self: start;
  }
}

/* ---------- Projects ---------- */
.project {
  padding-bottom: 1.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.project:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.project h3 {
  font-size: var(--step-1);
  margin-bottom: 0.5rem;
}

.project p {
  margin-bottom: 0.75rem;
}

.project__link,
.text-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1.5px;
}

.project__link:hover,
.text-link:hover {
  text-decoration-thickness: 3px;
}

/* ---------- Skills ---------- */
.skills {
  display: grid;
  gap: 1.25rem;
  margin: 0;
}

.skills dt {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
}

.skills dd {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

@media (min-width: 40rem) {
  .skills > div {
    display: grid;
    grid-template-columns: 12.5rem minmax(0, 1fr);
    gap: 1rem;
  }

  .skills dd {
    margin: 0;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 1.5rem var(--gutter);
  background: var(--mask-deep);
  color: var(--on-mask);
  font-family: var(--font-head);
  text-align: center;
}

.site-footer p {
  max-width: none;
  margin: 0;
}

@media (max-width: 34rem) {
  .site-nav ul {
    gap: 0.25rem 1rem;
  }

  /* Keep the nav on one line: the switch stays, the text label stays available to screen readers. */
  .theme-toggle__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
