:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: rgba(255, 255, 252, 0.78);
  --surface-strong: #fffefa;
  --text: #17201c;
  --muted: #69736d;
  --line: rgba(23, 32, 28, 0.13);
  --accent: #0f766e;
  --accent-strong: #0b4f4a;
  --amber: #b7791f;
  --shadow: 0 24px 80px rgba(33, 44, 38, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1412;
  --surface: rgba(18, 27, 24, 0.78);
  --surface-strong: #141f1b;
  --text: #edf4ef;
  --muted: #a7b2ac;
  --line: rgba(237, 244, 239, 0.14);
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --amber: #f0b84f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 420px),
    radial-gradient(circle at 85% 12%, rgba(183, 121, 31, 0.16), transparent 260px),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans SC", system-ui, sans-serif;
}

body.no-scroll {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.field {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.58;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 0;
  height: 3px;
  background: var(--accent);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--accent-strong);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.nav-links,
.header-actions,
.hero-controls,
.tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.nav-links a:hover {
  color: var(--text);
}

.icon-button,
.primary-button,
.tag-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  min-width: 42px;
  padding: 0 12px;
}

.primary-button {
  padding: 0 18px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

.section-shell {
  width: min(1160px, calc(100% - 36px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 36px;
  min-height: calc(100vh - 78px);
  align-items: center;
  padding: 72px 0 56px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(54px, 10vw, 116px);
  line-height: 0.88;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1;
}

.hero-lede {
  max-width: 690px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.8;
}

.hero-controls {
  align-items: stretch;
  max-width: 720px;
  margin-top: 30px;
}

.search-box {
  flex: 1;
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.search-box span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.search-box input,
.palette input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.signal-panel {
  display: grid;
  gap: 12px;
}

.signal-panel div,
.lab-card,
.article-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.signal-panel div {
  padding: 22px;
}

.metric {
  display: block;
  margin-bottom: 8px;
  font-size: 34px;
  font-weight: 800;
}

.live-dot {
  color: var(--accent-strong);
}

.signal-panel small,
.article-card small,
.lab-card p,
.now-band p {
  color: var(--muted);
  line-height: 1.7;
}

.rail,
.lab-grid,
.now-band {
  padding: 60px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.tag-row {
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tag-button {
  padding: 0 14px;
  color: var(--muted);
}

.tag-button.active {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent-strong);
}

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

.article-card {
  display: grid;
  min-height: 310px;
  padding: 20px;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-3px);
  transition: transform 160ms ease;
}

.article-card h3 {
  margin: 18px 0 12px;
  font-size: 24px;
  line-height: 1.12;
}

.article-card p {
  color: var(--muted);
  line-height: 1.65;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.bookmark {
  color: var(--amber);
  font-weight: 800;
}

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

.lab-grid .section-heading {
  grid-column: 1 / -1;
}

.lab-card {
  padding: 22px;
}

.lab-card span {
  color: var(--accent-strong);
  font-weight: 800;
}

.now-band {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 32px;
  border-top: 1px solid var(--line);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 34px clamp(18px, 5vw, 64px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

dialog {
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
}

dialog::backdrop {
  background: rgba(7, 12, 10, 0.58);
  backdrop-filter: blur(10px);
}

.reader article,
.palette-box {
  width: min(780px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.reader article {
  position: relative;
  padding: clamp(24px, 5vw, 54px);
}

.reader h2 {
  margin-bottom: 24px;
}

.reader p,
.reader li {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 24px;
}

.palette {
  margin-top: 12vh;
}

.palette-box {
  padding: 12px;
}

.palette input {
  height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.palette-results {
  display: grid;
  gap: 6px;
  padding-top: 10px;
}

.palette-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.palette-item:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 860px) {
  .nav-links {
    display: none;
  }

  .hero,
  .now-band,
  .lab-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .site-header {
    padding-inline: 14px;
  }

  .brand small,
  .signal-panel {
    display: none;
  }

  .hero {
    min-height: auto;
    padding-top: 56px;
  }

  .hero-controls {
    flex-direction: column;
  }

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

  .site-footer {
    flex-direction: column;
  }
}
