/* ==========================================================================
   Haydn McIntyre — personal site
   Dark by design: green-black ground, brass accent, wide Archivo lettering.
   ========================================================================== */

:root {
  --ground:    #0A100E;
  --raised:    #0F1815;
  --card:      #131E1A;
  --chalk:     #ECF1EC;
  --dim:       #93A79A;   /* 7.53:1 on ground */
  --faint:     #6F8276;   /* 4.69:1 — the old #64766B measured 3.97:1 and failed */
  --green:     #1C5F4A;
  --electric:  #3FD9C0;   /* hero effect only — brass stays the brand accent */
  --brass:     #E5B457;
  --brass-dim: #B98C33;
  --line:      rgba(236, 241, 236, 0.11);
  --line-2:    rgba(236, 241, 236, 0.22);   /* decorative only — 1.73:1 */
  --line-int:  rgba(236, 241, 236, 0.38);   /* anything interactive — 3.05:1 */
  --danger:    #F08C7A;

  --wrap: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section-y: clamp(4.5rem, 10vw, 9rem);

  --sans: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;

  --fs-label: 0.75rem;
  --fs-sm:    0.9rem;
  --fs-base:  1.0625rem;
  --fs-lg:    1.1875rem;
  --fs-h3:    1.375rem;
  --fs-h2:    clamp(2.1rem, 5vw, 3.6rem);
  --fs-hero:  clamp(3rem, 11vw, 8.5rem);

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

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* clip beats hidden: hidden still lets script scroll the page sideways */
  overflow-x: hidden;
  overflow-x: clip;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--chalk);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
}

/* One environment behind the whole page, not just the hero. */
.ambient {
  position: fixed; inset: -10%; z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(48vw 48vw at 80% 10%, rgba(28, 95, 74, 0.20), transparent 62%),
    radial-gradient(42vw 42vw at 8% 55%, rgba(63, 217, 192, 0.07), transparent 64%),
    radial-gradient(38vw 38vw at 62% 95%, rgba(229, 180, 87, 0.05), transparent 62%);
  animation: ambientDrift 80s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes ambientDrift { to { transform: translate3d(0, -4%, 0) scale(1.1); } }
main, .footer { position: relative; z-index: 1; }

/* Pause every animation when the tab is hidden. play-state does not inherit,
   so it has to be set on the elements and their pseudo-elements directly. */
body.paused *, body.paused *::before, body.paused *::after {
  animation-play-state: paused !important;
}

img { max-width: 100%; display: block; height: auto; }
h1, h2, h3 { margin: 0; line-height: 1.02; text-wrap: balance; }
p { margin: 0; }
ul, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brass); color: #17130A;
  padding: 0.75rem 1.25rem; font-size: var(--fs-sm); font-weight: 600;
}
.skip:focus { left: 0; }

.wrap {
  width: 100%; max-width: var(--wrap);
  margin-inline: auto; padding-inline: var(--gutter);
}

/* --- Shared type ---------------------------------------------------------- */
.eyebrow {
  font-size: var(--fs-label); font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--brass);
}
.h2 {
  font-variation-settings: "wdth" 115;
  font-weight: 700; font-size: var(--fs-h2);
  letter-spacing: -0.025em;
  margin-top: 0.9rem;
}

/* --- Top bar -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.topbar.is-stuck {
  background: rgba(10, 16, 14, 0.86);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: 68px;
}
.mark {
  display: inline-flex; align-items: center; gap: 0.6rem;
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
  font-variation-settings: "wdth" 105;
}
.mark-glyph {
  width: auto; height: 23px; flex: none;
  color: var(--brass);
  transition: color 0.25s var(--ease);
}
.mark:hover .mark-glyph { color: var(--chalk); }

.nav { display: none; align-items: center; gap: 2rem; }
@media (min-width: 860px) { .nav { display: flex; } }
.nav a {
  position: relative; font-size: var(--fs-sm); font-weight: 500;
  text-decoration: none; color: var(--dim);
  transition: color 0.2s var(--ease);
}
.nav a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; bottom: -6px;
  width: 100%; height: 1px; background: var(--brass);
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.35s var(--ease);
}
.nav a:hover { color: var(--chalk); }
.nav a:not(.nav-cta):hover::after { transform: scaleX(1); transform-origin: left; }
.nav a.is-current { color: var(--chalk); }
.nav a.is-current::after { transform: scaleX(1); transform-origin: left; }
.nav .nav-cta {
  background: var(--brass); color: #17130A;
  padding: 0.6rem 1.15rem; font-weight: 600;
}
.nav .nav-cta:hover { background: var(--chalk); color: var(--ground); }

.menu-toggle {
  display: grid; gap: 6px; align-content: center;
  width: 44px; height: 44px; padding: 0 10px;
  background: none; border: 1px solid var(--line-int); cursor: pointer;
}
.menu-toggle span { display: block; height: 2px; background: var(--chalk); }
@media (min-width: 860px) { .menu-toggle { display: none; } }

.mobile-nav { display: grid; background: var(--raised); border-top: 1px solid var(--line); }
.mobile-nav[hidden] { display: none; }
.mobile-nav a {
  text-decoration: none; font-weight: 500;
  padding: 1rem var(--gutter); border-bottom: 1px solid var(--line);
}

/* --- Hero ----------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: min(88vh, 780px);
  display: grid; align-items: center;
  padding-block: clamp(3.5rem, 10vw, 7rem) clamp(3.5rem, 9vw, 7rem);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
/* Layer 1: slow gradient wash. Three blurred blobs drifting on their own clocks. */
.hero-glow {
  position: absolute; inset: -20%;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.85;
}
.hero-glow span {
  position: absolute;
  display: block;
  border-radius: 50%;
  will-change: transform;
}
/* weighted to the right — the headline lives on the left and needs a calm ground */
.hero-glow span:nth-child(1) {
  width: 50vw; height: 50vw; min-width: 380px; min-height: 380px;
  top: 4%; left: 46%;
  background: radial-gradient(circle, rgba(28, 95, 74, 1), transparent 66%);
  animation: drift1 26s ease-in-out infinite alternate;
}
.hero-glow span:nth-child(2) {
  width: 40vw; height: 40vw; min-width: 300px; min-height: 300px;
  top: 40%; left: 64%;
  background: radial-gradient(circle, rgba(63, 217, 192, 0.42), transparent 64%);
  animation: drift2 34s ease-in-out infinite alternate;
}
.hero-glow span:nth-child(3) {
  width: 32vw; height: 32vw; min-width: 240px; min-height: 240px;
  top: 2%; left: 20%;
  background: radial-gradient(circle, rgba(229, 180, 87, 0.2), transparent 66%);
  animation: drift3 42s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate3d(14%, 10%, 0) scale(1.15); } }
@keyframes drift2 { to { transform: translate3d(-16%, -12%, 0) scale(1.2); } }
@keyframes drift3 { to { transform: translate3d(-10%, 16%, 0) scale(0.9); } }

/* Layer 2: particles and electric arcs, drawn in script.js. */
.hero-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  pointer-events: none;
}
/* keeps the type readable over the brightest part of the wash */
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(10, 16, 14, 0.88) 0%, rgba(10, 16, 14, 0.62) 38%, rgba(10, 16, 14, 0.12) 78%, rgba(10, 16, 14, 0) 100%);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .hero-glow span { animation: none; }
}
.hero-inner { position: relative; z-index: 1; }
.hero-eyebrow {
  font-size: var(--fs-label); font-weight: 600;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--brass);
  margin-bottom: 1.5rem;
}
.hero-title {
  display: grid;
  font-variation-settings: "wdth" 122;
  font-weight: 800; font-size: var(--fs-hero);
  letter-spacing: -0.04em; line-height: 0.88;
}
.hero-title .accent { color: var(--brass); }
.hero-sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  margin-top: 1.9rem;
  font-size: clamp(0.95rem, 1.7vw, 1.2rem); font-weight: 500;
  letter-spacing: 0.01em; color: var(--dim);
}
.hero-sub em { color: var(--brass); font-style: normal; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 2.6rem; }
@media (max-width: 430px) {
  .hero-actions { display: grid; }
  .hero-actions .btn { text-align: center; }
}

/* load-in */
.rise { opacity: 0; transform: translateY(24px); animation: rise 0.9s var(--ease) forwards; animation-delay: var(--d, 0ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-block;
  font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0.02em;
  padding: 0.95rem 1.7rem; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease),
              border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn-primary { background: var(--brass); color: #17130A; }
.btn-primary:hover { background: var(--chalk); transform: translateY(-2px); }
.btn-ghost { color: var(--chalk); border-color: var(--line-int); }
.btn-ghost:hover { border-color: var(--brass); color: var(--brass); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .btn:hover { transform: none; } }

/* --- Sections ------------------------------------------------------------- */
.section { padding-block: var(--section-y); }
.section-tint { background: var(--raised); border-block: 1px solid var(--line); }
.section-head { margin-bottom: clamp(2.5rem, 6vw, 4rem); }

/* --- Projects ------------------------------------------------------------- */
.project {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: center;
  padding-block: clamp(2rem, 5vw, 3.5rem);
  border-top: 1px solid var(--line);
}
@media (min-width: 900px) {
  .project { grid-template-columns: 1.15fr 1fr; }
  .project-alt .project-media { order: 2; }
}
.project-media { overflow: hidden; background: var(--card); }
.project-media img { transition: transform 0.7s var(--ease); width: 100%; }
/* scoped to the hovered image itself, so one shot moving never moves its neighbours */
.zoom:hover img, .zoom:focus-visible img { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) {
  .zoom:hover img, .zoom:focus-visible img { transform: none; }
}
.project-media-shots {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem; background: none; overflow: visible;
}
.project-media-shots img { border: 1px solid var(--line); }

/* the whole image is the button that opens the lightbox */
.zoom {
  display: block; width: 100%;
  padding: 0; margin: 0; border: 0; background: none;
  cursor: zoom-in; overflow: hidden;
  font: inherit; color: inherit;
}
.zoom:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

/* --- Lightbox ------------------------------------------------------------- */
.lightbox {
  border: 0; padding: 0; background: none;
  max-width: 100vw; max-height: 100vh;
  overflow: visible;
  color: var(--chalk);
}
.lightbox::backdrop {
  background: rgba(5, 9, 8, 0.88);
  backdrop-filter: blur(6px);
}
.lightbox-inner { position: relative; display: block; }
.lightbox img {
  max-width: min(92vw, 1180px);
  max-height: 82vh;
  width: auto; height: auto;
  object-fit: contain;
  border: 1px solid var(--line-2);
  background: var(--card);
}
.lightbox-close {
  position: absolute; top: -3.1rem; right: 0;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  padding: 0; cursor: pointer;
  color: var(--chalk);
  background: none; border: 1px solid var(--line-2);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.lightbox-close:hover { background: var(--brass); border-color: var(--brass); color: #17130A; }
/* on short screens the button has nowhere to sit above the image */
@media (max-height: 620px), (max-width: 560px) {
  .lightbox-close { top: 0.5rem; right: 0.5rem; background: rgba(10, 16, 14, 0.8); }
}
.lightbox[open] { animation: lightboxIn 0.28s var(--ease); }
@keyframes lightboxIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox[open] { animation: none; }
}
body.is-locked { overflow: hidden; }

.project-body { display: grid; align-content: center; gap: 0.85rem; }
.project-meta {
  font-size: var(--fs-label); font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass);
}
.project-title {
  font-variation-settings: "wdth" 118;
  font-weight: 800; font-size: clamp(1.9rem, 4vw, 2.9rem);
  letter-spacing: -0.03em;
}
.project-desc { color: var(--dim); max-width: 46ch; }
.repo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  justify-self: start;
  margin-top: 0.7rem; padding: 0.7rem 1.15rem;
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--chalk); text-decoration: none;
  border: 1px solid var(--line-int);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease),
              background 0.25s var(--ease);
}
.repo svg { flex: none; }
.repo:hover { color: var(--brass); border-color: var(--brass); background: rgba(229, 180, 87, 0.07); }
.repo span::after { content: " \2197"; }

.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.4rem; }
.tags li {
  font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.04em;
  padding: 0.32rem 0.7rem; border: 1px solid var(--line-2); color: var(--dim);
}

/* --- The stack -----------------------------------------------------------
   Four ordered layers, top of the stack down to delivery. The numbering is
   real information here: it is the order the request travels. */
.layers { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.layer {
  position: relative;
  background: var(--ground);
  padding: clamp(1.5rem, 3.2vw, 2.25rem) clamp(1.35rem, 3vw, 2.25rem);
  display: grid; gap: 0.8rem;
  transition: background 0.35s var(--ease);
}
@media (min-width: 860px) {
  .layer { grid-template-columns: 14rem 1fr; align-items: baseline; gap: 0 2.5rem; }
  .layer-note { grid-column: 2; }
  .layer-tech { grid-column: 2; }
}
.layer:hover, .layer:focus-within { background: var(--card); }
/* the accent edge draws down the layer you are on */
.layer::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--brass);
  transform: scaleY(0); transform-origin: 50% 0;
  transition: transform 0.5s var(--ease);
}
.layer:hover::after, .layer:focus-within::after { transform: scaleY(1); }

.layer-head { display: flex; align-items: baseline; gap: 0.85rem; }
.layer-n {
  font-variation-settings: "wdth" 125;
  font-weight: 800; font-size: var(--fs-label);
  letter-spacing: 0.1em; color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.layer-head h3 {
  font-variation-settings: "wdth" 110;
  font-weight: 700; font-size: var(--fs-h3); letter-spacing: -0.01em;
}
.layer-note { color: var(--dim); font-size: var(--fs-base); max-width: 52ch; }
.layer-tech { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.35rem; }
.layer-tech li {
  font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.04em;
  padding: 0.32rem 0.7rem; border: 1px solid var(--line-2); color: var(--dim);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.layer:hover .layer-tech li, .layer:focus-within .layer-tech li {
  border-color: var(--line-int); color: var(--chalk);
}

/* --- The bolt rule (the site's signature mark, echoed from the logo) ------- */
.bolt-rule { width: 124px; height: 18px; margin-top: 1.3rem; }
.bolt-rule svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bolt-rule polyline {
  fill: none; stroke: var(--brass); stroke-width: 2;
  stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.bolt-rule.is-in polyline {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.1s var(--ease) 0.15s;
}
@media (prefers-reduced-motion: reduce) {
  .bolt-rule polyline { stroke-dashoffset: 0; transition: none; }
}

/* --- Touch targets -------------------------------------------------------- */
@media (pointer: coarse) {
  .footer-gh, .fact-link { min-height: 44px; }
  .footer-gh { display: inline-flex; align-items: center; }
}

/* --- About ---------------------------------------------------------------- */
.about { display: grid; gap: clamp(2rem, 5vw, 4rem); }
@media (min-width: 900px) { .about { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.about-lede { color: var(--dim); font-size: var(--fs-lg); max-width: 56ch; margin-top: 1.5rem; }

.facts { display: grid; gap: 1.5rem; align-content: start; }
@media (min-width: 900px) { .facts { padding-top: 4rem; } }
.facts > div {
  display: grid; gap: 0.3rem;
  padding-top: 1.1rem; border-top: 1px solid var(--line);
}
.facts dt {
  font-size: var(--fs-label); font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint);
}
.facts dd { font-size: var(--fs-base); font-weight: 500; }
.facts dd span { display: block; color: var(--brass); font-weight: 400; font-size: var(--fs-sm); }

/* --- Contact -------------------------------------------------------------- */
.contact { display: grid; gap: clamp(2.5rem, 5vw, 4rem); }
@media (min-width: 900px) { .contact { grid-template-columns: 1fr 1fr; align-items: start; } }

.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-size: var(--fs-sm); font-weight: 600; }
.field input, .field textarea {
  font-family: var(--sans); font-size: var(--fs-base); color: var(--chalk);
  background: var(--ground); border: 1px solid var(--line-int);
  border-radius: 0; padding: 0.8rem 0.9rem; width: 100%;
  transition: border-color 0.25s var(--ease);
}
.field input:focus, .field textarea:focus { border-color: var(--brass); }
.field textarea { resize: vertical; min-height: 6.5rem; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.err { font-size: var(--fs-sm); color: var(--danger); }
.btn-submit { justify-self: start; margin-top: 0.35rem; }
/* full width on a phone — an easier target, and it looks intentional */
@media (max-width: 520px) {
  .btn-submit { justify-self: stretch; text-align: center; }
}
.form-note { font-size: var(--fs-sm); color: var(--dim); min-height: 1.25rem; }
.form-note[data-state="ok"] { color: var(--brass); font-weight: 600; }
.form-note[data-state="bad"] { color: var(--danger); }
.form-alt { font-size: var(--fs-sm); color: var(--faint); }
.form-alt a {
  color: var(--dim); text-decoration: none;
  border-bottom: 1px solid var(--line-2); padding-bottom: 1px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.form-alt a:hover { color: var(--brass); border-color: var(--brass); }

/* --- Footer --------------------------------------------------------------- */
.footer { border-top: 1px solid var(--line); padding-block: 2.75rem; }
.footer-inner { display: grid; gap: 0.75rem; font-size: var(--fs-sm); color: var(--dim); }
@media (min-width: 700px) {
  .footer-inner { grid-template-columns: 1fr auto auto; align-items: center; gap: 2rem; }
}
.footer-mark {
  font-variation-settings: "wdth" 112;
  font-weight: 700; font-size: 1rem; color: var(--chalk);
}
.footer a { color: var(--brass); text-decoration: none; }
.footer a:hover { color: var(--chalk); }
.footer-gh {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 500;
  transition: color 0.25s var(--ease);
}
.footer-gh svg { flex: none; }

.fact-link {
  color: var(--brass); text-decoration: none;
  border-bottom: 1px solid var(--brass-dim); padding-bottom: 1px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.fact-link:hover { color: var(--chalk); border-color: var(--chalk); }

/* --- Craft details -------------------------------------------------------- */

/* Film grain. Flat dark grounds look cheap; a little tooth fixes that. */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 9;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 190px 190px;
}

::selection { background: var(--brass); color: #17130A; }

html { scrollbar-color: #2C3D34 var(--ground); scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: #2C3D34; border: 3px solid var(--ground); }
::-webkit-scrollbar-thumb:hover { background: var(--brass-dim); }

/* Scroll progress hairline */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 60; pointer-events: none;
}
.progress span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--brass), var(--electric));
  transform: scaleX(0); transform-origin: 0 50%;
}

/* Section rail — only where there is margin to spare beside the content */
.rail { display: none; }
@media (min-width: 1360px) {
  .rail {
    position: fixed; right: 2rem; top: 50%; transform: translateY(-50%);
    z-index: 40; display: grid; gap: 1.1rem;
  }
}
.rail a {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.7rem;
  text-decoration: none; color: var(--faint);
  font-size: var(--fs-label); font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  transition: color 0.3s var(--ease);
}
.rail a span {
  opacity: 0; transform: translateX(8px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.rail a::after {
  content: ""; width: 20px; height: 2px; background: currentColor;
  transition: width 0.3s var(--ease);
}
.rail a:hover { color: var(--dim); }
.rail a:hover span { opacity: 1; transform: none; }
.rail a.is-active { color: var(--brass); }
.rail a.is-active span { opacity: 1; transform: none; }
.rail a.is-active::after { width: 36px; }

/* Cursor spotlight on cards */
.project { position: relative; }
.project::before, .layer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%),
              rgba(229, 180, 87, 0.07), transparent 68%);
  opacity: 0; transition: opacity 0.35s var(--ease);
}
.project:hover::before, .layer:hover::before { opacity: 1; }

/* Sheen across the primary buttons */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -130%;
  width: 55%; height: 100%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-18deg);
  transition: left 0.7s var(--ease);
}
.btn-primary:hover::after { left: 150%; }

/* Headings rise word by word */
.head-anim .w {
  display: inline-block; overflow: hidden; vertical-align: top;
  padding-bottom: 0.12em; margin-bottom: -0.12em;
}
.head-anim .w > span { display: inline-block; transform: translateY(108%); }
.head-anim.is-in .w > span {
  transform: none;
  transition: transform 0.85s var(--ease) var(--wd, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .head-anim .w > span,
  .head-anim.is-in .w > span { transform: none; transition: none; }
  .btn-primary::after { display: none; }
  .progress span { transition: none; }
}

/* --- Scroll reveal -------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(26px); }
.reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity 0.7s var(--ease) var(--d, 0ms), transform 0.7s var(--ease) var(--d, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-in { opacity: 1; transform: none; transition: none; }
  .rise { opacity: 1; transform: none; animation: none; }
}

/* --- Portfolio teaser (home page) ----------------------------------------- */
.teaser-lede { color: var(--dim); font-size: var(--fs-lg); max-width: 54ch; margin-top: 1.25rem; }
.teaser-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 2.5rem; }
@media (min-width: 700px) { .teaser-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.teaser {
  display: grid; gap: 0.35rem; align-content: start;
  padding: 0 0 1.35rem; background: var(--ground); text-decoration: none;
  transition: background 0.3s var(--ease);
}
.teaser:hover { background: var(--card); }
.teaser-shot { display: block; overflow: hidden; background: var(--card); margin-bottom: 1.1rem; aspect-ratio: 16 / 10; }
.teaser-shot img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; transition: transform 0.6s var(--ease); }
.teaser:hover .teaser-shot img { transform: scale(1.04); }
.teaser-meta {
  font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brass);
}
.teaser-name { font-variation-settings: "wdth" 112; font-weight: 700; font-size: var(--fs-h3); }
.teaser-cta { justify-self: start; }
@media (prefers-reduced-motion: reduce) { .teaser:hover .teaser-shot img { transform: none; } }

/* --- Portfolio page ------------------------------------------------------- */
.page-head { padding-block: clamp(3.5rem, 8vw, 6rem) clamp(2rem, 4vw, 3rem); position: relative; }
.page-head .h2 { font-size: var(--fs-hero); font-variation-settings: "wdth" 122; letter-spacing: -0.04em; }
.page-lede { color: var(--dim); font-size: var(--fs-lg); max-width: 60ch; margin-top: 1.6rem; }
.back-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: var(--fs-sm); font-weight: 600; color: var(--dim); text-decoration: none;
  margin-top: 2.25rem; transition: color 0.25s var(--ease);
}
.back-link:hover { color: var(--brass); }
.back-link::before { content: "\2190"; }
.case-role {
  display: grid; gap: 0.5rem; margin-top: 1.4rem;
  padding-top: 1.25rem; border-top: 1px solid var(--line);
}
.case-role dt {
  font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--faint);
}
.case-role dd { color: var(--dim); font-size: var(--fs-base); }
.case-role li { color: var(--dim); position: relative; padding-left: 1.05rem; }
.case-role li::before {
  content: ""; position: absolute; left: 0; top: 0.68em;
  width: 5px; height: 5px; background: var(--brass);
}
.case-role ul { display: grid; gap: 0.5rem; }

/* --- Skills (portfolio page) ---------------------------------------------- */
.skills { display: grid; gap: 2rem 3rem; }
@media (min-width: 680px)  { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .skills { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.skill-group h3 {
  font-size: var(--fs-label); font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--brass); margin-bottom: 0.85rem;
}
.skill-group ul { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.skill-group li {
  font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.03em;
  padding: 0.3rem 0.62rem;
  border: 1px solid var(--line-2); color: var(--dim);
}

/* --- Portfolio dropdown --------------------------------------------------- */
.nav-drop { position: relative; display: flex; align-items: center; }
.drop-menu {
  position: absolute; top: calc(100% + 14px); left: 50%;
  transform: translateX(-50%) translateY(-6px);
  display: grid; min-width: 190px;
  background: rgba(15, 24, 21, 0.97);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-int);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0.22s;
  z-index: 60;
}
/* bridges the gap so the menu does not close as the pointer travels to it */
.nav-drop::after { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 16px; }
.nav-drop:hover .drop-menu,
.nav-drop:focus-within .drop-menu {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.drop-menu a {
  padding: 0.7rem 1rem;
  font-size: var(--fs-sm); font-weight: 500; color: var(--dim);
  text-decoration: none; border-bottom: 1px solid var(--line);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.drop-menu a:last-child { border-bottom: 0; }
.drop-menu a:hover, .drop-menu a:focus-visible { background: var(--card); color: var(--brass); }
.drop-menu a::after { content: none; }
@media (prefers-reduced-motion: reduce) { .drop-menu { transition: none; } }

/* --- Cursor light in the hero ---------------------------------------------
   Sits above the readability scrim but below the type, so it genuinely
   lifts the dark left side instead of being crushed by the gradient. */
.hero-cursor {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(240px circle at var(--cx, -300px) var(--cy, -300px),
      rgba(63, 217, 192, 0.13), transparent 70%),
    radial-gradient(480px circle at var(--cx, -300px) var(--cy, -300px),
      rgba(28, 95, 74, 0.22), transparent 72%);
  opacity: 0;
  transition: opacity 0.45s var(--ease);
  mix-blend-mode: screen;
}
.hero-cursor.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .hero-cursor { display: none; } }

/* --- Portfolio page header (stands alone when linked from a resume) -------- */
.page-name {
  font-variation-settings: "wdth" 122;
  font-weight: 800; font-size: clamp(2.6rem, 7vw, 5rem);
  letter-spacing: -0.035em; margin-top: 0.7rem;
}
.page-role {
  font-size: clamp(1rem, 2vw, 1.35rem); font-weight: 500;
  color: var(--brass); margin-top: 0.65rem; letter-spacing: 0.01em;
}
.page-links {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.75rem;
  margin-top: 1.9rem; font-size: var(--fs-sm);
}
.page-links a {
  color: var(--dim); text-decoration: none;
  border-bottom: 1px solid var(--line-2); padding-bottom: 2px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.page-links a:hover { color: var(--brass); border-color: var(--brass); }
/* image runs edge to edge; only the labels are inset */
.teaser-meta, .teaser-name { padding-inline: 1.25rem; }
