/* Centred single-column layout. Dark by default, light theme via body.light. */

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

:root {
  --bg: #0c0c0b;
  --bg-raised: #131312;
  --surface: #181816;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8e6df;
  --text-dim: #a3a099;
  --muted: #78756d;
  --accent: #b5e0c8;
  --accent-deep: #4caf7d;
  --amber: #d4a24c;

  --serif: 'DM Serif Display', Georgia, serif;
  --mono: 'DM Mono', 'Courier New', monospace;
  --sans: 'Instrument Sans', system-ui, sans-serif;

  --measure: 720px;
  --gutter: 24px;
}

body.light {
  --bg: #f4f2ec;          /* a touch deeper so white cards actually read as raised */
  --bg-raised: #ffffff;
  --surface: #eae7de;
  --border: rgba(28, 25, 20, 0.14);
  --border-strong: rgba(28, 25, 20, 0.26);
  --text: #171613;
  --text-dim: #403e38;    /* darker than the dark-mode equivalent. light bg needs more contrast, not less */
  --muted: #6a675f;
  --accent: #1f6b46;
  --accent-deep: #1f6b46;
  --amber: #8a5a11;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  font-family: var(--serif);
  font-size: 16px;
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-right: auto;
}

.topbar-handle {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent-deep);
  letter-spacing: 0.09em;
}

.topbar-nav { display: flex; gap: 4px; }

.topbar-nav a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.topbar-nav a:hover { color: var(--text); }

.topbar-nav a.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-deep) 12%, transparent);
}

.theme-toggle {
  font-size: 15px;
  line-height: 1;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--border-strong); }

/* ---------- Shell ---------- */

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
  /* clip, not hidden. hidden here would break the sticky header. */
  overflow-x: clip;
}

.section {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.section-title {
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 400;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 34px;
  padding-bottom: 14px;
  position: relative;
}

/* short accent rule under each section head */
.section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 44px;
  height: 2px;
  background: var(--accent-deep);
  border-radius: 2px;
}

.subsection-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.015em;
  margin: 56px 0 22px;
}

.prose p { color: var(--text-dim); margin-bottom: 16px; max-width: 66ch; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- Hero ---------- */

.hero { padding: 44px 0 48px; }

.hero-main {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 34px;
  align-items: center;
}

.hero-avatar {
  width: 150px;
  height: 150px;
  border-radius: 14px; /* squared off now that it sits beside the text */
  object-fit: cover;
  border: 1px solid var(--border-strong);
}

.hero-role {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.hero-name {
  font-family: var(--serif);
  font-size: clamp(38px, 6.5vw, 58px);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.025em;
  margin-bottom: 14px;
}

.hero-pitch {
  color: var(--text-dim);
  max-width: 46ch;
  margin-bottom: 22px;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 18px;
}

.btn {
  font-size: 13.5px;
  text-decoration: none;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #08120d;
  font-weight: 500;
}

body.light .btn-primary { color: #ffffff; }
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost { color: var(--text-dim); background: var(--surface); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }

.hero-status {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-deep);
  box-shadow: 0 0 6px var(--accent-deep);
  flex-shrink: 0;
}

/* stat strip fills the space under the hero and gives the numbers somewhere to live */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 38px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.stat { display: flex; flex-direction: column; gap: 2px; }

.stat-num {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Entrance. Avatar and stats animate as blocks, the text column line by line. */
.hero.enter .hero-avatar,
.hero.enter .hero-text > *,
.hero.enter .hero-stats {
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
}

.hero.enter .hero-avatar { animation-delay: 0.02s; }
.hero.enter .hero-text > *:nth-child(1) { animation-delay: 0.10s; }
.hero.enter .hero-text > *:nth-child(2) { animation-delay: 0.16s; }
.hero.enter .hero-text > *:nth-child(3) { animation-delay: 0.22s; }
.hero.enter .hero-text > *:nth-child(4) { animation-delay: 0.28s; }
.hero.enter .hero-text > *:nth-child(5) { animation-delay: 0.34s; }
.hero.enter .hero-stats { animation-delay: 0.40s; }

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

/* ---------- Capabilities ---------- */

.capabilities {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
}

.capabilities li {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

/* ---------- Featured project ---------- */

.feature {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px;
  margin-bottom: 16px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.feature-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.feature-name {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.badge {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

.badge-live {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 40%, transparent);
  background: color-mix(in srgb, var(--amber) 10%, transparent);
}

.feature-desc {
  color: var(--text-dim);
  margin-bottom: 14px;
  max-width: 66ch;
}

.feature-links { margin-top: 16px; display: flex; gap: 16px; }

.feature-links a,
.project-links a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent-deep) 40%, transparent);
  padding-bottom: 1px;
}

.feature-links a:hover,
.project-links a:hover { border-bottom-color: var(--accent); }

/* ---------- Tags ---------- */

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
}

/* ---------- Project grid ---------- */

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.project-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-name {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.project-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  flex-grow: 1;
}

.project-links { margin-top: 2px; }

/* Alternating entrance. Odd items come from the left, even from the right.
   JS adds .is-in once the item scrolls into view. */
.slide-l,
.slide-r {
  opacity: 0;
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.3, 1);
  will-change: opacity, transform;
}

.slide-l { transform: translateX(-40px); }
.slide-r { transform: translateX(40px); }

.slide-l.is-in,
.slide-r.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Experience entries ---------- */

.entry {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.entry:last-of-type { border-bottom: none; }

.entry-meta { display: flex; flex-direction: column; gap: 3px; }

.entry-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.entry-loc {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.entry-title {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.entry-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin: 4px 0 10px;
}

.entry-bullets { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.entry-bullets li {
  font-size: 14.5px;
  color: var(--text-dim);
  padding-left: 16px;
  position: relative;
  max-width: 62ch;
}

.entry-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 5px;
  height: 1px;
  background: var(--accent-deep);
}

.entry-detail {
  font-size: 14.5px;
  color: var(--text-dim);
  max-width: 62ch;
}

/* ---------- Stack ---------- */

.stack-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.stack-row:last-child { border-bottom: none; }

.stack-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding-top: 3px;
}

.stack-items { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  font-size: 13px;
  color: var(--text-dim);
  padding: 4px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
}

/* ---------- Contact ---------- */

.contact-intro { margin-bottom: 28px; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.contact-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.contact-link:hover { border-color: var(--border-strong); }

.contact-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.contact-val { font-size: 14px; color: var(--text); word-break: break-word; }

/* ---------- Footer ---------- */

footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 28px var(--gutter) 44px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

footer code { color: var(--accent-deep); }

/* ---------- Light mode depth ----------
   In dark mode a card lifts by being lighter than the page. That trick is
   unavailable on a light background, so use shadow instead. */

body.light .feature,
body.light .project-card,
body.light .contact-link {
  box-shadow: 0 1px 2px rgba(28, 25, 20, 0.05), 0 4px 14px rgba(28, 25, 20, 0.045);
}

body.light .feature:hover,
body.light .project-card:hover,
body.light .contact-link:hover {
  box-shadow: 0 2px 4px rgba(28, 25, 20, 0.06), 0 8px 22px rgba(28, 25, 20, 0.07);
}

body.light .topbar {
  box-shadow: 0 1px 0 rgba(28, 25, 20, 0.06);
}

/* the glow reads as a smudge on a pale background */
body.light .status-dot { box-shadow: none; }

/* pale amber on cream was nearly invisible */
body.light .badge-live {
  color: var(--amber);
  background: rgba(138, 90, 17, 0.09);
  border-color: rgba(138, 90, 17, 0.32);
}

body.light .chip,
body.light .tag,
body.light .capabilities li {
  background: var(--surface);
  border-color: rgba(28, 25, 20, 0.12);
}

body.light .btn-ghost { background: #ffffff; }

body.light .topbar-nav a.active {
  background: rgba(31, 107, 70, 0.10);
  color: var(--accent-deep);
}

/* ---------- Responsive ---------- */

@media (max-width: 700px) {
  .topbar-nav { display: none; }
  .topbar { padding: 12px 18px; }

  .hero { padding: 30px 0 38px; }
  .hero-main { grid-template-columns: 1fr; gap: 20px; }
  .hero-avatar { width: 104px; height: 104px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 28px; }
  .stat-num { font-size: 24px; }
  .stat-label { font-size: 10px; }
  .section { padding: 46px 0; }

  .projects-grid,
  .contact-grid { grid-template-columns: 1fr; }

  .entry,
  .stack-row { grid-template-columns: 1fr; gap: 10px; }

  .entry-meta { flex-direction: row; gap: 10px; align-items: baseline; }

  .feature { padding: 20px; }
  .feature-name { font-size: 24px; }
  .project-name { font-size: 19px; }
  .entry-title { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
