/* ========== Theme variables ========== */
:root {
  --sky-top: #6db8f2;
  --sky-bottom: #d9efff;
  --cloud: rgba(255, 255, 255, 0.95);
  --text: #0f2742;
  --muted: #233a52;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(255, 255, 255, 0.9);
  --accent: #0a4f96;
  --accent-2: var(--accent); /* light mode: the second colour is the same blue (the darkened orange looked brown) */
  --on-accent: #ffffff; /* text on accent-coloured buttons */
  --menu-bg: #f4faff;
  --page-bg: var(--sky-top);
  --accent-on-sky: #08427f; /* for text sitting directly on the light blue sky */
  --chip-bg: rgba(11, 116, 214, 0.1);
  --shadow: 0 8px 30px rgba(15, 39, 66, 0.12);
  --terminal-bg: #0d1b2a;
  --star-opacity: 0;
  --radius: 16px;
}

[data-theme="dark"] {
  --sky-top: #050b1a;
  --sky-bottom: #14284a;
  --cloud: rgba(170, 190, 230, 0.12);
  --text: #e6eefb;
  --muted: #9fb3d1;
  --card-bg: rgba(20, 35, 65, 0.6);
  --card-border: rgba(120, 150, 210, 0.2);
  --accent: #5cb6ff;
  --accent-2: #ff9900; /* AWS orange */
  --on-accent: #04121f;
  --menu-bg: #0b1730;
  --page-bg: var(--sky-bottom);
  --accent-on-sky: var(--accent);
  --chip-bg: rgba(92, 182, 255, 0.12);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --terminal-bg: #020814;
  --star-opacity: 1;
}

/* ========== Base ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background-color: var(--page-bg); }
body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: color 0.4s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

/* ========== Sky background ========== */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  transition: background 0.6s;
}
.stars {
  position: absolute;
  inset: 0;
  opacity: var(--star-opacity);
  transition: opacity 0.6s;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, #fff, transparent),
    radial-gradient(1px 1px at 30% 70%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 55% 15%, #fff, transparent),
    radial-gradient(1px 1px at 75% 45%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 90% 80%, #fff, transparent),
    radial-gradient(1px 1px at 20% 90%, #fff, transparent),
    radial-gradient(1px 1px at 65% 85%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 85% 10%, #fff, transparent);
  background-size: 400px 400px;
}
.cloud {
  position: absolute;
  background: var(--cloud);
  filter: blur(1.5px);
  animation: drift linear infinite;
  transition: background 0.6s;
}
/* Each cloud is one shape (an SVG outline used as a mask), so no overlapping circles show through in dark mode */
.cloud {
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%20200%20100%27%20preserveAspectRatio%3D%27none%27%3E%3Cpath%20d%3D%27M30%2090%20H170%20A30%2030%200%200%200%20172%2030.2%20A50%2050%200%200%200%2088%2025%20A32%2032%200%200%200%2036%2046%20A22%2022%200%200%200%2030%2090%20Z%27/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%20200%20100%27%20preserveAspectRatio%3D%27none%27%3E%3Cpath%20d%3D%27M30%2090%20H170%20A30%2030%200%200%200%20172%2030.2%20A50%2050%200%200%200%2088%2025%20A32%2032%200%200%200%2036%2046%20A22%2022%200%200%200%2030%2090%20Z%27/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.c1 { width: 240px; height: 120px; top: 12%; animation-duration: 70s; animation-delay: -10s; }
.c2 { width: 170px; height: 85px; top: 35%; animation-duration: 90s; animation-delay: -40s; opacity: 0.8; }
.c3 { width: 300px; height: 150px; top: 58%; animation-duration: 110s; animation-delay: -70s; opacity: 0.7; }
.c4 { width: 150px; height: 75px; top: 78%; animation-duration: 80s; animation-delay: -20s; opacity: 0.6; }
.c5 { width: 210px; height: 105px; top: 25%; animation-duration: 120s; animation-delay: -95s; opacity: 0.5; }

@keyframes drift {
  from { transform: translateX(-350px); }
  to   { transform: translateX(calc(100vw + 350px)); }
}


/* ========== Nav ========== */
.logo { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.logo .accent { color: var(--accent); }

.theme-toggle {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  font-size: 1rem;
}
[data-theme="light"] .icon-sun,
[data-theme="dark"] .icon-moon { display: none; }

/* ========== Layout ========== */
main { max-width: 1100px; margin: 0 auto; padding: 0 clamp(1rem, 5vw, 2rem); }
.section { padding: 5rem 0 2rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 1.5rem; }
.section-num { font-family: "Inter", system-ui, sans-serif; color: var(--accent-2); font-size: 0.8em; }
.sub-heading { margin: 2.5rem 0 1rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
  transition: transform 0.25s, box-shadow 0.25s, background 0.4s;
}

/* ========== Hero ========== */
.hero {
  min-height: calc(100vh - 70px);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 3rem;
  padding: 3rem 0;
}
.eyebrow { font-family: "JetBrains Mono", monospace; color: var(--accent); }
.hero h1 { font-size: clamp(2.8rem, 7vw, 4.5rem); line-height: 1.1; }
.tagline { font-size: 1.2rem; font-weight: 600; color: var(--muted); margin: 0.5rem 0 1rem; }
.lead { max-width: 520px; color: var(--muted); }
.hero-cta { display: flex; gap: 0.6rem; margin-top: 2rem; flex-wrap: wrap; }
.hero-cta .btn { padding: 0.75rem 1.05rem; white-space: nowrap; }

.btn {
  display: inline-block;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn.ghost { border: 2px solid var(--accent); color: var(--accent); background: var(--card-bg); }

/* Terminal */
.terminal {
  background: var(--terminal-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88rem;
}
.terminal-bar { display: flex; align-items: center; gap: 0.45rem; padding: 0.7rem 1rem; background: rgba(255, 255, 255, 0.06); }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.red { background: #ff5f57; } .yellow { background: #febc2e; } .green { background: #28c840; }
.terminal-title { margin-left: auto; color: #8aa0bf; font-size: 0.8rem; }
.terminal-body { padding: 1.2rem; color: #cfe3ff; min-height: 260px; white-space: pre-wrap; }
.terminal-body .k { color: #ff9900; }
.terminal-body .s { color: #7ee787; }
.terminal-body .p { color: #5cb6ff; }
.cursor { color: #5cb6ff; animation: blink 1s steps(1) infinite; padding-left: 1.2rem; }
@keyframes blink { 50% { opacity: 0; } }

/* ========== About ========== */
.about-card p + p { margin-top: 1rem; }

/* ========== Skills ========== */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.2rem; }
.skill-group h3 { margin-bottom: 0.9rem; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li {
  background: var(--chip-bg);
  color: var(--accent);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ========== Projects ========== */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.5rem; }
.project { display: flex; flex-direction: column; }
.project:hover { transform: translateY(-6px); }
.project-head { display: flex; justify-content: flex-end; align-items: center; margin-bottom: 1rem; }
.project-icon { font-size: 2rem; }
.project-links { display: flex; gap: 0.9rem; font-size: 0.9rem; font-weight: 600; }
.project h3 { margin-bottom: 0.5rem; }
.project p { color: var(--muted); flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.2rem; font-family: "Inter", system-ui, sans-serif; font-size: 0.78rem; color: var(--accent-2); }

/* ========== Timeline ========== */
.timeline { list-style: none; position: relative; padding-left: 1.8rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0.45rem; top: 0.5rem; bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.timeline li { position: relative; margin-bottom: 1.2rem; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -1.75rem; top: 1.8rem;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--sky-bottom);
}
.when { font-family: "Inter", system-ui, sans-serif; font-size: 0.8rem; color: var(--accent); }
.timeline h3 { margin: 0.2rem 0 0.4rem; font-size: 1.1rem; }
.timeline p { color: var(--muted); }

/* Keep line breaks typed in the admin panel */
.timeline p, .project p, .about-card p, .lead { white-space: pre-line; }

/* ========== Image galleries (projects, experience, education) ========== */
.gallery { display: grid; gap: 0.6rem; margin: 0.4rem 0 1rem; }
.gallery.count-2 { grid-template-columns: 1fr 1fr; }
/* Project cards: 3 to 6 images in a grid of 3 */
.gallery.count-3, .gallery.count-4, .gallery.count-5, .gallery.count-6 { grid-template-columns: repeat(3, 1fr); }

/* Experience, Education and Read more pages: big, uncropped images, 2 across (1 across on phones) */
/* Every tile is the same shape; the whole photo fits inside it (nothing is cut off) */
.timeline .gallery, .details-card .gallery { grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.timeline .gallery { margin: 1.2rem 0 0; }
.timeline .gallery.count-1, .details-card .gallery.count-1 { grid-template-columns: minmax(0, 720px); }
.timeline .gallery a, .details-card .gallery a { background: rgba(127, 140, 160, 0.1); }
.timeline .gallery img, .details-card .gallery img { aspect-ratio: 4 / 3; object-fit: contain; }
@media (max-width: 600px) {
  .gallery.count-3, .gallery.count-4, .gallery.count-5, .gallery.count-6 { grid-template-columns: 1fr 1fr; }
  .timeline .gallery, .details-card .gallery { grid-template-columns: 1fr; }
}
.gallery a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--card-border); }
.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.3s;
}
.gallery a:hover img { transform: scale(1.04); }

.certs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.cert { display: flex; gap: 1rem; align-items: center; }
.cert span { font-size: 1.8rem; }
.cert small { display: block; color: var(--muted); }
/* Uploaded certificate image sits where the emoji icon goes */
img.cert-icon { width: 2.6rem; height: 2.6rem; flex-shrink: 0; object-fit: contain; border-radius: 8px; }

/* ========== Read more ========== */
.read-more {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  align-self: flex-start;
}
.read-more:hover { text-decoration: none; transform: translateX(3px); }
.read-more { transition: transform 0.2s; }

/* ========== References ========== */
.references-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.5rem; }
.reference { margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.reference blockquote { color: var(--muted); font-style: italic; white-space: pre-line; flex: 1; }
.reference figcaption { border-left: 3px solid var(--accent-2); padding-left: 0.8rem; }
.reference figcaption small { display: block; color: var(--muted); }

/* ========== Details ("Read more") page ========== */
.details-page { max-width: 820px; padding-top: 3rem; padding-bottom: 4rem; }
.back-link { display: inline-block; margin-bottom: 1.5rem; font-weight: 600; }
.details-card h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.2; margin: 0.3rem 0 1rem; }
.details-card .eyebrow { font-size: 0.85rem; }
.details-card .summary { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.5rem; white-space: pre-line; }
.details-card .body { white-space: pre-line; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--card-border); }
.details-card .gallery { margin: 1.5rem 0; }
.details-card .project-links { margin-top: 1.5rem; }

/* ========== Contact ========== */
.contact { text-align: center; padding-bottom: 5rem; }
.contact p { color: var(--muted); max-width: 520px; margin: 0 auto; }
.contact-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }

.footer { text-align: center; padding: 2rem 1rem; color: var(--muted); font-size: 0.9rem; }

/* ========== Scroll reveal ========== */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ========== Responsive ========== */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 4rem; }
}

/* ===================================================================
   Accessibility
   =================================================================== */

/* Header buttons: phone menu, accessibility, dark mode */
.nav-controls { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
}
.menu-toggle { display: none; }

/* Accessibility settings panel */
.a11y { position: relative; }
.a11y-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  z-index: 20;
  width: min(300px, 88vw);
  padding: 1rem;
  background: var(--menu-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.a11y-panel.open { display: block; }
.a11y-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.7rem; }
.a11y-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; }
.a11y-sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin-bottom: 0.9rem; }
.a11y-size, .a11y-toggle, .a11y-reset {
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  cursor: pointer;
}
.a11y-size { padding: 0.45rem 0; font-weight: 700; font-size: 0.85rem; }
.a11y-size[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.a11y-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.92rem;
  text-align: left;
}
.switch {
  position: relative;
  flex-shrink: 0;
  width: 2.3rem;
  height: 1.3rem;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--muted);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.3rem - 6px);
  height: calc(1.3rem - 6px);
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s;
}
.a11y-toggle[aria-pressed="true"] .switch { background: var(--accent); border-color: var(--accent); }
.a11y-toggle[aria-pressed="true"] .switch::after { transform: translateX(1rem); background: var(--on-accent); }
.a11y-reset { width: 100%; margin-top: 0.5rem; padding: 0.55rem; font-size: 0.88rem; font-weight: 600; color: var(--accent); }

/* Keyboard focus is always clearly visible */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }

/* "Skip to main content": hidden until a keyboard user tabs to it */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* Text only screen readers announce */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.noscript { padding: 1rem; text-align: center; font-weight: 600; background: #fff3cd; color: #000; }

/* Text size */
html[data-text-size="115"] { font-size: 115%; }
html[data-text-size="130"] { font-size: 130%; }
html[data-text-size="150"] { font-size: 150%; }

/* Stop animations (from the device setting or the accessibility menu) */
html[data-motion="reduce"] { scroll-behavior: auto; }
html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after { animation: none !important; transition: none !important; }
html[data-motion="reduce"] .cloud { left: 20%; }
html[data-motion="reduce"] .reveal { opacity: 1; transform: none; }
html[data-motion="reduce"] .project:hover,
html[data-motion="reduce"] .btn:hover,
html[data-motion="reduce"] .read-more:hover,
html[data-motion="reduce"] .gallery a:hover img { transform: none; }

/* High contrast: solid colours, strong borders, no clouds or stars */
html[data-contrast="on"] {
  --text: #000000;
  --muted: #000000;
  --card-bg: #ffffff;
  --card-border: #000000;
  --accent: #003a7a;
  --accent-2: #7a3a00;
  --chip-bg: #e6eef8;
  --menu-bg: #ffffff;
  --on-accent: #ffffff;
  --page-bg: #ffffff;
  --accent-on-sky: var(--accent);
}
html[data-theme="dark"][data-contrast="on"] {
  --text: #ffffff;
  --muted: #ffffff;
  --card-bg: #000000;
  --card-border: #ffffff;
  --accent: #9fd4ff;
  --accent-2: #ffc266;
  --chip-bg: #1c1c1c;
  --menu-bg: #000000;
  --on-accent: #000000;
  --page-bg: #000000;
  --accent-on-sky: var(--accent);
}
html[data-contrast="on"] .sky { background: var(--page-bg); }
html[data-contrast="on"] .cloud,
html[data-contrast="on"] .stars { display: none; }
html[data-contrast="on"] .card,
html[data-contrast="on"] .nav { backdrop-filter: none; }
html[data-contrast="on"] .card { border-width: 2px; box-shadow: none; }
html[data-contrast="on"] .nav { background: var(--page-bg); }

/* Easy-read font (Atkinson Hyperlegible, designed for low-vision readers) */
html[data-font="on"] body,
html[data-font="on"] .eyebrow,
html[data-font="on"] .section-num,
html[data-font="on"] .tags,
html[data-font="on"] .when { font-family: "Atkinson Hyperlegible", Verdana, sans-serif; }

/* Wider text spacing (the WCAG text-spacing values) */
html[data-spacing="on"] body { line-height: 1.9; letter-spacing: 0.12em; word-spacing: 0.16em; }
html[data-spacing="on"] p + p { margin-top: 2em; }

/* Underline links */
html[data-links="on"] a:not(.btn):not(.skip-link) { text-decoration: underline; text-underline-offset: 0.2em; }

/* Text placed straight on the sky (not on a card) */
.hero .eyebrow, .back-link { color: var(--accent-on-sky); }

/* Phone menu button (must come after the base .menu-toggle rule above) */

/* Project cards: images stack full width, so each is the same size as a single image on other projects */
.project .gallery.count-2 { grid-template-columns: 1fr; }
.project .when { display: block; margin-bottom: 0.3rem; }

/* Date and location line on experience/education cards */
.timeline .when { margin: 0; color: var(--accent); }
.timeline .location { white-space: nowrap; }

/* ========== Logo: just the first name ========== */
.logo { font-size: 1.3rem; }

/* ========== Contact form page ========== */
.contact-form { display: grid; gap: 1.1rem; max-width: 560px; }
.form-field { display: grid; gap: 0.4rem; }
.form-field > span { font-weight: 600; }
.form-field input,
.form-field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--muted);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}
.form-field textarea { resize: vertical; min-height: 160px; }
.form-field small { color: var(--muted); font-size: 0.8rem; justify-self: end; }
.contact-form .btn { justify-self: start; border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.contact-form .btn:disabled { opacity: 0.6; cursor: default; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { min-height: 1.5em; font-weight: 600; }
.form-status.error { color: #b3261e; }
.form-status.ok { color: #1e7d3a; }
[data-theme="dark"] .form-status.error { color: #ff8a80; }
[data-theme="dark"] .form-status.ok { color: #7ee787; }

/* ========== How I built this site ========== */
.details-page.wide { max-width: 1000px; }
.how h2 { font-size: 1.3rem; margin: 2.2rem 0 0.8rem; }
.how ol, .how ul:not(.tags) { padding-left: 1.3rem; display: grid; gap: 0.6rem; }
.how ul:not(.tags) { list-style: disc; }
.how code { font-family: "JetBrains Mono", monospace; font-size: 0.88em; background: var(--chip-bg); padding: 0.1em 0.35em; border-radius: 5px; }
.how-tags { margin-top: 0.4rem; }
.source-link { margin-top: 2rem; font-weight: 600; }

.arch-figure { margin: 2rem 0 0.5rem; }
.arch-scroll { overflow-x: auto; }
.arch { display: block; width: 100%; min-width: 680px; height: auto; font-family: "Inter", system-ui, sans-serif; }
.arch .node { fill: var(--card-bg); stroke: var(--accent); stroke-width: 1.5; }
.arch .group { fill: var(--chip-bg); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 7 6; }
.arch .t { fill: var(--text); font-size: 16px; font-weight: 700; text-anchor: middle; }
.arch .s { fill: var(--muted); font-size: 13px; text-anchor: middle; }
.arch .g { fill: var(--accent); font-size: 15px; font-weight: 700; text-anchor: middle; }
.arch .l { fill: var(--accent-2); font-size: 12px; font-weight: 600; text-anchor: middle; }
.arch .flow { fill: none; stroke: var(--accent-2); stroke-width: 2; }
.arch .head { fill: var(--accent-2); }
.arch-figure figcaption { color: var(--muted); font-size: 0.88rem; margin-top: 0.6rem; }
html[data-font="on"] .arch { font-family: "Atkinson Hyperlegible", Verdana, sans-serif; }
.footer a { color: var(--accent-on-sky); }
/* Tags on the How I built this page sit lower on the sky, so they need a slightly darker orange in light mode */

/* "Hi, I'm" uses the same font as the name below it */
.hero .eyebrow { font-family: "Inter", system-ui, sans-serif; font-weight: 600; }
.logo-cloud { font-size: 0.9em; }

/* Read more pages: the "Experience · dates · location" line above the title */
.details-card .eyebrow { font-family: "Inter", system-ui, sans-serif; font-weight: 600; }

/* Turnstile human check on the contact form */
.turnstile { min-height: 65px; }

/* ===================================================================
   Experience / Education rows (expandable, one line each)
   =================================================================== */
.rows { --when-col: 13.5rem; padding: 0; overflow: hidden; }
.row + .row { border-top: 1px solid var(--card-border); }
.row-head {
  display: grid;
  grid-template-columns: var(--when-col) minmax(0, 1fr) auto 1.5rem;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  list-style: none;
}
details.row > summary { cursor: pointer; }
details.row > summary::-webkit-details-marker { display: none; }
details.row > summary:hover { background: var(--chip-bg); }
details.row > summary:focus-visible { outline-offset: -3px; }
.row-when { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.row-title { min-width: 0; }
.row-title strong { font-weight: 600; }
.row-org { color: var(--muted); }
.row-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; }
.row-tag, .row-badge { font-size: 0.75rem; font-weight: 500; padding: 0.2rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.row-tag { background: var(--chip-bg); color: var(--text); }
.row-badge { background: color-mix(in srgb, var(--accent-2) 16%, transparent); color: var(--accent-2); font-weight: 600; }
.row-arrow { display: flex; justify-content: center; color: var(--muted); transition: transform 0.2s; }
details.row[open] .row-arrow { transform: rotate(180deg); }
/* The opened details line up under the title */
.row-body { padding: 0 1.25rem 1.25rem calc(1.25rem + var(--when-col) + 1rem); }
.row-location { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
.row-desc { color: var(--muted); white-space: pre-line; }
.row-body .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 620px; margin: 1rem 0 0; }
.row-body .gallery a { background: rgba(127, 140, 160, 0.1); }
.row-body .gallery img { aspect-ratio: 4 / 3; object-fit: contain; }
.row-body .read-more { margin-top: 0.9rem; }
html[data-contrast="on"] .row-badge { border: 1px solid currentColor; }

@media (max-width: 720px) {
  .row-head { grid-template-columns: minmax(0, 1fr) 1.5rem; gap: 0.35rem 0.8rem; }
  .row-when { grid-column: 1; white-space: normal; }
  .row-title { grid-column: 1; }
  .row-tags { grid-column: 1; justify-content: flex-start; }
  .row-arrow { grid-column: 2; grid-row: 1 / span 3; }
  .row-body { padding-left: 1.25rem; }
  .row-body .gallery { grid-template-columns: 1fr 1fr; }
}

/* ===================================================================
   Top bar: one floating pill in the middle (like leeam.uk)
   =================================================================== */
.nav {
  position: sticky;
  top: 0.9rem;
  z-index: 10;
  display: flex;
  justify-content: center;
  padding: 0 1rem;
  margin-top: 0.9rem;
  pointer-events: none; /* only the pill itself is clickable */
}
.nav-pill {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.3rem 0.35rem 0.3rem 1.05rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--menu-bg) 90%, transparent);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.nav-pill .logo { font-size: 1rem; margin-right: 0.4rem; white-space: nowrap; }
.nav-links { display: flex; gap: 0.1rem; }
.nav-links a {
  display: block;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text); text-decoration: none; background: var(--chip-bg); }
.nav-links a[aria-current] { color: var(--text); background: var(--chip-bg); font-weight: 600; }
.nav-pill .nav-controls { gap: 0.15rem; margin-left: 0.2rem; }
.nav-pill .icon-btn { width: 2.2rem; height: 2.2rem; background: transparent; border: 0; }
.nav-pill .icon-btn:hover { background: var(--chip-bg); }
html[data-contrast="on"] .nav-pill { background: var(--page-bg); border-width: 2px; backdrop-filter: none; }
/* Section headings aren't hidden under the floating bar when jumped to */
main > section[id] { scroll-margin-top: 4.5rem; }

/* Phones: logo and buttons stay in the pill, the links drop down underneath it */
@media (max-width: 680px) {
  .menu-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    min-width: 220px;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    background: var(--menu-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.7rem 1rem; font-size: 1rem; border-radius: 10px; }
}

/* Certification rows: small icon or badge image before the name */
.cert-row .row-title { display: flex; align-items: center; gap: 0.25rem; }
.row-icon { width: 1.6rem; height: 1.6rem; margin-right: 0.5rem; flex-shrink: 0; border-radius: 6px; object-fit: contain; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }

/* ========== Separate pages ========== */
.section > h1.page-title { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 1.5rem; }
/* Contact page: message and buttons above the form */
.details-card .contact-links { justify-content: flex-start; margin: 0 0 2.2rem; }
.form-heading { font-size: 1.3rem; margin-bottom: 0.3rem; }
.form-intro { color: var(--muted); margin-bottom: 1.2rem; }

.project h2.project-title { font-size: 1.17rem; line-height: 1.4; margin-bottom: 0.5rem; }

/* ===================================================================
   Skills: groups of icon tiles (like leeam.uk/stack)
   =================================================================== */
.stack { display: grid; gap: 1rem; }
.stack-group { padding: 0; }
.stack-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.25rem;
  cursor: pointer;
  list-style: none;
}
.stack-head::-webkit-details-marker { display: none; }
.stack-head h3, .stack-head .stack-title { font-size: 1.1rem; margin: 0; }
.stack-head p { color: var(--muted); font-size: 0.9rem; margin-top: 0.15rem; }
.stack-group[open] .row-arrow { transform: rotate(180deg); }
.skill-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.6rem;
  padding: 0 1.25rem 1.25rem;
}
.skill-tile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--chip-bg);
  font-weight: 500;
  font-size: 0.92rem;
}
.skill-tile img { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }
html[data-contrast="on"] .skill-tile { border: 1px solid var(--card-border); }

/* ===================================================================
   Footer: name on the left, links on the right (like leeam.uk)
   =================================================================== */
.footer { padding: 2.5rem 1rem 2rem; margin-top: 3rem; border-top: 1px solid var(--card-border); }
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(0rem, 4vw, 1rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  text-align: left;
}
.footer-inner p { color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }
.footer-links a { color: var(--muted); font-weight: 500; }
.footer-links a:hover { color: var(--text); }
@media (max-width: 560px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
  .skill-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 1rem 1rem; }
  .skill-tile { padding: 0.6rem 0.7rem; font-size: 0.88rem; }
}

/* More breathing room between the last section and the footer */
.footer { margin-top: 8rem; }

/* Icon next to a skill group's title */
.stack-head h3, .stack-head .stack-title { display: flex; align-items: center; gap: 0.6rem; }
.stack-icon { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }

/* ===================================================================
   Smooth page changes (like leeam.uk): the menu bar and sky stay put,
   the page content fades out and the new page slides in.
   Supported in Chrome, Edge and Safari; other browsers just load the page as normal.
   =================================================================== */
@view-transition { navigation: auto; }
.nav { view-transition-name: site-nav; }
.sky { view-transition-name: site-sky; }
main { view-transition-name: page; }
.footer { view-transition-name: site-footer; }
::view-transition-old(page) { animation: page-out 0.16s ease-in both; }
::view-transition-new(page) { animation: page-in 0.28s ease-out both; }
::view-transition-old(site-footer) { animation: page-out 0.16s ease-in both; }
::view-transition-new(site-footer) { animation: page-in 0.28s ease-out both; }
@keyframes page-out { to { opacity: 0; } }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }
/* Animations switched off (device setting or the accessibility menu): change page instantly */
html[data-motion="reduce"]::view-transition-group(*),
html[data-motion="reduce"]::view-transition-old(*),
html[data-motion="reduce"]::view-transition-new(*) { animation: none !important; }

/* While a dropdown is closing, the arrow already turns back */
details.row.closing .row-arrow, .stack-group.closing .row-arrow { transform: none; }

/* ===================================================================
   Home page: AWS architecture diagram (replaces the terminal)
   =================================================================== */
.arch-hero { margin: 0; }
.aws-diagram { display: block; width: 100%; max-width: 540px; height: auto; margin: 0 auto; font-family: "Inter", system-ui, sans-serif; }
.aws-diagram .c-vpc { fill: color-mix(in srgb, var(--card-bg) 70%, transparent); stroke: #8C4FFF; stroke-width: 1.6; stroke-dasharray: 7 5; }
.aws-diagram .c-asg { fill: none; stroke: #ED7100; stroke-width: 1.6; stroke-dasharray: 7 5; }
.aws-diagram .c-az { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 4; opacity: 0.8; }
.aws-diagram .c-subnet { fill: color-mix(in srgb, #7AA116 12%, transparent); stroke: #7AA116; stroke-width: 1.2; }
.aws-diagram .c-sg { fill: none; stroke: #DD344C; stroke-width: 1.2; stroke-dasharray: 5 4; }
.aws-diagram .lbl { fill: var(--muted); font-size: 12px; font-weight: 600; }
.aws-diagram .lbl-sm { font-size: 11px; }
.aws-diagram .lbl-vpc { fill: #8C4FFF; font-size: 13px; }
.aws-diagram .lbl-asg { fill: #ED7100; }
.aws-diagram .lbl-sg { fill: #DD344C; }
[data-theme="dark"] .aws-diagram .lbl-vpc { fill: #B794FF; }
[data-theme="dark"] .aws-diagram .lbl-sg { fill: #FF7A8C; }
[data-theme="light"] .aws-diagram .lbl-asg { fill: #A84D00; }
[data-theme="light"] .aws-diagram .lbl-vpc { fill: #6930D9; }
[data-theme="light"] .aws-diagram .lbl-sg { fill: #B3203A; }
.aws-diagram .svc-box { fill: var(--menu-bg); stroke: var(--card-border); stroke-width: 1.2; }
.aws-diagram .svc-name { fill: var(--text); font-size: 13px; font-weight: 600; }
.aws-diagram .svc-name-sm { font-size: 12px; }
.aws-diagram .link { fill: none; stroke: var(--muted); stroke-width: 1.6; }
.aws-diagram .link-dotted { stroke-dasharray: 2 4; }
.aws-diagram .aws-head { fill: var(--muted); }
.aws-diagram .users circle, .aws-diagram .users path { fill: none; stroke: var(--text); stroke-width: 1.8; }
.aws-diagram .flow circle { fill: var(--accent); }
html[data-motion="reduce"] .aws-diagram .flow { display: none; }
html[data-contrast="on"] .aws-diagram .c-vpc,
html[data-contrast="on"] .aws-diagram .c-subnet { fill: none; }
.arch-hero figcaption { color: var(--muted); font-size: 0.82rem; text-align: center; margin-top: 0.6rem; }

/* Drawn icons in the menu pill */
.logo { display: inline-flex; align-items: center; gap: 0.35rem; }
.logo-cloud { color: var(--accent); flex-shrink: 0; }
.theme-toggle svg { display: block; }
.badge-icon { color: var(--accent); }

/* Experience/Education rows with a logo before the title */
.row-title.has-logo { display: flex; align-items: center; gap: 0.25rem; }

/* Referee's company icon */
.reference figcaption.has-logo { display: flex; align-items: center; gap: 0.7rem; }
.ref-logo { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; border-radius: 6px; }
.reference figcaption span { display: block; }
