.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.projects-shell,
.project-page-shell {
  display: grid;
  align-content: start;
  gap: 56px;
}

.projects-browser {
  display: grid;
  gap: 32px;
}

.projects-primary-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 220px) auto;
  align-items: end;
  gap: 16px;
}

.project-control,
.project-view-control {
  display: grid;
  gap: 8px;
  color: var(--foreground);
  font-weight: 700;
}

.project-control input,
.project-control select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--foreground);
  font: inherit;
}

.project-control input:focus,
.project-control select:focus,
.project-filter-option input:focus-visible + span,
.text-button:focus-visible,
.active-filter:focus-visible,
.secondary-link:focus-visible {
  border-color: var(--accent);
  outline: 2px solid rgba(185, 61, 61, 0.24);
  outline-offset: 2px;
}

.project-filter-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
}

.project-filter-panel[hidden] {
  display: none;
}

.project-filter-panel fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.project-filter-panel legend {
  margin-bottom: 10px;
  color: var(--foreground);
  font-weight: 700;
}

.project-filter-options,
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-filter-option {
  position: relative;
  cursor: pointer;
}

.project-filter-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.project-filter-option span,
.active-filter {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
}

.project-filter-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.project-results-toolbar {
  min-height: 40px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.project-result-count {
  margin: 0;
  color: var(--foreground);
  font-size: 1rem;
  font-weight: 700;
}

.active-filters {
  flex: 1;
}

.active-filter {
  cursor: pointer;
}

.active-filter:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.text-button {
  border: 0;
  padding: 7px 2px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.project-results,
.related-project-grid {
  display: grid;
  gap: 24px;
}

.project-results[data-view="grid"],
.related-project-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.project-results[data-view="list"] {
  grid-template-columns: 1fr;
}

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

.project-card:hover,
.project-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(7, 6, 2, 0.08);
  outline: none;
  transform: translateY(-2px);
}

.project-card-media {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(185, 61, 61, 0.2), rgba(185, 61, 61, 0)),
    var(--background);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  overflow: hidden;
}

.project-card-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.project-card-content {
  min-width: 0;
  padding: 20px;
}

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

.project-card h3 {
  margin: 0;
  font-size: 1.35rem;
}

.project-card-summary,
.project-card-details {
  margin-top: 10px;
  font-size: 0.96rem;
}

.project-card-details {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}

.project-card-tags,
.project-tag-list,
.project-technology-list {
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
}

.project-card-tags li,
.project-tag-list li,
.project-technology-list li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.project-card--list {
  grid-template-columns: minmax(180px, 28%) 1fr;
}

.project-card--list .project-card-media {
  height: 100%;
  min-height: 210px;
  aspect-ratio: auto;
}

.project-empty-state,
.project-error {
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.project-empty-state[hidden] {
  display: none;
}

.project-empty-state h2,
.project-error h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

.project-loading {
  min-height: 40vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  align-items: center;
  gap: clamp(32px, 7vw, 80px);
}

.project-hero-body {
  min-width: 0;
}

.project-hero .back-link {
  margin-bottom: 44px;
}

.project-hero h1 {
  font-size: clamp(2.5rem, 6.8vw, 5rem);
  overflow-wrap: anywhere;
}

.project-subtitle {
  color: var(--foreground);
  font-size: clamp(1.2rem, 2.3vw, 1.55rem);
  font-weight: 700;
}

.project-summary {
  max-width: 680px;
}

.project-actions {
  margin-top: 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.secondary-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 18px;
  background: var(--surface);
  color: var(--foreground);
  font-weight: 700;
  text-decoration: none;
}

.secondary-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.project-hero-media {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(185, 61, 61, 0.2), rgba(185, 61, 61, 0)),
    var(--surface);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 700;
  overflow: hidden;
}

.project-hero-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.project-facts,
.related-projects {
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.project-facts > h2,
.related-projects > h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.5rem);
}

.project-facts-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.project-fact-group h3 {
  margin: 0;
  font-size: 1.08rem;
}

.project-date-list,
.project-contributor-list {
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  list-style: none;
}

.project-date-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.project-date-list dt {
  color: var(--muted);
}

.project-date-list dd {
  margin: 0;
  color: var(--foreground);
  text-align: right;
}

.project-contributor-list li {
  display: grid;
}

.project-contributor-list small {
  color: var(--muted);
}

.project-content {
  max-width: 900px;
  display: grid;
  gap: 56px;
}

.project-module > h2 {
  margin: 0 0 18px;
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
}

.project-module > h3,
.project-feature-list h3,
.project-timeline h3 {
  margin: 0;
  font-size: 1.15rem;
}

.project-module > p:first-child {
  margin-top: 0;
}

.project-module--rich-text ul,
.project-module--rich-text ol {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.project-figure,
.project-gallery-item {
  margin: 0;
}

.project-figure img,
.project-gallery-item img,
.project-module--video video {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.project-figure img {
  max-height: 640px;
  object-fit: contain;
}

.project-figure figcaption,
.project-gallery-item figcaption,
.project-media-caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.project-gallery-item img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.project-module--quote blockquote {
  margin: 0;
  padding: 28px;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface);
}

.project-module--quote blockquote p {
  margin: 0;
  color: var(--foreground);
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  font-weight: 700;
}

.project-module--quote blockquote footer {
  margin-top: 14px;
  color: var(--muted);
}

.project-metrics {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.project-metric {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.project-metric dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.project-metric dd {
  margin: 6px 0 0;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
}

.project-metric p {
  margin-top: 8px;
  font-size: 0.9rem;
}

.project-feature-list {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  list-style: none;
}

.project-feature-list li {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.project-feature-list p {
  margin-top: 8px;
  font-size: 0.96rem;
}

.project-timeline {
  margin: 0;
  padding: 0 0 0 28px;
  display: grid;
  gap: 24px;
  border-left: 2px solid var(--line);
  list-style: none;
}

.project-timeline li {
  position: relative;
}

.project-timeline li::before {
  position: absolute;
  left: -35px;
  top: 5px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--background);
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.project-timeline-date {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
}

.project-timeline li > p:last-child {
  margin-top: 7px;
  font-size: 0.98rem;
}

.project-module--code pre {
  margin: 0;
  padding: 22px;
  border-radius: 8px;
  background: #1d1917;
  color: #f7f6f2;
  overflow: auto;
  tab-size: 2;
}

.project-module--code code {
  font: 0.92rem/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.project-module--callout {
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface);
}

.project-module--callout > h2 {
  font-size: 1.35rem;
}

.project-module--callout > p:last-child {
  margin-bottom: 0;
}

.project-divider {
  width: 100%;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.related-project-grid {
  margin-top: 24px;
}

.project-error-page {
  display: grid;
  align-content: start;
}

@media (max-width: 780px) {
  .projects-primary-controls {
    grid-template-columns: 1fr 1fr;
  }

  .project-search {
    grid-column: 1 / -1;
  }

  .project-filter-panel,
  .project-facts-grid {
    grid-template-columns: 1fr;
  }

  .project-hero {
    grid-template-columns: 1fr;
  }

  .project-hero-media {
    grid-row: 1;
  }
}

@media (max-width: 540px) {
  .projects-primary-controls {
    grid-template-columns: 1fr;
  }

  .project-search {
    grid-column: auto;
  }

  .project-filter-panel {
    padding: 18px;
  }

  .project-results[data-view="grid"],
  .related-project-grid,
  .project-gallery {
    grid-template-columns: 1fr;
  }

  .project-card--list {
    grid-template-columns: 92px 1fr;
  }

  .project-card--list .project-card-media {
    min-height: 100%;
  }

  .project-card--list .project-card-content {
    padding: 14px;
  }

  .project-card--list .project-card-summary,
  .project-card--list .project-card-tags,
  .project-card--list .project-card-details {
    display: none;
  }

  .project-hero .back-link {
    margin-bottom: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-card {
    transition: none;
  }

  .project-card:hover,
  .project-card:focus-visible {
    transform: none;
  }
}
