:root {
  --paper: #faf8f5;
  --ink: #1a1816;
  --muted: #5c534a;
  --line: #d4cdc2;
  --accent: #075a4e;
  --accent-2: #8a3018;
  --soft: #ece4da;
  --glow: rgba(138, 48, 24, 0.08);
  --card-bg: rgba(250, 248, 245, 0.75);
  --header-bg: transparent;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --card-border-hover: var(--accent);
}

:root.dark {
  --paper: #141210;
  --ink: #ddd6ce;
  --muted: #90847a;
  --line: #2a2521;
  --accent: #1a9a85;
  --accent-2: #c45a3a;
  --soft: #1e1a17;
  --glow: rgba(196, 90, 58, 0.08);
  --card-bg: rgba(20, 18, 16, 0.85);
  --header-bg: rgba(20, 18, 16, 0.9);
  --shadow-color: rgba(0, 0, 0, 0.25);
  --card-border-hover: var(--accent);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(ellipse 80% 40% at 50% -6%, var(--glow), transparent);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-2);
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}

h1,
h2,
h3,
p,
ul,
ol {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.1;
  font-weight: 720;
  text-wrap: balance;
}

h1 {
  max-width: 14ch;
  margin-bottom: 1rem;
  font-size: clamp(2.65rem, 7vw, 5.2rem);
  letter-spacing: -0.02em;
}

h2 {
  color: var(--accent-2);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 750;
}

.site-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header,
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.site-header {
  align-items: center;
  padding: 32px 0 20px;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 2px 0 var(--accent);
  margin-bottom: 0;
  background: var(--header-bg);
  transition: background 0.3s, border-color 0.3s;
}

.site-footer {
  padding: 32px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.wordmark {
  display: inline-grid;
  min-width: 9rem;
  color: var(--ink);
  font-weight: 760;
  line-height: 0.95;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: opacity 0.2s;
}

.wordmark:hover {
  opacity: 0.7;
}

.wordmark span:last-child {
  color: var(--accent-2);
}

.site-nav,
.actions,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-nav {
  justify-content: flex-end;
}

.site-nav a,
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.site-nav a:hover,
.site-nav a[aria-current="page"],
.button-link:hover {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent);
}

.site-nav a[aria-current="page"] {
  border-color: var(--accent);
  color: var(--accent);
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(3rem, 7vw, 5rem) 0 3.5rem;
}

.kicker {
  margin-bottom: 1.25rem;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-copy,
.page-intro,
.post-description {
  max-width: 42rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.7;
}

.hero-copy {
  text-wrap: pretty;
}

.actions {
  margin-top: 1.75rem;
  gap: 0.6rem;
}

.profile-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
  justify-items: start;
}

.profile-panel img {
  width: min(100%, 260px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  filter: saturate(0.9) contrast(1.06);
}

.profile-note {
  max-width: 19rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(140px, 0.3fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  padding: 4rem 0;
  border-top: 1px solid var(--line);
}

.prose {
  display: grid;
  gap: 1.25rem;
  max-width: 46rem;
}

.prose p {
  text-wrap: pretty;
  line-height: 1.7;
}

.role ul {
  padding-left: 1.2rem;
  margin-top: 0.8rem;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.role li {
  color: var(--ink);
  line-height: 1.55;
  font-size: 0.95rem;
}

.role li u {
  color: var(--ink);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: var(--deep-teal);
  text-underline-offset: 2px;
  text-decoration-thickness: 1.5px;
}

.signal-list,
.timeline,
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.signal,
.role,
.post-card {
  min-height: 100%;
  padding: 1.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.25s, border-color 0.25s;
}

.signal:hover,
.role:hover,
.post-card:hover {
  box-shadow: 0 2px 8px var(--shadow-color);
  border-color: var(--card-border-hover);
}

.signal strong,
.role strong,
.post-card a {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 720;
  font-size: 1.1rem;
  color: var(--accent);
}

[aria-labelledby="resume-publications"] .signal strong {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.signal span,
.role > span,
.post-card p,
.post-card time {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.6;
}

.project-card {
  min-height: 100%;
  padding: 1.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.25s, border-color 0.25s;
}

.project-card:hover {
  box-shadow: 0 2px 8px var(--shadow-color);
  border-color: var(--card-border-hover);
}

.project-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.project-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
}

.project-icon svg {
  width: 24px;
  height: 24px;
}

.project-meta {
  flex: 1;
}

.project-title {
  margin: 0 0 0.25rem 0;
  font-weight: 720;
  font-size: 1.15rem;
  line-height: 1.25;
}

.project-title a {
  color: var(--accent);
  text-decoration: none;
}

.project-title a:hover {
  color: var(--rust);
  text-decoration: underline;
}

.project-kicker {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.project-desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0.5rem 0 1.25rem 0;
  flex-grow: 1;
}

.project-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.project-tag {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  border: 1px solid var(--line);
}

.project-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.project-link {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.project-link:hover {
  color: var(--rust);
  text-decoration: underline;
}

.role > span {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  color: var(--muted);
}

.resume-subtitle {
  margin: 0;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 600;
}

.resume-content {
  max-width: 100%;
  padding: 2rem 0 3rem;
}

.resume-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--line);
  color: var(--accent-2);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.resume-content h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.25rem;
  color: var(--ink);
  font-size: 1.1rem;
}

.resume-content h3 + strong {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.resume-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--soft);
  border-radius: 6px;
  color: var(--muted);
  font-style: italic;
}

.resume-content table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.resume-content th {
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--accent);
  text-align: left;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.resume-content td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.resume-content ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

.resume-content li {
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.resume-content li strong {
  color: var(--accent-2);
}

.resume-content hr {
  margin: 2rem 0;
  border: none;
  border-top: 1px solid var(--line);
}

.resume-content a {
  font-weight: 500;
}

.page-hero,
.resume-hero {
  padding: clamp(2.5rem, 5vw, 4rem) 0 2rem;
}

.page-hero .kicker {
  margin-bottom: 0.75rem;
}

.page-intro {
  text-wrap: pretty;
}

.post {
  padding: 2rem 0 4rem;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.post-header .kicker {
  color: var(--muted);
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.post-header h1 {
  max-width: 100%;
}

.post-body {
  max-width: 46rem;
}

.post-body p {
  text-wrap: pretty;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

.back-link::before {
  content: "←";
  font-size: 1rem;
  line-height: 1;
}

.resume-hero {
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.resume-hero h1 {
  margin-bottom: 0.5rem;
}

.resume-pdf {
  margin-top: 2rem;
}

.resume-viewer {
  width: 100%;
  min-height: 78vh;
  margin: 1rem 0 3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

@media (max-width: 760px) {
  .resume-content table,
  .resume-content thead,
  .resume-content tbody,
  .resume-content th,
  .resume-content td,
  .resume-content tr {
    display: block;
  }

  .resume-content thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .resume-content tr {
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.5rem;
  }

  .resume-content td {
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 0;
  }

  .resume-content td:last-child {
    border-bottom: none;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

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

.theme-icon-dark,
:root.dark .theme-icon-light {
  display: none;
}

:root.dark .theme-icon-dark {
  display: block;
}

@keyframes theme-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.theme-toggle:active svg {
  animation: theme-spin 0.4s ease;
}


@media (max-width: 760px) {
  body {
    background-image: none;
  }

  .site-shell {
    width: min(1120px, calc(100% - 32px));
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 0 16px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .home-hero,
  .section-grid,
  .signal-list,
  .timeline,
  .post-list {
    grid-template-columns: 1fr;
  }

  .home-hero {
    padding-top: 2rem;
    gap: 2rem;
  }

  .section-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 2.5rem 0;
  }

  .profile-panel {
    border-top: 1px solid var(--line);
    padding-top: 1.5rem;
  }

  .profile-panel img {
    width: min(100%, 200px);
  }
}
