:root {
  color-scheme: light dark;
  --bg: #f3f0e7;
  --surface: rgba(255, 255, 255, 0.72);
  --ink: #171d1d;
  --muted: #526060;
  --line: rgba(23, 29, 29, 0.16);
  --accent: #b84f2d;
  --accent-soft: #f0d3c6;
  --max: 1320px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1517;
    --surface: rgba(20, 31, 34, 0.84);
    --ink: #eef3ef;
    --muted: #aebdb9;
    --line: rgba(226, 239, 235, 0.16);
    --accent: #ff8a61;
    --accent-soft: #4d2a21;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}
a { color: inherit; }
.masthead, main, footer { width: min(calc(100% - 40px), var(--max)); margin-inline: auto; }
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 78px;
  border-bottom: 1px solid var(--line);
}
.identity { font-weight: 800; text-decoration: none; letter-spacing: -0.02em; }
nav { display: flex; flex-wrap: wrap; gap: 22px; }
nav a, footer a { text-underline-offset: 4px; }
.hero { padding: clamp(72px, 10vw, 150px) 0 90px; max-width: 1050px; }
.eyebrow { color: var(--accent); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.16em; }
h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; letter-spacing: -0.04em; line-height: 0.98; }
h1 { font-size: clamp(3.2rem, 9vw, 8.4rem); }
.lede { max-width: 760px; margin: 34px 0; color: var(--muted); font-size: clamp(1.1rem, 2vw, 1.45rem); }
.summary { display: flex; flex-wrap: wrap; gap: 12px; margin: 46px 0 18px; }
.summary div { min-width: 180px; padding: 20px; border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(16px); }
.summary dt { font-size: 2rem; font-weight: 800; }
.summary dd { margin: 0; color: var(--muted); }
.updated, #result-count { color: var(--muted); font-size: 0.88rem; }
.catalog { padding: 70px 0 120px; border-top: 1px solid var(--line); }
.catalog__header { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 36px; align-items: end; }
.catalog h2 { font-size: clamp(2.2rem, 5vw, 4.8rem); }
.controls { display: grid; gap: 10px; }
.controls label { font-size: 0.82rem; font-weight: 700; }
input {
  width: 100%; padding: 15px 17px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; font: inherit;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
button {
  padding: 9px 13px; color: var(--ink); background: transparent; border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer;
}
button.active { color: var(--bg); background: var(--ink); }
.projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.project {
  min-width: 0; padding: 24px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; backdrop-filter: blur(16px); transition: transform 180ms ease, border-color 180ms ease;
}
.project:hover { transform: translateY(-4px); border-color: var(--accent); }
.project[hidden] { display: none; }
.project__meta { display: flex; justify-content: space-between; gap: 12px; color: var(--accent); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.project h2 { margin-top: 30px; font-size: 1.62rem; line-height: 1.08; text-transform: capitalize; }
.project p { color: var(--muted); }
.topics { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.topics li { padding: 4px 8px; background: var(--accent-soft); border-radius: 999px; font-size: 0.72rem; }
.project__links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.project__links a { color: var(--accent); font-weight: 750; text-underline-offset: 4px; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 34px 0 50px; border-top: 1px solid var(--line); color: var(--muted); }

@media (max-width: 920px) {
  .catalog__header { grid-template-columns: 1fr; }
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .masthead, footer { align-items: flex-start; flex-direction: column; padding-block: 20px; }
  .projects { grid-template-columns: 1fr; }
  .hero { padding-top: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
