/* ==========================================================================
   Gabriel Magat Jr. — Portfolio
   Look and feel: the cream "browser window" desert from github.com/gbmagat
   (sage pixel dinosaur, cacti, clouds, uppercase window titles).

   1  Tokens        7  Projects        13 Case study dialog
   2  Base          8  About           14 Toast
   3  Layout        9  Experience      15 Divider band
   4  Components    10 Stack           16 Chat
   5  Header        11 Contact         17 Motion
   6  Hero          12 Footer
   ========================================================================== */

/* 1 — Tokens ------------------------------------------------------------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-lg: 20px;
  --radius-md: 14px;
  --container: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 66px;
  --ease-out: cubic-bezier(.22, .8, .3, 1);

  /* Day theme — colours taken from the GitHub profile artwork */
  color-scheme: light;
  --bg: #e9e6d7;
  --bg-dots: rgba(64, 80, 57, .085);
  --surface: #f7f5ec;
  --surface-2: #efede0;
  --bar: #e5e1cf;
  --line: #aeb3a7;
  --line-soft: #d2d1c1;
  --ink: #27311f;
  --ink-2: #4a5543;
  --ink-3: #646d5e;
  --heading: #354333;
  --label: #405039;
  --accent: #7f9672;
  --link: #4d6643;
  --dino-c: #7f9672;
  --cactus-c: #78906a;
  --butter-c: #f4e8b2;
  --butter-ink: #405039;
  --btn-dark: #405039;
  --btn-dark-ink: #f7f5ec;
  --shot-filter: none;
  --shadow-md: 0 1px 0 rgba(53, 67, 51, .06), 0 14px 30px -18px rgba(53, 67, 51, .45);
  --shadow-lg: 0 2px 0 rgba(53, 67, 51, .05), 0 30px 60px -24px rgba(36, 46, 33, .5);
}

[data-theme="night"] {
  color-scheme: dark;
  --bg: #121610;
  --bg-dots: rgba(233, 230, 214, .05);
  --surface: #1a2017;
  --surface-2: #1f261c;
  --bar: #232b20;
  --line: #3b4636;
  --line-soft: #2b3427;
  --ink: #e7e5d7;
  --ink-2: #c4c8b7;
  --ink-3: #9aa290;
  --heading: #f3f1e5;
  --label: #b8cba6;
  --accent: #93ad84;
  --link: #b3cba3;
  --dino-c: #a3bc93;
  --cactus-c: #8aa57b;
  --butter-c: #e6d68f;
  --butter-ink: #29280f;
  --btn-dark: #e9e6d6;
  --btn-dark-ink: #1a2017;
  --shot-filter: brightness(.9);
  --shadow-md: 0 14px 34px -16px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 60px -22px rgba(0, 0, 0, .8);
}

/* 2 — Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, var(--bg-dots) 1px, transparent 0);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}

h1, h2, h3, h4 { margin: 0; color: var(--heading); line-height: 1.1; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--link); text-underline-offset: 3px; }
img, svg { display: block; }
img { max-width: 100%; height: auto; }
button { font: inherit; }
strong, b { font-weight: 700; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--butter-c); color: #2b3626; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon { width: 1em; height: 1em; flex: none; fill: currentColor; shape-rendering: crispEdges; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 300;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--btn-dark);
  color: var(--btn-dark-ink);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* 3 — Layout ------------------------------------------------------------- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }

.section { padding-block: clamp(72px, 10vw, 120px); }

.section-head h2 {
  margin-top: 18px;
  font-size: clamp(2.1rem, 4.6vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.02;
}
.section-head p {
  margin-top: 16px;
  max-width: 60ch;
  font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
  color: var(--ink-2);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 600 .75rem/1 var(--font-mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--label);
}

.subhead {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: clamp(48px, 7vw, 72px) 0 20px;
  font: 700 .8125rem/1 var(--font-mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--label);
}
.subhead::after { content: ""; flex: 1; height: 2px; background: var(--line-soft); }

/* Pixel ground line with pebbles (same shape as the GitHub artwork) */
.ground {
  height: 20px;
  background: var(--line);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='20' viewBox='0 0 600 20'><g fill='none' stroke='black' stroke-width='2'><path d='M0 6h120l5 3h30l5-3h170l5-4h10l5 4h120l5 3h24l5-3h96'/><path d='M18 14h6m40 4h8m60-5h8m50 5h5m42-6h10m64 7h6m46-6h7m38 4h10m48-5h6m60 5h8'/></g></svg>") repeat-x 0 0 / 600px 20px;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='20' viewBox='0 0 600 20'><g fill='none' stroke='black' stroke-width='2'><path d='M0 6h120l5 3h30l5-3h170l5-4h10l5 4h120l5 3h24l5-3h96'/><path d='M18 14h6m40 4h8m60-5h8m50 5h5m42-6h10m64 7h6m46-6h7m38 4h10m48-5h6m60 5h8'/></g></svg>") repeat-x 0 0 / 600px 20px;
}

/* 4 — Components --------------------------------------------------------- */
/* Window: the cream browser frame used across the site */
.window {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.window__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 46px;
  padding: 0 18px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}
.window__title {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  font: 500 .75rem/1.2 var(--font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--label);
}

.dots { display: inline-flex; flex: none; gap: 8px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.dots i:nth-child(2) { background: var(--line); }
.dots i:nth-child(3) { background: var(--butter-c); box-shadow: inset 0 0 0 1px var(--line); }

/* Buttons: modelled on the README badges (tinted block + coloured left bar) */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 20px 0 23px;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  font: 700 .8125rem/1 var(--font-sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .2s var(--ease-out), filter .2s ease;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--btn-bar, var(--accent));
  transition: width .25s var(--ease-out);
}
.btn:hover { transform: translateY(-2px); }
.btn:hover::before { width: 8px; }
.btn:active { transform: translateY(0); }
.btn .icon { position: relative; width: 16px; height: 16px; }
.btn--primary { background: var(--btn-dark); color: var(--btn-dark-ink); --btn-bar: var(--butter-c); }
.btn--butter { background: var(--butter-c); color: var(--butter-ink); --btn-bar: var(--accent); }
.btn--ghost { background: var(--bar); color: var(--label); --btn-bar: var(--accent); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--sm { min-height: 40px; padding: 0 14px 0 18px; font-size: .75rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--label);
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease-out), border-color .2s ease, background-color .2s ease;
}
.icon-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.icon-btn .icon { width: 16px; height: 16px; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: transparent;
  font: 600 .875rem/1 var(--font-sans);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .2s var(--ease-out);
}
.link-btn:hover { background: var(--surface); border-color: var(--accent); transform: translateY(-1px); }
.link-btn .icon { width: 12px; height: 12px; }
.link-btn--strong { background: var(--btn-dark); border-color: var(--btn-dark); color: var(--btn-dark-ink); }
.link-btn--strong:hover { background: var(--btn-dark); border-color: var(--btn-dark); filter: brightness(1.15); }

.tag {
  padding: 4px 8px 4px 11px;
  border-radius: 3px;
  background: var(--butter-c);
  color: var(--butter-ink);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Square pixel bullets */
.points { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.points li { position: relative; padding-left: 22px; color: var(--ink-2); line-height: 1.55; }
.points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .6em;
  width: 8px;
  height: 8px;
  background: var(--accent);
}

/* Tech badges — same colours as the README badges */
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.badge {
  --c: #64748b; --tint: #e9ecef; --fg: #515d70;
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px 0 13px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--tint);
  color: var(--fg);
  font: 700 .6875rem/1 var(--font-sans);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c); }
[data-theme="night"] .badge {
  background: color-mix(in srgb, var(--c-night, var(--c)) 15%, var(--surface));
  color: color-mix(in srgb, var(--c-night, var(--c)) 45%, #f3f1e6);
}
[data-theme="night"] .badge::before { background: var(--c-night, var(--c)); }

.b-javascript { --c: #f7df1e; --tint: #fefbdf; --fg: #74690c; }
.b-typescript { --c: #3178c6; --tint: #e2ecf7; --fg: #2761a0; }
.b-python     { --c: #3776ab; --tint: #e3ecf3; --fg: #2c5f89; }
.b-dart       { --c: #0175c2; --tint: #dbeef4; --fg: #00578f; }
.b-php        { --c: #777bb4; --tint: #ecedf5; --fg: #565982; }
.b-sql,
.b-ssh        { --c: #64748b; --tint: #e9ecef; --fg: #515d70; }
.b-html       { --c: #e34f26; --tint: #fbe6e1; --fg: #a4381b; }
.b-css        { --c: #663399; --tint: #eae2f1; --fg: #663399; --c-night: #9a6fd0; }
.b-react      { --c: #61dafb; --tint: #e9fafe; --fg: #327282; }
.b-nextjs     { --c: #000000; --tint: #dbdbdb; --fg: #000000; --c-night: #e7e5d7; }
.b-tailwind   { --c: #06b6d4; --tint: #dcf5f9; --fg: #01697b; }
.b-node       { --c: #5fa04e; --tint: #e9f2e6; --fg: #3d6832; }
.b-express    { --c: #0a0a0a; --tint: #dddddd; --fg: #0a0a0a; --c-night: #e7e5d7; }
.b-mysql      { --c: #4479a1; --tint: #e5ecf2; --fg: #366181; }
.b-postgresql { --c: #4169e1; --tint: #e4eafb; --fg: #3454b5; }
.b-sqlite     { --c: #003b57; --tint: #dbe4e7; --fg: #003b57; --c-night: #5b9ab8; }
.b-aws,
.b-ec2,
.b-lambda     { --c: #ff9900; --tint: #fff1db; --fg: #955900; }
.b-alibaba    { --c: #ff6a00; --tint: #ffe9da; --fg: #a04300; }
.b-gcp        { --c: #4285f4; --tint: #e5eefd; --fg: #2f60b1; }
.b-docker     { --c: #2496ed; --tint: #e0f0fc; --fg: #166199; }
.b-k8s        { --c: #326ce5; --tint: #e2eafb; --fg: #2857b9; }
.b-linux      { --c: #fcc624; --tint: #fff7e0; --fg: #755d0f; }
.b-nginx      { --c: #009639; --tint: #dbf0e3; --fg: #006c28; }
.b-git        { --c: #f03c2e; --tint: #fde4e2; --fg: #ae2b20; }
.b-github     { --c: #181717; --tint: #dfdfdf; --fg: #181717; --c-night: #e7e5d7; }
.b-vite       { --c: #9135ff; --tint: #f0e3ff; --fg: #752ace; }
.b-playwright { --c: #2ead33; --tint: #e2f4e2; --fg: #1c7020; }
.b-leaflet    { --c: #199900; --tint: #e2f3dd; --fg: #1f6a12; }
.b-zod        { --c: #3068b7; --tint: #e2eaf6; --fg: #275595; }
.b-jquery     { --c: #0769ad; --tint: #deebf6; --fg: #0a578d; }

/* 5 — Header ------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.3) blur(12px);
          backdrop-filter: saturate(1.3) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background-color .3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line-soft); }
.site-header__inner { display: flex; align-items: center; gap: 12px; height: var(--header-h); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px 4px;
  margin-left: -4px;
  font: 500 .8125rem/1 var(--font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--label);
  text-decoration: none;
}
.brand b { font-weight: 800; color: var(--heading); }
.brand__text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.nav { margin-left: auto; }
.nav ul { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}
.nav a:hover { color: var(--heading); background: color-mix(in srgb, var(--bar) 85%, transparent); }
.nav a[aria-current="true"] { color: var(--heading); background: var(--bar); box-shadow: inset 0 -2px 0 var(--accent); }
.nav__resume { display: none; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: none; }
.theme-toggle .i-sun,
.nav-toggle .i-close { display: none; }
[data-theme="night"] .theme-toggle .i-sun { display: block; }
[data-theme="night"] .theme-toggle .i-moon { display: none; }
.nav-open .nav-toggle .i-menu { display: none; }
.nav-open .nav-toggle .i-close { display: block; }

@media (max-width: 899px) {
  .header-actions { margin-left: auto; }
  .header-resume { display: none; }
  .nav-toggle { display: inline-grid; }
  .nav {
    position: fixed;
    top: calc(var(--header-h) + 6px);
    left: var(--gutter);
    right: var(--gutter);
    margin: 0;
    padding: 8px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s var(--ease-out), visibility .2s;
  }
  .nav-open .nav { opacity: 1; visibility: visible; transform: none; }
  .nav ul { flex-direction: column; align-items: stretch; }
  .nav a { padding: 14px 16px; font-size: 1rem; }
  .nav a[aria-current="true"] { box-shadow: inset 3px 0 0 var(--accent); }
  .nav__resume { display: block; }
}

@media (max-width: 440px) {
  .brand .dots { display: none; }
  .brand { font-size: .75rem; letter-spacing: .1em; }
}

/* 6 — Hero --------------------------------------------------------------- */
.hero { padding-top: clamp(16px, 3vw, 36px); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font: 600 .6875rem/1 var(--font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--label);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-out infinite;
}

.hero__body {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  column-gap: 16px;
}
.hero__text {
  container-type: inline-size; /* lets the tagline size itself to this column */
  padding: clamp(36px, 5vw, 64px) 0 clamp(28px, 4vw, 44px) clamp(24px, 5vw, 60px);
}
.hero__hello {
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--label);
}
.hero__name {
  margin-top: 10px;
  font-size: clamp(2.65rem, 6.4vw, 4.6rem);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: .98;
}
/* Tagline: always one line. It scales with the column; narrow columns switch to the short version. */
.hero__role {
  margin-top: 18px;
  font-size: clamp(.9375rem, 3cqi, 1.125rem);
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
}
.hero__role .sep { padding: 0 .15em; color: var(--accent); }
.hero__role-short { display: none; }
@container (max-width: 480px) {
  .hero__role { font-size: clamp(.8125rem, 5.2cqi, 1.125rem); }
  .hero__role-full {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .hero__role-short { display: inline; }
}
.hero__lead { margin-top: 14px; max-width: 54ch; font-size: clamp(1rem, 1.5vw, 1.125rem); color: var(--ink-2); }
.hero__lead strong { color: var(--ink); }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
.socials { display: flex; gap: 8px; margin: 0 0 0 4px; padding: 0; list-style: none; }

.hero__scene { position: relative; z-index: 1; align-self: end; padding-right: clamp(12px, 3vw, 36px); }
.hero__ground { grid-column: 1 / -1; margin-top: -5px; }

.scene {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scene__svg { width: 100%; height: auto; overflow: visible; }
.scene__cacti { fill: var(--cactus-c); }
.dino__body { fill: var(--dino-c); }
.dino__eye { fill: var(--surface); transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; }
.cloud { stroke: var(--line); }
.scene__night { display: none; }
[data-theme="night"] .scene__night { display: inline; }
.scene__moon { fill: var(--butter-c); shape-rendering: crispEdges; }
.scene__stars rect { fill: var(--ink-3); animation: twinkle 3.2s ease-in-out infinite; }
.scene__stars rect:nth-child(2n) { animation-delay: -1.1s; }
.scene__stars rect:nth-child(3n) { animation-delay: -2.2s; }
.cloud--a { animation: drift 16s ease-in-out infinite alternate; }
.cloud--b { animation: drift 22s ease-in-out infinite alternate-reverse; }
.cloud--c { animation: drift 28s ease-in-out infinite alternate; }
.dino.is-hopping { animation: hop .62s; }

.bubble {
  position: absolute;
  left: 33%;
  top: 8%;
  padding: 7px 11px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font: 600 .75rem/1.2 var(--font-mono);
  color: var(--label);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(.92);
  transform-origin: 12% 100%;
  transition: opacity .2s ease, transform .25s var(--ease-out);
}
.bubble::after {
  content: "";
  position: absolute;
  left: 16px;
  bottom: -7px;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  transform: rotate(45deg);
}
.scene.is-talking .bubble { opacity: 1; transform: none; }

.hero__status {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px clamp(18px, 3vw, 24px);
  background: var(--bar);
  border-top: 1px solid var(--line);
  font: 500 .75rem/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--label);
}
.hero__where { display: inline-flex; align-items: center; gap: 8px; }
.hero__where .icon { width: 13px; height: 13px; color: var(--accent); }

/* The road so far: milestones standing on the desert ground; the dino marks the current year */
.road { margin-top: 14px; box-shadow: none; }
.road__range {
  margin-left: auto;
  font: 600 .6875rem/1 var(--font-mono);
  letter-spacing: .14em;
  white-space: nowrap;
  color: var(--ink-3);
}
.road__stops {
  --ground-y: 62px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 20px 0 22px;
  list-style: none;
}
.road__stop { position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 0 18px; }
/* Each stop draws its own piece of ground, so the road stays continuous when it scrolls */
.road__stop::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--ground-y);
  height: 20px;
  background: var(--line);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='20' viewBox='0 0 600 20'><g fill='none' stroke='black' stroke-width='2'><path d='M0 6h120l5 3h30l5-3h170l5-4h10l5 4h120l5 3h24l5-3h96'/><path d='M18 14h6m40 4h8m60-5h8m50 5h5m42-6h10m64 7h6m46-6h7m38 4h10m48-5h6m60 5h8'/></g></svg>") repeat-x 0 0 / 600px 20px;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='20' viewBox='0 0 600 20'><g fill='none' stroke='black' stroke-width='2'><path d='M0 6h120l5 3h30l5-3h170l5-4h10l5 4h120l5 3h24l5-3h96'/><path d='M18 14h6m40 4h8m60-5h8m50 5h5m42-6h10m64 7h6m46-6h7m38 4h10m48-5h6m60 5h8'/></g></svg>") repeat-x 0 0 / 600px 20px;
}
.road__stop:nth-child(2)::before { -webkit-mask-position: -230px 0; mask-position: -230px 0; }
.road__stop:nth-child(3)::before { -webkit-mask-position: -410px 0; mask-position: -410px 0; }
.road__stop:nth-child(4)::before { -webkit-mask-position: -95px 0; mask-position: -95px 0; }
.road__stop:nth-child(5)::before { -webkit-mask-position: -340px 0; mask-position: -340px 0; }
.road__year {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px 0 11px;
  border-radius: 3px;
  background: var(--bar);
  box-shadow: inset 3px 0 0 var(--accent);
  font: 700 .75rem/1 var(--font-mono);
  letter-spacing: .1em;
  color: var(--label);
}
.is-now .road__year { background: var(--butter-c); color: var(--butter-ink); }
.is-now .road__year::after { content: "\00b7  now"; margin-left: 6px; font-weight: 600; white-space: pre; }
/* Pixel flag for each milestone (pole + notched flag) */
.road__marker {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 32px;
  margin-top: 12px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 20'><path d='M0 0h2v20H0Z M2 1h13v2h-1v1h-1v2h1v1h1v2H2Z'/></svg>") left bottom / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 20'><path d='M0 0h2v20H0Z M2 1h13v2h-1v1h-1v2h1v1h1v2H2Z'/></svg>") left bottom / contain no-repeat;
}
.is-next .road__marker { background: var(--line); }
/* The dino stands where Gabriel is now */
.is-now .road__marker {
  width: 31px;
  background: var(--dino-c);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 84'><path fill-rule='evenodd' d='M44 0h32v4h4v20H56v8h16v4H56v8h12v4H56v8h-8v8h-8v8H24v-4H12v-8H4V48H0V28h4v12h4v8h8v-4h8v-8h8v-8h8V4h4Z M48 5h5v5h-5Z'/><path d='M24 64h8v16h8v4H24Zm16 0h8v8h8v4H44v-4h-4Z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 84'><path fill-rule='evenodd' d='M44 0h32v4h4v20H56v8h16v4H56v8h12v4H56v8h-8v8h-8v8H24v-4H12v-8H4V48H0V28h4v12h4v8h8v-4h8v-8h8v-8h8V4h4Z M48 5h5v5h-5Z'/><path d='M24 64h8v16h8v4H24Zm16 0h8v8h8v4H44v-4h-4Z'/></svg>");
}
.road__text { margin-top: 20px; max-width: 24ch; font-size: .875rem; line-height: 1.45; color: var(--ink-2); }
.is-next .road__text { color: var(--ink-3); }

@media (max-width: 859px) {
  .hero__body { grid-template-columns: 1fr; }
  .hero__text { padding: 32px 24px 8px; }
  .hero__scene { justify-self: end; width: min(100%, 420px); padding: 0 12px 0 0; }
  /* The road scrolls sideways on smaller screens */
  .road__stops {
    grid-template-columns: repeat(5, minmax(168px, 1fr));
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }
  .road__stop { scroll-snap-align: start; }
}

@media (max-width: 480px) {
  .hero__text { padding: 28px 20px 4px; }
  .hero__actions .btn { flex: 1 1 auto; }
  .socials { margin-left: 0; }
  .window__bar { padding: 0 14px; gap: 10px; }
  .status-pill { padding: 4px 8px; letter-spacing: .1em; }
  .road__range { display: none; }
}

/* 7 — Projects ----------------------------------------------------------- */
.projects { display: grid; gap: clamp(64px, 9vw, 112px); margin-top: clamp(40px, 6vw, 64px); }

.project {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: clamp(28px, 4.5vw, 64px);
  align-items: center;
}
.project:nth-child(even) .project__media { order: 2; }

.browser {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out), border-color .3s ease;
}
.browser:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.browser__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 12px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}
.browser__bar .dots { gap: 6px; }
.browser__bar .dots i { width: 10px; height: 10px; }
.browser__url {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 24px;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface);
  font: 500 .75rem/1 var(--font-mono);
  color: var(--ink-3);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.browser__url .icon { width: 10px; height: 10px; color: var(--accent); }
.browser__shot {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  background: var(--surface-2);
  filter: var(--shot-filter);
  transition: transform .7s var(--ease-out);
}
.browser:hover .browser__shot { transform: scale(1.025); }

.project__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font: 600 .75rem/1.3 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--label);
}
.project__title { margin-top: 12px; font-size: clamp(1.9rem, 3.4vw, 2.6rem); font-weight: 800; letter-spacing: -.035em; }
.project__subtitle { margin-top: 8px; font-size: 1.125rem; font-weight: 600; line-height: 1.45; color: var(--ink); }
.project__desc { margin-top: 12px; color: var(--ink-2); }
.project__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

@media (max-width: 959px) {
  .project { grid-template-columns: 1fr; gap: 28px; }
  .project:nth-child(even) .project__media { order: 0; }
}

/* Smaller projects list */
.archive { margin-top: clamp(72px, 10vw, 120px); }
.archive__list { margin: 0; padding: 0; list-style: none; }
.archive__row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 180px auto;
  gap: 6px 20px;
  align-items: baseline;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
  transition: background-color .2s ease;
}
.archive__row:hover { background: var(--surface-2); }
.archive__year { font: 600 .8125rem/1.5 var(--font-mono); color: var(--ink-3); }
.archive__name { font-size: .9375rem; line-height: 1.5; color: var(--ink-2); }
.archive__name b { display: block; font-size: 1rem; color: var(--heading); }
.archive__stack { font: 500 .75rem/1.5 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.archive__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--label);
  text-decoration: none;
  white-space: nowrap;
}
.archive__link:hover { text-decoration: underline; }
.archive__link .icon,
.archive__more .icon { width: 11px; height: 11px; }
.archive__more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--surface-2);
  font-size: .9375rem;
  font-weight: 600;
  color: var(--label);
  text-decoration: none;
}
.archive__more:hover { background: var(--bar); }

@media (max-width: 720px) {
  .archive__row { grid-template-columns: 48px minmax(0, 1fr); padding: 16px 18px; }
  .archive__stack,
  .archive__link { grid-column: 2; }
}

/* 8 — About -------------------------------------------------------------- */
.about {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
  margin-top: clamp(32px, 5vw, 48px);
}
.about__avatar {
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 36px 32px 0;
  background: var(--surface-2);
  border-bottom: 2px solid var(--line);
}
.about__avatar svg { width: 58%; height: auto; margin-bottom: -2px; fill: var(--dino-c); shape-rendering: crispEdges; }
.about__avatar img { width: 100%; height: auto; }
.facts { margin: 0; padding: 6px 20px 14px; }
.facts div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.facts div:last-child { border-bottom: 0; }
.facts dt { font: 600 .6875rem/1.7 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--label); }
.facts dd { margin: 0; font-size: .9375rem; line-height: 1.5; color: var(--ink); }

.about__text { display: grid; gap: 16px; max-width: 64ch; color: var(--ink-2); }
.about__intro {
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  font-weight: 650;
  line-height: 1.42;
  letter-spacing: -.012em;
  color: var(--heading);
}

.caps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.cap {
  padding: 22px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  transition: transform .3s var(--ease-out), border-color .3s ease;
}
.cap:hover { transform: translateY(-3px); border-color: var(--accent); }
.cap__icon { width: 32px; height: 32px; fill: var(--accent); shape-rendering: crispEdges; }
.cap h4 { margin-top: 16px; font-size: 1.0625rem; font-weight: 750; letter-spacing: -.01em; }
.cap p { margin-top: 6px; font-size: .9375rem; line-height: 1.55; color: var(--ink-2); }

@media (max-width: 899px) {
  .about { grid-template-columns: 1fr; }
  .about__card { max-width: 460px; }
  .caps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .caps { grid-template-columns: 1fr; }
}

/* 9 — Experience --------------------------------------------------------- */
.xp { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); }
.xp .subhead { margin-top: clamp(36px, 5vw, 52px); }

.timeline { position: relative; margin: 0; padding: 0 0 0 30px; list-style: none; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: repeating-linear-gradient(to bottom, var(--line) 0 6px, transparent 6px 12px);
}
.timeline__item { position: relative; padding-bottom: 34px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 3px;
  width: 14px;
  height: 14px;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline__item.is-current::before { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent); }
.timeline__date { font: 600 .75rem/1.4 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--label); }
.timeline__role { margin-top: 6px; font-size: 1.25rem; font-weight: 750; letter-spacing: -.015em; }
.timeline__org { margin-top: 3px; font-size: .9375rem; color: var(--ink-3); }
.timeline .points { margin-top: 12px; }
.timeline .badges { margin-top: 14px; }

.edu__body { display: flex; gap: 18px; padding: 22px; }
.edu__body .points { margin-top: 12px; }
.edu__icon { width: 40px; height: 40px; flex: none; fill: var(--accent); shape-rendering: crispEdges; }

.certs { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.cert {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--line-soft);
  border-radius: 12px;
}
.cert__icon { width: 22px; height: 22px; flex: none; margin-top: 2px; fill: var(--accent); shape-rendering: crispEdges; }
.cert b { display: block; font-size: .9375rem; line-height: 1.4; color: var(--heading); }
.cert span { display: block; margin-top: 3px; font: 500 .6875rem/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }

@media (max-width: 959px) {
  .xp { grid-template-columns: 1fr; gap: 0; }
}

/* 10 — Stack ------------------------------------------------------------- */
.stack { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: clamp(32px, 5vw, 48px); }
.stack__group { box-shadow: none; }
.stack__group--wide { grid-column: span 2; }
.stack__group .window__bar { min-height: 42px; }
.stack__group .dots i { width: 10px; height: 10px; }
.stack__group .badges { margin: 0; padding: 20px; }

@media (max-width: 959px) {
  .stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .stack { grid-template-columns: 1fr; }
  .stack__group--wide { grid-column: auto; }
}

/* 11 — Contact ----------------------------------------------------------- */
.section--contact { padding-top: clamp(24px, 4vw, 40px); }
.contact__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
  padding: clamp(28px, 5vw, 56px);
}
.contact__text h2 { margin-top: 18px; font-size: clamp(2.3rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -.045em; }
.contact__text > p:not(.eyebrow):not(.contact__email) { margin-top: 14px; max-width: 46ch; font-size: 1.0625rem; color: var(--ink-2); }
.contact__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.contact__email { margin-top: 14px; font: 500 .875rem/1.4 var(--font-mono); color: var(--ink-3); word-break: break-all; }

.terminal {
  overflow: hidden;
  border: 2px solid #3b4636;
  border-radius: var(--radius-md);
  background: #1c2319;
  box-shadow: var(--shadow-md);
  font: 500 .875rem/1.8 var(--font-mono);
  color: #dfe3d0;
}
.terminal__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 36px;
  padding: 0 14px;
  background: #252e21;
  border-bottom: 1px solid #3b4636;
  font-size: .75rem;
  letter-spacing: .06em;
  color: #98a28e;
}
.terminal__bar .dots i { width: 10px; height: 10px; }
.terminal__bar .dots i:nth-child(1) { background: #93ad84; }
.terminal__bar .dots i:nth-child(2) { background: #59644f; }
.terminal__bar .dots i:nth-child(3) { background: #e6d68f; box-shadow: none; }
.terminal__screen { padding: 18px 20px 22px; overflow-x: auto; }
.t-line { margin: 0; white-space: pre; }
.t-prompt, .t-ok { color: #a7c196; }
.t-muted { color: #8d9884; }
.t-key { color: #e6d68f; }
.terminal a { color: #f1efe3; text-decoration: underline; text-decoration-color: rgba(241, 239, 227, .35); text-underline-offset: 3px; }
.terminal a:hover { text-decoration-color: currentColor; }
.terminal a:focus-visible { outline-color: #e6d68f; }
.t-cursor { display: inline-block; width: .6em; height: 1.1em; vertical-align: -.2em; background: #a7c196; animation: blink-cursor 1.1s steps(1) infinite; }

/* Typing effect — only armed when JavaScript runs and motion is allowed */
.terminal.is-armed .t-line { opacity: 0; }
.terminal.is-live .t-line { animation: t-show .01s linear forwards; animation-delay: calc(var(--d) * 1ms); }
.terminal.is-live .t-cmd { display: inline-block; overflow: hidden; vertical-align: bottom; width: 0; animation: t-type .9s steps(12, end) forwards; }

@media (max-width: 899px) {
  .contact__body { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .terminal { font-size: .75rem; }
  .terminal__screen { padding: 14px 14px 18px; }
  .t-line { white-space: pre-wrap; word-break: break-word; }
}

/* 12 — Footer ------------------------------------------------------------ */
.site-footer { padding-bottom: 96px; } /* leaves room for the floating Chat button */
.footer-window { box-shadow: none; }
.footer-scene { width: 100%; height: clamp(84px, 9vw, 104px); background: var(--surface-2); }
.footer-scene__lines { stroke: var(--line); }
.window__bar--bottom { justify-content: space-between; min-height: 40px; border-top: 1px solid var(--line); border-bottom: 0; }
.window__bar--bottom .dots i { width: 10px; height: 10px; }
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 20px 4px 0;
  font-size: .875rem;
  color: var(--ink-3);
}
.to-top { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--label); text-decoration: none; }
.to-top:hover { text-decoration: underline; }
.to-top .icon { width: 12px; height: 12px; }

/* 13 — Case study dialog ------------------------------------------------- */
.case {
  width: min(920px, calc(100vw - 24px));
  max-width: none;
  max-height: min(92vh, 980px);
  max-height: min(92dvh, 980px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.case[open] { display: flex; animation: case-in .32s var(--ease-out); }
.case::backdrop { background: rgba(18, 22, 16, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.case__window {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.case__close { width: 34px; height: 34px; margin-left: auto; }
.case__close .icon { width: 14px; height: 14px; }
.case__scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: clamp(22px, 4vw, 44px); }
.case__title { margin-top: 10px; font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 800; letter-spacing: -.035em; }
.case__lead { margin-top: 10px; max-width: 62ch; font-size: 1.125rem; color: var(--ink-2); }
.case__figure { margin: 28px 0; }
.case__figure img {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  filter: var(--shot-filter);
}
.case__figure figcaption { margin-top: 8px; font: 500 .75rem/1.5 var(--font-mono); letter-spacing: .04em; color: var(--ink-3); }
.case__facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 8px;
  overflow: hidden;
  border: 1.5px solid var(--line-soft);
  border-radius: 12px;
  background: var(--line-soft);
}
.case__facts div { padding: 14px 16px; background: var(--surface-2); }
.case__facts dt { font: 600 .6875rem/1.4 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--label); }
.case__facts dd { margin: 4px 0 0; font-size: .9375rem; line-height: 1.45; color: var(--ink); }
.case__scroll h3 { margin-top: 30px; font-size: 1.125rem; font-weight: 750; letter-spacing: -.01em; }
.case__scroll h3 + p { margin-top: 10px; }
.case__scroll h3 + .points { margin-top: 12px; }
.case__scroll > p:not(.project__kicker):not(.case__lead) { color: var(--ink-2); }
.case__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; padding-top: 24px; border-top: 1px dashed var(--line); }

@media (max-width: 720px) {
  .case__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .case { width: 100vw; height: 100vh; height: 100dvh; max-height: none; }
  .case__window { border: 0; border-radius: 0; }
  .case__facts { grid-template-columns: 1fr; }
}

/* 14 — Toast ------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px 10px 12px;
  border-radius: 12px;
  background: var(--btn-dark);
  color: var(--btn-dark-ink);
  font: 600 .875rem/1.4 var(--font-sans);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: opacity .25s ease, transform .3s var(--ease-out), visibility .25s;
}
.toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast__dino { width: 22px; height: 23px; flex: none; fill: var(--butter-c); shape-rendering: crispEdges; }
[data-theme="night"] .toast__dino { fill: #5b7350; }
@media (max-width: 720px) {
  .toast { bottom: calc(max(20px, env(safe-area-inset-bottom)) + 66px); } /* sits above the Chat button */
}

/* 15 — Divider band: one scrolling row of skills ------------------------- */
.band {
  --band-bg: #405039;
  --band-ink: #f4f1e4;
  --band-accent: #f4e8b2;
  --band-edge: #354333;
  margin-top: clamp(44px, 6vw, 72px);
  overflow: hidden;
  background: var(--band-bg);
  border-block: 2px solid var(--band-edge);
  color: var(--band-ink);
  -webkit-user-select: none;
          user-select: none;
}
[data-theme="night"] .band {
  --band-bg: #1f261c;
  --band-ink: #e7e5d7;
  --band-accent: #e6d68f;
  --band-edge: #3b4636;
}
.band__row { display: flex; width: max-content; }
.band__track {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  margin: 0;
  padding: 12px 0 18px;
  list-style: none;
}
.band__track li {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.6vw, 20px);
  padding-right: clamp(12px, 1.6vw, 20px);
  font: 800 clamp(1rem, 1.9vw, 1.4rem)/1.25 var(--font-sans);
  letter-spacing: -.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* Pixel cactus between words (same shape as the GitHub artwork) */
.band__track li::after {
  content: "";
  flex: none;
  width: .5em;
  height: .6em;
  background: var(--band-accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 31 37'><path d='M10 0h9v37h-9Z M0 8h6v12h4v6H2v-3H0Z M25 3h6v20h-3v3h-9v-6h6Z'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 31 37'><path d='M10 0h9v37h-9Z M0 8h6v12h4v6H2v-3H0Z M25 3h6v20h-3v3h-9v-6h6Z'/></svg>") center / contain no-repeat;
}
/* Ground line and pebbles under the words, moving with them */
.band__track::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 20px;
  background: var(--band-accent);
  opacity: .45;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='20' viewBox='0 0 600 20'><g fill='none' stroke='black' stroke-width='2'><path d='M0 6h120l5 3h30l5-3h170l5-4h10l5 4h120l5 3h24l5-3h96'/><path d='M18 14h6m40 4h8m60-5h8m50 5h5m42-6h10m64 7h6m46-6h7m38 4h10m48-5h6m60 5h8'/></g></svg>") repeat-x 0 0 / 600px 20px;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='20' viewBox='0 0 600 20'><g fill='none' stroke='black' stroke-width='2'><path d='M0 6h120l5 3h30l5-3h170l5-4h10l5 4h120l5 3h24l5-3h96'/><path d='M18 14h6m40 4h8m60-5h8m50 5h5m42-6h10m64 7h6m46-6h7m38 4h10m48-5h6m60 5h8'/></g></svg>") repeat-x 0 0 / 600px 20px;
}
.band__row.is-ready { animation: marquee var(--marquee-time, 45s) linear infinite; }
.band:hover .band__row { animation-play-state: paused; }

/* 16 — Chat -------------------------------------------------------------- */
.chat-launcher {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 150;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 20px 0 18px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--butter-c);
  color: #405039;
  font: 800 1.0625rem/1 var(--font-sans);
  letter-spacing: -.01em;
  box-shadow: 0 12px 28px -14px rgba(36, 46, 33, .6);
  cursor: pointer;
  transition: transform .2s var(--ease-out), box-shadow .2s ease;
}
.chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -14px rgba(36, 46, 33, .7); }
.chat-launcher .icon { width: 20px; height: 20px; color: #5f7752; }

.chat__panel {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + 68px);
  z-index: 150;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(580px, calc(100vh - 120px));
  height: min(580px, calc(100dvh - 120px));
  box-shadow: var(--shadow-lg);
  transform-origin: 100% 100%;
  animation: chat-in .28s var(--ease-out);
}
.chat__panel[hidden] { display: none; }
.chat__close { width: 32px; height: 32px; margin-left: auto; }
.chat__close .icon { width: 14px; height: 14px; }
.chat__who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-soft);
}
.chat__who b { display: block; font-size: .9375rem; line-height: 1.2; color: var(--heading); }
.chat__who small { display: block; font-size: .75rem; line-height: 1.35; color: var(--ink-3); }
.chat__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--butter-c);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.chat__avatar svg { width: 22px; height: 23px; fill: #5f7752; shape-rendering: crispEdges; }
.chat__log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: .9375rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  animation: msg-in .22s var(--ease-out);
}
.msg--bot { align-self: flex-start; background: var(--surface-2); border: 1.5px solid var(--line-soft); border-bottom-left-radius: 4px; color: var(--ink); }
.msg--me { align-self: flex-end; background: var(--btn-dark); color: var(--btn-dark-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg a { color: var(--link); font-weight: 600; }
.msg__links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg__link,
.msg a.msg__link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--label);
  font: 600 .8125rem/1 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
}
.msg__link:hover { border-color: var(--accent); }
.msg a.msg__link--strong { background: var(--btn-dark); border-color: var(--btn-dark); color: var(--btn-dark-ink); }
.typing { display: inline-flex; gap: 4px; padding: 5px 0; }
.typing i { width: 6px; height: 6px; background: var(--ink-3); animation: typing 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
.chat__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.chat__chips:empty { display: none; }
.chip {
  min-height: 32px;
  padding: 0 12px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: var(--surface);
  color: var(--label);
  font: 600 .8125rem/1 var(--font-sans);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.chip:hover { background: var(--butter-c); color: #405039; }
.chat__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 8px;
  background: var(--bar);
  border-top: 1px solid var(--line);
}
.chat__form textarea {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  overflow-y: hidden;
  resize: none;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 400 1rem/1.4 var(--font-sans); /* 16px+ stops iPhones zooming in when the box is tapped */
}
.chat__form textarea::placeholder { color: var(--ink-3); }
.chat__form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat__send {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--btn-dark);
  color: var(--btn-dark-ink);
  cursor: pointer;
}
.chat__send .icon { width: 16px; height: 16px; }
.chat__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.chat__note { margin: 0; padding: 0 14px 10px; background: var(--bar); font: 500 .6875rem/1.4 var(--font-mono); letter-spacing: .03em; color: var(--ink-3); }

/* Keep the Chat button out of the way of the open mobile menu */
.nav-open .chat-launcher { display: none; }

@media (max-width: 560px) {
  .chat__panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .chat-open .chat-launcher { display: none; }
  html.chat-open { overflow: hidden; }
  .chat-launcher { height: 50px; padding: 0 18px 0 16px; }
}

@media print {
  .chat, .toast, .skip-link { display: none !important; }
  /* Sections that haven't faded in yet must still print */
  .reveal-ready [data-reveal] { opacity: 1 !important; transform: none !important; }
  /* The contact terminal prints fully typed out */
  .terminal.is-armed .t-line { opacity: 1 !important; animation: none !important; }
  .terminal .t-cmd { width: auto !important; animation: none !important; }
}

/* 17 — Motion ------------------------------------------------------------ */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.reveal-ready [data-reveal].is-visible { opacity: 1; transform: none; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(127, 150, 114, .55); }
  70% { box-shadow: 0 0 0 8px rgba(127, 150, 114, 0); }
  100% { box-shadow: 0 0 0 0 rgba(127, 150, 114, 0); }
}
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes drift { from { transform: translateX(-12px); } to { transform: translateX(12px); } }
@keyframes twinkle { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@keyframes hop {
  0% { transform: translateY(0); animation-timing-function: cubic-bezier(.15, .65, .35, 1); }
  45% { transform: translateY(-52px); animation-timing-function: cubic-bezier(.65, 0, .85, .35); }
  100% { transform: translateY(0); }
}
@keyframes blink-cursor { 50% { opacity: 0; } }
@keyframes t-show { to { opacity: 1; } }
@keyframes t-type { to { width: 12ch; } }
@keyframes case-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes chat-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes typing { 0%, 100% { transform: translateY(0); opacity: .45; } 50% { transform: translateY(-3px); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
}
