:root {
  --bg: #1f2326;
  --bg-raise: #262b2f;
  --text: #e8ebe6;
  --muted: #a9b1ab;
  --accent: #a9c98a;
  --accent-ink: #1b2417;
  --rule: #353b40;
  --focus: #d3e8bd;

  --glass: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  --glass-line: rgba(255, 255, 255, 0.09);
  --glow: rgba(169, 201, 138, 0.5);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --measure: 66ch;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(50% 40% at 92% 8%, rgba(169, 201, 138, 0.07), transparent 70%),
    radial-gradient(45% 40% at 4% 96%, rgba(96, 140, 150, 0.06), transparent 70%);
}

::selection { background: rgba(169, 201, 138, 0.35); color: var(--text); }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--focus); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
/* Sections and headings that script focuses after Enter Portfolio, Back to top and skip links are not controls. */
[tabindex="-1"]:focus-visible { outline: none; }

.skip {
  position: absolute; left: var(--gutter); top: -60px;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 6px; font-weight: 600; z-index: 10;
}
.skip:focus { top: 12px; }

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

/* Launch screen */
.launch {
  position: relative;
  padding: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}

.launch-glow {
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(55% 55% at 72% 46%, rgba(169, 201, 138, 0.2), transparent 70%),
    radial-gradient(38% 30% at 72% 92%, rgba(169, 201, 138, 0.09), transparent 70%),
    linear-gradient(180deg, #171b1d 0%, #1f2326 100%);
}

.launch-vignette {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 60% 45%, transparent 55%, rgba(0, 0, 0, 0.38) 100%);
}

.launch-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.launch-name {
  width: fit-content;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(3.4rem, 9vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-shadow: 0 0 22px rgba(255, 80, 120, 0), 0 0 46px rgba(80, 200, 255, 0), 0 0 80px rgba(160, 120, 255, 0);
  transition: text-shadow 0.45s ease;
}
.launch-name:hover {
  text-shadow: 0 0 22px rgba(255, 80, 120, 0.6), 0 0 46px rgba(80, 200, 255, 0.5), 0 0 80px rgba(160, 120, 255, 0.45);
}
.i-spade { position: relative; display: inline-block; }
.spade {
  position: absolute;
  left: 50%;
  bottom: 0.65em;
  width: 0.17em;
  height: 0.2em;
  transform: translateX(-50%);
  fill: #e0192f;
  transition: filter 0.45s ease;
}
.launch-name:hover .spade { filter: drop-shadow(0 0 0.08em rgba(255, 60, 80, 0.9)); }

.launch-headline {
  margin-top: 22px;
  max-width: 42ch;
  color: var(--accent);
  font-size: clamp(1rem, 2vw, 1.5rem);
  line-height: 1.4;
}
.hl-line { display: inline-block; text-wrap: balance; }

.launch-actions { margin-top: 32px; }

/* Launch gate: the portfolio stays asleep until Enter, then fades in */
.intro-active .layout, .intro-skip .launch { display: none; }
.launch.is-gone { display: none; }
.launch.is-leaving {
  opacity: 0;
  filter: blur(8px);
  transform: scale(1.03);
  pointer-events: none;
  transition: opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease;
}

@keyframes launch-return {
  from { opacity: 0; filter: blur(8px); transform: scale(1.03); }
  to { opacity: 1; filter: none; transform: none; }
}
.launch.is-returning { animation: launch-return 0.6s ease both; }
.portfolio-leaving .layout { opacity: 0; transform: translateY(12px); transition: opacity 0.35s ease, transform 0.35s ease; }
@media (prefers-reduced-motion: reduce) {
  .launch.is-returning { animation: none; }
  .portfolio-leaving .layout { transition: none; }
}

@keyframes live-in {
  from { opacity: 0; transform: translateY(24px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .portfolio-live .layout { animation: live-in 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .portfolio-live .rail-inner > * { animation: live-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 70ms + 160ms); }
  .rail-inner > :nth-child(2) { --i: 1; }
  .rail-inner > :nth-child(3) { --i: 2; }
  .rail-inner > :nth-child(4) { --i: 3; }
  .rail-inner > :nth-child(5) { --i: 4; }
  .rail-inner > :nth-child(6) { --i: 5; }
}

/* Layout */
.layout { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

.rail { padding: 40px 0 8px; }

.eyebrow { color: var(--muted); font-size: 0.875rem; letter-spacing: 0.08em; text-transform: uppercase; }

.name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  line-height: 1.1;
  margin-top: 10px;
  letter-spacing: -0.01em;
}

.headline { font-size: 1.1875rem; line-height: 1.4; margin-top: 14px; color: var(--accent); max-width: 30ch; }
.tagline { margin-top: 10px; color: var(--muted); font-size: 0.9375rem; }

.nav { margin-top: 28px; margin-bottom: 20px; }
.nav ul { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.nav a {
  display: inline-block; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 0.9375rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, text-shadow 0.25s ease, box-shadow 0.25s ease;
}
.nav a:hover, .nav a:focus-visible {
  color: var(--text);
  border-bottom-color: rgba(169, 201, 138, 0.55);
  text-shadow: 0 0 16px rgba(169, 201, 138, 0.7);
  box-shadow: 0 8px 16px -12px var(--glow);
}
.nav a[aria-current="true"] { color: var(--text); border-bottom-color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--accent); border-radius: 10px;
  color: var(--accent); background: transparent;
  font-weight: 600; font-size: 0.9375rem; text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.btn:hover { background: rgba(169, 201, 138, 0.12); color: var(--focus); transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--focus); color: var(--accent-ink); box-shadow: 0 0 0 4px rgba(169, 201, 138, 0.16), 0 10px 28px -10px var(--glow); }
.btn .meta { font-weight: 500; font-size: 0.75rem; opacity: 0.75; }

/* Content */
.content { padding-bottom: 40px; }
section { padding: 64px 0 8px; }
.section-title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.15; letter-spacing: -0.01em;
  padding-bottom: 16px; margin-bottom: 30px;
  background: linear-gradient(90deg, var(--rule), rgba(53, 59, 64, 0)) left bottom / 100% 1px no-repeat;
  display: flex; align-items: center; gap: 14px;
}
.section-title::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--glow); }

.lead { font-family: var(--serif); font-size: clamp(1.375rem, 2.2vw, 1.75rem); line-height: 1.45; max-width: var(--measure); margin-bottom: 22px; }
section p { max-width: var(--measure); }
section p + p { margin-top: 16px; }
.note { color: var(--muted); font-size: 0.9375rem; margin-top: 20px; }

.subhead { font-family: var(--serif); font-weight: 600; font-size: 1.375rem; margin: 44px 0 16px; }
.subhead.first { margin-top: 0; }

/* Glass surfaces */
.tiles li, .pillars > li, .case, .chips li {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 34px -22px rgba(0, 0, 0, 0.7);
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.tiles li:hover, .pillars > li:hover, .case:hover, .chips li:hover {
  border-color: rgba(169, 201, 138, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 40px -22px rgba(0, 0, 0, 0.8), 0 0 28px -14px var(--glow);
}
.tiles li:hover, .pillars > li:hover { transform: translateY(-2px); }

/* Impact tiles */
.tiles { display: grid; grid-template-columns: 1fr; gap: 14px; }
.tiles li { border-radius: 14px; padding: 22px; }
.tile-tag { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 10px; }
.tile-num { font-family: var(--serif); font-size: clamp(1.75rem, 2.2vw, 2.125rem); line-height: 1.05; color: var(--accent); text-shadow: 0 0 28px rgba(169, 201, 138, 0.28); }
.tile-text { margin-top: 10px; color: var(--text); font-size: 0.9375rem; line-height: 1.5; }

/* About: at a glance */
.glance { display: grid; grid-template-columns: 1fr 1fr 1.8fr; gap: 20px 16px; margin-top: 34px; padding: 24px 0; border-top: 1px solid var(--glass-line); border-bottom: 1px solid var(--glass-line); max-width: none; }
.glance dt { order: 2; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; margin: 0; }
.glance dd { order: 1; font-family: var(--serif); font-size: 2rem; line-height: 1.1; color: var(--accent); margin: 0 0 6px; max-width: none; text-shadow: 0 0 26px rgba(169, 201, 138, 0.25); }
.glance > div { display: flex; flex-direction: column; }
.glance .paren { font-family: var(--sans); font-size: 0.9375rem; color: var(--muted); white-space: nowrap; text-shadow: none; }
.creds-line { margin-top: 16px; color: var(--muted); font-size: 0.9375rem; }

/* Focus areas */
.pillars { display: grid; grid-template-columns: 1fr; gap: 14px; }
.pillars > li { position: relative; border-radius: 14px; padding: 22px; overflow: hidden; }
.pillars > li::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--accent), rgba(169, 201, 138, 0)); }
.pillars h4 { font-family: var(--serif); font-size: 1.1875rem; line-height: 1.3; font-weight: 600; margin-bottom: 8px; }
.pillars .plain li { font-size: 0.9375rem; line-height: 1.55; margin-top: 10px; padding-left: 16px; }
.pillars .plain li::before { width: 6px; }

/* Timeline */
.timeline > li { padding: 0; border-bottom: 1px solid var(--glass-line); }
.role summary {
  cursor: pointer; padding: 18px 0; list-style: none;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; align-items: start;
}
.role summary::-webkit-details-marker { display: none; }
.role summary > * { grid-column: 1; }
.role summary::after { content: "+"; grid-column: 2; grid-row: 1 / span 3; color: var(--accent); font-size: 1.5rem; line-height: 1; }
.role[open] summary::after { content: "\2212"; }
.dates { display: block; color: var(--muted); font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase; }
.timeline h3 { font-size: 1.1875rem; line-height: 1.35; font-weight: 600; }
.timeline h4 { font-size: 1.0625rem; line-height: 1.35; font-weight: 600; }
.org { display: block; color: var(--accent); font-size: 0.9375rem; margin-top: 2px; }
.role > ul { margin: 0; padding: 0 0 24px; }
.timeline ul li, .plain li { position: relative; padding-left: 20px; margin-top: 8px; max-width: var(--measure); }
.timeline ul li::before, .plain li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 8px; height: 2px; background: var(--accent); }

/* Case studies */
.case { border-radius: 14px; margin-top: 14px; }
.case summary {
  cursor: pointer; padding: 20px 22px; list-style: none;
  display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center;
}
.case summary > .case-title, .case summary > .case-tag { grid-column: 1; }
.case-title { display: block; font-family: var(--serif); font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.case-tag { display: block; margin-top: 4px; color: var(--muted); font-size: 0.8125rem; letter-spacing: 0.04em; font-family: var(--sans); font-weight: 500; }
.case summary::-webkit-details-marker { display: none; }
.case summary::after { content: "+"; grid-column: 2; grid-row: 1 / span 2; color: var(--accent); font-family: var(--sans); font-size: 1.5rem; line-height: 1; }
.case[open] summary::after { content: "\2212"; }
.case[open] { border-color: rgba(169, 201, 138, 0.28); }
.case dl { padding: 0 22px 22px; }
.case dt { color: var(--accent); font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 16px; }
.case dd { margin-top: 4px; max-width: var(--measure); }

/* Expertise */
.groups dt { color: var(--accent); font-weight: 600; margin-top: 22px; }
.groups dt:first-child { margin-top: 0; }
.groups dd { margin-top: 4px; max-width: var(--measure); }

/* Credentials */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 7px 15px; border-radius: 999px; font-size: 0.9375rem; }
.chips-soft li { border-style: dashed; color: var(--muted); }

.actions-row { margin-top: 20px; }

.footer { margin-top: 64px; padding-top: 20px; background: linear-gradient(90deg, var(--rule), rgba(53, 59, 64, 0)) left top / 100% 1px no-repeat; color: var(--muted); font-size: 0.875rem; }

/* Motion: restrained, and only when enabled */
.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  .launch-name,
  .launch-headline,
  .launch-actions {
    animation: launch-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .launch-headline { animation-delay: 0.12s; }
  .launch-actions { animation-delay: 0.24s; }
}

@keyframes launch-rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .nav a, .tiles li, .pillars > li, .case, .chips li { transition: none; }
  .btn:hover, .tiles li:hover, .pillars > li:hover { transform: none; }
}

/* Tablet */
@media (min-width: 640px) {
  :root { --gutter: 32px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .timeline > li { position: relative; padding-left: 28px; border-bottom: 0; border-left: 1px solid var(--glass-line); }
  .timeline > li::before { content: ""; position: absolute; left: -5px; top: 26px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--glow); }
  .role summary { grid-template-columns: 170px minmax(0, 1fr) auto; column-gap: 24px; }
  .role summary .dates { grid-column: 1; grid-row: 1 / span 2; padding-top: 4px; }
  .role summary h3, .role summary h4 { grid-column: 2; grid-row: 1; }
  .role summary .org { grid-column: 2; grid-row: 2; }
  .role summary::after { grid-column: 3; grid-row: 1 / span 2; }
}

/* Desktop: sticky identity rail */
@media (min-width: 960px) {
  .layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); column-gap: 72px; }
  .rail { position: sticky; top: 0; align-self: start; height: 100vh; padding: 80px 0 40px; }
  .rail::after { content: ""; position: absolute; right: -36px; top: 80px; bottom: 40px; width: 1px; background: linear-gradient(180deg, rgba(169, 201, 138, 0.35), rgba(169, 201, 138, 0)); }
  .rail-inner { display: flex; flex-direction: column; height: 100%; }
  .nav ul { flex-direction: column; gap: 2px; }
  .nav a { padding: 6px 0 6px 0; }
  .actions { flex-direction: column; margin-top: auto; align-items: stretch; }
  .actions .btn { justify-content: center; }
  .actions-row { flex-direction: row; }
  .actions-row .btn { justify-content: flex-start; }
  section:first-child { padding-top: 80px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1200px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .pillars { grid-template-columns: repeat(3, 1fr); }
}

/* Medium-height desktop windows: compact rail so every control stays reachable */
@media (min-width: 960px) and (max-height: 900px) {
  .rail { padding: 40px 0 24px; }
  .rail-inner { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
  .nav { margin-top: 20px; margin-bottom: 16px; }
  .nav a { padding: 3px 0; }
  .actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .actions li { flex: 1 1 0; }
  .actions li:first-child { flex-basis: 100%; }
  .actions .btn { width: 100%; justify-content: center; }
}

/* Short desktop windows: let the rail scroll instead of clipping */
@media (min-width: 960px) and (max-height: 720px) {
  .rail { height: auto; position: static; }
  .rail::after { display: none; }
  .actions { margin-top: 28px; }
}

@media print {
  body { background: #fff; color: #000; }
  body::before, .launch { display: none; }
  .rail .nav, .skip { display: none; }
  .js .reveal { opacity: 1; transform: none; }
}

/* Corner buttons: back to top, back to launch pad */
.to-top, .launch-back {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(169, 201, 138, 0.45);
  border-radius: 50%;
  background: rgba(31, 35, 38, 0.55);
  color: var(--accent);
  cursor: pointer;
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, bottom 0.25s ease, visibility 0.25s, background-color 0.2s ease, border-color 0.2s ease;
}
.to-top.is-shown ~ .launch-back { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 54px); }
.to-top.is-shown, .launch-back.is-shown { opacity: 0.7; visibility: visible; transform: none; }
.to-top.is-shown:hover, .to-top.is-shown:focus-visible,
.launch-back.is-shown:hover, .launch-back.is-shown:focus-visible { opacity: 1; background: rgba(31, 35, 38, 0.85); border-color: var(--accent); }
.corner-label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(31, 35, 38, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transform: translate(6px, -50%);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.to-top:hover .corner-label, .to-top:focus-visible .corner-label,
.launch-back:hover .corner-label, .launch-back:focus-visible .corner-label { opacity: 1; transform: translate(0, -50%); }

@media (prefers-reduced-motion: reduce) {
  .to-top, .launch-back, .corner-label { transition: none; transform: none; }
  .corner-label { transform: translateY(-50%); }
}

@media print { .to-top, .launch-back { display: none; } }

/* Mail chooser */
.mail-menu {
  position: fixed;
  z-index: 40;
  min-width: 248px;
  padding: 6px;
  border: 1px solid rgba(169, 201, 138, 0.4);
  border-radius: 14px;
  background: rgba(31, 35, 38, 0.97);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.8), 0 0 28px -14px var(--glow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.mail-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.mail-menu-address { padding: 8px 12px 6px; color: var(--muted); font-size: 0.8125rem; word-break: break-all; }
.mail-menu-item {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.mail-menu-item:hover, .mail-menu-item:focus-visible { background: rgba(169, 201, 138, 0.14); color: var(--focus); }
@media (prefers-reduced-motion: reduce) { .mail-menu { transition: none; transform: none; } }
@media print { .mail-menu { display: none; } }

.copy-buffer { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }
