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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, picture, svg, video {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

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

ul, ol {
  list-style: none;
  padding: 0;
}

table {
  border-collapse: collapse;
}


/*
  Theme contract: every template/component must only use the semantic
  custom properties defined here (--color-*, --radius, --shadow-*,
  --font-*). There are only two real color states, light and dark — see
  docs/design.md for the palette rationale and docs/development.md for how
  "auto" mode picks between them at runtime.
*/

:root {
  --radius: 6px;

  --font-heading: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --heading-weight: 600;
  --heading-tracking: -0.01em;
}

/* Light palette — the default (no [data-theme] attribute, or an explicit
   "light" choice). */
:root,
:root[data-theme="light"] {
  --color-bg: #f6f3ec;
  --color-surface: #ffffff;
  --color-surface-alt: #efe9dc;
  --color-text: #22291f;
  --color-text-muted: #5f6a57;
  --color-accent: #c1652b;
  --color-accent-strong: #954d1d;
  --color-accent-contrast: #ffffff;
  --color-border: #e2dac7;
  --color-border-strong: #c7bb9e;
  --shadow-card: 0 1px 2px rgba(40, 28, 12, 0.07), 0 1px 1px rgba(40, 28, 12, 0.04);
  --shadow-raised: 0 16px 40px rgba(40, 28, 12, 0.16);
}

/* Dark palette applied automatically when no explicit mode was stamped on
   <html> (e.g. JavaScript is disabled, so layout.mjs's pre-paint script
   never ran) and the OS prefers dark — a no-JS fallback for "auto" mode. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #14181a;
    --color-surface: #1d2320;
    --color-surface-alt: #232b27;
    --color-text: #ece8dd;
    --color-text-muted: #9aa394;
    --color-accent: #e08a4c;
    --color-accent-strong: #f2aa70;
    --color-accent-contrast: #1b140d;
    --color-border: #2b332e;
    --color-border-strong: #3c463f;
    --shadow-card: 0 0 0 1px var(--color-border);
    --shadow-raised: 0 0 0 1px rgba(224, 138, 76, 0.2), 0 20px 48px rgba(0, 0, 0, 0.5);
  }
}

/* Dark palette, explicit override — wins regardless of OS preference once
   layout.mjs's pre-paint script (or a manual toggle click) sets
   data-theme="dark". Same values as the media-query block above; the
   duplication is unavoidable since a media query and an attribute selector
   can't share one declaration block. */
:root[data-theme="dark"] {
  --color-bg: #14181a;
  --color-surface: #1d2320;
  --color-surface-alt: #232b27;
  --color-text: #ece8dd;
  --color-text-muted: #9aa394;
  --color-accent: #e08a4c;
  --color-accent-strong: #f2aa70;
  --color-accent-contrast: #1b140d;
  --color-border: #2b332e;
  --color-border-strong: #3c463f;
  --shadow-card: 0 0 0 1px var(--color-border);
  --shadow-raised: 0 0 0 1px rgba(224, 138, 76, 0.2), 0 20px 48px rgba(0, 0, 0, 0.5);
}


:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;
  --space-12: 6rem;

  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-4xl: 3rem;

  --max-width: 72rem;
  --max-width-prose: 42rem;
  --transition: 160ms ease;
}

html {
  color-scheme: light dark;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition: background-color var(--transition), color var(--transition);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  line-height: 1.15;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); margin-top: var(--space-10); }
h3 { font-size: var(--text-xl); margin-top: var(--space-6); }

p { margin-top: var(--space-4); }
p:first-child { margin-top: 0; }

a {
  color: var(--color-accent);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.prose {
  max-width: var(--max-width-prose);
}

.prose > * + * {
  margin-top: var(--space-4);
}

.prose ul,
.prose ol {
  list-style: disc;
  padding-inline-start: 1.25em;
}

.prose ol {
  list-style: decimal;
}

section {
  padding-block: var(--space-10);
}

/* Clears the fixed corner mark/waypoints trigger, which sit outside normal
   flow (see components.css). The home hero is exempt — its photo is meant
   to bleed to the very top of the viewport, with the corner marks floating
   over it. */
main > section:first-of-type:not(.hero-home) {
  padding-top: var(--space-12);
}

/* Locks background scroll while the waypoints overlay is open
   (site/assets/js/theme.js toggles this class). */
html.waypoints-open {
  overflow: hidden;
}

.section-tight {
  padding-block: var(--space-8);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
}

/* A one-line deck under a page's <h1> — the mono "coordinate" register
   used for a genuine subtitle, not a label announcing the heading above
   it (see docs/design.md's "atlas, not a dashboard" typography note). */
.deck {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  max-width: var(--max-width-prose);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  padding: var(--space-2) var(--space-4);
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
}

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

@media (min-width: 48rem) {
  h1 { font-size: 3.5rem; }
}


/* Corner marks — no header bar. Two fixed anchors instead of a strip: the
   mark (home link) top-left, the waypoints trigger top-right. Each is a
   small translucent chip so it stays legible over whatever scrolls beneath
   it — the hero photo, prose, or the dark theme. See docs/design.md. */

/* Positioning only — no background/filter here. A <details> is one of the
   two corner marks, and giving *it* a backdrop-filter would make it the
   containing block for its own fixed-position overlay panel, trapping the
   full-screen panel inside a 44px box. The chip look lives on the leaf
   elements (.brand, .waypoints summary) instead. */
.corner-mark {
  position: fixed;
  top: var(--space-5);
  z-index: 60;
}

.corner-mark--left {
  left: var(--space-5);
}

.corner-mark--right {
  right: var(--space-5);
}

.brand,
.waypoints summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-bg) 78%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.brand:hover {
  border-color: var(--color-accent);
}

.brand__logo {
  width: 1.4rem;
  height: 1.4rem;
  color: var(--color-accent);
  flex-shrink: 0;
}

/* Waypoints: a full-screen "legend" of the site's pages instead of a menu
   bar. Built on <details>/<summary> so it works with no JS — theme.js only
   adds closing on link-click, Escape and a background scroll lock. */

.waypoints summary {
  position: relative;
  list-style: none;
}

.waypoints summary::-webkit-details-marker {
  display: none;
}

.waypoints[open] summary {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.waypoints__icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.3rem;
  height: 1.3rem;
  transition: opacity var(--transition);
}

.waypoints__icon--close {
  opacity: 0;
}

.waypoints[open] .waypoints__icon--open {
  opacity: 0;
}

.waypoints[open] .waypoints__icon--close {
  opacity: 1;
}

.waypoints__panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--color-bg);
  overflow-y: auto;
}

.waypoints[open] .waypoints__panel {
  display: flex;
  flex-direction: column;
}

.waypoints__topo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--color-border-strong);
  opacity: 0.5;
  pointer-events: none;
}

.waypoints__list {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding: var(--space-12) var(--space-6);
}

.waypoints__link {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.waypoints__link:hover,
.waypoints__link[aria-current="page"] {
  color: var(--color-accent);
  text-decoration: none;
}

.waypoints__name {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  font-size: var(--text-3xl);
}

.waypoints__hint {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.waypoints__footer {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6);
  border-top: 1px solid var(--color-border);
}

@media (max-width: 47.99rem) {
  .waypoints__name {
    font-size: var(--text-2xl);
  }
}

/* Buttons — sharp corners with a pair of corner-bracket marks (viewfinder /
   surveyor's-benchmark register) instead of the generic rounded rectangle.
   The brackets sit just outside the box and step further out on hover, like
   a focus point locking on. See docs/design.md. */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.65em 1.25em;
  font-weight: 600;
  font-size: var(--text-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

.btn:hover {
  text-decoration: none;
}

.btn::before,
.btn::after {
  content: "";
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  border-color: currentColor;
  transition: inset var(--transition);
}

.btn::before {
  top: -5px;
  left: -5px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.btn::after {
  bottom: -5px;
  right: -5px;
  border-bottom: 2px solid;
  border-right: 2px solid;
}

.btn:hover::before,
.btn:focus-visible::before {
  top: -8px;
  left: -8px;
}

.btn:hover::after,
.btn:focus-visible::after {
  bottom: -8px;
  right: -8px;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.btn-primary::before,
.btn-primary::after {
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background: var(--color-accent-strong);
}

.btn-primary:hover::before,
.btn-primary:hover::after {
  border-color: var(--color-accent-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn-ghost:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* Projects: a ledger, not a card grid — an ongoing company, a contract
   engagement and a blog aren't the same kind of thing, so they read as
   entries in a list (like the CV timeline) rather than identical boxes. */

.project-list {
  margin-top: var(--space-8);
}

.project-entry {
  padding-block: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.project-entry:first-child {
  border-top: none;
  padding-top: 0;
}

.project-entry__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.project-entry__head h3 {
  margin-top: 0;
}

.project-entry__period {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.project-entry__stack {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent);
  margin-top: var(--space-2);
}

/* Hero */

.hero {
  padding-block: var(--space-12) var(--space-10);
}

.hero__tagline {
  font-size: var(--text-xl);
  color: var(--color-text-muted);
  max-width: var(--max-width-prose);
  margin-top: var(--space-4);
}

/* Value list */

.value-list {
  display: grid;
  gap: var(--space-4);
  /* Never more than 3 columns, so a 4th/7th/etc. item never ends up alone on its own row. */
  grid-template-columns: repeat(auto-fit, minmax(max(14rem, calc((100% - 2 * var(--space-4)) / 3)), 1fr));
  margin-top: var(--space-8);
}

.value-list li {
  padding-left: var(--space-6);
  position: relative;
}

.value-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--color-accent);
}

/* Timeline (CV) */

.timeline {
  margin-top: var(--space-8);
  border-left: 2px solid var(--color-border);
  padding-left: var(--space-6);
}

.timeline-entry {
  position: relative;
  padding-bottom: var(--space-8);
}

.timeline-entry:last-child {
  padding-bottom: 0;
}

.timeline-entry::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-6) - 6px);
  top: 0.4em;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-bg);
}

.timeline-entry__dates {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent);
}

.timeline-entry h3 {
  margin-top: var(--space-1);
}

.timeline-entry__org {
  color: var(--color-text-muted);
  font-weight: 500;
}

.timeline-entry__stack {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent);
  margin-top: var(--space-2);
}

.timeline-entry ul {
  margin-top: var(--space-2);
  list-style: disc;
  padding-inline-start: 1.2em;
}

.timeline-entry li {
  margin-top: 0.3em;
}

.timeline-earlier {
  margin-top: var(--space-6);
}

.timeline-earlier summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent);
  padding: var(--space-2) 0;
}

.timeline-earlier[open] summary {
  margin-bottom: var(--space-2);
}

/* Profile / about */

.profile-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.skills-tags span {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.3em 0.9em;
  color: var(--color-text-muted);
}

/* Contact block */

.contact-block {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-8);
  margin-top: var(--space-6);
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

.contact-item__label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.contact-item__value {
  font-weight: 600;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-12);
  padding-block: var(--space-8);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.site-footer__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.site-footer__meta a {
  color: var(--color-text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin-top: 0.3em;
}

.site-footer__controls {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

/* Theme toggle */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
}

.theme-toggle button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  padding: 0.35em 0.9em;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}

.theme-toggle button:hover {
  color: var(--color-text);
}

.theme-toggle button[aria-pressed="true"] {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

/* Social links + language switch (waypoints nav overlay and site footer) */

.social-links {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-text-muted);
}

.social-links a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.social-links svg {
  width: 1.5rem;
  height: 1.5rem;
}

.lang-switch {
  display: inline-flex;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

.lang-switch a {
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.lang-switch a[aria-current="true"] {
  color: var(--color-accent);
  font-weight: 700;
}

/* Structured fact grids (CV competencies, personal info, legal-style dl) */

.legal-grid {
  display: grid;
  gap: var(--space-6);
  margin-top: var(--space-8);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.legal-grid dt {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.legal-grid dd {
  margin-top: 0.25em;
}


/* Home hero: the real Monteynard-lake photo (site/assets/img/hero-mountain.1b8141e6f9.jpg)
   as a flat stack of layers — photo, dark scrim, topographic contour-line
   watermark, then the text — so the same band works as a legible backdrop
   in both light and dark mode without depending on theme color variables. */

.hero-home {
  position: relative;
  overflow: hidden;
  padding-block: var(--space-12) var(--space-10);
  isolation: isolate;
}

.hero-home__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: image-set("/assets/img/hero-mountain.1b8141e6f9.jpg" 1x);
  background-image: url("/assets/img/hero-mountain.1b8141e6f9.jpg");
  background-size: cover;
  background-position: center 62%;
}

@media (max-width: 47.99rem) {
  .hero-home__bg {
    background-image: url("/assets/img/hero-mountain-sm.21c02178e5.jpg");
  }
}

.hero-home__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(16, 18, 14, 0.5) 0%, rgba(16, 18, 14, 0.8) 100%);
}

.hero-home__topo {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  color: rgba(253, 250, 243, 0.4);
}

.hero-home__content {
  position: relative;
  z-index: 3;
}

.hero-home .eyebrow {
  color: #f2aa70;
}

.hero-home h1 {
  color: #fdfaf3;
  max-width: 16ch;
}

.hero-home .hero__tagline {
  color: rgba(253, 250, 243, 0.85);
}

/* CV */

@media print {
  .corner-mark, .site-footer, .btn-row {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .timeline {
    border-left-color: #ccc;
  }
}
