/* Light theme (default) */
:root {
  color-scheme: light;
  --page: #fafaf7;
  --surface: #ffffff;
  --text: #141c2b;
  --muted: #4a5568;
  --line: #e2e3e0;
  --tag-bg: #dde6f3;
  --tag-text: #142a4a;
  --tag-line: #b9c9e0;
  --selection: #d6e0ef;

  /* Sidebar: a light blue tint that separates it from the content */
  --sidebar-bg: #e7f0fb;
  --sidebar-line: #c9d9ee;
  --nav-active: #d2e2f6;

  /* Navy accent, with amber as a small secondary */
  --accent: #1b365d;
  --accent-strong: #142a4a;
  --accent-soft: #e6ebf3;
  --on-accent: #ffffff;
  --warm: #b45309;
  --warm-soft: #fdf3e0;
  --warm-line: #f2d9a8;
  --warm-text: #8a4006;

  /* Text links: classic blue and underlined, with a different hover colour */
  --link: #0b57d0;
  --link-hover: #9a4a06;

  --card-shadow: 0 1px 2px rgba(20, 28, 43, .05);
  --card-hover-shadow: 0 8px 22px rgba(27, 54, 93, .12);
  --float-shadow: 0 2px 8px rgba(20, 28, 43, .12);
  --menu-shadow: 0 14px 28px rgba(20, 28, 43, .14);
  --diagram-opacity: .5;
  --icon-plate: transparent;
  --scrim: rgba(20, 28, 43, .55);

  /* MacEwan logo tile: the official maroon mark on white */
  --org-logo: url("assets/macewan-mark.svg");
  --org-logo-plate: #ffffff;
  --org-logo-size: 76%;
}

/* Dark theme: used for the visitor's system setting unless they chose light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d1320;
    --surface: #172033;
    --text: #e8ecf3;
    --muted: #a8b3c5;
    --line: #2a364d;
    --tag-bg: #26395c;
    --tag-text: #e3ecfa;
    --tag-line: #3f5682;
    --selection: #2a3c5d;
    --sidebar-bg: #14223c;
    --sidebar-line: #2b3d5f;
    --nav-active: #233859;
    --accent: #7fa6dc;
    --accent-strong: #a3c1ea;
    --accent-soft: #1c2c47;
    --on-accent: #0b1322;
    --warm: #f2b24c;
    --warm-soft: #33250d;
    --warm-line: #5c431a;
    --warm-text: #f7cb7e;
    --link: #8ab4f8;
    --link-hover: #f7cb7e;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    --float-shadow: 0 2px 10px rgba(0, 0, 0, .45);
    --menu-shadow: 0 14px 28px rgba(0, 0, 0, .5);
    --diagram-opacity: .6;
    --icon-plate: #eef2f8;
    --scrim: rgba(2, 5, 12, .72);
    --org-logo: url("assets/macewan-mark-white.png");
    --org-logo-plate: transparent;
    --org-logo-size: 100%;
  }
}
/* Dark theme: used when the visitor chose it with the toggle (keep in sync with the block above) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d1320;
  --surface: #172033;
  --text: #e8ecf3;
  --muted: #a8b3c5;
  --line: #2a364d;
  --tag-bg: #26395c;
  --tag-text: #e3ecfa;
  --tag-line: #3f5682;
  --selection: #2a3c5d;
  --sidebar-bg: #14223c;
  --sidebar-line: #2b3d5f;
  --nav-active: #233859;
  --accent: #7fa6dc;
  --accent-strong: #a3c1ea;
  --accent-soft: #1c2c47;
  --on-accent: #0b1322;
  --warm: #f2b24c;
  --warm-soft: #33250d;
  --warm-line: #5c431a;
  --warm-text: #f7cb7e;
  --link: #8ab4f8;
  --link-hover: #f7cb7e;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  --float-shadow: 0 2px 10px rgba(0, 0, 0, .45);
  --menu-shadow: 0 14px 28px rgba(0, 0, 0, .5);
  --diagram-opacity: .6;
  --icon-plate: #eef2f8;
  --scrim: rgba(2, 5, 12, .72);
  --org-logo: url("assets/macewan-mark-white.png");
  --org-logo-plate: transparent;
  --org-logo-size: 100%;
}

:root {
  --sidebar-width: 240px;
  --bar: 0px;
  --section-pad: clamp(80px, 12vh, 128px);
  --diagram-space: 0px;
  --scrollbar-offset: 0px;
  /* Use this instead of vw for sizes: script.js holds it steady while the project dialog is open */
  --vw: 1vw;
  --sans: Lexend, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, p { overflow-wrap: break-word; }
h1, h2, h3 { font-weight: 600; }
strong { font-weight: 600; }
::selection { background: var(--selection); color: var(--text); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.skip-link { position: fixed; z-index: 1000; top: -80px; left: 16px; padding: 8px 12px; border-radius: 4px; background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-size: .86rem; }
.skip-link:focus { top: 8px; }

/* Text links must look like links everywhere: blue, underlined, and a different colour on hover */
.side-links a, .note a, .email-link, .contact-links a, .detail-links a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.side-links a:hover, .note a:hover, .email-link:hover, .contact-links a:hover, .detail-links a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

/* Sidebar */
.sidebar { position: sticky; z-index: 20; top: 0; height: 100vh; height: 100svh; overflow-y: auto; display: flex; flex-direction: column; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-line); }
.identity { padding: 34px 24px 26px; }
.site-name { display: block; font-size: 1.1rem; font-weight: 600; line-height: 1.3; text-decoration: none; }
.role-line { margin-top: 6px; color: var(--muted); font-size: .82rem; line-height: 1.45; text-wrap: balance; }
.menu-button { display: none; }
.sidebar-panel { flex: 1; display: flex; flex-direction: column; }

.site-nav { position: relative; padding: 14px 0; border-block: 1px solid var(--sidebar-line); font-family: var(--mono); font-size: .88rem; }
.site-nav a { position: relative; z-index: 1; display: block; padding: 9px 24px; color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current] { color: var(--accent-strong); font-weight: 500; }
.site-nav a:focus-visible { outline-offset: -3px; }
.nav-indicator { position: absolute; top: 0; right: 0; left: 0; border-left: 3px solid var(--accent); background: var(--nav-active); opacity: 0; }
.nav-indicator.is-visible { opacity: 1; }

.side-links { display: grid; gap: 9px; margin-top: auto; padding: 24px; font-family: var(--mono); font-size: .78rem; line-height: 1.4; }
.side-links a { width: fit-content; overflow-wrap: anywhere; }

/* Theme toggle: fixed in the top-right corner on desktop, in the top bar on mobile */
.theme-toggle { position: fixed; z-index: 95; top: 14px; right: calc(16px + var(--scrollbar-offset)); display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--accent-strong); box-shadow: var(--float-shadow); cursor: pointer; }
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun, .theme-toggle.is-dark .icon-moon { display: none; }
.theme-toggle.is-dark .icon-sun { display: block; }

/* Page structure. Each section is its own view: script.js sets data-view on <html>, and these
   rules hide every other section. Without JavaScript nothing is hidden and the page simply scrolls.
   When adding a section, add a line for it here. */
html[data-view]:not([data-view="home"]) #home,
html[data-view]:not([data-view="about"]) #about,
html[data-view]:not([data-view="experience"]) #experience,
html[data-view]:not([data-view="projects"]) #projects,
html[data-view]:not([data-view="skills"]) #skills,
html[data-view]:not([data-view="organizations"]) #organizations,
html[data-view]:not([data-view="education"]) #education,
html[data-view]:not([data-view="contact"]) #contact { display: none; }

.main-col { position: relative; min-width: 0; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
main { flex: 1; display: flex; flex-direction: column; }
main > section { flex: 1; display: flex; flex-direction: column; padding-right: var(--diagram-space); scroll-margin-top: var(--bar); }
main > section > .column { flex: 1; display: flex; flex-direction: column; }
[tabindex="-1"]:focus { outline: none; }
.column { width: min(calc(100% - clamp(64px, calc(8 * var(--vw)), 128px)), 860px); margin-inline: auto; }
.section { padding-block: var(--section-pad); background: var(--page); }
html:not(.js) .section { border-top: 1px solid var(--line); }

/* "← Previous" and "Next: section →" at the bottom of every view */
.view-pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; margin-top: auto; padding-top: 72px; }
.pager-link { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--accent-strong); font-weight: 500; text-decoration: none; }
.pager-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.pager-next { margin-left: auto; border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.pager-next:hover { border-color: var(--accent-strong); background: var(--accent-strong); color: var(--on-accent); }

.section-head { margin-bottom: 52px; }
.section-head::before { content: ""; display: block; width: 36px; height: 3px; margin-bottom: 20px; border-radius: 2px; background: var(--accent); }
h2 { font-size: clamp(1.9rem, calc(3.4 * var(--vw)), 2.35rem); line-height: 1.2; letter-spacing: -.015em; }
.section-sub { margin-top: 12px; color: var(--muted); font-size: 1.05rem; }
h3 { font-size: 1.15rem; line-height: 1.4; }

/* Hero */
.hero { position: relative; padding-block: var(--section-pad); }
.status-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 36px; }
.status-badge { display: inline-flex; align-items: center; gap: 10px; padding: 5px 15px 5px 12px; border: 1px solid var(--warm-line); border-radius: 999px; background: var(--warm-soft); color: var(--warm-text); font-size: .84rem; font-weight: 500; line-height: 1.5; }
.status-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--warm); }
h1 { font-size: clamp(2.5rem, calc(5 * var(--vw)), 3.8rem); line-height: 1.12; letter-spacing: -.025em; }
.statement { margin-top: 20px; color: var(--accent); font-size: clamp(1.2rem, calc(2.4 * var(--vw)), 1.55rem); font-weight: 500; line-height: 1.4; letter-spacing: -.008em; text-wrap: balance; }
.intro { max-width: 62ch; margin-top: 24px; color: var(--muted); font-size: 1.05rem; line-height: 1.8; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 36px; }
.button { display: inline-flex; align-items: center; min-height: 50px; padding: 0 24px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 500; text-decoration: none; }
.button:hover { border-color: var(--accent-strong); background: var(--accent-strong); }
.button--quiet { background: transparent; color: var(--accent-strong); }
.button--quiet:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

.stats-block { margin-top: clamp(52px, 8vh, 80px); padding-top: 28px; border-top: 1px solid var(--line); }
.stats-label { color: var(--muted); font-family: var(--mono); font-size: .76rem; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 28px; margin-top: 20px; }
.stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.stat dd { font-size: clamp(1.55rem, calc(2.6 * var(--vw)), 1.95rem); font-weight: 600; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat dt { margin-top: 8px; color: var(--muted); font-size: .84rem; line-height: 1.45; }

/* About and Contact statement */
.about-statement { font-size: clamp(1.4rem, calc(2.6 * var(--vw)), 1.75rem); font-weight: 600; line-height: 1.35; letter-spacing: -.015em; }
.lead { max-width: 62ch; margin-top: 24px; font-size: 1.08rem; line-height: 1.8; }
.copy { max-width: 62ch; margin-top: 18px; color: var(--muted); line-height: 1.8; }

/* Experience and Organizations cards */
.roles { display: grid; gap: 32px; }
.role { padding: 36px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); }

/* Experience timeline: a thin line on the left, with a dot and the dates above each card */
.timeline { position: relative; display: grid; gap: 34px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; top: 12px; bottom: 0; left: 5px; width: 1px; background: var(--line); }
.timeline-date { position: relative; margin-bottom: 10px; color: var(--text); font-size: .86rem; font-weight: 600; line-height: 1.6; }
.timeline-date::before { content: ""; position: absolute; top: .42em; left: -26px; width: 11px; height: 11px; border: 2px solid var(--accent); border-radius: 50%; background: var(--page); }

.role-head { display: flex; align-items: flex-start; gap: 16px; }
.role-heading { flex: 1; min-width: 0; }
/* Official MacEwan logo as a small rounded-square tile. The theme variables choose the file. */
.org-logo { flex: none; width: 46px; height: 46px; margin-top: 2px; border: 1px solid var(--line); border-radius: 11px; background: var(--org-logo-plate) var(--org-logo) center / var(--org-logo-size) no-repeat; }
.role-title { font-size: clamp(1.25rem, calc(2.3 * var(--vw)), 1.4rem); line-height: 1.3; letter-spacing: -.012em; }
.role-org { margin-top: 5px; color: var(--accent); font-weight: 600; font-size: 1rem; line-height: 1.45; }
.role-project { margin-top: 3px; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.role-dates { flex: none; padding-top: 4px; color: var(--text); font-size: .88rem; font-weight: 600; white-space: nowrap; }
.role-summary { margin-top: 20px; color: var(--muted); font-size: .98rem; }
.impact { margin-top: 18px; }
.impact li { position: relative; padding-left: 22px; font-size: .98rem; }
.impact li + li { margin-top: 10px; }
.impact li::before { content: ""; position: absolute; top: .72em; left: 2px; width: 7px; height: 7px; border-radius: 1px; background: var(--warm); }
.tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.tags li { padding: 4px 12px; border: 1px solid var(--tag-line); border-radius: 6px; background: var(--tag-bg); color: var(--tag-text); font-family: var(--mono); font-size: .82rem; font-weight: 500; line-height: 1.5; }

/* "More details" expand button */
.more-details { margin-top: 24px; }
.more-details summary { display: inline-flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--accent-strong); font-size: .9rem; font-weight: 500; cursor: pointer; list-style: none; }
.more-details summary::-webkit-details-marker { display: none; }
.more-details summary::after { content: ""; width: 7px; height: 7px; margin-top: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.more-details[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.more-details summary:hover { border-color: var(--accent); background: var(--accent-soft); }
.more-details ul { margin-top: 18px; padding-left: 20px; list-style: disc; color: var(--muted); font-size: .94rem; }
.more-details li + li { margin-top: 10px; }
.more-details strong { color: var(--text); }

/* Project tiles: a compact grid that adds rows as projects are added */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 24px; }
html:not(.js) .project-grid { grid-template-columns: minmax(0, 1fr); }
.project-tile { display: flex; flex-direction: column; padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--card-shadow); }
.tile-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.tile-top h3 { font-size: 1.16rem; line-height: 1.35; letter-spacing: -.008em; }
.award-badge { flex: none; padding: 2px 11px; border: 1px solid var(--warm-line); border-radius: 999px; background: var(--warm-soft); color: var(--warm-text); font-size: .76rem; font-weight: 500; line-height: 1.6; }
.award-badge::before { content: "★ "; }
.tile-pitch { margin-top: 12px; color: var(--muted); font-size: .94rem; line-height: 1.65; }
.tech { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.tech li { padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-family: var(--mono); font-size: .74rem; line-height: 1.7; }
/* "View more", plus small icon links to the live demo and GitHub where a project has them */
.tile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: auto; }
.tile-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent-strong); text-decoration: none; }
.tile-icon:hover { border-color: var(--accent); background: var(--accent-soft); }
.tile-icon svg { width: 19px; height: 19px; }
svg.icon-stroke { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.icon-fill { fill: currentColor; }
.tile-open { min-height: 44px; padding: 0 18px; border: 1px solid var(--accent); border-radius: 8px; background: transparent; color: var(--accent-strong); font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; }
.tile-open:hover { background: var(--accent); color: var(--on-accent); }
.tile-open[hidden] { display: none; }
.tech:has(+ .tile-actions) { margin-bottom: 22px; }
.note { margin-top: 36px; font-size: .96rem; font-weight: 500; }

/* Project details. With JavaScript they only show in the dialog; without it, in the tile. */
.js .project-detail { display: none; }
html:not(.js) .project-detail { margin-top: 28px; padding-top: 4px; border-top: 1px solid var(--line); }
.project-detail h4 { margin-top: 30px; font-size: 1.02rem; font-weight: 600; line-height: 1.4; }
.project-detail h4 + p, .project-detail h4 + .impact, .project-detail h4 + .tech, .project-detail h4 + .tech-groups, .project-detail h4 + .detail-shots { margin-top: 10px; }
.project-detail p, .project-detail ol { font-size: .95rem; line-height: 1.7; }
.detail-meta { display: grid; gap: 12px; margin-top: 22px; padding: 16px 18px; border-radius: 10px; background: var(--accent-soft); }
.detail-meta dt { color: var(--muted); font-family: var(--mono); font-size: .74rem; font-weight: 500; }
.detail-meta dd { margin-top: 2px; font-size: .95rem; font-weight: 500; line-height: 1.5; }
.detail-flow { display: grid; gap: 24px; margin-top: 12px; }
.detail-flow p + p, .detail-flow ol + p { margin-top: 12px; }
.detail-flow ol { margin-top: 10px; padding-left: 22px; list-style: decimal; }
.detail-flow li + li { margin-top: 6px; }
.detail-flow li::marker { color: var(--muted); }
.modal-content .diagram--modal { position: relative; display: block; width: 240px; height: 440px; max-width: 100%; }

/* Live demo and GitHub buttons, then smaller text links */
.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.detail-actions .button { min-height: 46px; padding: 0 20px; font-size: .95rem; }
.project-detail .detail-links { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-top: 14px; font-size: .92rem; font-weight: 500; }
.detail-links a { display: inline-flex; align-items: center; min-height: 32px; }
.project-detail .detail-note { margin-top: 14px; color: var(--muted); font-size: .88rem; }
.project-detail .detail-subhead { margin-top: 22px; font-weight: 600; }
.detail-subhead + .impact { margin-top: 10px; }

/* "Try the demo": the public demo accounts */
.demo-box { margin-top: 26px; padding: 4px 22px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--page); }
.project-detail .demo-box h4 { margin-top: 18px; }
.demo-logins { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: .9rem; line-height: 1.5; }
.demo-logins th { padding: 0 14px 8px 0; color: var(--muted); font-family: var(--mono); font-size: .74rem; font-weight: 500; text-align: left; }
.demo-logins td { padding: 8px 14px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
.demo-box code { font-family: var(--mono); font-size: .86rem; overflow-wrap: anywhere; }
.project-detail .demo-password { margin-top: 14px; font-weight: 500; }
.demo-notes { margin-top: 10px; padding-left: 18px; list-style: disc; color: var(--muted); font-size: .88rem; line-height: 1.6; }
.demo-notes li + li { margin-top: 4px; }

/* Screenshots, each opening full size in a new tab */
.detail-shots { display: grid; gap: 26px; }
.detail-shots figure { margin: 0; }
.detail-shots a { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.detail-shots a:hover { border-color: var(--accent); }
.detail-shots img { display: block; width: 100%; height: auto; }
.detail-shots figcaption { margin-top: 8px; color: var(--muted); font-size: .86rem; line-height: 1.5; }

/* Tech stack in labelled rows */
.tech-groups > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 4px 16px; padding-block: 10px; border-top: 1px solid var(--line); }
.tech-groups > div:last-child { border-bottom: 1px solid var(--line); }
.tech-groups dt { padding-top: 2px; color: var(--muted); font-family: var(--mono); font-size: .76rem; font-weight: 500; }
.tech-groups .tech { margin-top: 0; }

/* Project dialog: a tall rounded panel. Its inner part scrolls so the corners stay clean. */
/* While it is open the scrollbar space is released so the dimmed overlay reaches the window edge.
   --scrollbar-offset (set by script.js) holds everything exactly where it was. */
html.modal-open { overflow: hidden; scrollbar-gutter: auto; }
html.modal-open body { padding-right: var(--scrollbar-offset); }
.project-modal { width: min(680px, calc(100vw - 32px)); height: min(860px, 88vh); height: min(860px, 88svh); max-width: none; max-height: none; margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--menu-shadow); }
.project-modal::backdrop { background: var(--scrim); }
.modal-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.modal-bar { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px 18px 32px; border-bottom: 1px solid var(--line); background: var(--surface); }
.modal-bar h3 { font-size: clamp(1.15rem, calc(2.4 * var(--vw)), 1.35rem); line-height: 1.3; letter-spacing: -.01em; }
.modal-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--accent-strong); cursor: pointer; }
.modal-close:hover { border-color: var(--accent); background: var(--accent-soft); }
.modal-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.modal-body { padding: 24px 32px 40px; }
.modal-badge { display: inline-block; margin-bottom: 12px; }
.modal-badge[hidden] { display: none; }
.modal-pitch { color: var(--muted); font-size: 1.02rem; line-height: 1.65; }
.modal-content .project-detail { display: block; }
.modal-content .detail-meta { margin-top: 20px; }
@media (min-width: 640px) {
  .modal-content .detail-flow { grid-template-columns: minmax(0, 1fr) 240px; }
}

/* Skills: grouped chips. Each group is a native <details>, most technical first, and the first few
   start open. "Expand all" (JavaScript only) opens or closes every group at once. */
.skills-bar { display: flex; justify-content: flex-end; }
.skills-toggle { min-height: 42px; margin-bottom: 16px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--accent-strong); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; }
.skills-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.skills-toggle[hidden] { display: none; }
.skill-groups { border-bottom: 1px solid var(--line); }
.skill-group { border-top: 1px solid var(--line); }
.skill-group summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; min-height: 64px; padding: 19px 36px 19px 0; position: relative; cursor: pointer; list-style: none; }
.skill-group summary::-webkit-details-marker { display: none; }
.skill-group summary::after { content: ""; position: absolute; top: 50%; right: 8px; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--accent-strong); border-bottom: 2px solid var(--accent-strong); transform: rotate(45deg); }
.skill-group[open] summary::after { margin-top: -2px; transform: rotate(-135deg); }
.skill-group summary:focus-visible { outline-offset: -2px; }
.skill-group h3 { font-size: 1.02rem; line-height: 1.45; }
.skill-group summary:hover h3 { color: var(--accent-strong); }
.skill-count { color: var(--muted); font-family: var(--mono); font-size: .76rem; white-space: nowrap; }
.skill-group .chips { padding-bottom: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips li { display: inline-flex; align-items: center; gap: 8px; padding: 4px 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: .86rem; line-height: 1.6; }
/* Logos keep their official colours. In dark mode each one sits on a small light tile so dark logos stay visible. */
.chip-icon { flex: none; display: block; width: 18px; height: 18px; padding: 1px; border-radius: 4px; background: var(--icon-plate); }

/* Education: compact block */
.education { padding-block: 32px; border-block: 1px solid var(--line); }
.education-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.education h3 { font-size: 1.25rem; line-height: 1.35; }
.education-school { margin-top: 6px; color: var(--accent); font-weight: 500; }
.education-date { padding: 3px 13px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: .82rem; font-weight: 500; white-space: nowrap; }
.education-minors { margin-top: 16px; color: var(--muted); }
.course-rows { margin-top: 24px; }
.course-rows > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 2px 16px; padding-block: 8px; font-size: .94rem; }
.course-rows dt { font-weight: 500; }
.course-rows dd { color: var(--muted); }

/* Contact */
.contact-email { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-top: 36px; }
.email-link { font-size: clamp(1.1rem, calc(2.5 * var(--vw)), 1.4rem); font-weight: 500; overflow-wrap: anywhere; }
.copy-button { min-width: 8em; min-height: 42px; padding: 0 14px; border: 1px solid var(--accent); border-radius: 7px; background: transparent; color: var(--accent-strong); font: inherit; font-size: .84rem; font-weight: 500; cursor: pointer; }
.copy-button:hover { background: var(--accent-soft); }
.copy-button.is-copied { border-color: var(--warm); background: var(--warm-soft); color: var(--warm-text); }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 24px; font-weight: 500; }
.contact-links a { display: inline-flex; align-items: center; min-height: 32px; }

/* "This site may be outdated" notice. Without JavaScript it sits above the content; with it, it is a
   small card at the bottom of the content column (clear of the sidebar, the diagram, and back to top). */
.site-notice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 14px 18px; border: 1px solid var(--warm-line); border-radius: 14px; background: var(--surface); color: var(--text); font-size: .9rem; line-height: 1.6; }
.site-notice[hidden] { display: none; }
html:not(.js) .site-notice { margin: 24px clamp(22px, calc(4 * var(--vw)), 64px) 0; }
.js .site-notice { position: fixed; z-index: 15; bottom: 24px; left: calc(var(--sidebar-width) + 24px); width: min(400px, calc(100% - var(--sidebar-width) - 48px)); padding: 14px 10px 14px 18px; box-shadow: var(--menu-shadow); }
.js .site-notice:not(.is-visible) { opacity: 0; translate: 0 12px; visibility: hidden; }
.notice-dot { width: 9px; height: 9px; margin-top: .55em; border-radius: 50%; background: var(--warm); }
.notice-text strong { font-weight: 600; }
.notice-close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -8px 0 -8px -4px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--accent-strong); cursor: pointer; }
.notice-close:hover { border-color: var(--line); background: var(--accent-soft); }
.notice-close[hidden] { display: none; }
.notice-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Back to top */
.back-to-top { position: fixed; z-index: 90; right: calc(20px + var(--scrollbar-offset)); bottom: 20px; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--accent-strong); font-family: var(--mono); font-size: .8rem; font-weight: 500; text-decoration: none; box-shadow: var(--float-shadow); }
.back-to-top:hover { border-color: var(--accent); }
.js .back-to-top:not(.is-visible) { opacity: 0; visibility: hidden; }

/* Background: one labelled diagram per section or card, drawn by script.js from DIAGRAMS.
   Wide screens: fixed in a reserved space on the right that content never enters. On views with
   cards it follows the active card, which is highlighted so the link between them is clear.
   Narrow screens: a simple chain above the section heading, or at the top of each card. */
.diagram { display: none; pointer-events: none; }
.diagram svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.diagram-line { fill: none; stroke: var(--accent); stroke-opacity: var(--diagram-opacity); stroke-width: 1.3; }
.diagram-node { fill: var(--page); stroke: var(--accent); stroke-width: 1.4; }
.diagram-node--store { fill: var(--accent); }
.diagram-dot { fill: var(--accent); offset-distance: var(--rest); offset-rotate: 0deg; }
.diagram-dot--warm { fill: var(--warm); }
.diagram-label { fill: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.diagram-note { fill: var(--muted); font-family: var(--mono); font-size: 9.5px; }
.diagram-caption { fill: var(--muted); font-family: var(--mono); font-size: 10px; }
.diagram--band { position: absolute; z-index: 1; top: 16px; right: 72px; display: block; width: min(calc(100% - 140px), 400px); height: 46px; }
.diagram--card { position: relative; display: block; height: 46px; margin-bottom: 24px; }
@media (min-width: 1240px) {
  :root { --diagram-space: 270px; }
  .diagram--band, .diagram--card { display: none; }
  [data-diagram].is-active:is(.role, .project-tile) { border-color: var(--accent); box-shadow: var(--card-hover-shadow); }
  .diagram--side { position: fixed; z-index: 5; top: 76px; right: calc(18px + var(--scrollbar-offset)); display: block; width: 240px; height: min(calc(100vh - 110px), 440px); }
}

/* Custom cursor: a small accent dot with a soft ring that trails it.
   The dot is a real browser cursor image drawn by script.js, so the operating system moves it with
   no lag and it is always on top. The ring is a decorative element that eases after it, grows over
   links and buttons, shrinks while the mouse is pressed, and fades out over text and form fields,
   where the normal text cursor shows. It never takes clicks (pointer-events: none). */
html.has-custom-cursor { cursor: var(--cursor-default), auto; }
html.has-custom-cursor :is(a, button, summary, label) { cursor: var(--cursor-link), pointer; }
html.has-custom-cursor.over-text { cursor: text; }
html.has-custom-cursor .project-modal::backdrop { cursor: var(--cursor-default), auto; }
html.has-custom-cursor :is(input, textarea, select, [contenteditable]) { cursor: auto; }
.cursor-ring { position: fixed; z-index: 999; top: 0; left: 0; width: 36px; height: 36px; margin: -18px 0 0 -18px; pointer-events: none; opacity: 0; }
.cursor-ring.is-visible { opacity: 1; }
.cursor-ring span { display: block; width: 100%; height: 100%; border: 1.5px solid var(--accent); border-radius: 50%; opacity: .5; }
.cursor-ring.is-link span { opacity: 1; scale: 1.4; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cursor-ring.is-pressed span { scale: .7; }
.cursor-ring.is-link.is-pressed span { scale: 1.1; }
.cursor-ring.is-text span { opacity: 0; scale: .4; }
/* A modal dialog sits in the browser's top layer, above any element, so only the dot shows there */
html.modal-open .cursor-ring { visibility: hidden; }

/* Motion. Everything here is off for reduced-motion visitors. */
@media (prefers-reduced-motion: no-preference) {
  html:not(.js) { scroll-behavior: smooth; }

  /* Fade-up uses opacity and translate only, so it can never move the layout. */
  .js .reveal:not(.is-visible) { opacity: 0; translate: 0 14px; }
  .reveal { transition: opacity 420ms ease var(--delay, 0ms), translate 420ms ease var(--delay, 0ms); }
  .section-head + .reveal { --delay: 60ms; }
  .role { transition: opacity 420ms ease var(--delay, 0ms), translate 420ms ease var(--delay, 0ms), border-color 180ms ease, box-shadow 180ms ease; }
  .project-tile { transition: opacity 420ms ease, translate 240ms ease, border-color 180ms ease, box-shadow 180ms ease; }

  /* The current view fades out quickly before the next one fades up */
  main > section.is-leaving { opacity: 0; translate: 0 -8px; transition: opacity 140ms ease, translate 140ms ease; }

  /* The bar slides to the current section */
  .nav-indicator { transition: transform 320ms cubic-bezier(.3, .7, .3, 1), height 320ms ease, opacity 200ms ease; }
  .button, .pager-link, .copy-button, .back-to-top, .theme-toggle, .site-nav a, .side-links a, .note a, .email-link, .contact-links a, .more-details summary, .tile-open, .tile-icon, .detail-links a, .detail-shots a, .modal-close, .notice-close, .skills-toggle, .skill-group h3 { transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, opacity 200ms ease, visibility 200ms ease; }
  .more-details summary::after, .skill-group summary::after { transition: transform 200ms ease, margin-top 200ms ease; }

  /* "More details" and the skill groups open smoothly in browsers that support it, and instantly in others */
  .more-details, .skill-group { interpolate-size: allow-keywords; }
  :is(.more-details, .skill-group)::details-content { height: 0; overflow: clip; transition: height 260ms ease, content-visibility 260ms allow-discrete; }
  :is(.more-details, .skill-group)[open]::details-content { height: auto; }

  /* The site notice fades up into the corner, and fades out when closed */
  .js .site-notice { transition: opacity 280ms ease, translate 280ms ease, visibility 280ms ease; }

  /* Cursor ring: the position comes from script.js; only its size and fill animate here */
  .cursor-ring { transition: opacity 200ms ease; }
  .cursor-ring span { transition: scale 220ms cubic-bezier(.3, .7, .3, 1), opacity 200ms ease, background-color 200ms ease; }

  /* Project dialog opens and closes with a quick fade-up */
  .project-modal[open] { animation: modal-in 220ms cubic-bezier(.2, .7, .3, 1); }
  .project-modal[open]::backdrop { animation: scrim-in 220ms ease; }
  .project-modal.is-closing { animation: modal-out 160ms ease forwards; }
  .project-modal.is-closing::backdrop { animation: scrim-out 160ms ease forwards; }
  @keyframes modal-in { from { opacity: 0; translate: 0 16px; } }
  @keyframes modal-out { to { opacity: 0; translate: 0 10px; } }
  @keyframes scrim-in { from { opacity: 0; } }
  @keyframes scrim-out { to { opacity: 0; } }

  /* Switching diagrams: the old one fades out, the new one draws its lines and fades in */
  .diagram svg.is-leaving { opacity: 0; transition: opacity 240ms ease; }
  .diagram svg.is-entering .diagram-line { stroke-dasharray: 1 1; animation: diagram-draw 700ms ease both; }
  .diagram svg.is-entering .diagram-fade { animation: diagram-fade 480ms ease var(--appear) both; }
  @keyframes diagram-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  @keyframes diagram-fade { from { opacity: 0; } to { opacity: 1; } }

  /* Data dots travelling along the lines */
  .diagram-dot { animation: diagram-travel var(--travel) linear var(--start) infinite; }
  @keyframes diagram-travel {
    0% { offset-distance: 0%; opacity: 0; }
    12%, 88% { opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; }
  }
  .is-tab-hidden .diagram-dot, .diagram.is-offscreen .diagram-dot { animation-play-state: paused; }
}

/* Theme switch: a circle expands from the toggle where View Transitions are supported */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
/* Simple fade for browsers without View Transitions */
html.theme-fade, html.theme-fade * { transition: background-color 320ms ease, color 320ms ease, border-color 320ms ease, fill 320ms ease, stroke 320ms ease !important; }

@media (hover: hover) {
  .role:hover, .project-tile:hover { border-color: var(--accent); box-shadow: var(--card-hover-shadow); }
}
/* Tiles lift slightly on hover */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .project-tile:hover { translate: 0 -3px; }
}
@media print {
  .js .reveal:not(.is-visible) { opacity: 1; translate: none; }
  .back-to-top, .diagram, .theme-toggle, .view-pager, .chip-icon, .tile-open, .project-modal, .site-notice, .cursor-ring, .skills-bar { display: none !important; }
  .js .project-detail { display: block; }
  html[data-view] main > section { display: block !important; padding-right: 0; }
}

/* Mobile: the sidebar becomes a top bar with a menu */
@media (max-width: 860px) {
  :root { --bar: 64px; --section-pad: 76px; }
  body { display: block; font-size: 16px; }

  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; height: auto; min-height: var(--bar); overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .identity { flex: 1; min-width: 0; padding: 9px 0 9px 20px; }
  .site-name { font-size: .96rem; }
  .role-line { margin-top: 1px; font-size: .7rem; line-height: 1.3; }

  .theme-toggle { position: static; flex: none; margin-right: 8px; box-shadow: none; }

  .sidebar-panel { flex: none; width: 100%; background: var(--sidebar-bg); }
  .site-nav { padding: 8px 0; border-bottom: 0; }
  .site-nav a { display: flex; align-items: center; min-height: 46px; padding: 8px 20px; }
  .site-nav a[aria-current] { border-left: 3px solid var(--accent); padding-left: 17px; background: var(--nav-active); }
  .nav-indicator { display: none; }
  .side-links { gap: 2px; margin: 0; padding: 14px 20px 18px; border-top: 1px solid var(--sidebar-line); }
  .side-links a { padding-block: 8px; }

  html:not(.js) .sidebar { position: static; }
  html:not(.js) { --bar: 0px; }

  .js .menu-button { flex: none; display: block; min-width: 68px; min-height: 44px; margin-right: 14px; padding: 0 12px; border: 1px solid var(--sidebar-line); border-radius: 6px; background: transparent; color: var(--text); font-family: var(--mono); font-size: .82rem; font-weight: 500; cursor: pointer; }
  .js .sidebar-panel { position: absolute; top: 100%; right: 0; left: 0; max-height: calc(100vh - var(--bar)); max-height: calc(100svh - var(--bar)); overflow-y: auto; border-bottom: 1px solid var(--sidebar-line); box-shadow: var(--menu-shadow); }
  .js .sidebar-panel:not(.is-open) { display: none; }

  .column { width: min(calc(100% - 44px), 860px); }
  .section-head { margin-bottom: 40px; }
  .role { padding: 26px 22px; }
  .project-tile { padding: 24px 22px; }
  .timeline { padding-left: 20px; }
  .timeline-date::before { left: -20px; }
  .timeline::before { left: 5px; }
  .diagram--band { right: 22px; width: calc(100% - 44px); }
  .back-to-top { right: calc(14px + var(--scrollbar-offset)); bottom: 14px; justify-content: center; min-width: 44px; padding: 0 10px; font-size: 1rem; }
  .back-to-top-label { display: none; }
  /* The notice spans the bottom of the screen, so back to top moves above it while it is open */
  .js .site-notice { right: calc(12px + var(--scrollbar-offset)); bottom: 12px; left: 12px; width: auto; }
  html:not(.js) .site-notice { margin: 20px 22px 0; }
  html.notice-open .back-to-top { bottom: calc(24px + var(--notice-height, 0px)); }
  .contact-links a, .more-details summary, .note a { min-height: 44px; }
  .note a { display: inline-flex; align-items: center; }
  .copy-button { min-height: 44px; }
  .view-pager { padding-top: 56px; }
}
/* Short laptop screens: keep the whole sidebar visible without scrolling */
@media (min-width: 861px) and (max-height: 680px) {
  .identity { padding: 18px 24px 14px; }
  .site-nav { padding-block: 6px; }
  .site-nav a { padding-block: 5px; }
  .side-links { gap: 3px; padding: 10px 24px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-head { flex-wrap: wrap; }
  .role-heading { flex-basis: calc(100% - 62px); }
  .role-dates { width: 100%; padding: 0 0 0 62px; }
  .modal-bar { padding-left: 22px; padding-right: 14px; }
  .modal-body { padding: 20px 22px 32px; }
  .course-rows > div { grid-template-columns: minmax(0, 1fr); padding-block: 10px; }
  .tech-groups > div { grid-template-columns: minmax(0, 1fr); }
  .demo-box { padding-inline: 16px; }
}
