@font-face {
  font-family: "Parclo Serif";
  src: url("../fonts/ParcloSerifStudent-BlackItalic.woff2") format("woff2");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Departure Mono";
  src: url("../fonts/DepartureMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

:root {
  color-scheme: dark;
  --accent: #ffbf00;
  --bg: #18181b;
  --bg-soft: #1d1d20;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: rgba(255, 255, 255, 0.12);
  --panel: rgba(39, 39, 42, 0.64);
  --pill: rgba(255, 255, 255, 0.10);
}

:root.light {
  color-scheme: light;
  --bg: #f4f1ea;
  --bg-soft: #ebe7dc;
  --text: #202124;
  --muted: #696969;
  --faint: #8b867b;
  --line: rgba(31, 31, 34, 0.14);
  --panel: rgba(255, 255, 255, 0.68);
  --pill: rgba(0, 0, 0, 0.08);
}

html {
  min-height: 100%;
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

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

button,
input {
  color: inherit;
  font: inherit;
}

.projects-page {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 22% 10%, rgba(255, 255, 255, 0.025), transparent 25rem),
    radial-gradient(circle at 82% 38%, rgba(255, 255, 255, 0.018), transparent 31rem),
    var(--bg);
}

.projects-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image:
    linear-gradient(rgba(255,255,255,0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  mix-blend-mode: soft-light;
}

:root.light .projects-page::before {
  opacity: 0.16;
  mix-blend-mode: multiply;
}

.topbar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1136px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 28px 0 50px;
}

.brand {
  justify-self: start;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--text);
  font-size: 16px;
}

.topnav a {
  opacity: 0.88;
  transition: color 160ms ease, opacity 160ms ease;
}

.topnav a:hover,
.topnav a[aria-current="page"] {
  color: var(--accent);
  opacity: 1;
}

.quick-actions {
  justify-self: end;
  display: flex;
  gap: 8px;
}

.quick-actions button,
.scroll-top {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: var(--text);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
  transition: transform 160ms ease, background 160ms ease;
}

.quick-actions button:hover,
.scroll-top:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.22);
}

:root.light .quick-actions button,
:root.light .scroll-top {
  background: rgba(0,0,0,0.12);
}

.menu-popover {
  position: fixed;
  top: 74px;
  right: max(24px, calc((100vw - 1136px) / 2));
  z-index: 20;
  display: grid;
  min-width: 190px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(31, 31, 34, 0.94);
  box-shadow: 0 18px 60px rgba(0,0,0,0.38);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

:root.light .menu-popover {
  background: rgba(255, 255, 255, 0.94);
}

.menu-popover.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.menu-popover a {
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
}

.menu-popover a:hover {
  background: var(--pill);
  color: var(--text);
}

.projects-hero {
  position: relative;
  z-index: 1;
  width: min(1136px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 10px 0 40px;
}

.projects-hero h1 {
  margin: 0;
  font-family: "Parclo Serif", Georgia, serif;
  font-size: clamp(4.3rem, 8.3vw, 6rem);
  font-style: italic;
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.045em;
  color: var(--text);
}

.toc-band {
  position: relative;
  z-index: 1;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(rgba(24, 24, 27, 0.88), rgba(24, 24, 27, 0.88)),
    url("../images/project-texture.png") center 55% / cover;
}

.toc-band::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 35%, rgba(255, 255, 255, 0.05), transparent 21rem),
    repeating-radial-gradient(circle at 40% 45%, rgba(255,255,255,0.07) 0 1px, transparent 1px 5px);
  opacity: 0.12;
  pointer-events: none;
}

.toc-inner {
  position: relative;
  width: min(1136px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 42px 0 55px;
}

.toc-inner h2 {
  margin: 0 0 22px;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.toc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 120px;
  max-width: 760px;
}

.toc-grid a {
  width: fit-content;
  color: #dedee2;
  font-size: 17px;
  line-height: 1.35;
  transition: color 160ms ease;
}

.toc-grid a:hover {
  color: var(--accent);
}

.project-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  border-bottom: 1px solid var(--line);
  background: rgba(24, 24, 27, 0.84);
  backdrop-filter: blur(14px);
}

:root.light .project-toolbar {
  background: rgba(244, 241, 234, 0.86);
}

.toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1136px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 18px 0 14px;
}

.sort-tabs,
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 22px;
}

.sort-icon {
  color: var(--muted);
  font-size: 18px;
}

.sort-tabs button,
.filter-tabs button {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  transition: color 160ms ease;
}

.sort-tabs button::after,
.filter-tabs button:not(.filter-icon)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -13px;
  height: 2px;
  border-radius: 99px;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 160ms ease, transform 160ms ease;
}

.sort-tabs button.is-active,
.filter-tabs button.is-active {
  color: var(--accent);
}

.sort-tabs button.is-active::after,
.filter-tabs button.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.filter-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
}

.filter-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.projects-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 78px;
  width: min(1136px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 52px 0 18px;
}

.project-item {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.92fr);
  gap: 72px;
  align-items: center;
  scroll-margin-top: 96px;
}

.project-item.is-hidden {
  display: none;
}

.project-copy h3 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 8px;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.project-copy small {
  color: var(--faint);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.pill--star {
  background: #78350f;
  color: #fcd34d;
}

.summary {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.description {
  max-width: 710px;
  margin: 0;
  color: #c6c6cc;
  font-size: 18px;
  line-height: 1.52;
}

:root.light .description {
  color: #505057;
}

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-weight: 500;
  transition: color 160ms ease;
}

.links a:hover {
  color: var(--accent);
}

.links a span {
  font-size: 14px;
}

.preview-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 138px;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  background: #111827;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.09);
  transform: translateZ(0);
}

.preview-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 62%;
  background: linear-gradient(to top, rgba(0,0,0,0.74), rgba(0,0,0,0.38), transparent);
  pointer-events: none;
}

.preview-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: invert(1) contrast(0.8) opacity(0.72);
}

.preview-label,
.preview-card strong {
  position: relative;
  z-index: 1;
}

.preview-label {
  color: rgba(255,255,255,0.68);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.preview-card strong {
  margin-top: 2px;
  color: #fff;
  font-size: 17px;
  font-weight: 500;
}

.preview-card--market {
  background:
    radial-gradient(circle at 72% 30%, rgba(255, 191, 0, 0.22), transparent 7rem),
    linear-gradient(135deg, #1b2a41, #111827);
}

.preview-orbit {
  position: absolute;
  top: 22px;
  right: 34px;
  width: 120px;
  height: 72px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.preview-orbit::before,
.preview-orbit::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
}

.preview-orbit::before { left: 16px; top: 18px; }
.preview-orbit::after { right: 18px; bottom: 12px; }

.preview-card--ilog {
  background:
    radial-gradient(circle at 50% 34%, rgba(255,255,255,0.9), transparent 3.6rem),
    linear-gradient(135deg, #203d34, #121826);
}

.plate {
  position: absolute;
  top: 34px;
  right: 82px;
  width: 82px;
  height: 82px;
  border: 10px solid rgba(255,255,255,0.92);
  border-radius: 999px;
  box-shadow: inset 0 0 0 3px rgba(69, 97, 78, 0.5);
}

.plate::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 20px;
  width: 22px;
  height: 26px;
  border-radius: 50% 50% 35% 35%;
  background: #f4a261;
  box-shadow: 18px 8px 0 #8ab17d, -10px 8px 0 #e76f51;
}

.preview-card--iot {
  background:
    radial-gradient(circle at 73% 24%, rgba(172, 211, 184, 0.28), transparent 8rem),
    linear-gradient(135deg, #223237, #0e1726);
}

.washer {
  position: absolute;
  top: 28px;
  right: 54px;
  width: 92px;
  height: 92px;
  border-radius: 18px;
  background: rgba(255,255,255,0.86);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.washer::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 24px;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, #6fa7b8 0 35%, transparent 36%),
    conic-gradient(from 60deg, #9cc3ce, #4e7986, #9cc3ce);
}

.preview-card--mars {
  background:
    radial-gradient(circle at 22% 10%, rgba(255, 191, 0, 0.16), transparent 7rem),
    linear-gradient(140deg, #40271d, #111827);
}

.terrain {
  position: absolute;
  inset: 42% 0 0;
  background:
    linear-gradient(160deg, transparent 48%, rgba(233, 164, 87, 0.7) 49% 57%, transparent 58%),
    linear-gradient(21deg, transparent 44%, rgba(178, 103, 64, 0.68) 45% 55%, transparent 56%),
    linear-gradient(to top, #b9694b, #5c342c);
  opacity: 0.9;
}

.preview-card--mind {
  background:
    radial-gradient(circle at 70% 20%, rgba(196, 181, 253, 0.28), transparent 7rem),
    linear-gradient(135deg, #26345f, #101724);
}

.mind-grid {
  position: absolute;
  top: 26px;
  right: 44px;
  display: grid;
  grid-template-columns: repeat(4, 18px);
  gap: 8px;
  transform: rotate(-6deg);
}

.mind-grid::before {
  content: "";
  grid-column: 1 / -1;
  display: block;
  width: 96px;
  height: 96px;
  background:
    radial-gradient(circle, #f8d8ea 0 8px, transparent 9px) 0 0 / 24px 24px,
    radial-gradient(circle, #bbf7d0 0 5px, transparent 6px) 12px 12px / 24px 24px;
  opacity: 0.92;
}

.projects-footer {
  position: relative;
  z-index: 1;
  width: min(1136px, calc(100vw - 48px));
  margin: 82px auto 0;
  padding: 34px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.footer-line {
  position: absolute;
  top: -28px;
  left: 27%;
  display: flex;
  gap: 3px;
  font-family: "Departure Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--text);
  opacity: 0.74;
}

.footer-icons {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 700;
}

.projects-footer p {
  margin: 0;
  font-size: 15px;
}

.command-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: start center;
  padding-top: 15vh;
  background: rgba(0,0,0,0.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.command-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.command-panel {
  width: min(560px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(31, 31, 34, 0.96);
  box-shadow: 0 22px 80px rgba(0,0,0,0.48);
}

:root.light .command-panel {
  background: rgba(255, 255, 255, 0.98);
}

.command-panel input {
  width: 100%;
  padding: 17px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: 0;
  background: transparent;
  color: var(--text);
}

.command-results {
  display: grid;
  max-height: 360px;
  overflow: auto;
  padding: 8px;
}

.command-results button,
.command-results a {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.command-results button:hover,
.command-results a:hover {
  background: var(--pill);
}

.command-results span {
  color: var(--muted);
  font-size: 13px;
}

.scroll-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 12;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  opacity: 0.75;
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr auto;
    row-gap: 18px;
    padding-top: 22px;
  }

  .topnav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 4px;
    font-size: 15px;
  }

  .toolbar-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .sort-tabs,
  .filter-tabs {
    gap: 15px;
    flex-wrap: wrap;
  }

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

  .project-item {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .preview-card {
    max-width: 520px;
  }
}

@media (max-width: 560px) {
  .projects-hero h1 {
    font-size: 4rem;
  }

  .project-copy h3 {
    font-size: 20px;
  }

  .summary {
    font-size: 18px;
  }

  .description {
    font-size: 16px;
  }
}
