:root {
  --knowledge-ink: #172033;
  --knowledge-navy: #172d50;
  --knowledge-gold: #f3b53f;
  --knowledge-coral: #f2675a;
  --knowledge-mint: #43b69f;
  --knowledge-paper: #fffdf8;
}

body.periodic-page {
  --container-max-width: 1380px;
}

.knowledge-page {
  color: var(--knowledge-ink);
}

.knowledge-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 7vw, 72px);
  background:
    radial-gradient(circle at 82% 18%, rgba(243, 181, 63, 0.3), transparent 26%),
    radial-gradient(circle at 12% 88%, rgba(67, 182, 159, 0.2), transparent 30%),
    linear-gradient(135deg, #172d50 0%, #234d77 62%, #246579 100%);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(23, 45, 80, 0.24);
}

.knowledge-hero::after {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 17px;
}

.knowledge-eyebrow {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: #ffe3a6;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.knowledge-hero h1 {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0;
  color: #fff;
  font-size: clamp(36px, 7vw, 68px);
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-align: left;
}

.knowledge-hero .subtitle {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(17px, 2.4vw, 21px);
  line-height: 1.55;
  text-align: left;
}

.directory-hero {
  padding-block: clamp(30px, 5vw, 54px);
}

.directory-hero h1 {
  font-size: clamp(38px, 6vw, 62px);
}

.knowledge-stats {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.knowledge-stat {
  min-width: 120px;
}

.knowledge-stat strong,
.knowledge-stat span {
  display: block;
}

.knowledge-stat strong {
  color: #fff;
  font-size: 24px;
}

.knowledge-stat span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.knowledge-section {
  margin-top: 28px;
  padding: clamp(24px, 5vw, 44px);
  background: var(--knowledge-paper);
  border: 1px solid rgba(23, 45, 80, 0.1);
  border-radius: 20px;
  box-shadow: 0 12px 34px rgba(23, 45, 80, 0.08);
}

.knowledge-section > h2:first-child {
  margin-top: 0;
}

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

.collection-card {
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 26px;
  color: #fff;
  background: linear-gradient(145deg, #234d77, #172d50);
  border-radius: 18px;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(23, 45, 80, 0.16);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.collection-card::before {
  content: attr(data-mark);
  position: absolute;
  top: -18px;
  right: 14px;
  color: rgba(255, 255, 255, 0.12);
  font-family: Georgia, serif;
  font-size: 112px;
  font-weight: 700;
  line-height: 1;
}

.collection-card:nth-child(2) {
  background: linear-gradient(145deg, #6a3245, #321e33);
}

.collection-card:nth-child(3) {
  background: linear-gradient(145deg, #365f59, #153d3a);
}

.collection-card:nth-child(4) {
  background: linear-gradient(145deg, #6a4d17, #35280f);
}

.collection-card:hover {
  color: #fff;
  transform: translateY(-4px);
  box-shadow: 0 18px 34px rgba(23, 45, 80, 0.22);
}

.collection-card .card-kicker {
  position: relative;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.collection-card h2 {
  position: relative;
  margin: 8px 0 5px;
  padding: 0;
  color: #fff;
  border: 0;
  font-family: Georgia, serif;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.08;
}

.collection-card p {
  position: relative;
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
}

.featured-strip {
  display: grid;
  grid-template-columns: minmax(190px, 0.65fr) minmax(0, 2fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 28px;
  padding: 22px;
  color: var(--knowledge-ink);
  background: var(--knowledge-paper);
  border: 1px solid rgba(23, 45, 80, 0.1);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(23, 45, 80, 0.08);
}

.featured-strip-heading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 12px;
}

.featured-strip-heading > span {
  color: #8d641d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.featured-strip-heading h2 {
  margin: 5px 0 0;
  padding: 0;
  border: 0;
  font-family: Georgia, serif;
}

.featured-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.featured-links a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 74px;
  padding: 13px 16px;
  color: #fff;
  background: linear-gradient(135deg, #234d77, #172d50);
  border-radius: 11px;
  text-decoration: none;
  transition: transform 150ms ease, filter 150ms ease;
}

.featured-links a:hover {
  color: #fff;
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.featured-links span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
}

.directory-shell {
  margin-top: 28px;
  padding: clamp(20px, 4vw, 34px);
  color: #ece2d0;
  background:
    radial-gradient(circle at 100% 0, rgba(201, 138, 75, 0.14), transparent 24%),
    #241d16;
  border: 1px solid #3d3327;
  border-radius: 20px;
  box-shadow: 0 22px 54px rgba(26, 20, 12, 0.3);
}

.directory-intro h2 {
  margin: 0;
  padding: 0;
  color: #fff;
  border: 0;
  font-family: Georgia, serif;
  font-size: clamp(30px, 5vw, 44px);
}

.directory-intro > p:last-child {
  margin: 8px 0 22px;
  color: #c9bda3;
}

.directory-controls label {
  color: #e4d8bd;
}

.directory-controls input,
.directory-controls select {
  color: #fff;
  background: #2f261c;
  border-color: #4a3d2c;
}

.directory-controls input::placeholder {
  color: #a8987d;
}

.directory-shell > .list-results-summary {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.directory-section {
  margin-top: 24px;
  overflow: hidden;
  background: rgba(30, 22, 14, 0.55);
  border: 1px solid #4a3d2c;
  border-radius: 14px;
}

.directory-section[hidden] {
  display: none;
}

.directory-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 18px;
  background: linear-gradient(90deg, #6b4a2a, #4a3420);
  border-left: 6px solid var(--knowledge-gold);
}

.directory-heading span {
  display: block;
  color: rgba(255, 255, 255, 0.66);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.directory-heading h2 {
  margin: 0;
  padding: 0;
  color: #fff;
  border: 0;
  font-family: Georgia, serif;
  font-size: clamp(20px, 3vw, 27px);
  font-style: italic;
}

.directory-heading strong {
  color: #f6e4c1;
  font-size: 12px;
  white-space: nowrap;
}

.directory-description {
  margin: 0;
  padding: 13px 20px;
  color: #b6a688;
  border-bottom: 1px solid #3d3327;
  font-size: 13px;
}

.directory-links {
  column-count: 2;
  column-gap: 34px;
  margin: 0;
  padding: 12px 20px 18px;
  list-style: none;
}

.directory-link-item {
  display: flex;
  gap: 9px;
  align-items: baseline;
  break-inside: avoid;
  padding: 8px 0;
  border-bottom: 1px solid rgba(168, 148, 112, 0.18);
}

.directory-link-item[hidden] {
  display: none;
}

.directory-link-item a {
  color: #f4e2b8;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration-color: rgba(244, 226, 184, 0.42);
  text-underline-offset: 3px;
}

.directory-link-item a:hover {
  color: #fff;
  text-decoration-color: #9db98a;
}

.directory-published {
  margin-left: auto;
  padding: 3px 6px;
  color: #22331a;
  background: #9db98a;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.directory-pending {
  margin-left: auto;
  color: #a89678;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.directory-leaf-hero {
  padding-block: clamp(28px, 5vw, 50px);
}

.directory-leaf-hero h1 {
  font-size: clamp(34px, 6vw, 58px);
}

.editorial-status {
  border-top: 5px solid var(--knowledge-gold);
}

.status-pill {
  display: inline-flex;
  padding: 6px 10px;
  color: #684a16;
  background: #fff0c5;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editorial-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  padding-left: 22px;
}

.list-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.7fr);
  gap: 12px;
  margin-bottom: 20px;
}

.list-control label {
  font-size: 13px;
}

.list-results-summary {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-entry {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(180px, 1fr) minmax(120px, 0.65fr);
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid rgba(23, 45, 80, 0.1);
  border-left: 5px solid var(--knowledge-gold);
  border-radius: 12px;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.timeline-entry:hover {
  border-color: rgba(23, 45, 80, 0.22);
  box-shadow: 0 8px 22px rgba(23, 45, 80, 0.08);
  transform: translateX(2px);
}

.timeline-entry[hidden] {
  display: none;
}

.timeline-years {
  color: #a56613;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.timeline-name {
  margin: 0;
  color: var(--knowledge-navy);
  font-family: Georgia, serif;
  font-size: 20px;
  line-height: 1.2;
}

.timeline-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.timeline-entry--detailed {
  grid-template-columns: minmax(145px, 0.35fr) minmax(0, 1.65fr);
  align-items: start;
}

.timeline-copy {
  min-width: 0;
}

.timeline-copy .timeline-meta {
  display: block;
  margin-top: 3px;
  color: #486071;
  font-weight: 700;
}

.timeline-note {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
}

.scope-note {
  padding: 16px 18px;
  background: #f1f6f8;
  border-left: 4px solid var(--knowledge-mint);
  border-radius: 10px;
  color: #3d5362;
}

.source-list {
  padding-left: 20px;
}

.source-list a {
  overflow-wrap: anywhere;
}

.periodic-workspace {
  margin-top: 28px;
  padding: clamp(16px, 3vw, 28px);
  background: #111827;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.28);
}

.periodic-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(190px, 0.45fr);
  gap: 12px;
  margin-bottom: 16px;
}

.periodic-toolbar label {
  color: #dce7f4;
  font-size: 13px;
}

.periodic-toolbar input,
.periodic-toolbar select {
  color: #f8fafc;
  background: #1f2937;
  border-color: #34445b;
}

.periodic-toolbar input::placeholder {
  color: #8da0b8;
}

.periodic-scroll {
  overflow-x: auto;
  padding: 3px 3px 12px;
  scrollbar-color: #56677e #1f2937;
}

.periodic-grid {
  min-width: 1180px;
  display: grid;
  grid-template-columns: repeat(18, minmax(44px, 1fr));
  grid-template-rows: repeat(9, 82px);
  gap: 5px;
}

.element-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 5px;
  color: #f8fafc;
  background: #2d6a9f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.element-cell:hover,
.element-cell:focus-visible {
  z-index: 3;
  filter: brightness(1.16);
  outline: 2px solid #fff;
  outline-offset: 1px;
  transform: scale(1.08);
}

.element-cell.is-muted {
  opacity: 0.16;
}

.element-cell.is-match {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.element-number,
.element-symbol,
.element-name {
  display: block;
}

.element-number {
  font-size: 10px;
  line-height: 1;
  opacity: 0.82;
}

.element-symbol {
  margin-top: 3px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.element-name {
  overflow: hidden;
  margin-top: 4px;
  font-size: 9px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-placeholder {
  display: grid;
  place-items: center;
  color: #dce7f4;
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 7px;
  font-size: 11px;
  text-align: center;
}

.family-alkali { background: #c84f59; }
.family-alkaline { background: #b66b2a; }
.family-transition { background: #8862aa; }
.family-post-transition { background: #477e91; }
.family-metalloid { background: #2d8879; }
.family-nonmetal { background: #337bb6; }
.family-halogen { background: #ba4f8a; }
.family-noble { background: #4e64b5; }
.family-lanthanide { background: #b0576d; }
.family-actinide { background: #9d5a86; }
.family-unknown { background: #5f6c7c; }

.periodic-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 16px;
  color: #c8d4e3;
  font-size: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.element-detail {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-top: 18px;
  padding: 20px;
  color: #e5edf6;
  background: #1f2937;
  border: 1px solid #34445b;
  border-radius: 14px;
}

.detail-symbol {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 18px;
  color: #fff;
  background: #2d6a9f;
  font-size: 42px;
  font-weight: 800;
}

.element-detail h2 {
  margin: 0 0 4px;
  padding: 0;
  color: #fff;
  border: 0;
  font-family: Georgia, serif;
  font-size: 28px;
}

.detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 9px;
  color: #b9c7d8;
  font-size: 13px;
}

.periodic-empty {
  margin: 14px 0 0;
  color: #ffd58a;
}

@media (max-width: 720px) {
  .collection-grid,
  .list-controls,
  .periodic-toolbar,
  .featured-strip {
    grid-template-columns: 1fr;
  }

  .featured-links,
  .editorial-checklist {
    grid-template-columns: 1fr;
  }

  .directory-links {
    column-count: 1;
  }

  .timeline-entry {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .knowledge-hero {
    border-radius: 18px;
  }

  .knowledge-hero h1 {
    font-size: clamp(34px, 12vw, 52px);
  }

  .element-detail {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .detail-symbol {
    width: 68px;
    height: 68px;
    font-size: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .collection-card,
  .timeline-entry,
  .element-cell {
    transition: none;
  }
}
