@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500&family=Onest:wght@400;500&family=IBM+Plex+Mono:wght@400;500&family=Josefin+Sans:wght@300;400;600&family=Inter:wght@400;500;700&family=Special+Elite&family=Orbitron:wght@500&family=Prata&family=Manrope:wght@400;500;700&family=Courier+Prime:wght@400;700&family=Permanent+Marker&display=swap");

/* ——— shared shell ——— */
[class^="theme-"] .top {
  position: relative;
  z-index: 2;
  padding: 18px 16px 12px;
  flex-shrink: 0;
}

[class^="theme-"] .page-title {
  margin: 0 0 12px;
  font-size: clamp(2.1rem, 7vw, 3.6rem);
  line-height: 1.08;
  text-align: center;
}

.name-search {
  position: relative;
  width: min(28rem, 100%);
  margin: 0 auto 12px;
  z-index: 6;
}

.name-search__input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: 999px;
}

.name-search__input::placeholder {
  color: var(--ink);
  opacity: 0.45;
}

.name-search__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.name-search__list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--sheet-bg, var(--panel-bg));
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  max-height: 16rem;
  overflow: auto;
}

.name-search__list[hidden] {
  display: none;
}

.name-search__option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.name-search__option.is-active,
.name-search__option:hover {
  background: var(--picker-active, rgba(127, 127, 127, 0.16));
}

.name-search__empty {
  margin: 0;
  padding: 8px 12px;
  opacity: 0.6;
  font-size: 0.88rem;
}

.theme-picker-wrap {
  margin: 0 0 12px;
}

.theme-picker {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.theme-picker::-webkit-scrollbar {
  display: none;
}

.theme-picker__btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--picker-bg, transparent);
  color: var(--ink);
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.theme-picker__btn:hover {
  transform: translateY(-1px);
}

.theme-picker__btn.is-active {
  border-color: var(--accent);
  background: var(--picker-active, rgba(255, 255, 255, 0.08));
}

.credit {
  position: fixed;
  z-index: 4;
  right: 16px;
  bottom: 14px;
  margin: 0;
  max-width: min(22rem, calc(100vw - 32px));
  text-align: right;
  font-size: 0.62rem;
  line-height: 1.35;
  color: var(--ink);
  pointer-events: none;
}

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin: 0;
  padding: 0;
  font-size: 0.68rem;
  line-height: 1;
}

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

[class^="theme-"] .top__main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.thread-swatch {
  flex: 0 0 22px;
  height: 3px;
  border-radius: 2px;
}

.thread-swatch--hub {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
}

[class^="theme-"] .graph-wrap {
  position: relative;
  flex: 1 1 auto;
  height: clamp(340px, calc(100dvh - 270px), 900px);
  min-height: 380px;
}

[class^="theme-"] #network {
  position: absolute;
  inset: 0;
}

[class^="theme-"] #network canvas {
  background: transparent !important;
}

/* ——— alt / emo ——— */
.theme-alt {
  --ink: #f6d5e4;
  --line: rgba(255, 77, 148, 0.38);
  --accent: #ff4d94;
  --panel-bg: rgba(22, 6, 12, 0.92);
  --sheet-bg: #180810;
  --picker-bg: rgba(255, 77, 148, 0.08);
  --picker-active: rgba(255, 77, 148, 0.22);
  background:
    radial-gradient(ellipse 80% 42% at 50% 0%, rgba(255, 40, 110, 0.34), transparent 70%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(180, 60, 220, 0.16), transparent 70%),
    #12060e;
  color: var(--ink);
  font-family: "Josefin Sans", sans-serif;
}

.theme-alt .page-title {
  font-weight: 300;
  color: #ff8ab8;
  letter-spacing: 0.04em;
}

.theme-alt .name-search__input {
  border-color: rgba(255, 77, 148, 0.55);
}

.theme-alt .legend .thread-swatch,
.theme-dossier .legend .thread-swatch {
  height: 7px;
  flex-basis: 28px;
}

.theme-alt .thread-swatch--gold {
  background: #e879f9;
  box-shadow: 0 0 0 1px #fff;
}
.theme-alt .thread-swatch--red {
  background: #ff2a2a;
  box-shadow: 0 0 0 1px #fff;
}
.theme-alt .thread-swatch--hub {
  background: #fff;
  box-shadow: 0 0 0 2px #e879f9;
}

/* ——— dossier ——— */
.theme-dossier {
  --ink: #2a241c;
  --line: rgba(42, 36, 28, 0.22);
  --accent: #8c6b3a;
  --panel-bg: rgba(255, 252, 246, 0.92);
  --sheet-bg: #f7f2ea;
  --picker-bg: rgba(42, 36, 28, 0.06);
  --picker-active: rgba(140, 107, 58, 0.14);
  background: #e5dfd3;
  color: var(--ink);
  font-family: "Special Elite", "Courier New", monospace;
}

.theme-dossier .page-title {
  font-family: "Special Elite", "Courier New", monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.theme-dossier .antiglamour {
  box-shadow: inset 0 0 0 1px rgba(42, 36, 28, 0.08);
}

.theme-dossier .thread-swatch--gold {
  background: #c8960a;
  box-shadow: 0 0 0 1px #1c1408;
}
.theme-dossier .thread-swatch--red {
  background: #d01212;
  box-shadow: 0 0 0 1px #1c1408;
}
.theme-dossier .thread-swatch--hub {
  background: #111;
  box-shadow: 0 0 0 2px #c8960a;
}

/* ——— scheme (transit map) ——— */
.theme-scheme {
  --ink: #111;
  --line: #c8c6c2;
  --accent: #1fa34a;
  --panel-bg: #fff;
  --sheet-bg: #fff;
  background: #eeedeb;
  color: var(--ink);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
}

.theme-scheme .page-title {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.theme-scheme .antiglamour {
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.theme-scheme .antiglamour__brand {
  font-weight: 600;
  letter-spacing: 0.12em;
}

.theme-scheme .thread-swatch {
  height: 6px;
  border-radius: 4px;
}

.theme-scheme .thread-swatch--gold {
  background: #1fa34a;
}
.theme-scheme .thread-swatch--red {
  background: #e8562a;
}
.theme-scheme .thread-swatch--hub {
  background: #f4c400;
  border: 2px solid #111;
}

@media (min-width: 900px) {
  [class^="theme-"] .top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 22px 28px 14px;
  }

  [class^="theme-"] .top__main {
    gap: 12px;
  }

  [class^="theme-"] .page-title {
    text-align: center;
    margin: 0 0 4px;
  }

  .theme-picker-wrap {
    margin: 0;
    width: 100%;
    display: flex;
    justify-content: center;
  }

  [class^="theme-"] .graph-wrap {
    height: calc(100dvh - 250px);
    min-height: 520px;
    margin: 0 12px 12px;
  }
}