:root {
  --bg: #FAF9F6;
  --ink: #141412;
  --muted: #6d6a62;
  --accent: #FF6600;
  --line: #e4e1d8;
  --step-0: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  --step-1: clamp(1.3rem, 1.1rem + 1vw, 1.9rem);
  --step-2: clamp(1.9rem, 1.4rem + 2.2vw, 3.2rem);
  --step-3: clamp(2.6rem, 1.6rem + 4.5vw, 5rem);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 1100px; margin: 0 auto; padding: 4rem 1.5rem 6rem; }
h1, h2, h3 { line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 1.2rem; }
h1 { font-size: var(--step-3); font-weight: 900; text-transform: uppercase; }
/* page headings (About, Projects, Experience, Outside of Work, Contact) in accent
   orange; the home hero name is nested deeper so it keeps the ink colour */
main > h1 { color: var(--accent); }
h2 { font-size: var(--step-2); font-weight: 800; margin-top: 3rem; }
h3 { font-size: var(--step-1); font-weight: 700; margin-top: 2rem; }
p { max-width: 68ch; }
a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

.site-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  max-width: 1100px; margin: 0 auto; padding: 1.4rem 1.5rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { font-weight: 800; text-decoration: none; letter-spacing: -0.01em; }
.site-header nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.site-header nav a {
  text-decoration: none; font-size: 0.9rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
}
/* subtle sparkle on the AI Demo menu item */
.nav-sparkle::after {
  content: "\2726";
  color: var(--accent);
  display: inline-block;
  margin-left: 0.35em;
  font-size: 0.85em;
  animation: sparkle 2.6s ease-in-out infinite;
}
@keyframes sparkle {
  0%, 100% { opacity: 0.35; transform: scale(0.75) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(25deg); }
}
.site-footer {
  border-top: 1px solid var(--line);
  max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 3rem;
  color: var(--muted); font-size: 0.9rem;
}
.lede { font-size: var(--step-1); font-weight: 600; line-height: 1.4; max-width: 30ch; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.ask-ai { border-top: 1px solid var(--line); background: #f3f1ea; }
.ask-ai-inner { max-width: 1100px; margin: 0 auto; padding: 3.5rem 1.5rem 4rem; }
.ask-ai h2 { margin-top: 0; }
.ask-ai-buttons { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.5rem; }
.ask-ai-buttons a, .ask-ai-buttons button {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 0.75rem 1.6rem; border-radius: 999px;
  border: 2px solid var(--ink); background: transparent; color: var(--ink);
  text-decoration: none; transition: background 0.15s, color 0.15s;
  display: inline-flex; align-items: center; gap: 0.5em;
}
.ask-ai-buttons .icon { width: 1.2em; height: 1.2em; }
.ask-ai-buttons a:hover, .ask-ai-buttons button:hover { background: var(--ink); color: var(--bg); }

.kicker {
  text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.8rem;
  font-weight: 700; color: var(--accent); margin: 0 0 1rem;
  white-space: nowrap;
}
/* on narrow screens let the kicker wrap naturally at a readable size */
@media (max-width: 640px) {
  .kicker { white-space: normal; text-wrap: balance; letter-spacing: 0.1em; font-size: 0.72rem; }
}
.hero h1 {
  font-size: clamp(2.8rem, 10vw, 7.3rem); margin: 0 0 2rem;
  position: relative; z-index: 2;
}
.h1-outline {
  color: var(--bg);
  -webkit-text-stroke: 0.022em var(--ink);
}
.hero-links { display: flex; gap: 1.6rem; flex-wrap: wrap; margin-top: 2rem; font-weight: 700; }
.hero-photos {
  position: relative; aspect-ratio: 3 / 4; overflow: hidden;
  width: min(100%, 420px);
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 98%);
  mask-image: linear-gradient(to bottom, #000 80%, transparent 98%);
  /* photo is placed in its final position on load (no entrance sweep);
     me1 (B&W) shows first, me2 (colour) fades in when the underline switches it on */
}
.hero-photos img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
/* energy trails race toward the photo; the contact flash switches colour on */
.hero-photo-alt { opacity: 0; animation: colour-in 0.6s ease-out 3.55s forwards; }
.h1-left > span, .h1-right > span { position: relative; display: inline-block; }
/* the trail (amber underline) is left behind the racing head, with a glow that settles */
.h1-left > span::after, .h1-right > span::after {
  content: ""; position: absolute; bottom: -0.04em; height: 0.06em;
  background: var(--accent);
  box-shadow: 0 0 10px 1px var(--accent);
  animation: draw-underline 0.9s ease-in-out 2.6s both,
             trail-glow 1.1s ease-out 3.5s both;
}
.h1-left > span::after { left: 0; width: 100%; transform-origin: left; }
.h1-right > span::after { right: 0; width: 100%; transform-origin: right; }
/* the head: a bright comet of light that races along the trail and bursts at the photo */
.h1-left > span::before, .h1-right > span::before {
  content: ""; position: absolute; bottom: -0.07em;
  width: 0.9em; height: 0.11em; border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 8px 2px var(--accent), 0 0 20px 5px var(--accent);
  opacity: 0; pointer-events: none;
}
.h1-left > span::before { left: 0; animation: comet-left 0.95s ease-in-out 2.6s both; }
.h1-right > span::before { right: 0; animation: comet-right 0.95s ease-in-out 2.6s both; }
@keyframes colour-in {
  to { opacity: 1; }
}
@keyframes draw-underline {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes trail-glow {
  from { box-shadow: 0 0 14px 2px var(--accent); }
  to { box-shadow: 0 0 0 0 rgba(255, 102, 0, 0); }
}
@keyframes comet-left {
  0% { left: 0; opacity: 0; transform: scale(0.5); }
  12% { opacity: 1; }
  82% { left: calc(100% - 0.9em); opacity: 1; transform: scale(1); }
  100% { left: calc(100% - 0.45em); opacity: 0; transform: scale(2.4); }
}
@keyframes comet-right {
  0% { right: 0; opacity: 0; transform: scale(0.5); }
  12% { opacity: 1; }
  82% { right: calc(100% - 0.9em); opacity: 1; transform: scale(1); }
  100% { right: calc(100% - 0.45em); opacity: 0; transform: scale(2.4); }
}
@media (min-width: 801px) {
  body.home main { padding-top: 2rem; }
  /* the home page uses more screen width so SCOTT/MARSHALL can grow beside the photo */
  body.home .site-header,
  body.home main,
  body.home .ask-ai-inner,
  body.home .site-footer { max-width: 1280px; }
  .hero { display: flex; flex-direction: column; min-height: min(calc(100svh - 110px), 780px); }
  .hero-grid {
    display: grid; flex: 1;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 0.5rem;
  }
  .hero-name { display: contents; }
  .h1-word { display: block; container-type: inline-size; margin-top: 1.2rem; position: relative; z-index: 2; }
  .h1-left { grid-column: 1; grid-row: 1; text-align: right; }
  .h1-right { grid-column: 3; grid-row: 1; text-align: left; }
  .h1-word > span { font-size: 16.9cqw; line-height: 1.05; letter-spacing: -0.04em; }
  /* extend the underlines across the small gap so they visibly touch the photo */
  .h1-left > span::after, .h1-right > span::after { width: calc(100% + 0.5rem); }
  .hero-grid .hero-photos {
    grid-column: 2; grid-row: 1 / 3;
    width: auto; height: min(calc(100svh - 152px), 500px);
  }
  .hero-text { grid-column: 1; grid-row: 2; align-self: center; justify-self: end; text-align: right; margin-top: 1rem; }
  .hero-text .hero-links { justify-content: flex-end; margin-top: 1.4rem; }
  .hero-text .lede { font-size: clamp(1.05rem, 1.5vw, 1.35rem); text-wrap: balance; max-width: 24ch; margin-left: auto; }
}

.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; }
.icon-link { display: inline-flex; align-items: center; gap: 0.45em; }
.contact-value { display: flex; align-items: center; gap: 0.5em; }

.case { border-top: 2px solid var(--ink); padding: 2rem 0 2.5rem; margin-top: 2.5rem; }
.case-stat { font-size: var(--step-3); font-weight: 900; color: var(--accent); margin: 0; line-height: 1; }
.case h2 { margin-top: 0.5rem; }
ul { padding-left: 1.2rem; }
li { margin-bottom: 0.6rem; max-width: 68ch; }

/* dark theme for non-work pages - inverts the palette via the custom properties */
body.dark {
  --bg: #141412;
  --ink: #FAF9F6;
  --line: #35332c;
  --muted: #a8a498;
}
body.dark .ask-ai { background: #1d1c19; }
body.dark .lede { max-width: none; }

.hobby { margin-top: 3.5rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
/* four-photo galleries (Porsche) lay out as a 2x2 grid instead of 3+1 */
@media (min-width: 600px) {
  .gallery:has(img:nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
}
.gallery img, .gallery video { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; aspect-ratio: 4 / 3; }

.contact-links { display: grid; gap: 1rem; margin-top: 2.5rem; max-width: 640px; }
.contact-card {
  display: flex; flex-direction: column; gap: 0.3rem;
  border: 2px solid var(--ink); border-radius: 6px; padding: 1.4rem 1.6rem;
  text-decoration: none; transition: background 0.15s, color 0.15s;
}
.contact-card:hover { background: var(--ink); color: var(--bg); }
.contact-label { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; font-weight: 700; color: var(--accent); }
.contact-value { font-size: var(--step-1); font-weight: 800; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
