.directory-hero,
.directory-section,
.portfolio-essay {
  --border: var(--line);
  --surface: var(--paper);
  --surface-muted: var(--soft);
  --background: #f7f4eb;
  --accent: var(--moss);
}

.directory-hero,
.directory-section,
.portfolio-essay {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.directory-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: 52px;
  align-items: center;
  padding: 42px 0 52px;
}

.directory-hero h1 {
  max-width: 720px;
  margin: 14px 0 22px;
  font-size: clamp(2.25rem, 4.6vw, 3.625rem);
  line-height: 1.07;
  font-weight: 680;
  letter-spacing: -0.045em;
}

.directory-hero h1 span {
  display: block;
}

.hero-lead {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 1.8vw, 1.35rem);
  line-height: 1.6;
}

.directory-scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(38, 52, 43, 0.08);
}

.directory-scoreboard div {
  min-height: 132px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.directory-scoreboard div:nth-child(even) {
  border-right: 0;
}

.directory-scoreboard div:nth-child(n + 3) {
  border-bottom: 0;
}

.directory-scoreboard strong {
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--accent);
}

.directory-scoreboard span {
  max-width: 130px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.directory-section {
  padding: 64px 0 110px;
  border-top: 1px solid var(--border);
}

.directory-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.5fr);
  gap: 44px;
  align-items: end;
}

.directory-heading > p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.55;
}

.directory-toolbar {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  position: sticky;
  top: 82px;
  z-index: 5;
  box-shadow: 0 14px 40px rgba(38, 52, 43, 0.08);
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filter-buttons button {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-buttons button:hover,
.filter-buttons button:focus-visible {
  color: var(--ink);
  background: var(--surface-muted);
}

.filter-buttons button.is-active {
  color: white;
  background: var(--accent);
}

.directory-search input {
  width: min(270px, 28vw);
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--ink);
  font: inherit;
}

.directory-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 24px 0 14px;
}

.result-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.tag-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.directory-card {
  position: relative;
  min-height: 335px;
  padding: 23px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.directory-protected-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(126, 85, 20, 0.22);
  border-radius: 999px;
  padding: 5px 10px 5px 5px;
  color: #5a491b;
  background: rgba(255, 248, 224, 0.92);
  box-shadow: 0 10px 24px rgba(126, 85, 20, 0.11);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.directory-lock-medallion {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f6d98a, #c99b35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 6px 14px rgba(126, 85, 20, 0.2);
}

.directory-lock-medallion svg {
  width: 18px;
  height: 18px;
  fill: rgba(255, 250, 232, 0.44);
  stroke: #4f421d;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.directory-card.is-protected .status-pill {
  visibility: hidden;
}

.directory-back-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid rgba(89, 101, 75, 0.18);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--moss);
  background: rgba(255, 253, 248, 0.72);
  font-weight: 800;
  text-decoration: none;
}

.directory-back-link:hover,
.directory-back-link:focus-visible {
  border-color: rgba(89, 101, 75, 0.32);
  background: rgba(255, 253, 248, 0.96);
  outline: none;
}

.directory-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 20px 46px rgba(38, 52, 43, 0.09);
}

.directory-card.is-expandable {
  cursor: pointer;
}

.directory-card.is-expandable:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(89, 101, 75, 0.13), 0 20px 46px rgba(38, 52, 43, 0.09);
  outline: none;
  transform: translateY(-3px);
}

.directory-card[data-category="agents"] {
  background: color-mix(in srgb, var(--surface) 90%, #dce7df);
}

.directory-card[data-category="platform"] {
  background: color-mix(in srgb, var(--surface) 90%, #e9e0d3);
}

.directory-card[data-category="apps"] {
  background: color-mix(in srgb, var(--surface) 90%, #e1e8dc);
}

.directory-card[data-category="content"] {
  background: color-mix(in srgb, var(--surface) 90%, #eadbd5);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.62rem;
}

.status-produktiv {
  background: #dce9dc;
  color: #35533a;
}

.status-vorzeigbar {
  background: #e6e1ce;
  color: #62531c;
}

.status-in-arbeit {
  background: #e8ddd5;
  color: #704b35;
}

.status-zu-verifizieren {
  background: #eedbd8;
  color: #803f37;
}

.status-retired {
  background: #e6e3df;
  color: #625e59;
}

.status-zu-klären {
  background: #eedbd8;
  color: #803f37;
}

.status-prototyp {
  color: #5d456c;
  background: #e8dfee;
}

.card-kicker {
  margin: 34px 0 7px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.directory-card h3 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.directory-card h3 a {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  color: inherit;
  text-decoration: none;
}

.directory-card h3 a span {
  color: var(--accent);
  font-size: 1rem;
}

.directory-card > p:not(.card-kicker) {
  margin: 14px 0 22px;
  color: var(--muted);
  line-height: 1.52;
}

.directory-card .portfolio-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}

.portfolio-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border: 1px solid rgba(89, 101, 75, 0.16);
  border-radius: 999px;
  padding: 4px 9px;
  color: #485440;
  background: rgba(220, 233, 220, 0.74);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.15;
}

.portfolio-tags .tag-platform,
.tag-legend .tag-platform { color: #506532; border-color: rgba(126, 152, 84, 0.28); background: rgba(126, 152, 84, 0.15); }
.portfolio-tags .tag-identity,
.tag-legend .tag-identity { color: #765619; border-color: rgba(210, 154, 54, 0.3); background: rgba(210, 154, 54, 0.16); }
.portfolio-tags .tag-security,
.tag-legend .tag-security { color: #794232; border-color: rgba(214, 121, 93, 0.28); background: rgba(214, 121, 93, 0.15); }
.portfolio-tags .tag-cloud,
.tag-legend .tag-cloud { color: #2f6270; border-color: rgba(76, 151, 172, 0.28); background: rgba(76, 151, 172, 0.15); }
.portfolio-tags .tag-ai,
.tag-legend .tag-ai { color: #745906; border-color: rgba(217, 165, 21, 0.3); background: rgba(217, 165, 21, 0.16); }
.portfolio-tags .tag-data,
.tag-legend .tag-data { color: #5d4d70; border-color: rgba(132, 110, 160, 0.28); background: rgba(132, 110, 160, 0.14); }

.tag-legend span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border: 1px solid;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.66rem;
  font-weight: 800;
}

.card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  border-top: 1px solid rgba(89, 101, 75, 0.12);
  padding-top: 14px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
  text-decoration: none;
}

.card-action span {
  font-size: 1rem;
}

.card-action:hover,
.card-action:focus-visible {
  color: var(--ink);
  outline: none;
}

.project-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: 0 36px 110px rgba(31, 39, 30, 0.28);
}

.project-dialog::backdrop {
  background: rgba(39, 46, 35, 0.58);
  backdrop-filter: blur(8px);
}

.project-dialog-shell {
  position: relative;
  overflow-y: auto;
  max-height: min(820px, calc(100vh - 32px));
  border: 1px solid rgba(89, 101, 75, 0.16);
  border-radius: 18px;
  padding: clamp(28px, 5vw, 54px);
  background:
    radial-gradient(circle at 88% 8%, rgba(143, 163, 123, 0.2), transparent 30%),
    var(--paper);
}

.project-dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(89, 101, 75, 0.18);
  border-radius: 50%;
  color: var(--moss);
  background: rgba(255, 253, 248, 0.92);
  font: inherit;
  font-size: 1.45rem;
  cursor: pointer;
}

.project-dialog-close:hover,
.project-dialog-close:focus-visible {
  color: var(--paper);
  background: var(--moss);
  outline: none;
}

.project-dialog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-right: 56px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.project-dialog .card-kicker {
  margin-top: 34px;
}

.project-dialog h2 {
  max-width: 640px;
  margin: 8px 0 18px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.02;
}

.project-dialog-lead {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.project-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 30px 0 24px;
}

.project-dialog-grid section {
  border: 1px solid rgba(89, 101, 75, 0.13);
  border-radius: 10px;
  padding: 20px;
  background: rgba(247, 244, 235, 0.82);
}

.project-dialog-grid span {
  color: var(--clay);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-dialog-grid p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.58;
}

.project-dialog .portfolio-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.empty-state {
  padding: 60px 20px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.portfolio-essay {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 56px;
  align-items: center;
  padding: 92px 0;
  border-top: 1px solid var(--border);
}

.essay-visual {
  min-width: 0;
}

.graveyard-trigger {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 0;
  color: inherit;
  background: transparent;
  cursor: zoom-in;
  transition: transform 320ms ease;
}

.graveyard-trigger:hover {
  animation: graveyard-wobble 620ms ease both;
}

.graveyard-trigger:focus-visible {
  outline: 3px solid rgba(89, 101, 75, 0.55);
  outline-offset: 7px;
  transform: translateY(-7px) rotate(-0.35deg);
}

.graveyard-image {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 26px 64px rgba(38, 52, 43, 0.16), 0 8px 20px rgba(38, 52, 43, 0.08);
  transition: box-shadow 320ms ease, filter 320ms ease;
}

.graveyard-trigger:hover .graveyard-image,
.graveyard-trigger:focus-visible .graveyard-image {
  filter: saturate(1.03) contrast(1.02);
  box-shadow: 0 42px 92px rgba(38, 52, 43, 0.23), 0 16px 34px rgba(38, 52, 43, 0.12);
}

.graveyard-zoom-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  padding: 7px 11px;
  color: white;
  background: rgba(34, 43, 32, 0.72);
  box-shadow: 0 8px 20px rgba(20, 26, 18, 0.2);
  font-size: 0.7rem;
  font-weight: 850;
  opacity: 0.82;
  backdrop-filter: blur(10px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.graveyard-trigger:hover .graveyard-zoom-hint,
.graveyard-trigger:focus-visible .graveyard-zoom-hint {
  opacity: 1;
  transform: translateY(-2px);
}

body.has-image-lightbox {
  overflow: hidden;
}

.graveyard-lightbox {
  width: min(1380px, calc(100vw - 36px));
  max-width: none;
  max-height: calc(100svh - 36px);
  border: 0;
  padding: 0;
  color: white;
  background: transparent;
  overflow: visible;
}

.graveyard-lightbox[open] {
  animation: graveyard-lightbox-in 180ms ease both;
}

.graveyard-lightbox::backdrop {
  background: rgba(16, 23, 19, 0.68);
  backdrop-filter: blur(18px);
}

.graveyard-lightbox figure {
  margin: 0;
  animation: graveyard-panel-in 220ms ease both;
}

.graveyard-lightbox img {
  display: block;
  width: 100%;
  max-height: calc(100svh - 88px);
  border-radius: 16px;
  object-fit: contain;
  box-shadow: 0 54px 140px rgba(0, 0, 0, 0.42), 0 18px 48px rgba(0, 0, 0, 0.28);
}

.graveyard-lightbox figcaption {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.graveyard-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 50%;
  color: rgba(16, 23, 19, 0.9);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
  font: inherit;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.graveyard-lightbox-close:hover,
.graveyard-lightbox-close:focus-visible {
  color: white;
  background: rgba(45, 57, 42, 0.92);
  outline: 2px solid white;
  outline-offset: 3px;
}

@keyframes graveyard-wobble {
  0% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-8px) rotate(-0.55deg); }
  65% { transform: translateY(-7px) rotate(0.35deg); }
  100% { transform: translateY(-8px) rotate(-0.2deg); }
}

@keyframes graveyard-lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes graveyard-panel-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.essay-copy h2 {
  margin: 12px 0 20px;
  max-width: 520px;
}

.essay-copy > p:not(.eyebrow) {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

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

@media (max-width: 1000px) {
  .directory-hero,
  .directory-heading,
  .portfolio-essay {
    grid-template-columns: 1fr;
  }

  .portfolio-essay {
    gap: 34px;
  }

  .directory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .directory-toolbar {
    align-items: stretch;
    flex-direction: column;
    top: 68px;
  }

  .directory-search input {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .directory-hero,
  .directory-section,
  .portfolio-essay {
    width: min(100% - 28px, 1180px);
  }

  .directory-hero {
    padding: 34px 0 44px;
    gap: 30px;
  }

  .directory-scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .directory-scoreboard div {
    min-height: 104px;
    padding: 16px;
  }

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

  .directory-toolbar {
    position: static;
  }

  .directory-list-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .tag-legend {
    justify-content: flex-start;
  }

  .filter-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .directory-card {
    min-height: 300px;
  }

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

  .project-dialog-shell {
    padding: 26px 20px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .directory-card,
  .graveyard-trigger,
  .graveyard-image,
  .graveyard-zoom-hint,
  .graveyard-lightbox,
  .graveyard-lightbox figure {
    animation: none;
    transition: none;
  }
}
