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

:root {
  --fg: #2a2825;
  --fg-muted: #6b6660;
  --fg-faint: #a8a29d;
  --bg: #f0ede6;
  --border: rgba(42, 40, 37, 0.08);
  --border-hover: rgba(42, 40, 37, 0.18);
  --fill: rgba(42, 40, 37, 0.04);
  --fill-hover: rgba(42, 40, 37, 0.08);
  --press-fill: rgba(42, 40, 37, 0.03);
  --font: "IBM Plex Mono", "SF Mono", "Consolas", monospace;
}

html {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

a {
  color: inherit;
}

.header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.header h1 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.signup {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
  flex-shrink: 0;
}

.signup input {
  font-family: var(--font);
  font-size: 11px;
  color: var(--fg);
  background: transparent;
  border: none;
  border-bottom: 0.5px solid var(--border);
  padding: 2px 0;
  width: 160px;
  outline: none;
  transition: border-color 0.15s;
}

.signup input::placeholder {
  color: var(--fg-faint);
}

.signup input:focus {
  border-bottom-color: var(--fg-muted);
}

.signup button {
  font-family: var(--font);
  font-size: 11px;
  color: var(--fg-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.03em;
  transition: color 0.15s;
}

.signup button:hover {
  color: var(--fg);
}

.signup-status {
  font-size: 10px;
  color: var(--fg-faint);
}

.signup-status.error {
  color: #b07040;
}

.press {
  padding: 0;
  margin-bottom: 28px;
}

.press-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.press-links {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.press-links a {
  font-size: 11px;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}

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

.press-text,
.footer-text,
.project-link-muted,
.card-link-muted {
  color: var(--fg-faint);
}

.press-links .sep,
.footer-links .sep {
  font-size: 10px;
  color: var(--border-hover);
  user-select: none;
}

.press-sources {
  font-size: 11px;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-left: auto;
  animation: sources-pulse 3s ease-in-out infinite;
}

.press-sources:hover {
  color: var(--fg);
  animation: none;
}

@keyframes sources-pulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

.press-depth {
  font-size: 10px;
  color: var(--fg-faint);
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.15s;
}

.press-depth:hover {
  color: var(--fg);
}


.press-archive {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin-top 0.3s ease;
  margin-top: 0;
}

.press.open .press-archive {
  max-height: 70vh;
  margin-top: 14px;
  overflow-y: auto;
}

.press.open .press-depth::after {
  content: " ×";
}

.press-archive-inner {
  border-top: 0.5px dashed var(--border);
  padding-top: 12px;
}

.press-archive-year {
  font-size: 10px;
  font-weight: 500;
  color: var(--fg-faint);
  letter-spacing: 0.08em;
  margin: 14px 0 6px;
}

.press-archive-year:first-child {
  margin-top: 0;
}

.press-archive-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
}

.press-archive-item a {
  font-size: 12px;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
  line-height: 1.4;
}

.press-archive-item a:hover,
.footer-links a:hover,
.detail-back:hover,
.project-link:hover,
.mcp-hint a:hover,
.card-open-link:hover {
  color: var(--fg);
}

.press-archive-item .outlet {
  font-size: 10px;
  color: var(--fg-faint);
  flex-shrink: 0;
  min-width: 90px;
}

.year-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--fg-faint);
  letter-spacing: 0.08em;
  margin: 32px 0 10px;
}

.year-label:first-of-type {
  margin-top: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}

.card {
  position: relative;
  aspect-ratio: 1;
  border: 0.5px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-top,
.card-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.card-top {
  gap: 5px;
}

.card-bottom {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-name-link {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  width: fit-content;
}

.card-meta {
  font-size: 10px;
  color: var(--fg-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-location {
  font-size: 10px;
  color: var(--fg-muted);
  line-height: 1.35;
}

.card-year {
  font-size: 10px;
  color: var(--fg-faint);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.card-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--fill);
  transition: background 0.15s;
}

.card:hover .card-fill {
  background: var(--fill-hover);
}

.upcoming-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 28px;
}

.upcoming-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 11px;
  color: var(--fg-faint);
  flex-wrap: wrap;
  flex: 1;
}

.press-sources-mobile {
  display: none;
}

.upcoming-year {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
}

.upcoming-sep {
  color: var(--fg-faint);
}

.upcoming-locations {
  font-size: 11px;
  color: var(--fg-muted);
}

.project-summary {
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.card-stats,
.project-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.card-stat,
.project-stat {
  font-size: 10px;
  color: var(--fg-faint);
}

.card-stat b,
.project-stat b {
  font-weight: 500;
  color: var(--fg-muted);
}

.card-mcp-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg-faint);
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.card:hover .card-mcp-dot {
  opacity: 1;
}

.card-links,
.project-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: baseline;
}

.card-links {
  gap: 10px;
}

.project-links {
  font-size: 11px;
  line-height: 1.45;
}

.card-name-link,
.card-link,
.detail-back,
.project-link,
.footer-links a,
.mcp-hint a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.card-link,
.project-link {
  border-bottom: 0.5px solid transparent;
}

.card-name-link:hover,
.card-link:hover,
.project-link:hover {
  border-bottom-color: var(--fg-muted);
}

.footer-links {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 0.5px solid var(--border);
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 11px;
  flex-wrap: wrap;
}

.mcp-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--fg-faint);
}

.mcp-hint a {
  border-bottom: 0.5px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}

.mcp-details {
  margin-top: 12px;
  font-size: 11px;
  color: var(--fg-faint);
}

.mcp-details summary {
  cursor: pointer;
  color: var(--fg-muted);
  transition: color 0.15s;
}

.mcp-details summary:hover {
  color: var(--fg);
}

.mcp-details p {
  margin: 8px 0 4px;
  line-height: 1.5;
}

.mcp-details a {
  color: var(--fg-muted);
  text-decoration: none;
  border-bottom: 0.5px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}

.mcp-details a:hover {
  color: var(--fg);
}

.mcp-details pre {
  margin: 4px 0 12px;
  padding: 8px 10px;
  background: var(--card-bg, rgba(255,255,255,0.03));
  border: 0.5px solid var(--border);
  border-radius: 3px;
  font-size: 10px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  user-select: all;
}

.mcp-details ul {
  margin: 4px 0 0;
  padding-left: 16px;
  line-height: 1.7;
}

.mcp-details code {
  font-size: 10px;
}

.mcp-details em {
  font-style: italic;
}

.detail-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail-back {
  font-size: 11px;
}

.project-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-title {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.project-meta {
  font-size: 11px;
  color: var(--fg-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.project-links a {
  font-size: 11px;
}

pre.raw-json {
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.5;
  overflow-x: auto;
  padding: 14px;
  border: 0.5px solid var(--border);
  background: rgba(90, 90, 80, 0.03);
}

/* ── Sources page ───────────────────────────────────────────────────────── */

.sources-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sources-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sources-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.sources-page-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
}

.sources-count {
  font-size: 10px;
  color: var(--fg-faint);
}


.sources-search {
  font-family: var(--font);
  font-size: 11px;
  background: transparent;
  border: none;
  border-bottom: 0.5px solid var(--border);
  color: var(--fg);
  padding: 6px 0;
  outline: none;
  width: 100%;
  max-width: 300px;
  transition: border-color 0.15s;
}

.sources-search::placeholder {
  color: var(--fg-faint);
}

.sources-search:focus {
  border-bottom-color: var(--border-hover);
}

.sources-list {
  display: flex;
  flex-direction: column;
}

.sources-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 0.5px solid var(--border);
}

.sources-item:first-child {
  border-top: 0.5px solid var(--border);
}

.sources-item-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sources-outlet {
  font-size: 10px;
  color: var(--fg-faint);
  flex-shrink: 0;
  width: 120px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
}

.sources-title {
  font-size: 12px;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  flex: 1;
}

a.sources-title:hover {
  color: var(--fg);
}

.sources-item-meta {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-shrink: 0;
}

.sources-type {
  font-size: 9px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sources-tag {
  font-size: 9px;
  color: var(--fg-faint);
  text-decoration: none;
  transition: color 0.15s;
}

.sources-tag:hover {
  color: var(--fg-muted);
}

.sources-empty {
  font-size: 11px;
  color: var(--fg-faint);
  padding: 20px 0;
}

@media (max-width: 600px) {
  body {
    padding: 20px 16px 64px;
  }

  /* Header: name top-left, signup below full-width */
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
  }

  .header h1 {
    font-size: 12px;
  }

  .signup {
    margin-left: 0;
    width: 100%;
    gap: 6px;
    flex-wrap: nowrap;
  }

  /* 16px prevents iOS zoom; wrap in a container that scales it back down visually */
  .signup {
    font-size: 0;
  }

  .signup input {
    -webkit-appearance: none;
    border-radius: 0;
    width: auto;
    flex: 1;
    min-width: 0;
    font-size: 11px;
  }

  .signup button {
    font-size: 11px;
  }

  /* Viewport meta disables zoom so we can use real sizes */

  .signup button {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Press: keep label + depth on one row, links below */
  .press {
    padding: 0;
    margin-bottom: 22px;
  }

  .press-row {
    gap: 0;
    row-gap: 6px;
  }

  .press-label {
    flex: 1;
  }

  /* Depth toggle stays on the same line as the label */
  .press-depth {
    margin-left: 0;
    order: 2;
  }

  .press-sources:not(.press-sources-mobile) {
    display: none;
  }

  .press-sources-mobile {
    display: inline;
    margin-left: auto;
    flex-shrink: 0;
  }

  /* Links wrap to their own row */
  .press-links {
    order: 3;
    width: 100%;
    flex-basis: 100%;
    gap: 4px;
  }

  .press-archive-item {
    flex-direction: column;
    gap: 1px;
    padding: 6px 0;
  }

  .press-archive-item .outlet {
    min-width: 0;
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  /* Year labels */
  .year-label {
    font-size: 9px;
    letter-spacing: 0.06em;
    margin: 22px 0 8px;
  }

  /* 2-column card grid */
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
  }

  .card {
    padding: 10px;
    aspect-ratio: 1;
  }

  .card-name-link {
    font-size: 12px;
    line-height: 1.25;
  }

  .card-meta {
    font-size: 10px;
  }

  .card-location {
    font-size: 10px;
  }

  .card-year {
    font-size: 10px;
  }

  .card-stat {
    font-size: 10px;
  }

  /* Upcoming line */
  .upcoming-row {
    margin-top: 10px;
    margin-bottom: 22px;
  }

  .upcoming-line {
    font-size: 10px;
  }

  /* Detail page */
  .project-title {
    font-size: 17px;
  }

  .footer-links {
    margin-top: 36px;
    font-size: 10px;
  }

  .mcp-hint {
    font-size: 10px;
  }

  /* Sources page */
  .sources-item {
    flex-direction: row;
    gap: 8px;
    align-items: baseline;
  }

  .sources-outlet {
    width: auto;
    min-width: 0;
    font-size: 9px;
    flex-shrink: 0;
    text-align: left;
  }

  .sources-title {
    font-size: 11px;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    text-align: right;
    margin-left: auto;
  }

  .sources-search {
    font-size: 16px;
    max-width: 100%;
  }
}

/* ── Color schemes ── */

/* Auto light/dark — Bone is default, dark mode in evening */
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #c9c7c2;
    --fg-muted: #8a8883;
    --fg-faint: #56544f;
    --bg: #19191a;
    --border: rgba(201, 199, 194, 0.08);
    --border-hover: rgba(201, 199, 194, 0.18);
    --fill: rgba(205, 185, 90, 0.06);
    --fill-hover: rgba(205, 185, 90, 0.11);
    --press-fill: rgba(205, 185, 90, 0.05);
  }
}

/* Schemes applied to html — override background too */
[data-scheme] { background: var(--bg); color: var(--fg); }

/* A: Bone — warm parchment, dark ink */
[data-scheme="bone"] {
  --fg: #2a2825;
  --fg-muted: #6b6660;
  --fg-faint: #a8a29d;
  --bg: #f0ede6;
  --border: rgba(42, 40, 37, 0.08);
  --border-hover: rgba(42, 40, 37, 0.18);
  --fill: rgba(42, 40, 37, 0.04);
  --fill-hover: rgba(42, 40, 37, 0.08);
  --press-fill: rgba(42, 40, 37, 0.03);
}

/* B: Deep blue — near-black navy, silver text */
[data-scheme="deep-blue"] {
  --fg: #b0b8c4;
  --fg-muted: #6d7a8a;
  --fg-faint: #3a4555;
  --bg: #0b0f14;
  --border: rgba(176, 184, 196, 0.06);
  --border-hover: rgba(176, 184, 196, 0.14);
  --fill: rgba(100, 140, 200, 0.05);
  --fill-hover: rgba(100, 140, 200, 0.09);
  --press-fill: rgba(100, 140, 200, 0.04);
}

/* C: Moss — dark olive ground, pale sage text */
[data-scheme="moss"] {
  --fg: #c4c2b0;
  --fg-muted: #8a8970;
  --fg-faint: #4e4d3e;
  --bg: #12130f;
  --border: rgba(196, 194, 176, 0.07);
  --border-hover: rgba(196, 194, 176, 0.15);
  --fill: rgba(140, 150, 90, 0.05);
  --fill-hover: rgba(140, 150, 90, 0.09);
  --press-fill: rgba(140, 150, 90, 0.04);
}

/* D: Ash — pure neutral, no warmth */
[data-scheme="ash"] {
  --fg: #bdbdbd;
  --fg-muted: #757575;
  --fg-faint: #424242;
  --bg: #121212;
  --border: rgba(189, 189, 189, 0.06);
  --border-hover: rgba(189, 189, 189, 0.14);
  --fill: rgba(189, 189, 189, 0.04);
  --fill-hover: rgba(189, 189, 189, 0.08);
  --press-fill: rgba(189, 189, 189, 0.03);
}

/* Scheme switcher */
.scheme-switcher {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
  z-index: 100;
}

.scheme-btn {
  width: 18px;
  height: 18px;
  border-radius: 2px;
  border: 1px solid rgba(128,128,128,0.3);
  cursor: pointer;
  transition: transform 0.15s;
}

.scheme-btn:hover { transform: scale(1.2); }

.scheme-btn[data-s="default"] { background: #19191a; }
.scheme-btn[data-s="bone"]    { background: #f0ede6; }
.scheme-btn[data-s="deep-blue"] { background: #0b0f14; }
.scheme-btn[data-s="moss"]    { background: #12130f; border-color: rgba(140,150,90,0.4); }
.scheme-btn[data-s="ash"]     { background: #121212; }
