:root {
  /* ---- Light-mode palette · 60-30-10 distribution ----
     60% surface : off-white page + white cards (low eye-strain, lets work pop)
     30% structure: navy / charcoal / slate text and borders (authority)
     10% accent  : royal-blue links (academic) + deep-teal CTAs (portfolio)
     Every text colour is verified WCAG AAA (>=7:1) on the off-white base;
     white-on-teal CTA text is 7.6:1 (AAA). */

  /* 60 — surfaces */
  --color-bg: #f8f9fa;             /* page base — off-white / alabaster */
  --color-card: #ffffff;           /* cards & raised surfaces */
  --color-surface: #eef2f7;        /* code blocks, subtle fills */

  /* 30 — structure & text */
  --color-heading: #0f172a;        /* navy     · 16.9:1 AAA */
  --color-text: #334155;           /* charcoal ·  9.8:1 AAA */
  --color-text-secondary: #475569; /* slate    ·  7.2:1 AAA */
  --color-muted: #475569;          /* slate    ·  7.2:1 AAA */
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;

  /* 10 — accent */
  --color-accent: #1746c9;         /* royal blue · links/anchors · 7.2:1 AAA */
  --color-accent-hover: #143ca8;   /* 8.9:1 AAA */
  --color-accent-soft: #eaeefb;    /* pale blue tint for highlights */
  --color-link: var(--color-accent);
  --color-link-hover: var(--color-accent-hover);
  --color-cta: #115e59;            /* deep teal · CTAs only · white text 7.6:1 AAA */
  --color-cta-hover: #134e4a;      /* 9.5:1 AAA */

  /* elevation */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-card-hover: 0 8px 24px rgba(15, 23, 42, 0.10);

  --header-height: 56px;
  --content-width: 1000px;   /* wide frame — same on every page; all text fills it equally */

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  overflow-y: scroll;
}

body {
  font-family: var(--font-sans);
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-height);
}

/* Smooth page load */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typography */

h1, h2, h3, h4 {
  color: var(--color-heading);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.6em;
}

h1 { font-size: var(--text-3xl); font-weight: 700; margin-top: 0; }
h2 { font-size: var(--text-2xl); margin-top: 2.5em; }
h3 { font-size: var(--text-xl); margin-top: 2em; }
h4 { font-size: var(--text-base); font-weight: 600; margin-top: 1.5em; }

p {
  margin-bottom: 1.2em;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Inline links in running prose are underlined — academic convention and
   WCAG 1.4.1 (links not distinguished by colour alone). Scoped so nav,
   buttons, the TOC and link clusters stay clean. */
.home-bio a,
.post-content a:not(.btn),
.page-content li a:not(.btn),
.page-content p:not([class]) a:not(.btn),
footer a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

strong { font-weight: 600; color: var(--color-heading); }

code {
  font-family: var(--font-mono);
  background: var(--color-surface);
  padding: 0.15em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}

pre {
  background: var(--color-surface);
  padding: 1em;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.2em;
}

pre code { background: transparent; padding: 0; }

/* Layout — single consistent width everywhere */

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

main {
  min-height: calc(100vh - 200px);
  padding-top: 3rem;
  padding-bottom: 3rem;
  animation: fadeIn 0.2s ease-out;
}

/* Header — fixed, full-width bar */

.site-header {
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.site-header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: var(--header-height);
}

.site-title {
  font-size: 1rem;
  font-weight: 600;
}

.site-title a {
  color: var(--color-heading);
  text-decoration: none;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
}

.nav-links li {
  margin: 0;
}

.nav-links a {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 450;
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--color-heading);
  text-decoration: none;
}

.nav-links a[aria-current="page"] {
  color: var(--color-accent);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--color-text);
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    flex-direction: column;
    padding: 0.75rem 2rem 1rem;
    border-bottom: 1px solid var(--color-border);
    gap: 0;
  }
  .nav-links.active { display: flex; }
  .nav-links a { display: block; padding: 0.6rem 0; }
}

/* Page content — readable text width for inner pages */

.page-content {
  max-width: none;
}

/* First element in content sits flush with the top — no dead gap,
   and aligns with the TOC sidebar heading */
.page-content > :first-child {
  margin-top: 0;
}

/* ONE focused column for every page. The container (--content-width) is the
   single source of width and is centered, so the empty space on a wide monitor
   splits evenly on both sides (balanced) and every page is identical width and
   alignment. Content fills the column edge-to-edge — no per-element cap, so there
   is no asymmetric right-side gap. The tagline keeps its own narrower pull-quote. */
.page,
.post {
  max-width: none;
}

h1, h2, h3, h4, h5, h6, .page-title {
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.page > .page-title {
  margin-bottom: 1.5rem;
}

/* TOC sidebar layout */

.content-grid {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}

.content-grid > .page-content {
  flex: 1;
  min-width: 0;
  max-width: none;
}

.toc-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  width: 170px;
  flex-shrink: 0;
}

.toc-heading {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.toc {
  list-style: none;
  display: block;
  height: auto;
  max-width: none;
  margin: 0;
  padding: 0;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc ul ul {
  padding-left: 0.75rem;
}

.toc a {
  display: block;
  padding: 0.2rem 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color 0.15s;
}

.toc a:hover { color: var(--color-heading); }
.toc a.active { color: var(--color-heading); font-weight: 600; }

@media (max-width: 900px) {
  .toc-sidebar { display: none; }
}

/* Footer */

footer {
  border-top: 1px solid var(--color-border);
  padding: 1rem 0;
  margin-top: 3rem;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-muted);
}

footer p { text-align: center; }
footer a { color: var(--color-muted); }
footer a:hover { color: var(--color-heading); }

/* Lists */

ul, ol {
  margin-left: 1.5em;
  margin-bottom: 1.2em;
}

li {
  margin-bottom: 0.5em;
  line-height: 1.65;
}

/* Homepage: profile */

.profile {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.profile-photo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--color-card);
  box-shadow: 0 0 0 1px var(--color-border), var(--shadow-card);
}

.profile-info h1 {
  font-size: var(--text-2xl);
  margin-bottom: 0.15em;
}

.profile-info .role {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  margin-bottom: 0.3em;
}

.profile-info .links {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.profile-info .links a {
  color: var(--color-link);
  margin-right: 0.5rem;
}


@media (max-width: 480px) {
  .profile { flex-direction: column; align-items: center; text-align: center; }
  .profile-info .links a { margin: 0 0.25rem; }
  .profile-photo { width: 100px; height: 100px; }
}

/* Homepage: positioning hook — the line a recruiter reads first */

.tagline {
  font-size: var(--text-xl);
  line-height: 1.5;
  font-weight: 500;
  color: var(--color-heading);
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--color-accent-soft);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 8px 8px 0;
}

/* Home call-to-action row — primary action a recruiter can act on immediately. */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 2.5rem;
}

@media (max-width: 480px) {
  .tagline { font-size: var(--text-lg); max-width: none; }
}

/* Homepage: sections */

.home-section {
  margin-top: 2.5rem;
}

.home-section h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--color-heading);
}

/* Work items — card grid that fills the full editorial frame width */

.work-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 700px) {
  .work-grid { grid-template-columns: 1fr; gap: 1rem; }
}

/* Cards (Miller's Law — chunk projects into scannable blocks). The hover lift
   signals interactivity and gives the grid depth against the off-white page. */
.work-item {
  margin-bottom: 0;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.work-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-border-strong);
}

.work-item h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0 0 0.15em;
}

.work-item .meta {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: 0.3em;
}

.work-item p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

/* Separator */

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5rem 0;
}


/* CV page */

.cv-header {
  text-align: left;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.cv-header .cv-name {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-top: 0;
}

.cv-contact {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0.75em 0;
}

.cv-download { margin-top: 1rem; }

.cv-footer {
  text-align: left;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: var(--text-sm);
}

/* Skills — scannable label/value rows (a recruiter reads these in seconds) */

.skills {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.55rem 1.5rem;
  margin: 0 0 1.2em;
}

.skills dt {
  font-weight: 600;
  color: var(--color-heading);
}

.skills dd {
  margin: 0;
  color: var(--color-text);
}

@media (max-width: 560px) {
  .skills {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .skills dt { margin-top: 0.7rem; }
  .skills dt:first-child { margin-top: 0; }
  .skills dd { margin: 0.1rem 0 0; }
}

/* Buttons */

/* Primary CTA (Fitts's Law — large, high-contrast target with generous padding,
   set apart from competing links). Filled deep teal, white text 7.6:1 (AAA). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.7em 1.6em;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  background: var(--color-cta);
  border: 1px solid var(--color-cta);
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  background: var(--color-cta-hover);
  border-color: var(--color-cta-hover);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

/* Secondary CTA — outline, so it supports the primary teal without competing
   (teal text on off-white is 7.6:1, AAA). */
.btn-secondary {
  color: var(--color-cta);
  background: transparent;
  border-color: var(--color-border-strong);
  box-shadow: none;
}

.btn-secondary:hover {
  color: #fff;
  background: var(--color-cta);
  border-color: var(--color-cta);
}

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
}

th, td {
  padding: 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 600;
  color: var(--color-heading);
}

/* Images */

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Utilities */

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

/* Skip link: hidden until focused by keyboard, then revealed top-left */
.sr-only:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.6rem 1rem;
  clip: auto;
  background: var(--color-bg);
  color: var(--color-link);
  border: 1px solid var(--color-link);
  border-radius: 4px;
  z-index: 1100;
}

*:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

/* Blog */

.post-list { margin-top: 1rem; max-width: var(--reading-width); }

.post-item {
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.post-date {
  font-size: var(--text-sm);
  color: var(--color-muted);
  display: inline-block;
  min-width: 7em;
}

.post-desc {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

/* Back link — sits above the title on posts (Anthropic "Back to Overview"). */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-bottom: 1.5rem;
  padding: 0.3rem 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.back-link:hover {
  color: var(--color-link);
  text-decoration: none;
}

.post-header { margin-bottom: 2rem; }

.post-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: 0.3em;
}

.post-meta {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.post-content {
  margin-bottom: 3rem;
}

.post-navigation {
  display: flex;
  justify-content: space-between;
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.disqus-comments {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.disqus-comments h2 {
  font-size: var(--text-xl);
  margin-top: 0;
  margin-bottom: 1.5rem;
}

/* Contact page */

.contact-links {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
}

.section-compact {
  margin-top: 1em;
  margin-bottom: 0.5em;
}

/* Calendar embed — rendered inline as part of the page, no container chrome */

.calendar-embed {
  margin-top: 0.5rem;
}

.calendar-embed iframe {
  display: block;
  width: 100%;
  height: 800px;
  border: 0;
  overflow: hidden;
}

@media (max-width: 640px) {
  .calendar-embed iframe {
    height: 1400px;
  }
}

/* Utilities */

.text-muted {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

/* Print */

@media print {
  header, footer, .nav-toggle { display: none; }
  body { color: #000; background: #fff; padding-top: 0; }
  a { color: #000; text-decoration: underline; }
  .container { max-width: 100%; padding: 0; }
}
