:root {
  --ink: #152028;
  --ink-soft: #3d4a55;
  --muted: #6b7883;
  --paper: #f3f1ec;
  --paper-deep: #e4e8ec;
  --line: rgba(21, 32, 40, 0.12);
  --accent: #1f5c4d;
  --accent-hover: #17483c;
  --display: "Cormorant Garamond", Georgia, serif;
  --sans: "Figtree", system-ui, sans-serif;
  --space: clamp(1.25rem, 3vw, 2.5rem);
  --max: 68rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.65;
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 55% at 12% -10%, rgba(31, 92, 77, 0.14), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 8%, rgba(61, 90, 120, 0.12), transparent 50%),
    linear-gradient(165deg, #eef2f4 0%, #f3f1ec 42%, #ebe6df 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

a {
  color: inherit;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  backdrop-filter: blur(10px);
  background: rgba(243, 241, 236, 0.72);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.85rem 1.15rem;
}

.nav a {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--accent);
}

main {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
  padding-bottom: 4rem;
}

.hero {
  min-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3rem, 10vh, 6rem) 0 clamp(4rem, 12vh, 7rem);
  border-bottom: 1px solid var(--line);
}

.hero-kicker {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-name {
  margin: 0;
  max-width: 14ch;
  font-family: var(--display);
  font-size: clamp(3.4rem, 11vw, 6.6rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.hero-lede {
  margin: 1.4rem 0 0;
  max-width: 36rem;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #f7faf8;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.section {
  padding: clamp(3.5rem, 8vh, 5.5rem) 0;
  border-bottom: 1px solid var(--line);
}

.section-intro {
  margin-bottom: 2rem;
  max-width: 36rem;
}

.section-label {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.section h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.1rem, 4.5vw, 3rem);
  font-weight: 500;
  line-height: 1.1;
}

.entry + .entry {
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}

.entry-meta h3 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.45rem, 2.5vw, 1.85rem);
  font-weight: 600;
  line-height: 1.2;
}

.entry-role {
  margin: 0.45rem 0 0;
  font-weight: 500;
  color: var(--ink-soft);
}

.entry-place {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.entry ul {
  margin: 1rem 0 0;
  padding-left: 1.15rem;
  color: var(--ink-soft);
}

.entry li + li {
  margin-top: 0.45rem;
}

.skills-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 720px) {
  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
  }
}

.skills-grid h3 {
  margin: 0 0 0.55rem;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
}

.skills-grid p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.contact .contact-note {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.contact-list {
  display: grid;
  gap: 1.25rem;
  margin: 0;
  max-width: 28rem;
}

.contact-list div {
  display: grid;
  gap: 0.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.contact-list dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-list dd {
  margin: 0;
  min-height: 1.5rem;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.reveal {
  opacity: 0;
  transform: translateY(1.1rem);
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.hero .reveal:nth-child(1) {
  transition-delay: 0.05s;
}
.hero .reveal:nth-child(2) {
  transition-delay: 0.16s;
}
.hero .reveal:nth-child(3) {
  transition-delay: 0.28s;
}
.hero .reveal:nth-child(4) {
  transition-delay: 0.4s;
}

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

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn:hover {
    transform: none;
  }
}

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

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

  .hero {
    min-height: auto;
    padding-top: 3.5rem;
  }
}

.entry-action {
  margin: 1.15rem 0 0;
}

.btn-sm {
  padding: 0.65rem 1.05rem;
  font-size: 0.85rem;
}

.project-modal {
  width: min(920px, calc(100vw - 1.5rem));
  max-height: min(90vh, 920px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  background: #f8f6f2;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(21, 32, 40, 0.28);
}

.project-modal::backdrop {
  background: rgba(21, 32, 40, 0.55);
  backdrop-filter: blur(3px);
}

.modal-shell {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 920px);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.modal-header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 600;
  line-height: 1.15;
}

.modal-subtitle {
  margin: 0.55rem 0 0;
  max-width: 42rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.modal-close {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.modal-body {
  overflow: auto;
  padding: 1rem 1.25rem 1.5rem;
}

.notebook-chrome {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  background: #ece8e1;
  font-size: 0.8rem;
  color: var(--muted);
}

.notebook-chrome span {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #c4b8a8;
}

.notebook-chrome span:nth-child(1) {
  background: #b56a5a;
}
.notebook-chrome span:nth-child(2) {
  background: #c2a04a;
}
.notebook-chrome span:nth-child(3) {
  background: #6f9a6a;
}

.notebook-chrome p {
  margin: 0 0 0 0.4rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.nb-cell {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.nb-prompt {
  margin: 0.55rem 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #3f6f9f;
  text-align: right;
  user-select: none;
}

.nb-markdown .nb-prompt {
  min-height: 1rem;
}

.nb-markdown .nb-content {
  padding: 0.35rem 0.15rem 0.5rem;
}

.nb-markdown h3 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
}

.nb-markdown p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.nb-markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  padding: 0.05em 0.3em;
  background: rgba(21, 32, 40, 0.06);
}

.nb-code {
  margin: 0;
  padding: 0.95rem 1rem;
  overflow-x: auto;
  border: 1px solid #2a3340;
  background: #1b222b;
  color: #d7dee7;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
}

.nb-code .kw {
  color: #c792ea;
}
.nb-code .fn {
  color: #82aaff;
}
.nb-code .st {
  color: #c3e88d;
}
.nb-code .num {
  color: #f78c6c;
}

.nb-output {
  margin-top: 0.55rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  background: #fff;
}

.nb-output.nb-stream {
  background: #fbfaf7;
}

.nb-output.nb-stream pre {
  margin: 0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.nb-code .cmt {
  color: #7f8b99;
  font-style: italic;
}

.nb-chart img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #e4e0d8;
  background: #fff;
}

.nb-footnote a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(31, 92, 77, 0.35);
}

.nb-footnote a:hover,
.nb-footnote a:focus-visible {
  border-bottom-color: var(--accent);
}

.modal-subtitle code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
}

.nb-table-wrap {
  overflow-x: auto;
}

.nb-table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
}

.nb-table th,
.nb-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #ece8e1;
  text-align: right;
  white-space: nowrap;
}

.nb-table thead th {
  color: var(--muted);
  font-weight: 600;
}

.nb-table tbody th {
  text-align: left;
  color: var(--ink);
  font-weight: 600;
}

.nb-table tbody td {
  color: var(--ink-soft);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-safe {
  background: rgba(31, 92, 77, 0.12);
  color: #1f5c4d;
}

.badge-grey {
  background: rgba(154, 123, 47, 0.14);
  color: #7a6124;
}

.badge-distress {
  background: rgba(139, 58, 58, 0.12);
  color: #8b3a3a;
}

.nb-chart {
  margin: 0;
}

.nb-chart svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #e4e0d8;
}

.nb-chart figcaption {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--sans);
}

.nb-footnote {
  margin: 0.5rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .nb-cell {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .nb-prompt {
    text-align: left;
  }

  .modal-header {
    padding: 1.1rem 1rem;
  }

  .modal-body {
    padding: 0.85rem 0.85rem 1.25rem;
  }
}
