:root {
  --bg: #f9f9f7;
  --text: #121212;
  --accent: #3a5a40;
  --divider: #e5e5e1;
  --muted: #7a7a77;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.1rem;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  font-family: "IBM Plex Serif", Georgia, serif;
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h1 { font-size: clamp(2.8rem, 5.5vw, 4.5rem); letter-spacing: -0.025em; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; font-weight: 600; }

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

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 5rem 1.5rem 4rem;
}

.section {
  padding: 1.8rem 0;
  border-top: 1px solid var(--divider);
}

.section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-header-inline h2 {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.tagline {
  margin: 0.35rem 0 0;
  font-weight: 500;
}

.intro-section h1 {
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  letter-spacing: -0.02em;
}

.intro-name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
  padding: 3rem 0 2.5rem;
}

.intro-role {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 400;
}

.intro-right {
  padding-top: 0.5rem;
}

.intro-right > p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
}

.cards-grid {
  display: grid;
  gap: 0;
}

.cards-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 2.5rem;
}

.card {
  border: none;
  background: transparent;
  padding: 0 0 1.5rem;
}


.card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}

.card .meta-row {
  margin-bottom: 0.9rem;
  color: inherit;
}


.card-body {
  padding: 1rem;
}

.masonry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--divider);
}

.project-image-wrap {
  border-bottom: 1px solid var(--divider);
}

.project-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  filter: grayscale(1);
  transition: filter 220ms ease;
}

.project-card:hover .project-image {
  filter: grayscale(0);
}

.card-links {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
}

.card-links a {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.03em;
}

.card-links a:hover {
  text-decoration: underline;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
}

.meta-date {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
}

.pill {
  border: none;
  color: var(--accent);
  background: #edf2ee;
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  white-space: nowrap;
  line-height: 1.5;
  text-decoration: none;
}

a.pill {
  cursor: pointer;
}

.pill:hover,
a.pill:hover {
  text-decoration: none !important;
}

.research-list {
  display: flex;
  flex-direction: column;
}

.research-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  column-gap: 2.5rem;
  row-gap: 0;
  align-items: start;
  padding: 1.5rem 0;
}

.research-date {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
}


.research-main p {
  margin: 0;
}

.research-tags {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: end;
}

.entry-links a {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}

.entry-links a:hover {
  text-decoration: underline;
}

.entry-shell {
  display: flex;
  justify-content: center;
}

.entry-article {
  width: min(72ch, 100%);
}

.entry-article > h1 {
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  letter-spacing: -0.015em;
}

.entry-body h2 { font-size: 1.3rem; }
.entry-body h3 { font-size: 1.1rem; }

/* ── Single rule for every listing/card title across the entire site ── */
.listing-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  line-height: 1.3;
  font-family: "IBM Plex Serif", Georgia, serif;
}

.research-main p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.entry-image-wrap {
  margin: 1rem 0 1.25rem;
  border: 1px solid var(--divider);
}

.entry-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

.entry-links {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.entry-body {
  font-size: 1rem;
}

.entry-body p,
.entry-body li,
.entry-body td {
  font-size: 1rem;
  line-height: 1.7;
}

.entry-body pre {
  overflow-x: auto;
  border: 1px solid var(--divider);
  margin: 1.2rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.entry-body code {
  font-size: 0.875rem;
}

.entry-body pre code {
  font-size: inherit;
}

.ghost-button,
button.ghost-button {
  border: 1px solid var(--divider);
  background: transparent;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 120ms ease, border-color 120ms ease;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  background: #efefec;
}

.floating-nav-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: none;
  z-index: 30;
  background: rgba(249, 249, 247, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--divider);
}

.floating-nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0;
  border: none;
  background: transparent;
  backdrop-filter: none;
}

.nav-brand {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-brand:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
}

.nav-sep {
  color: var(--divider);
  padding: 0 0.3rem;
  user-select: none;
  font-size: 0.85rem;
}

.nav-link {
  padding: 0.75rem 0.55rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: none;
  transition: color 120ms ease;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.is-active {
  color: var(--accent);
  border-bottom: none;
}

.flash-wrap {
  max-width: 1180px;
  margin: 4.8rem auto 0;
  padding: 0 1.5rem;
}

.flash {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.3rem 0;
  border: none;
  background: transparent;
}

.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2.2rem;
  border-top: 1px solid var(--divider);
}

.footer-copy {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-right {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

.footer-link {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}

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

.search-form {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.25rem;
  max-width: 560px;
}

.search-input {
  flex: 1;
  border: none;
  border-bottom: 1px solid var(--divider);
  background: transparent;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  padding: 0.45rem 0;
  outline: none;
  transition: border-color 120ms ease;
}

.search-input:focus {
  border-bottom-color: var(--accent);
}

.search-count {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.empty-state {
  border: 1px solid var(--divider);
  padding: 1rem;
  background: #fff;
}

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

.card a:hover {
  text-decoration: underline;
}

.page-header h1 {
  padding-left: 0;
}

.page-header p {
  margin: 0;
}

.admin-shell {
  border-top: none;
}

.admin-login-form {
  max-width: 320px;
}

.admin-login-label {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
  color: var(--text);
}

.admin-form {
  display: grid;
  gap: 0;
}

.admin-form .form-group {
  display: grid;
  gap: 0.3rem;
  padding: 0.75rem 0;
}

.admin-form label,
.admin-form .form-label {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.admin-form input[type="text"],
.admin-form input[type="date"],
.admin-form textarea,
.admin-form select {
  border: none;
  border-bottom: 1px solid var(--divider);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  transition: border-color 120ms ease;
}

.admin-form input[type="text"]:focus,
.admin-form input[type="date"]:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  border-bottom-color: var(--accent);
}

.admin-form select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7a77' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.25rem center;
  padding-right: 1.5rem;
  cursor: pointer;
}

.admin-form textarea {
  min-height: 80px;
  resize: vertical;
}

#body {
  min-height: 360px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.upload-row {
  padding: 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--divider);
  padding: 0.3rem 0.75rem;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease;
}

.file-label:hover {
  background: #efefec;
}

.file-chosen-name {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
}

.admin-form-footer {
  padding-top: 1.25rem;
}

.admin-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 0;
}

.admin-header h1 {
  margin: 0;
}

.admin-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.admin-list {
  display: grid;
  gap: 0;
}

.admin-list-item {
  border-top: 1px solid var(--divider);
  padding: 0.75rem 0;
}

.admin-list-item:last-child {
  border-bottom: 1px solid var(--divider);
}

.admin-item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.admin-item-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.admin-item-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.ghost-button--danger {
  border-color: #b91c1c;
  color: #b91c1c;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.ghost-button--danger:hover {
  background: #b91c1c;
  color: #fff;
}

.editor-toolbar {
  border-radius: 0;
}

.admin-shell .CodeMirror {
  border-radius: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.95rem !important;
  line-height: 1.6;
}

@media (max-width: 960px) {
  .masonry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .cards-grid-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .research-row {
    grid-template-columns: 1fr;
  }

  .research-tags {
    justify-content: start;
  }
}

/* Hamburger button — hidden on desktop */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  line-height: 1;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform 160ms ease, opacity 160ms ease;
}

.nav-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  main {
    padding: 4.5rem 1rem 3rem;
  }

  .section {
    padding: 2rem 0;
  }

  .intro-name-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .cards-grid-three,
  .masonry-grid {
    grid-template-columns: 1fr;
  }

  .floating-nav {
    padding: 0.75rem 1rem;
    position: relative;
  }

  .nav-hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgba(249, 249, 247, 0.98);
    border-top: 1px solid var(--divider);
    border-bottom: 1px solid var(--divider);
    padding: 0.5rem 1rem 0.75rem;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-sep {
    display: none;
  }

  .nav-link {
    font-size: 0.9rem;
    padding: 0.45rem 0;
    width: 100%;
  }
}
