/* ============================
   THEME
   Light is the default. Dark follows the device setting unless the
   header switch (theme.js) sets data-theme="light" or "dark" on <html>.
   Colours: scheme S13 from the theme lab (Archive/Old Backup Files/theme-lab).
   --header-bg is deep teal; --accent is navy (buttons, links);
   --highlight is amber, for small highlights only, never for body text.
   ============================ */
:root {
  color-scheme: light;
  --accent: #152787;
  --accent-hover: #11206f;
  --on-accent: #ffffff;
  --highlight: #ed9200;
  --highlight-ink: #a66600;     /* amber dark enough to read on the cards */
  --header-bg: #215859;
  --header-text: #ffffff;
  --ink: #112424;
  --body-text: #112424;
  --muted: #647173;
  --border: #a1a9cf;
  --line: #d3dade;
  --page-background: #f0f5fa;
  --surface: #fafcfd;
  --card-surface: #fafcfd;
  --surface-tint: #f9fbfd;
  --code-bg: #f8fbfc;
  --placeholder: #f8fafc;
  --photo-panel: #818d8f;      /* grey behind the photo grid */
  --danger: #b3261e;           /* reset / delete buttons */
  --warn-ink: #9a5800;         /* warnings in the tools */
  --viewer-bg: #f9fbfd;        /* 3D views and face previews */
  --paper: #ffffff;            /* drawing previews that must show true line colours */
  --radius: 12px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.06), 0 4px 16px rgb(16 24 40 / 0.06);
  --shadow-hover: 0 2px 4px rgb(16 24 40 / 0.08), 0 12px 32px rgb(16 24 40 / 0.12);
  --card-drop: drop-shadow(0 1px 2px rgb(16 24 40 / 0.06)) drop-shadow(0 4px 16px rgb(16 24 40 / 0.06));
  --card-drop-hover: drop-shadow(0 2px 4px rgb(16 24 40 / 0.08)) drop-shadow(0 12px 32px rgb(16 24 40 / 0.12));
  --font-display: 'Barlow Semi Condensed', system-ui, sans-serif;
  --content-width: 1120px;
}

/* Dark values live in one place and are applied twice below:
   once for "device is dark, no override" and once for the switch. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #8a93c3;
    --accent-hover: #a1a9cf;
    --on-accent: #141e21;
    --highlight: #ed9200;
    --highlight-ink: #ed9200;
    --header-bg: #173e3e;
    --ink: #eef1f4;
    --body-text: #dde0e3;
    --muted: #979da0;
    --border: #49536a;
    --line: #333b3e;
    --page-background: #141e21;
    --surface: #222c2e;
    --card-surface: #182f32;
    --surface-tint: #2e383a;
    --code-bg: #374042;
    --placeholder: #3b4446;
    --photo-panel: #30393c;
    --danger: #ff8a80;
    --warn-ink: #f0b45a;
    --viewer-bg: #111a1c;
    --paper: #cfd6dc;            /* dimmed, but black lines still show */
    --shadow: 0 1px 2px rgb(0 0 0 / 0.25);
    --shadow-hover: 0 12px 32px rgb(0 0 0 / 0.4);
    --card-drop: drop-shadow(0 1px 2px rgb(0 0 0 / 0.25));
    --card-drop-hover: drop-shadow(0 12px 32px rgb(0 0 0 / 0.4));
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #8a93c3;
  --accent-hover: #a1a9cf;
  --on-accent: #141e21;
  --highlight: #ed9200;
  --highlight-ink: #ed9200;
  --header-bg: #173e3e;
  --ink: #eef1f4;
  --body-text: #dde0e3;
  --muted: #979da0;
  --border: #49536a;
  --line: #333b3e;
  --page-background: #141e21;
  --surface: #222c2e;
  --card-surface: #182f32;
  --surface-tint: #2e383a;
  --code-bg: #374042;
  --placeholder: #3b4446;
  --photo-panel: #30393c;
  --danger: #ff8a80;
  --warn-ink: #f0b45a;
  --viewer-bg: #111a1c;
  --paper: #cfd6dc;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  --shadow-hover: 0 12px 32px rgb(0 0 0 / 0.4);
  --card-drop: drop-shadow(0 1px 2px rgb(0 0 0 / 0.25));
  --card-drop-hover: drop-shadow(0 12px 32px rgb(0 0 0 / 0.4));
}

/* ============================
   RESET & BASE
   ============================ */
* {
  box-sizing: border-box;
}

/* html/body take the header colour, so overscrolling past the top
   or the footer shows the same blue (main paints the page colour). */
html,
body {
  background-color: var(--header-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--body-text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  -webkit-user-drag: none;
}

::selection {
  background-color: var(--highlight);
  color: #1a0d08;
}

/* Safari 26+ samples this fixed element for toolbar tinting. */
.safari-toolbar-tint {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 30;
  height: 6px;
  background-color: var(--header-bg);
  pointer-events: none;
}

@view-transition {
  navigation: auto;
}

@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('barlow-semi-condensed-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ============================
   HEADER & NAVIGATION
   ============================ */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  min-height: 68px;
  padding: 0.75rem max(1.5rem, calc((100% - var(--content-width)) / 2 + 1.5rem));
  background-color: var(--header-bg);
}

.site-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  color: var(--header-text);
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-title img {
  width: auto;
  height: 30px;
}

nav {
  display: flex;
  gap: 0.25rem;
}

nav a {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--header-text);
  font-size: 0.95rem;
  text-decoration: none;
  opacity: 0.82;
  transition: opacity 0.15s, background-color 0.15s;
}

nav a:hover {
  opacity: 1;
  background-color: rgb(255 255 255 / 0.1);
}

nav a.active {
  font-weight: 650;
  opacity: 1;
}

/* An invisible bold copy of the label (data-label, added by theme.js)
   sets every link's width, so going bold grows the text from the
   centre and never pushes the other links along. */
nav a::before {
  content: attr(data-label);
  height: 0;
  overflow: hidden;
  font-weight: 650;
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

/* Coral bar under the current page */
nav a.active::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  bottom: 2px;
  left: 0.75rem;
  height: 3px;
  border-radius: 3px;
  background-color: var(--highlight);
}

nav a:focus-visible,
.site-title:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 2px;
}

/* ---------- Light / dark switch (added by theme.js) ---------- */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.3);
  border-radius: 50%;
  background: transparent;
  color: var(--header-text);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  border-color: rgb(255 255 255 / 0.7);
  background-color: rgb(255 255 255 / 0.1);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Show the moon in light mode (tap for dark) and the sun in dark mode */
.theme-toggle .icon-sun { display: none; }
.theme-toggle[data-mode="dark"] .icon-sun { display: block; }
.theme-toggle[data-mode="dark"] .icon-moon { display: none; }

/* ============================
   MAIN CONTENT
   ============================ */
main {
  flex: 1;
  width: 100%;
  padding: 3rem 1.5rem;
  background-color: var(--page-background);
}

h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h2,
h3 {
  color: var(--ink);
}

.hero {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
}

.hero .tagline {
  max-width: 40ch;
  margin-bottom: 1.5rem;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.5;
}

.hero p {
  max-width: 62ch;
}

/* Small label above a heading, with a coral dot */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--highlight);
}

/* Coral stroke under one word of a heading */
.hl {
  position: relative;
  z-index: 0;
  color: var(--accent);
  white-space: nowrap;
}

.hl::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0.02em;
  left: 0;
  height: 0.14em;
  border-radius: 99px;
  background-color: var(--highlight);
}

.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.7rem 1.3rem;
  border-radius: 8px;
  background-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}

/* Disabled buttons don't react to hover */
.btn:not(:disabled):hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

main a:not(.btn) {
  color: var(--accent);
}

main a:not(.btn):hover {
  text-decoration-thickness: 2px;
}

/* ---------- Home page extras ---------- */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero-actions .btn {
  margin-top: 0;
  border: 2px solid var(--accent);
}

.hero-actions .btn-secondary {
  border-color: var(--line);
  color: var(--ink);
}

.hero-actions .btn-secondary:not(:disabled):hover {
  border-color: var(--ink);
  background-color: transparent;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  max-width: var(--content-width);
  margin: 4rem auto 0;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.facts li {
  padding: 1.5rem 0;
}

.facts li + li {
  padding-left: 1.5rem;
  border-left: 1px solid var(--line);
}

.facts strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.facts span {
  color: var(--muted);
  font-size: 0.92rem;
}

.home-tools {
  width: 100%;
  max-width: var(--content-width);
  margin: 4.5rem auto 1rem;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1;
}

.section-head a {
  font-weight: 600;
  white-space: nowrap;
}

/* The tool cards are for big screens; phones get the button to /learn */
@media (max-width: 600px) {
  .home-tools {
    display: none;
  }

  .facts {
    grid-template-columns: 1fr;
    margin-top: 3rem;
  }

  .facts li + li {
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (min-width: 601px) {
  .mobile-only {
    display: none;
  }
}

/* ============================
   FOOTER
   ============================ */
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem max(1.5rem, calc((100% - var(--content-width)) / 2 + 1.5rem));
  background-color: var(--header-bg);
  color: var(--header-text);
}

footer p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.88;
}

.credit p {
  text-align: right;
}

.footer-name,
.footer-links {
  white-space: nowrap;
}

@media (max-width: 600px) {
  .footer-links { display: block; margin-top: 0.3rem; }
  .footer-sep { display: none; }
}

footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

footer a:hover,
footer a:focus-visible {
  opacity: 1;
  text-decoration-thickness: 2px;
}

#art text {
  font-family: 'Barlow Semi Condensed', system-ui, sans-serif !important;
  font-weight: 800 !important;
}

#art text { cursor: default; }
#art text.editable { cursor: text; }
#art text.editable:hover { fill: var(--accent) !important; }

.tool-picker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tool-picker[hidden] { display: none; }

.tool-picker label { font-weight: 600; }

.tool-picker select {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background-color: var(--surface);
  color: var(--ink);
  font: inherit;
}


/* ============================
   STAGE BOX TOOL
   (paste at the end of style.css)
   ============================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tool {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* On narrow screens the artwork scrolls sideways instead of shrinking to nothing */
#art {
  overflow-x: auto;
}

#art svg {
  display: block;
  width: 100%;
  min-width: 900px;
  height: auto;
}

#art g.interactive { cursor: pointer; }
#art g.locked { cursor: default; }
#art .selected {
  stroke: #ffffff;
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
}

#swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

#swatches button {
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;
}

#swatches button:hover {
  transform: scale(1.08);
}

#swatches button:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--border);
  outline-offset: 2px;
}

.tool-actions {
  display: flex;
  gap: 0.75rem;
}

button.btn {
  margin-top: 0;
  border: 2px solid var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  background-color: transparent;
  color: var(--accent);
}

/* Outline buttons get a light tint on hover and keep their blue text
   (a solid fill here would hide the text, which is the same blue) */
.btn-secondary:not(:disabled):hover {
  border-color: var(--accent);
  background-color: var(--code-bg);
  color: var(--accent);
}

.tool-hint {
  margin: 1rem 0 0;
  color: var(--ink);
  font-size: 0.9rem;
}

.tool-credit {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.tool-credit-margin {
  margin: 0.25rem 0 4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

#labelInput {
  position: fixed;
  z-index: 20;
  display: none;
  padding: 4px 6px;
  border: 2px solid var(--accent);
  border-radius: 4px;
  font: 600 16px system-ui, sans-serif;
  text-align: center;
}

/* ============================
   CONFIRM DIALOG ("Are you sure?")
   Shared by every page: paste at the end of style.css
   ============================ */
.confirm-dialog {
  width: min(26rem, calc(100vw - 2rem));
  background-color: var(--surface);
  padding: 1.5rem;
  border: 2px solid var(--accent);
  border-radius: 8px;
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.confirm-dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}

.confirm-dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.confirm-dialog p {
  margin: 0 0 1.5rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.dialog-actions .btn { margin-top: 0; }

button.btn.btn-confirm {
  border-color: #b3261e;
  background-color: #b3261e;
  color: #ffffff;
}

.confirm-dialog .btn:focus-visible {
  outline: 3px solid var(--border);
  outline-offset: 2px;
}

/* ============================
   JOB TRACKER PROJECT PAGE
   (paste at the end of style.css)
   ============================ */
.project {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.project h2 {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 1.5rem;
}

.project h3 {
  margin: 0 0 0.25rem;
  color: var(--ink);
  font-size: 1.05rem;
}

.project-section {
  margin-top: 3.5rem;
}

.project-section > p {
  max-width: 680px;
}

.small-print {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.project code {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background-color: var(--code-bg);
  color: var(--ink);
  font-size: 0.9em;
}

.project a:not(.btn) {
  color: var(--accent);
}

/* --- Key facts strip --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

.stat-grid li {
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: 8px;
}

.stat-grid strong {
  display: block;
  color: var(--accent);
  font-size: 1.75rem;
  line-height: 1.2;
}

.stat-grid span {
  color: var(--ink);
  font-size: 0.9rem;
}

/* --- Published sheet embed --- */
.embed-frame {
  overflow: hidden;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background-color: #ffffff;
}

.embed-frame iframe {
  display: block;
  width: 100%;
  height: 520px;
  border: 0;
}


/* --- Feature cards --- */
.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  padding: 1.25rem;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background-color: var(--surface-tint);
}

.feature-list p {
  margin: 0;
  font-size: 0.95rem;
}

/* --- Form flow --- */
.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.flow li {
  display: flex;
  flex: 1 1 150px;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.9rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

.flow li span {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background-color: var(--accent);
  color: var(--on-accent);
  font-size: 0.9rem;
}

.flow em {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: normal;
  font-weight: 400;
}

/* --- Screenshots --- */
.figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.figure-grid figure {
  margin: 0;
}

.figure-grid img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.figure-grid figcaption {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- Setup steps --- */
.steps {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 0 0 1.5rem 3.25rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background-color: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

/* line joining the step numbers */
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 2.5rem;
  bottom: 0.25rem;
  left: 1.07rem;
  width: 2px;
  background-color: var(--border);
}

.steps p {
  margin: 0;
}

.callout {
  margin-top: 0.5rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface-tint);
}

.callout p {
  margin: 0;
}

/* --- Changelog --- */
.changelog {
  margin: 0 0 1rem;
}

.changelog dt {
  font-weight: 700;
}

.changelog dt span {
  margin-left: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.changelog dd {
  margin: 0.25rem 0 1rem;
}

@media (max-width: 600px) {
  .embed-frame iframe { height: 420px; }
  .project h2 { font-size: 1.3rem; }
}

/* ============================
   MOBILE MENU (hamburger)
   Shared by every page: paste at the end of style.css
   The 760px breakpoint is where the five nav links stop
   fitting beside the site title — change it in both places
   below (and in nav.js) if you add or remove links.
   ============================ */
.menu-toggle {
  display: none;
}

@media (max-width: 760px) {
  /* Grid keeps the title and button on one row, with the
     dropdown spanning the full width underneath */
  header.has-menu {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    row-gap: 0;
  }

  .has-menu .theme-toggle {
    grid-row: 1;
    grid-column: 2;
  }

  .has-menu .menu-toggle {
    grid-row: 1;
    grid-column: 3;
  }

  .has-menu .site-title {
    min-width: 0;
  }

  .has-menu .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
  }

  .menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background-color: var(--header-text);
    transition: transform 0.25s ease, opacity 0.2s ease;
  }

  .menu-toggle:focus-visible {
    outline: 3px solid var(--highlight);
    outline-offset: 2px;
  }

  /* Turn the three lines into an X when open */
  .menu-open .menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .menu-open .menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .menu-open .menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* The links drop down as a full-width list under the header */
  .has-menu nav {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    gap: 0;
    grid-row: 2;
    margin: 0.75rem -1.5rem -0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }

  .menu-open nav {
    display: flex;
  }

  .has-menu nav a {
    align-items: flex-start;
    padding: 0.85rem 1.5rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .has-menu nav a:last-child {
    border-bottom: 0;
  }

  .has-menu nav a:hover,
  .has-menu nav a:focus-visible {
    background-color: rgba(255, 255, 255, 0.1);
  }

  /* Swap the desktop underline for a side marker on the current page */
  .has-menu nav a.active {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 4px 0 0 var(--highlight);
  }

  .has-menu nav a.active::after {
    display: none;
  }

  .has-menu nav a.active:last-child {
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu-toggle span {
    transition: none;
  }
}

/* ============================
   JOB TRACKER SETUP GUIDE PAGE
   (paste at the end of style.css)
   ============================ */
.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* Buttons side by side; matching borders keep them the same height */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-row .btn {
  margin-top: 0;
  border: 2px solid var(--accent);
}

.pdf-frame {
  margin-bottom: 0.5rem;
}

.pdf-frame object {
  display: block;
  width: 100%;
  height: 85vh;
  min-height: 600px;
  border: 0;
}

.pdf-fallback {
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.pdf-fallback p {
  margin: 0 0 1rem;
}

/* Permission names are long, so one per row reads better */
.permission-list {
  grid-template-columns: 1fr;
}

.permission-list + .callout,
.btn-row:not(:first-child) {
  margin-top: 1.5rem;
}

.callout + .callout {
  margin-top: 1rem;
}

.callout .btn {
  margin-top: 1rem;
}

/* Hidden on desktop, swapped in for the embed on phones and small tablets */
.pdf-mobile {
  display: none;
}

@media (max-width: 760px) {
  .pdf-frame,
  .pdf-help {
    display: none;
  }

  .pdf-mobile {
    display: block;
    margin-bottom: 0.5rem;
  }
}

/* ============================
   PROJECTS / TOOLS GRID
   Three columns on big screens, two on tablets, one on phones.
   A wrapping row rather than a grid, so a last row with fewer cards
   sits in the middle instead of on the left. Keep it this way: with
   three columns, one card left over sits in the centre, and two left
   over sit with their centres in line with the two gaps above (which
   centring gives exactly, as the cards are all the same width).
   ============================ */
.project-grid {
  --grid-gap: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--grid-gap);
  width: 100%;
  max-width: var(--content-width);
  margin: 2.25rem auto 0;
}

.project-grid > .project-card {
  flex: 0 1 calc((100% - 2 * var(--grid-gap)) / 3);
  min-width: 0;
}

@media (max-width: 900px) {
  .project-grid > .project-card {
    flex-basis: calc((100% - var(--grid-gap)) / 2);
  }
}

@media (max-width: 600px) {
  .project-grid > .project-card {
    flex-basis: 100%;
  }
}

/* The card's background and border are drawn on ::before so that layer can
   have its corner cut on hover, while the shadow (a drop-shadow filter on the
   card itself) follows the cut shape. On hover the bottom-right corner is cut
   at 45 degrees and two bands slide in: navy (::after) first, then teal (on
   ::before). Sizes measured from the corner along each edge:
     cut 17px, navy band 17-52px, teal band 52-87px.
   (A 315deg gradient starts at the bottom-right corner and measures at right
   angles to the cut, so each edge distance is divided by the square root of 2.) */
/* The cut size as a typed property, so its change can be timed: it appears at
   once on hover, and on the way out it waits until both bands have slid away
   (masks themselves can't animate, so without this the rounded corner would
   flash back behind the leaving bands). */
@property --cut-now {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

a.project-card {
  --cut: 12.02px;       /* 17px along each edge */
  --band-1: 36.77px;    /* 52px */
  --band-2: 61.52px;    /* 87px */
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);   /* no overflow clip: some browsers would shape the shadow to the rounded clip, not the cut corner */
  filter: var(--card-drop);
  text-decoration: none;
  --cut-now: 0px;
  transition: transform 0.2s ease, filter 0.2s ease, --cut-now 0s linear 0.2s;
}

a.project-card::before,
a.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(315deg, transparent var(--cut-now), #000 var(--cut-now));
  mask-image: linear-gradient(315deg, transparent var(--cut-now), #000 var(--cut-now));
}

/* Card background, with the teal band waiting off the corner */
a.project-card::before {
  z-index: -1;
  background:
    linear-gradient(315deg, transparent var(--band-1), var(--header-bg) var(--band-1), var(--header-bg) var(--band-2), transparent var(--band-2)) no-repeat border-box,
    var(--card-surface);
  background-position: 46px 46px;
  transition: background-position 0.22s ease;            /* on the way out, teal leaves first */
}

/* Border (in front, so it runs over the image) and the navy band waiting
   off the corner. Both bands are measured from the same outer corner
   (border-box), so they meet with no gap. */
a.project-card::after {
  z-index: 1;
  border: 1px solid var(--line);
  background: linear-gradient(315deg, transparent var(--cut), var(--accent) var(--cut), var(--accent) calc(var(--band-1) + 1px), transparent calc(var(--band-1) + 1px)) no-repeat border-box;
  background-position: 28px 28px;
  transition: border-color 0.2s ease, background-position 0.22s ease 0.06s;
}

a.project-card:hover {
  transform: translateY(-3px);
  filter: var(--card-drop-hover);
  --cut-now: var(--cut);
  transition-delay: 0s, 0s, 0s;
}

/* Slide both bands in (the corner cut comes from --cut-now above) */
a.project-card:hover::before,
a.project-card:hover::after {
  background-position: 0 0;
}

a.project-card:hover::before {
  transition-delay: 0.08s;                                 /* on the way in, navy first, then teal */
}

a.project-card:hover::after {
  border-color: var(--accent);
  transition-delay: 0s, 0s;
}

a.project-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  a.project-card,
  a.project-card::before,
  a.project-card::after,
  .project-card .thumb img {
    transition: none;
  }

  a.project-card:hover,
  a.project-card:hover .thumb img {
    transform: none;
  }
}

.project-card .thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;   /* the card itself doesn't clip */
  border-bottom: 1px solid var(--line);
  background: var(--placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.project-card .thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* crops images to fill the box without distorting */
  object-position: top left;
  transition: transform 0.4s ease;
}

a.project-card:hover .thumb img {
  transform: scale(1.03);
}

.project-card .info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.15rem 1.3rem 1.4rem;
}

.project-card .tag {
  color: var(--accent);         /* category label: button colour */
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.project-card h3 {
  margin: 0.15rem 0 0;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.3;
}

.project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.project-card .go {
  margin-top: auto;
  padding-top: 0.75rem;
  color: var(--highlight-ink);  /* "Open tool →": highlight colour, the readable shade */
  font-size: 0.9rem;
  font-weight: 600;
}

.project-card .go::after {
  content: " →";
  display: inline-block;
  transition: transform 0.15s;
}

a.project-card:hover .go::after {
  transform: translateX(4px);
}

/* ============================
   PROJECT PIC GRID
   This is CSS Grid: instead of one column stacking top to bottom
   (like flexbox column), grid lets you define a 2D layout.
   ============================ */
.projpic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 equal-width columns */
  gap: 1.5rem;
  margin-top: 2rem;
}

/* On narrow screens, drop to a single column */
@media (max-width: 600px) {
  .projpic-grid {
    grid-template-columns: 1fr;
  }
}

.projpic-card .thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--placeholder); /* placeholder color until you add real images */
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.projpic-card .thumb img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover /* crops images to fill the box without distorting */
}

.projpic-header h1 {
  margin: 1.5rem 0 0 5rem;
}

.projpic-header p {
  margin: 0 0 0 5rem;
}

/* ============================
   PHOTOS GRID
   The photos sit on a grey panel with thin gaps and rounded corners.
   White gaps crossing between photos make the eye see flickering grey
   dots where they meet (the Hermann grid illusion); a mid-grey panel,
   thin gaps and rounder corners make that almost disappear.
   One column on phones, two on laptops, three on big screens.
   ============================ */
.photos-header {
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
  /* Grows from main's own padding on phones up to ~3.5rem extra on wide screens */
  padding-inline: clamp(0rem, 5vw - 1rem, 3.5rem);
}

.photos-header h1 {
  margin: 0 0 0.25rem;
}

.photos-header p {
  margin: 0;
  color: var(--muted);
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  /* Lines up with the header text above */
  width: min(100% - 2 * clamp(0rem, 5vw - 1rem, 3.5rem), 1600px - 7rem);
  margin: 2rem auto;
  padding: 10px;
  border-radius: 24px;
  background-color: var(--photo-panel);
  list-style: none;
}

@media (min-width: 1400px) {
  .photos-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* On narrow screens, drop to a single column */
@media (max-width: 600px) {
  .photos-grid {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
    border-radius: 20px;
  }

  .photos-grid .photos-card {
    border-radius: 12px;
  }
}

.photos-card {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 16px;
  background: var(--placeholder); /* shows while the image loads */
  cursor: zoom-in;
}

.photos-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* crops images to fill the box without distorting */
  transition: transform 0.4s ease, filter 0.4s ease;
}

.photos-card:hover img {
  transform: scale(1.03);
  filter: brightness(1.05);
}

/* No long-press "Save Image" menu or text-selection on phones */
.photos-card,
.photos-card img,
.lightbox img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.photos-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ============================
   PHOTOS LIGHTBOX
   Uses <dialog>, so the browser handles focus trapping and puts
   it above everything else on the page.
   ============================ */
html.lightbox-open {
  overflow: hidden; /* stop the page scrolling behind the lightbox */
}

.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10, 10, 12, 0.94);
  color: #ffffff;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox::backdrop {
  background: transparent;
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox.is-visible {
  opacity: 1;
}

.lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 4.5rem 5.5rem 1.25rem;
  cursor: zoom-out;
}

.lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: calc(100% - 3rem);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: default;
  transform: scale(0.97);
  transition: transform 0.25s ease;
}

.lightbox.is-visible .lightbox-figure img {
  transform: scale(1);
}

.lightbox figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.25rem 1rem;
  max-width: 60rem;
  font-size: 0.9rem;
  text-align: center;
  cursor: default;
}

.lightbox-counter {
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

.lightbox-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  transition: background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.lightbox-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.lightbox-btn svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev {
  left: 1.25rem;
}

.lightbox-next {
  right: 1.25rem;
}

/* Subtle hint while the full-size image downloads */
.lightbox.is-loading .lightbox-figure img {
  filter: blur(2px);
}

@media (max-width: 600px) {
  .lightbox-figure {
    padding: 4rem 0.75rem 5.5rem;
  }

  .lightbox-figure img {
    border-radius: 0;
  }

  /* Arrows move to the bottom on phones, out of the photo's way */
  .lightbox-prev,
  .lightbox-next {
    top: auto;
    bottom: 1.25rem;
    transform: none;
  }

  .lightbox-prev {
    left: calc(50% - 4rem);
  }

  .lightbox-next {
    right: calc(50% - 4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .photos-card img,
  .lightbox,
  .lightbox-figure img {
    transition: none;
  }

  .photos-card:hover img {
    transform: none;
  }
}

/* ============================
   PROJECT DETAIL PAGE
   ============================ */
.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
 
.back-link:hover {
  color: var(--ink);
}
 
.project-hero {
  width: 100%;
  aspect-ratio: 16 / 8;
  border-radius: 8px;
  overflow: hidden;
  background: var(--placeholder);
  margin-bottom: 1.5rem;
}
 
.project-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
 
.project-detail h1 {
  margin-bottom: 0.25rem;
}
 
.project-detail .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ============================
   CONTACT PAGE
   ============================ */
.contact-form {
  display: flex;
  flex-direction: column;
  max-width: 480px;
  gap: 1rem;
  margin-top: 1.5rem;
}

.contact-form label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  display: block;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}

.contact-form textarea {
  min-height: 120px;
  resize: vertical;
}