:root {
  --bg: #edf2f0;
  --text: #14211d;
  --muted: #4f645d;
  --line: #cad7d1;
  --soft: #f8fbfa;
  --accent: #0f766e;
  --accent-strong: #0b4f4a;
  --accent-soft: #d6ece9;
  --panel-shadow: 0 8px 20px rgba(11, 31, 28, 0.05);
  --max: 1020px;
  --sans: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.06), rgba(239, 249, 246, 0.22) 36%, rgba(14, 46, 42, 0.05) 100%),
    repeating-linear-gradient(90deg, rgba(20, 33, 29, 0.012), rgba(20, 33, 29, 0.012) 1px, transparent 1px, transparent 36px),
    linear-gradient(180deg, #f4f9f7 0%, var(--bg) 35%, #e8efec 100%);
  color: var(--text);
}

body {
  margin: 0;
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: transparent;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color 180ms ease;
}

a:hover {
  text-decoration: underline;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: var(--accent-strong);
  color: white;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(calc(-100% - 1rem));
  transition: transform 160ms ease;
}

.skip-link:focus {
  color: white;
  transform: translateY(0);
}

.site-shell {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
}

.site-header,
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.1rem 0;
  border-bottom: 1px solid rgba(79, 100, 93, 0.23);
}

.site-footer {
  border-top: 1px solid rgba(79, 100, 93, 0.23);
  border-bottom: 0;
  margin-top: 3rem;
  padding-bottom: 2rem;
}

.site-brand {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  color: inherit;
  text-decoration: none;
}

.site-brand span:first-child {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.site-brand span:last-child {
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav,
.footer-links,
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
}

.site-nav {
  align-items: center;
  column-gap: 1.1rem;
}

.nav-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.72rem;
}

.site-nav a,
.footer-links a,
.quick-links a:not(.button) {
  color: var(--text);
  text-decoration: none;
  font-weight: 520;
}

.nav-primary a {
  font-weight: 700;
}

.site-nav a[aria-current="page"] {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.site-nav a:hover,
.footer-links a:hover,
.quick-links a:not(.button):hover {
  color: var(--accent);
}

.site-main {
  padding: 2rem 0 1rem;
}

.hero,
.panel {
  margin-bottom: 1.75rem;
}

.hero-grid,
.split-columns {
  display: grid;
  gap: 1.2rem;
}

.panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 250, 248, 0.98));
  border-radius: 18px;
  padding: 1.45rem;
  box-shadow: var(--panel-shadow);
}

.page-header h1,
.hero h1,
.post h1 {
  font-family: var(--sans);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.page-header h1,
.post h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2.15rem, 4.5vw, 3.55rem);
  line-height: 1.06;
  max-width: 17ch;
}

.meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 0.4rem;
}

.eyebrow {
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--accent-strong);
  font-weight: 700;
}

.lede {
  font-size: 1.08rem;
  max-width: 68ch;
}

.hero .lede {
  color: rgba(31, 27, 24, 0.92);
}

.quick-links {
  margin-top: 1.05rem;
  gap: 0.65rem;
}

.quick-links a:not(.button) {
  padding: 0.42rem 0.72rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
}

.quick-links a:not(.button):hover {
  background: rgba(214, 236, 233, 0.55);
}

.clean-list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.compact-list li + li {
  margin-top: 0.35rem;
}

.post-list {
  display: grid;
  gap: 1rem;
}

.post-item {
  padding: 0.25rem 0;
  border-top: 1px solid var(--line);
}

.post-item:first-child {
  border-top: 0;
}

.post-item h2,
.post-item h3,
.project-card h2,
.project-card h3 {
  margin: 0.25rem 0 0.35rem;
}

.post-item h2,
.post-item h3 {
  font-family: var(--sans);
}

.post-item p,
.project-card p,
.prose p,
.prose li {
  max-width: 72ch;
}

.mini-card .meta,
.section-link {
  margin-top: 0;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading h2,
.hero-note h2 {
  margin: 0;
  font-family: var(--sans);
  line-height: 1.15;
}

.project-card h3 {
  margin-bottom: 0.3rem;
}

.signal-list {
  margin-top: 0.35rem;
}

.mini-card {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.mini-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.mini-card h3 {
  margin: 0 0 0.35rem;
  line-height: 1.25;
}

.home-project-grid {
  grid-template-columns: 1fr;
}

.section-link {
  margin-bottom: 0;
}

.hero {
  padding: 0.45rem 0 0.2rem;
}

.hero-grid {
  align-items: start;
}

.hero-note {
  position: relative;
  overflow: hidden;
}

.hero-note::after {
  content: "";
  position: absolute;
  inset: auto -2.2rem -2.2rem auto;
  width: 9rem;
  height: 9rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.2), transparent 70%);
}

.hero-note p {
  color: rgba(31, 27, 24, 0.82);
}

.signal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
  padding: 0;
  list-style: none;
}

.signal-chips li {
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  padding: 0.24rem 0.58rem;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: rgba(226, 243, 240, 0.62);
  font-weight: 700;
}

.post-content > :first-child {
  margin-top: 0;
}

.post-content h2,
.post-content h3 {
  font-family: var(--sans);
  margin-top: 1.4rem;
}

.post-hero {
  margin: 1rem 0 0;
}

.post-hero img {
  width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.post-hero figcaption,
.post-note,
.writing-callout {
  color: var(--muted);
  font-size: 0.95rem;
}

.post-note {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.writing-callout {
  margin-bottom: 1.5rem;
}

.writing-callout code {
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

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

.project-card h3 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.project-nav {
  margin-top: 1rem;
  margin-bottom: 0;
}

.project-nav a {
  font-size: 0.92rem;
  font-weight: 700;
}

.project-figure {
  margin: 1.25rem 0 1.5rem;
  scroll-margin-top: 1rem;
}

.project-diagram-link,
.project-figure picture,
.project-figure img {
  display: block;
}

.project-diagram-link {
  border-radius: 14px;
}

.project-figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.project-figure figcaption {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.button,
.text-link {
  display: inline-block;
}

.button {
  padding: 0.72rem 1rem;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: white;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid rgba(9, 73, 67, 0.18);
  box-shadow: 0 8px 20px rgba(9, 73, 67, 0.24);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.button:hover {
  background: linear-gradient(180deg, #0c6a63, #094944);
  color: white;
  text-decoration: none;
}

table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.66rem 0.72rem;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

thead th {
  border-top: 0;
  background: rgba(214, 236, 233, 0.5);
  font-weight: 700;
}

tbody tr:nth-child(even) {
  background: rgba(248, 252, 251, 0.78);
}

.resume-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 1.4rem;
}

.resume-actions .meta {
  margin: 0;
}

@media (min-width: 760px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.85fr);
    gap: 1.6rem;
  }

  .split-columns {
    grid-template-columns: 1fr 1fr;
  }

  .home-project-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-project-grid .mini-card {
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 0 0 0 1rem;
  }

  .home-project-grid .mini-card:first-child {
    border-left: 0;
    padding-left: 0;
  }

  .home-project-grid .mini-card:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 1rem;
    padding-left: 0;
  }
}

@media (min-width: 960px) {
  .home-project-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .home-project-grid .mini-card:nth-child(3) {
    grid-column: auto;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding-top: 0;
    padding-left: 1rem;
  }
}

@media (max-width: 720px) {
  .site-header,
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
  }

  .site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .hero h1 {
    max-width: none;
    font-size: clamp(1.95rem, 9vw, 2.6rem);
  }

  table {
    font-size: 0.86rem;
  }

  th,
  td {
    padding: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  html,
  body {
    background: white;
  }

  .resume-page {
    color: #000;
    font-size: 10pt;
    line-height: 1.35;
  }

  .resume-page .skip-link,
  .resume-page .site-header,
  .resume-page .site-footer,
  .resume-page .page-header,
  .resume-page .resume-actions {
    display: none !important;
  }

  .resume-page .site-shell {
    width: 100%;
    margin: 0;
  }

  .resume-page .site-main {
    padding: 0;
  }

  .resume-page .panel {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: white;
    box-shadow: none;
  }

  .resume-page .prose h2 {
    margin: 0 0 0.25rem;
    font-size: 18pt;
  }

  .resume-page .prose h3 {
    margin: 0.8rem 0 0.2rem;
    font-size: 11pt;
    break-after: avoid;
  }

  .resume-page .prose p {
    margin: 0.2rem 0;
  }

  .resume-page .clean-list {
    margin-top: 0.2rem;
  }

  .resume-page a {
    color: #000;
    text-decoration: none;
  }

  .resume-page li,
  .resume-page p {
    break-inside: avoid;
  }
}
