/* ==========================================================================
   Klajd Koskija — personal site
   Single stylesheet. Replaces common.css + index.css + updatePage/history.css
   --------------------------------------------------------------------------
   1.  Design tokens & themes      8.  Approach
   2.  Reset & base                9.  About
   3.  Layout primitives          10.  Contact & form
   4.  Buttons, tags, links       11.  Footer
   5.  Header & navigation        12.  Changelog page
   6.  Hero                       13.  404 page
   7.  Work / expertise           14.  Motion, print, a11y
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS & THEMES
   ========================================================================== */

:root {
  /* Brand ------------------------------------------------------------- */
  --font-display: "Space Grotesk", "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Fluid type scale (min → max between 360px and 1280px viewports) ---- */
  --step--1: clamp(0.80rem, 0.77rem + 0.14vw, 0.875rem);
  --step-0:  clamp(0.95rem, 0.91rem + 0.20vw, 1.05rem);
  --step-1:  clamp(1.10rem, 1.02rem + 0.36vw, 1.30rem);
  --step-2:  clamp(1.35rem, 1.18rem + 0.75vw, 1.80rem);
  --step-3:  clamp(1.70rem, 1.35rem + 1.55vw, 2.60rem);
  --step-4:  clamp(2.20rem, 1.55rem + 2.90vw, 4.00rem);

  /* Spacing ----------------------------------------------------------- */
  --space-xs: 0.5rem;
  --space-sm: 0.875rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --section-y: clamp(4rem, 3rem + 5vw, 7.5rem);

  /* Shape ------------------------------------------------------------- */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --container: 1180px;
  --header-h: 74px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Dark theme (default) --------------------------------------------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:          hsl(216 33% 7%);
  --bg-alt:      hsl(216 30% 9.5%);
  --surface:     hsl(216 26% 12.5%);
  --surface-2:   hsl(216 24% 16%);
  --border:      hsl(216 20% 21%);
  --border-soft: hsl(216 20% 21% / 0.6);

  --text:        hsl(210 28% 96%);
  --text-muted:  hsl(213 16% 66%);
  --text-faint:  hsl(213 14% 48%);

  --accent:      hsl(162 72% 53%);
  --accent-hover:hsl(162 78% 62%);
  --accent-ink:  hsl(216 40% 8%);
  --accent-soft: hsl(162 72% 53% / 0.12);
  --accent-line: hsl(162 72% 53% / 0.32);

  --shadow-sm: 0 1px 2px hsl(216 40% 3% / 0.4);
  --shadow:    0 12px 32px -12px hsl(216 50% 2% / 0.7);
  --shadow-lg: 0 32px 64px -24px hsl(216 50% 2% / 0.85);

  --glow: radial-gradient(60% 60% at 50% 0%, hsl(162 72% 53% / 0.16), transparent 70%);
}

/* --- Light theme ------------------------------------------------------- */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:          hsl(210 40% 98.5%);
  --bg-alt:      hsl(212 34% 95.5%);
  --surface:     hsl(0 0% 100%);
  --surface-2:   hsl(210 40% 97%);
  --border:      hsl(214 24% 88%);
  --border-soft: hsl(214 24% 88% / 0.8);

  --text:        hsl(216 38% 12%);
  --text-muted:  hsl(215 15% 40%);
  --text-faint:  hsl(215 13% 52%);

  --accent:      hsl(168 82% 28%);
  --accent-hover:hsl(168 82% 22%);
  --accent-ink:  hsl(0 0% 100%);
  --accent-soft: hsl(168 82% 28% / 0.09);
  --accent-line: hsl(168 82% 28% / 0.25);

  --shadow-sm: 0 1px 2px hsl(216 30% 40% / 0.08);
  --shadow:    0 12px 28px -14px hsl(216 30% 30% / 0.22);
  --shadow-lg: 0 30px 60px -26px hsl(216 30% 30% / 0.28);

  --glow: radial-gradient(60% 60% at 50% 0%, hsl(168 82% 28% / 0.09), transparent 70%);
}

/* Follow the OS when the visitor has not chosen a theme yet. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg:          hsl(210 40% 98.5%);
    --bg-alt:      hsl(212 34% 95.5%);
    --surface:     hsl(0 0% 100%);
    --surface-2:   hsl(210 40% 97%);
    --border:      hsl(214 24% 88%);
    --border-soft: hsl(214 24% 88% / 0.8);
    --text:        hsl(216 38% 12%);
    --text-muted:  hsl(215 15% 40%);
    --text-faint:  hsl(215 13% 52%);
    --accent:      hsl(168 82% 28%);
    --accent-hover:hsl(168 82% 22%);
    --accent-ink:  hsl(0 0% 100%);
    --accent-soft: hsl(168 82% 28% / 0.09);
    --accent-line: hsl(168 82% 28% / 0.25);
    --shadow-sm: 0 1px 2px hsl(216 30% 40% / 0.08);
    --shadow:    0 12px 28px -14px hsl(216 30% 30% / 0.22);
    --shadow-lg: 0 30px 60px -26px hsl(216 30% 30% / 0.28);
    --glow: radial-gradient(60% 60% at 50% 0%, hsl(168 82% 28% / 0.09), transparent 70%);
  }
}


/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */

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

* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* `clip`, not `hidden`: `hidden` would make body a scroll container and
     break `position: sticky` on the header. */
  overflow-x: clip;
}

body.is-locked { overflow: hidden; }

/* Body is a flex column so the footer can be pushed down on short pages. */
main { flex: 1 0 auto; }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }

p { text-wrap: pretty; }

a { color: inherit; }

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

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

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% -150%;
  z-index: 200;
  padding: 0.7rem 1.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: translate 0.2s var(--ease);
}
.skip-link:focus-visible { translate: -50% 0; }

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


/* ==========================================================================
   3. LAYOUT PRIMITIVES
   ========================================================================== */

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }

.section-head {
  max-width: 62ch;
  margin-bottom: clamp(2.25rem, 1.5rem + 2.5vw, 3.5rem);
}
.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}
.section-head--center .eyebrow::after {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.section-head p {
  margin-top: 0.9rem;
  color: var(--text-muted);
  font-size: var(--step-1);
  line-height: 1.6;
}

.lead {
  color: var(--text-muted);
  font-size: var(--step-1);
  line-height: 1.65;
}


/* ==========================================================================
   4. BUTTONS, TAGS, LINKS
   ========================================================================== */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.8rem 1.5rem;
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.22s var(--ease), border-color 0.22s var(--ease),
              color 0.22s var(--ease), transform 0.22s var(--ease),
              box-shadow 0.22s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn svg { width: 1.1em; height: 1.1em; flex: none; }

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-ink);
  --btn-bd: var(--accent);
  box-shadow: 0 8px 24px -10px var(--accent);
}
.btn--primary:hover {
  --btn-bg: var(--accent-hover);
  --btn-bd: var(--accent-hover);
  box-shadow: 0 14px 30px -10px var(--accent);
}

.btn--ghost { --btn-bd: var(--border); }
.btn--ghost:hover {
  --btn-bd: var(--accent);
  --btn-fg: var(--accent);
  background: var(--accent-soft);
}

.btn--sm { padding: 0.55rem 1.1rem; font-size: var(--step--1); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: var(--space-md);
}

/* Inline text link with an animated underline */
.link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.3s var(--ease);
}
.link:hover { background-size: 100% 1px; }

/* Tag / chip */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  /* Also used on <ul>, so clear the list defaults. */
  list-style: none;
  padding: 0;
}
.tag {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--step--1);
  font-weight: 500;
  white-space: nowrap;
}
.tag--accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Icon tile used by cards and features */
.icon-tile {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease),
              transform 0.25s var(--ease);
}
.icon-tile svg { width: 24px; height: 24px; }


/* ==========================================================================
   5. HEADER & NAVIGATION
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  flex: none;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease),
              backdrop-filter 0.3s var(--ease);
}
.site-header.is-stuck {
  background: var(--bg); /* fallback where color-mix is unsupported */
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom-color: var(--border-soft);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

/* Logo: a white SVG re-coloured through a CSS mask so it works in both themes */
.brand {
  display: block;
  flex: none;
  width: 168px;
  aspect-ratio: 279 / 52;
  color: var(--text);
  text-decoration: none;
  background-color: currentColor;
  -webkit-mask: url("../img/logo.svg") no-repeat left center / contain;
          mask: url("../img/logo.svg") no-repeat left center / contain;
  transition: color 0.25s var(--ease), opacity 0.25s var(--ease);
}
.brand:hover { color: var(--accent); }

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav a {
  position: relative;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--step-0);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--surface-2); }

.nav a.is-active { color: var(--text); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.2rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Icon-only buttons (theme toggle, menu, back-to-top) */
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
              background-color 0.2s var(--ease);
}
.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.icon-btn svg { width: 19px; height: 19px; }

/* Sun/moon swap driven by the data-theme attribute */
.icon-btn .icon-moon { display: none; }
:root[data-theme="light"] .icon-btn .icon-moon { display: block; }
:root[data-theme="light"] .icon-btn .icon-sun  { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-btn .icon-moon { display: block; }
  :root:not([data-theme]) .icon-btn .icon-sun  { display: none; }
}

.nav-toggle { display: none; }

/* Mobile drawer */
@media (max-width: 860px) {
  .nav-toggle { display: grid; }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 1rem 1.25rem 1.5rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    translate: 0 -0.75rem;
    /* visibility is a discrete property: hold it until the fade-out finishes,
       and flip it instantly on the way in (see .is-open below). */
    transition: opacity 0.25s var(--ease), translate 0.25s var(--ease),
                visibility 0s linear 0.25s;
  }
  .nav.is-open {
    opacity: 1;
    visibility: visible;
    translate: 0 0;
    transition: opacity 0.25s var(--ease), translate 0.25s var(--ease),
                visibility 0s;
  }
  .nav a {
    padding: 0.85rem 0.75rem;
    font-size: var(--step-1);
    border-bottom: 1px solid var(--border-soft);
  }
  .nav a:last-child { border-bottom: 0; }
  .nav a.is-active::after { left: 0.75rem; right: auto; width: 1.25rem; bottom: 0.5rem; }
}


/* ==========================================================================
   6. HERO
   ========================================================================== */

.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(3.5rem, 2rem + 7vw, 7rem) clamp(4rem, 3rem + 5vw, 7rem);
  overflow: hidden;
}

/* Ambient background: pure CSS, no image payload */
.hero::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 130%;
  z-index: -2;
  background: var(--glow);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 58px 58px;
  opacity: 0.5;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 35%, #000 0%, transparent 100%);
          mask-image: radial-gradient(70% 60% at 50% 35%, #000 0%, transparent 100%);
  pointer-events: none;
}

.hero .container {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(2.5rem, 1rem + 5vw, 5rem);
}

/* Availability pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.95rem 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--step--1);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-line); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero h1 {
  margin: 1.25rem 0 0.5rem;
}
.hero h1 .accent {
  background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--text)));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

.hero-role {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.hero-copy {
  max-width: 52ch;
  margin-top: var(--space-md);
  color: var(--text-muted);
  font-size: var(--step-1);
}

/* Small proof row under the CTAs */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.25rem clamp(1.25rem, 0.5rem + 2vw, 2.25rem);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-soft);
}
.hero-stats div { min-width: 0; }
.hero-stats dt {
  font-size: var(--step--1);
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hero-stats dd {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 700;
  color: var(--text);
}

/* Portrait */
.hero-figure {
  position: relative;
  justify-self: center;
  width: min(100%, 380px);
  margin: 0;
}
.hero-figure::before {
  content: "";
  position: absolute;
  inset: -14%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  filter: blur(8px);
}
.hero-portrait {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

/* Floating credential chips over the portrait */
.hero-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface); /* fallback where color-mix is unsupported */
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  font-size: var(--step--1);
  font-weight: 600;
  white-space: nowrap;
  animation: float 6s ease-in-out infinite;
}
.hero-chip svg { width: 15px; height: 15px; color: var(--accent); }
.hero-chip--tl { top: 8%;  left: -8%; }
.hero-chip--br { bottom: 9%; right: -6%; animation-delay: -3s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}


/* ==========================================================================
   7. WORK / EXPERTISE
   ========================================================================== */

/* minmax(310px) resolves to 3 columns at the container width, so the six
   cards sit as a balanced 3 + 3 rather than a ragged 4 + 2. */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 1.25rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease),
              box-shadow 0.3s var(--ease);
}
/* Accent wash that fades in on hover */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--accent-soft), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow);
}
.card:hover::before { opacity: 1; }
.card:hover .icon-tile {
  background: var(--accent);
  color: var(--accent-ink);
  transform: scale(1.06);
}

.card > * { position: relative; }
.card h3 { font-size: var(--step-1); }
.card p {
  color: var(--text-muted);
  font-size: var(--step-0);
  margin-bottom: 0.15rem;
}
.card .tags { margin-top: auto; padding-top: 0.35rem; }


/* ==========================================================================
   8. APPROACH
   ========================================================================== */

/* Four items read best as a 2 x 2 block, not 3 + 1. */
.approach-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 1rem + 2vw, 2.75rem);
}
@media (min-width: 760px) {
  .approach-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.approach-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.approach-num {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.approach-item h3 { margin-bottom: 0.4rem; }
.approach-item p {
  color: var(--text-muted);
  font-size: var(--step-0);
}


/* ==========================================================================
   9. ABOUT
   ========================================================================== */

/* The photo is a 3:2 landscape shot, so it runs full width as a banner. A
   portrait side-column frame would force the whole height in and fill the top
   half with empty sky; a wide crop trims the sky and leaves no dead column. */
.about-banner {
  position: relative;
  margin: 0 0 clamp(2rem, 1.5rem + 2vw, 3rem);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.about-banner img {
  width: 100%;
  aspect-ratio: 5 / 2;
  object-fit: cover;
  object-position: center 42%;
}
/* Fade the base colour up over the foot of the photo so it sits in the page. */
.about-banner::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 45%;
  background: linear-gradient(transparent, color-mix(in srgb, var(--bg-alt) 75%, transparent));
  pointer-events: none;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(2rem, 1rem + 4vw, 4rem);
}

.about-body > * + * { margin-top: var(--space-md); }
.about-body p { color: var(--text-muted); }

/* Four facts, so keep them as 2 x 2 rather than letting one wrap alone. */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.5rem;
  padding: 1.35rem 0;
  border-block: 1px solid var(--border);
  list-style: none;
}
.facts div { display: flex; flex-direction: column; gap: 0.15rem; }
.facts dt {
  font-size: var(--step--1);
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.facts dd { margin: 0; font-weight: 600; }


/* ==========================================================================
   10. CONTACT & FORM
   ========================================================================== */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 1rem + 4vw, 4rem);
  align-items: start;
}

.contact-methods {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: var(--space-md);
}
.contact-method {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.22s var(--ease), transform 0.22s var(--ease),
              background-color 0.22s var(--ease);
}
.contact-method:hover {
  border-color: var(--accent-line);
  background: var(--surface-2);
  transform: translateX(4px);
}
.contact-method:hover .icon-tile { background: var(--accent); color: var(--accent-ink); }
.contact-method .icon-tile { width: 40px; height: 40px; border-radius: 10px; }
.contact-method .icon-tile svg { width: 19px; height: 19px; }
.contact-method strong { display: block; font-size: var(--step-0); font-weight: 600; }
.contact-method span { font-size: var(--step--1); color: var(--text-muted); }
.contact-method .arrow {
  margin-left: auto;
  color: var(--text-faint);
  transition: color 0.22s var(--ease), transform 0.22s var(--ease);
}
.contact-method:hover .arrow { color: var(--accent); transform: translateX(3px); }

/* Form */
.form {
  padding: clamp(1.5rem, 1rem + 2vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.field label {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text-muted);
}
.field input,
.field textarea {
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  color: var(--text);
  font-size: var(--step-0);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease),
              background-color 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 130px; }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-faint); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input:user-invalid,
.field textarea:user-invalid { border-color: hsl(0 70% 58%); }

.form .btn { width: 100%; }

/* Honeypot — hidden from humans, tempting to bots */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-status {
  margin-top: 0.9rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--step--1);
  text-align: center;
}
.form-status[hidden] { display: none; }
.form-status.is-ok {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}
.form-status.is-error {
  border-color: hsl(0 70% 58% / 0.4);
  background: hsl(0 70% 58% / 0.1);
  color: hsl(0 75% 68%);
}
:root[data-theme="light"] .form-status.is-error { color: hsl(0 70% 42%); }


/* ==========================================================================
   11. FOOTER
   ========================================================================== */

.site-footer {
  margin-top: auto;
  padding-block: var(--space-xl) var(--space-lg);
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.footer-brand .brand { margin-bottom: 1rem; }
.footer-brand p {
  max-width: 34ch;
  color: var(--text-muted);
  font-size: var(--step--1);
}

.footer-col h4 {
  margin-bottom: 0.9rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.footer-col ul { list-style: none; padding: 0; display: grid; gap: 0.55rem; }
.footer-col a {
  color: var(--text-muted);
  font-size: var(--step-0);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: var(--step--1);
}
.footer-socials { display: flex; gap: 0.5rem; }

/* Back to top */
.to-top {
  position: fixed;
  right: clamp(1rem, 2vw, 2rem);
  bottom: clamp(1rem, 2vw, 2rem);
  z-index: 90;
  width: 44px;
  height: 44px;
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  translate: 0 0.75rem;
  transition: opacity 0.3s var(--ease), translate 0.3s var(--ease), visibility 0.3s;
}
.to-top.is-visible { opacity: 1; visibility: visible; translate: 0 0; }


/* ==========================================================================
   12. CHANGELOG PAGE
   ========================================================================== */

.page-head {
  position: relative;
  isolation: isolate;
  padding-block: clamp(3rem, 2rem + 5vw, 5.5rem) clamp(2rem, 1.5rem + 3vw, 3.5rem);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.page-head::before {
  content: "";
  position: absolute;
  inset: -50% 0 auto 0;
  height: 150%;
  z-index: -1;
  background: var(--glow);
}
.page-head p { max-width: 60ch; margin-top: 0.75rem; color: var(--text-muted); font-size: var(--step-1); }

/* Vertical timeline */
.timeline {
  position: relative;
  display: grid;
  gap: 1.25rem;
  padding-left: 2rem;
}
/* Sits at the timeline's padding-box edge, which is exactly where the
   release nodes are centred (they use left:-2rem with a -50% translate). */
.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 1px;
  background: linear-gradient(var(--accent-line), var(--border), transparent);
}

.release {
  position: relative;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.release:hover { border-color: var(--accent-line); transform: translateX(3px); }
/* Timeline node */
.release::before {
  content: "";
  position: absolute;
  left: -2rem;
  top: 1.9rem;
  translate: -50% 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 2px solid var(--border);
}
.release--latest::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.release-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.release-head h2 { font-size: var(--step-1); }
.release-version {
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.release-date {
  margin-left: auto;
  color: var(--text-faint);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}
.release ul {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: var(--step-0);
}
.release li::marker { color: var(--accent); }

code {
  padding: 0.1em 0.4em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
}


/* ==========================================================================
   13. 404 PAGE
   ========================================================================== */

.error-page {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - var(--header-h));
  padding: var(--space-xl) 0;
  text-align: center;
}
.error-code {
  font-family: var(--font-display);
  font-size: clamp(5rem, 3rem + 14vw, 11rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(160deg, var(--accent), transparent 90%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.error-page p { max-width: 45ch; margin: 1rem auto 0; color: var(--text-muted); }
.error-page .btn-row { justify-content: center; }


/* ==========================================================================
   14. MOTION, RESPONSIVE, PRINT
   ========================================================================== */

/* Scroll reveal — the .is-in class is added by main.js */
.reveal {
  opacity: 0;
  translate: 0 18px;
  transition: opacity 0.7s var(--ease), translate 0.7s var(--ease);
}
.reveal.is-in { opacity: 1; translate: 0 0; }
/* Stagger children of a revealed group */
.reveal-group > * { transition-delay: calc(var(--i, 0) * 70ms); }

@media (max-width: 980px) {
  .hero .container,
  .about-grid,
  .contact-grid { grid-template-columns: 1fr; }

  .hero .container { gap: 3rem; }
  .hero-figure { order: -1; width: min(100%, 300px); }
  .hero-chip--tl { left: -4%; }
  .hero-chip--br { right: -2%; }

  .about-banner img { aspect-ratio: 16 / 9; }

  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  :root { --header-h: 66px; }
  .brand { width: 140px; }
  .hero-stats { gap: 1.25rem 2rem; }
  .hero-chip { font-size: 0.72rem; padding: 0.4rem 0.7rem; }
  .footer-top { grid-template-columns: 1fr; gap: var(--space-md); }
  .footer-bottom { justify-content: center; text-align: center; }
  .timeline { padding-left: 1.5rem; }
  .release::before { left: -1.5rem; }
  .release-date { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; translate: none; }
  .btn:hover, .card:hover, .contact-method:hover, .release:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .to-top, .hero-chip, .form { display: none !important; }
  body { background: #fff; color: #000; }
  .hero::before, .hero::after { display: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
