:root {
  color-scheme: light;
  --background: #f7f6f2;
  --surface: #ffffff;
  --surface-muted: #efeee8;
  --text: #161616;
  --muted: #64625c;
  --line: #d8d5cc;
  --accent: #2f6358;
  --accent-soft: #e7f0eb;
  --shadow: 0 12px 28px rgba(31, 31, 27, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

body.homepage {
  overflow-y: auto;
}

a {
  color: inherit;
}

.site-shell {
  width: min(1440px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 36px;
  overflow: visible;
}

.education-strip {
  display: block;
  padding: 18px 0 22px;
  text-align: center;
}

.education-strip h1,
.education-row h2,
.about-row h2,
.skills-row h2,
.section-heading h2,
.project-article h1,
.project-article h2,
.project-card h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

.education-strip h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 700;
  white-space: nowrap;
}

.title-row {
  display: block;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

.contact-links a {
  padding: 4px 0;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.contact-links a:hover,
.contact-links a:focus-visible {
  text-decoration: underline;
}

.education-row,
.about-row,
.skills-row {
  display: block;
}

.about-row,
.skills-row {
  margin-top: 16px;
}

.education-row h2,
.about-row h2,
.skills-row h2 {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.education-row p,
.about-row p {
  margin: 8px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.skills-list {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.skill-filter {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.skill-filter::after {
  content: "Filter";
  flex: 0 0 auto;
  color: transparent;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.skill-filter:hover,
.skill-filter:focus-visible {
  color: var(--text);
  text-decoration: underline;
  outline: none;
}

.skill-filter:hover::after,
.skill-filter:focus-visible::after {
  color: var(--accent);
}

.skill-filter.active-skill {
  color: var(--text);
}

.skill-filter.active-skill::after {
  content: "Clear";
  color: var(--accent);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.36fr);
  gap: 28px;
  align-items: start;
  min-height: 0;
  overflow: visible;
}

.panel {
  min-width: 0;
  padding: 30px 0 0;
}

.project-column {
  min-width: 0;
}

.project-sections {
  min-height: 0;
  overflow: visible;
  padding: 22px 8px 0 0;
  padding-bottom: min(18vh, 140px);
  scroll-behavior: smooth;
}

.right-column {
  position: sticky;
  top: 0;
  border-left: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.right-column .panel {
  padding-left: 28px;
}

.profile-panel {
  height: auto;
  overflow: visible;
}

.project-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 18px 0 12px;
  background: var(--background);
}

.project-tabs a {
  margin: 0;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  box-shadow: none;
  transition: border-color 140ms ease, color 140ms ease;
}

.project-tabs .filtered-tab {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-tabs a:hover,
.project-tabs a:focus-visible {
  border-bottom-color: var(--accent);
  color: var(--text);
  outline: none;
}

.project-tabs a.active-tab,
.project-tabs a[aria-current="true"] {
  border-bottom-color: rgba(47, 99, 88, 0.45);
  color: var(--text);
}

.project-section {
  scroll-margin-top: 86px;
}

.filtered-panel {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.filtered-heading {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
}

.clear-filter {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
}

.clear-filter:hover,
.clear-filter:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.tech-panel,
.other-panel,
.work-panel {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(1.3rem, 2vw, 2rem);
  font-weight: 650;
}

.card-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.tech-panel .compact-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 16px;
}

.project-card {
  display: grid;
  grid-template-rows: 1fr 132px;
  min-width: 0;
  min-height: 430px;
  height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.highlighted-card {
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.featured-card {
  grid-column: 1 / -1;
}

.card-grid .featured-card {
  grid-template-rows: 1fr 180px;
  min-height: 430px;
  height: 430px;
}

.featured-card.text-only-card {
  min-height: 280px;
  height: 280px;
}

.compact-grid .project-card {
  grid-template-rows: auto 128px;
  width: 100%;
  min-height: 0;
  height: auto;
}

.tech-panel .compact-grid .featured-card {
  min-height: 300px;
  height: auto;
}

.tech-panel .compact-grid .project-card:not(.featured-card) {
  min-height: 230px;
  height: 230px;
}

.tech-panel .compact-grid .text-only-card:not(.featured-card) {
  display: flex;
}

.tech-panel .compact-grid .project-card:not(.featured-card) .card-body {
  padding: 12px;
}

.tech-panel .compact-grid .project-card:not(.featured-card) h3 {
  font-size: 0.95rem;
}

.tech-panel .compact-grid .project-card:not(.featured-card) p {
  margin: 8px 0 10px;
  font-size: 0.84rem;
  -webkit-line-clamp: 3;
}

.tech-panel .compact-grid .project-card:not(.featured-card) .project-date {
  font-size: 0.7rem;
}

.tech-panel .compact-grid .project-card:not(.featured-card) .tag-list {
  gap: 4px;
}

.tech-panel .compact-grid .project-card:not(.featured-card) .tag-list li {
  font-size: 0.66rem;
}

.text-only-card {
  display: flex;
}

.project-card:hover,
.project-card:focus-visible {
  height: auto;
  min-height: 430px;
  transform: translateY(-2px);
  border-color: rgba(47, 99, 88, 0.45);
  box-shadow: 0 16px 34px rgba(31, 31, 27, 0.12);
  outline: none;
}

.highlighted-card:hover,
.highlighted-card:focus-visible {
  border-color: rgba(47, 99, 88, 0.45);
  box-shadow: 0 16px 34px rgba(31, 31, 27, 0.12);
}

.compact-grid .project-card:hover,
.compact-grid .project-card:focus-visible {
  height: auto;
  min-height: 230px;
}

.featured-card:hover,
.featured-card:focus-visible {
  height: auto;
  min-height: 430px;
}

.featured-card.text-only-card:hover,
.featured-card.text-only-card:focus-visible {
  height: auto;
  min-height: 280px;
}

.tech-panel .compact-grid .featured-card:hover,
.tech-panel .compact-grid .featured-card:focus-visible {
  height: auto;
  min-height: 300px;
}

.tech-panel .compact-grid .project-card:not(.featured-card):hover,
.tech-panel .compact-grid .project-card:not(.featured-card):focus-visible {
  height: auto;
  min-height: 230px;
}

.card-media {
  min-height: 132px;
  background: var(--surface-muted);
  border-top: 1px solid var(--line);
}

.compact-grid .card-media {
  min-height: 128px;
}

.card-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: var(--surface);
}

.card-media-empty {
  background:
    linear-gradient(135deg, rgba(47, 99, 88, 0.11), rgba(47, 99, 88, 0) 62%),
    var(--surface-muted);
}

.card-body {
  display: flex;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
  padding: 16px;
}

.project-card h3 {
  font-size: 1.14rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.compact-grid .project-card h3 {
  font-size: 1.03rem;
}

.project-card p {
  display: -webkit-box;
  margin: 12px 0 16px;
  overflow: hidden;
  color: #252525;
  font-size: 1rem;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
}

.project-card .project-date {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  -webkit-line-clamp: unset;
}

.compact-grid .project-card p {
  margin: 10px 0 14px;
  font-size: 0.94rem;
  -webkit-line-clamp: 4;
}

.text-only-card p {
  -webkit-line-clamp: 8;
}

.project-card:hover p,
.project-card:focus-visible p {
  display: block;
  -webkit-line-clamp: unset;
}

.tech-panel .compact-grid .project-card:not(.featured-card):hover p,
.tech-panel .compact-grid .project-card:not(.featured-card):focus-visible p,
.compact-grid .project-card:hover p,
.compact-grid .project-card:focus-visible p {
  display: block;
  -webkit-line-clamp: unset;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  max-width: 100%;
  padding: 0;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.tag-list li::after {
  content: ",";
}

.tag-list li:last-child::after {
  content: "";
}

.card-meta {
  margin: auto 0 0;
  padding-top: 10px;
}

.webring {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 34px;
  padding-top: 12px;
  color: var(--text);
  font-size: 0.82rem;
}

.webring a {
  color: inherit;
  text-decoration: none;
}

.webring a:hover,
.webring a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  outline: none;
}

.webring-home {
  display: inline-flex;
  align-items: center;
}

.webring-logo {
  display: block;
  width: 16px;
  height: 16px;
}

.webring-arrow {
  padding: 3px;
  font-size: 0.95rem;
  line-height: 1;
}

.project-page {
  background: #fbfaf7;
}

.project-nav {
  padding: 24px 0;
}

.back-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.project-article {
  width: min(820px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 64px;
}

.project-header {
  padding: 14px 0 26px;
  border-bottom: 1px solid var(--line);
}

.project-header h1 {
  max-width: 760px;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 750;
}

.project-summary {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.project-page-date {
  margin: 14px 0 0;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

.project-content {
  max-width: 100%;
  min-width: 0;
  padding-top: 28px;
}

.project-content > * {
  max-width: 100%;
}

.project-content h2 {
  margin: 34px 0 12px;
  font-size: 1.5rem;
}

.project-content p,
.project-content li {
  color: #2b2a27;
}

.project-content figure {
  margin: 28px 0;
}

.project-content video,
.project-content iframe,
.project-content object,
.project-content embed,
.project-content img {
  box-sizing: border-box;
  min-width: 0;
  max-inline-size: 100%;
  max-width: 100%;
  display: block;
  margin-right: auto;
  margin-left: auto;
  background: var(--surface);
}

.project-content img,
.project-content video {
  height: auto;
}

.project-content video {
  width: 100%;
  max-width: 640px;
}

.project-content iframe,
.project-content object,
.project-content embed {
  width: 100%;
}

.project-content object,
.project-content embed {
  min-height: 520px;
}

.project-content img {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.project-content figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.project-content blockquote {
  margin: 20px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: #243b35;
}

.project-content table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 18px 0;
  overflow-x: auto;
  border-collapse: collapse;
  background: var(--surface);
}

.project-content th,
.project-content td {
  padding: 9px 11px;
  border: 1px solid var(--line);
  text-align: left;
}

.project-content th {
  background: var(--surface-muted);
}

.project-content pre {
  max-width: 100%;
  margin: 22px 0;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.9rem;
  line-height: 1.45;
}

.project-content code {
  overflow-wrap: break-word;
  border-radius: 4px;
  background: rgba(47, 99, 88, 0.08);
  font-size: 0.92em;
}

.project-content pre code {
  overflow-wrap: normal;
  background: transparent;
  white-space: pre;
}

.project-content mjx-container,
.project-content .MathJax,
.project-content .katex-display {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.project-content .katex-display {
  padding-bottom: 2px;
}

.template-note {
  width: 100%;
  inline-size: 100%;
  max-width: 100%;
  max-inline-size: 100%;
  contain: inline-size;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.homepage {
    overflow-y: auto;
  }

  .site-shell {
    width: calc(100vw - 56px);
    max-width: 760px;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding-top: 16px;
    padding-bottom: 40px;
  }

  .education-strip,
  .project-layout {
    display: block;
  }

  .project-layout {
    display: flex;
    flex-direction: column;
    position: static;
    height: auto;
    min-width: 0;
    overflow: visible;
  }

  .education-strip {
    min-height: 0;
  }

  .education-strip h1 {
    white-space: normal;
  }

  .title-row {
    display: block;
  }

  .contact-links {
    justify-content: center;
  }

  .project-tabs {
    display: flex;
    gap: 14px;
    padding-top: 24px;
  }

  .project-tabs a {
    width: auto;
    text-align: left;
  }

  .project-column {
    display: block;
    order: 2;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    min-width: 0;
  }

  .project-sections {
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding-right: 0;
    padding-bottom: 0;
  }

  .profile-panel {
    height: auto;
    overflow: visible;
  }

  .education-row h2 {
    margin-bottom: 8px;
  }

  .project-column,
  .right-column .panel {
    padding-right: 0;
    padding-left: 0;
  }

  .right-column {
    display: block;
    order: 1;
    border-left: 0;
    min-width: 0;
    overflow: visible;
  }

  .right-column .panel {
    padding-top: 22px;
  }

  .tech-panel,
  .other-panel,
  .work-panel {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--line);
  }

  .card-grid,
  .compact-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
    overflow: hidden;
  }

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

  .tech-panel .compact-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    height: auto;
    width: 100%;
    max-width: 100%;
  }

  .card-grid .featured-card,
  .featured-card.text-only-card,
  .tech-panel .compact-grid .featured-card,
  .tech-panel .compact-grid .project-card:not(.featured-card) {
    height: auto;
  }

  .project-article {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding-right: 8px;
    padding-left: 8px;
    overflow-x: hidden;
  }

  .template-note {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    padding: 10px;
  }

  .project-content,
  .project-content > *,
  .template-note,
  .template-note > * {
    max-width: 100%;
    min-width: 0;
  }

  .project-content p,
  .project-content li,
  .project-content h2,
  .project-content h3 {
    max-inline-size: calc(100vw - 32px);
    overflow-wrap: anywhere;
  }

  .project-content video,
  .project-content iframe,
  .project-content object,
  .project-content embed,
  .project-content img,
  .project-content pre,
  .project-content table {
    inline-size: 100% !important;
    width: 100% !important;
    min-inline-size: 0 !important;
    min-width: 0 !important;
    max-inline-size: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
  }

  .project-content video,
  .project-content img {
    height: auto !important;
  }

  .project-content object,
  .project-content embed {
    min-height: 420px;
  }
}
