:root {
  color-scheme: light;
  --paper: #f8f7f3;
  --white: #ffffff;
  --ink: #14222e;
  --muted: #485862;
  --accent: #006a5e;
  --line: #d7dfda;
  --mint: #e3f0e9;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font: 16px/1.6 system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body, h1, h2, h3, p, figure, dl, dd { margin: 0; }
body { isolation: isolate; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle, #365d8426 1px, transparent 1.5px) 0 0 / 24px 24px,
    radial-gradient(ellipse at 72% 28%, #7dbbf58c, transparent 57%),
    radial-gradient(ellipse at 22% 72%, #ffc8a6b8, transparent 59%);
}
img { display: block; max-width: 100%; }
a { color: inherit; }
a:focus-visible { outline: 3px solid #007b6d; outline-offset: 5px; }
section[id] { scroll-margin-top: 28px; }
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }

.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus { position: absolute; z-index: 2; top: 12px; left: 12px; background: var(--white); padding: 8px 12px; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 76px; }
.brand, .header-resume, nav a, .button { text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; white-space: nowrap; }
nav { display: flex; gap: clamp(18px, 3vw, 36px); }
nav a { color: var(--muted); font-size: .9rem; font-weight: 600; }
nav a:hover, .header-resume:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.header-resume { font-size: .9rem; font-weight: 700; white-space: nowrap; }
.header-resume span { margin-left: 4px; color: var(--accent); }

.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: center; gap: clamp(28px, 5vw, 68px); padding-block: clamp(60px, 8vw, 114px) clamp(48px, 7vw, 90px); }
.eyebrow { font: 700 .72rem/1.5 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.hero .eyebrow { color: var(--accent); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #007f6e; box-shadow: 0 0 0 4px #d4eee3; margin: 0 9px 1px 4px; }
h1 { margin-top: 20px; font-size: clamp(2.65rem, 5.15vw, 4.65rem); line-height: 1.01; font-weight: 780; letter-spacing: -.065em; }
h1 span { color: #007d70; }
.hero-role { color: var(--accent); font-size: clamp(1.15rem, 2.1vw, 1.42rem); font-weight: 680; margin-top: 20px; }
.intro { color: var(--muted); max-width: 48ch; margin-top: 12px; font-size: 1.03rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.button { display: inline-flex; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 9px; padding: 10px 15px; font-size: .9rem; font-weight: 700; transition: background-color .18s, color .18s; }
.primary { color: white; background: var(--accent); }
.primary:hover { background: #005247; }
.secondary { border-color: #aebfba; }
.secondary:hover { background: var(--mint); }
.hero-art { position: relative; overflow: hidden; border: 1px solid #27414a; border-radius: 18px; background: #10232d; box-shadow: 0 20px 45px #10232d26; }
.hero-art svg { display: block; width: 100%; height: auto; }
.diagram-signal, .diagram-pulse { opacity: 0; }
.diagram-toggle {
  position: absolute;
  right: 4%;
  bottom: 4px;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid #4c827f;
  border-radius: 6px;
  background: #102630;
  color: #e6faf4;
  font: 600 .7rem/1.2 var(--mono);
  cursor: pointer;
}
.diagram-toggle:hover { background: #22434a; }
.diagram-toggle:focus-visible { outline: 2px solid #91efcd; outline-offset: 1px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); }
.stats div { padding: 19px clamp(12px, 3vw, 34px) 21px; }
.stats div:first-child { padding-left: 0; }
.stats div + div { border-left: 1px solid var(--line); }
.stats strong { display: block; color: var(--accent); font-size: clamp(1.2rem, 3vw, 2rem); font-weight: 750; letter-spacing: -.045em; }
.stats span { color: var(--muted); font-size: .86rem; }

.section { padding-top: clamp(62px, 8vw, 104px); }
.section-index { color: var(--accent); margin-bottom: 8px; }
h2 { font-size: clamp(2rem, 4.6vw, 3.65rem); line-height: 1.08; letter-spacing: -.055em; margin-bottom: 27px; }
h3 { font-size: 1.26rem; line-height: 1.25; letter-spacing: -.025em; }
.featured { display: grid; grid-template-columns: 1.4fr 1fr; gap: 25px; padding: clamp(24px, 4vw, 44px); background: #10232d; color: #f4fbf8; border-radius: 17px; }
.featured .eyebrow { color: #94ebcd; }
.featured h3 { margin: 10px 0; font-size: clamp(1.5rem, 3.3vw, 2.5rem); }
.featured p:not(.eyebrow, .result-value) { color: #c5d8d9; }
.featured-result { align-self: stretch; padding: clamp(17px, 3vw, 27px); border: 1px solid #385861; border-radius: 12px; background: #1a3541; }
.result-value { font-size: clamp(1.5rem, 3.75vw, 3.2rem); line-height: 1.2; font-weight: 750; letter-spacing: -.05em; margin-block: 8px 10px; }
.result-value span[aria-hidden] { color: #73e5bd; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 19px 0 0; list-style: none; }
.tags li { padding: 3px 8px; border: 1px solid #bfd9cd; border-radius: 5px; color: #215b4b; background: var(--mint); font: 600 .72rem/1.5 var(--mono); }
.featured .tags li { background: #22434a; color: #dcf6eb; border-color: #45676c; }

.project-grid, .toolkit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.project-grid { margin-top: 14px; }
.project, .toolkit-grid article { padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.project { display: flex; flex-direction: column; align-items: flex-start; }
.project .eyebrow { color: var(--accent); margin-bottom: 10px; }
.project-icon { font-size: 1rem; margin-right: 4px; }
.project p:not(.eyebrow), .toolkit-grid p { color: var(--muted); margin-top: 8px; }
.project p:not(.eyebrow) { margin-bottom: 18px; }
.project .tags { margin-top: auto; }

.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 3fr); gap: 18px; padding-block: 21px; border-bottom: 1px solid var(--line); }
.date, .credentials dt { font: 700 .75rem/1.5 var(--mono); color: var(--accent); }
.timeline .date { padding-top: 4px; }
.timeline .company { color: var(--accent); font-weight: 660; margin: 2px 0 6px; }
.timeline p { color: var(--muted); }
.timeline p.date { color: var(--accent); }

.credentials { display: grid; grid-template-columns: 1fr 1.35fr .8fr; gap: 20px; border-block: 1px solid var(--line); margin-top: 24px; padding-block: 18px; }
.credentials dd { margin-top: 4px; font-weight: 620; }
.site-footer { margin-top: clamp(64px, 9vw, 105px); padding-block: 26px; background: #e3f0e9b3; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.footer-inner p { color: var(--muted); font-size: .89rem; }
.footer-inner .footer-name { color: var(--ink); font-size: 1rem; font-weight: 750; }
.footer-inner a { color: var(--accent); font-size: .85rem; font-weight: 700; text-underline-offset: 4px; white-space: nowrap; }

@media (max-width: 760px) {
  .wrap { width: calc(100% - 40px); }
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero-art { width: min(100%, 460px); }
  h1 { font-size: clamp(2.45rem, 8.4vw, 4.1rem); }
  .featured { grid-template-columns: 1fr; gap: 18px; }
  .credentials { grid-template-columns: 1fr; gap: 14px; }
}

@media (max-width: 520px) {
  .header-inner { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding-block: 12px; }
  nav { grid-column: 1 / -1; grid-row: 2; gap: 22px; }
  nav a { padding-block: 4px; }
  .stats div { padding: 12px 8px 14px; }
  .stats span { display: block; font-size: .74rem; line-height: 1.4; }
  .project-grid, .toolkit-grid { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 5px; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes art-in {
  from { opacity: 0; transform: translateY(30px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes diagram-flow {
  0% { opacity: 0; stroke-dashoffset: 16; }
  4% { opacity: 1; }
  29% { opacity: 1; }
  34%, 100% { opacity: 0; stroke-dashoffset: -100; }
}

@keyframes diagram-ripple {
  0%, 20% { opacity: 0; transform: scale(1); }
  25% { opacity: .8; }
  52%, 100% { opacity: 0; transform: scale(1.64); }
}

@keyframes background-drift {
  from { transform: translate(-14%, -10%) scale(1.3); }
  to { transform: translate(14%, 10%) scale(1.3); }
}

@media (prefers-reduced-motion: no-preference) {
  body[data-motion]::before { animation: background-drift 6s ease-in-out infinite alternate; }
  .hero-copy > *, .has-entered {
    animation: rise-in 720ms cubic-bezier(.22, 1, .36, 1) backwards;
  }
  .hero-copy h1 { animation-delay: 120ms; }
  .hero-role { animation-delay: 240ms; }
  .hero-copy .intro { animation-delay: 340ms; }
  .hero-copy .actions { animation-delay: 460ms; }
  .hero-copy .actions:focus-within { animation: none; }
  .hero-art { animation: art-in 950ms cubic-bezier(.22, 1, .36, 1) 240ms backwards; }
  body[data-motion] .diagram-signal {
    stroke-dasharray: 16 100;
    animation: diagram-flow 4.8s linear infinite;
  }
  body[data-motion] .signal-documents { animation-delay: 650ms; }
  body[data-motion] .signal-index { animation-delay: 1.85s; }
  body[data-motion] .signal-answer { animation-delay: 3.05s; }
  body[data-motion] .diagram-pulse {
    transform-box: fill-box;
    transform-origin: center;
    animation: diagram-ripple 4.8s ease-out 650ms infinite;
  }
  body[data-motion="paused"]::before,
  body[data-motion="paused"] :is(.diagram-signal, .diagram-pulse) { animation-play-state: paused; }
  .button { transition: background-color .18s, color .18s, transform .22s, box-shadow .22s; }
  .project { transition: border-color .22s, box-shadow .22s; }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .button:hover { transform: translateY(-4px); box-shadow: 0 9px 20px #10232d29; }
  .project:hover { border-color: #aebfba; box-shadow: 0 10px 28px #10232d1a; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button { transition: none; }
  .diagram-toggle { display: none; }
}
