:root {
  --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-head: 'Newsreader', 'Georgia', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --bg: #fafbfc;
  --bg-elevated: #ffffff;
  --bg-muted: #f3f4f6;
  --text: #1a1a1a;
  --text-secondary: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #14b8a6;
  --accent-strong: #0d9488;
  --accent-soft: #f0fdfa;
  --accent-light: #ccfbf1;
  --success: #0f766e;
  --btn-bg: #f1f5f9;
  --btn-text: #1e293b;
  --btn-border: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-elevated: #141416;
  --bg-muted: #1c1c1f;
  --text: #fafafa;
  --text-secondary: #d4d4d8;
  --muted: #a1a1aa;
  --line: #27272a;
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --accent-soft: #134e4a;
  --accent-light: #1e3a3a;
  --btn-bg: #27272a;
  --btn-text: #f4f4f5;
  --btn-border: #3f3f46;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

[data-theme="dark"] .site-header {
  background: rgba(20, 20, 22, 0.88);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  box-shadow: var(--shadow-sm);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 600;
  font-style: italic;
}

.brand-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.nav-pills {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.1rem;
  box-shadow: none;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  mask-image: linear-gradient(to right, transparent, black 1rem, black calc(100% - 1rem), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 1rem, black calc(100% - 1rem), transparent);
}

.nav-pills::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.5rem;
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--bg-muted);
  text-decoration: none;
}

.top-search {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
  transition: var(--transition);
}

.top-search:focus-within {
  border-color: var(--accent);
}

.top-search input {
  border: 0;
  background: transparent;
  padding: 0.35rem 0.6rem;
  width: 6rem;
  font-size: 0.75rem;
  color: var(--text);
}

.top-search input::placeholder {
  color: var(--muted);
}

.top-search input:focus {
  outline: none;
}

.top-search button {
  border: 0;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.top-search button:hover {
  background: var(--accent-strong);
}

.main-shell {
  padding: 1.6rem 0 3.2rem;
}

.breadcrumb {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.breadcrumb a {
  color: var(--muted);
}

.page-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.8rem, 1.5rem + 1.2vw, 2.6rem);
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.025em;
}

.page-intro {
  margin: 0.55rem 0 0;
  color: var(--muted);
  max-width: 70ch;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-soft {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
}

.feed-layout {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.panel {
  padding: 1.15rem;
}

.lead-kicker,
.story-meta,
.kicker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.badge.type {
  background: var(--text);
  color: var(--bg);
}

.badge.ward {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: var(--accent-strong);
}

.lead-title,
.story-title {
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0.5rem 0 0.4rem;
}

.lead-title {
  font-size: clamp(2rem, 1.5rem + 1.5vw, 2.8rem);
  font-style: italic;
}

.story-title {
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.45rem);
}

.lead-title a,
.story-title a {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--text), var(--text));
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 0.3s ease;
}

.lead-title a:hover,
.story-title a:hover {
  background-size: 100% 1px;
  text-decoration: none;
}

.story-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.story-list {
  display: grid;
  gap: 0.8rem;
}

.story-card {
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  transition: var(--transition);
}

.story-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent-light);
}

.sidebar-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.list-links {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.list-links a {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

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

.link-btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-strong);
}

.hero-intro {
  text-align: center;
  margin-bottom: 1rem;
  padding: 1.5rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.hero-intro .hero-title {
  font-family: var(--font-head);
  font-size: clamp(2.2rem, 1.8rem + 1.6vw, 3.2rem);
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--text);
}

.hero-intro .hero-title .accent {
  color: var(--accent);
  font-style: italic;
}

.hero-intro .hero-copy {
  margin: 0.8rem auto 0;
  max-width: 60ch;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
}

.link-btn:hover,
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.pagination {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.article-layout {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1rem;
}

.article-body {
  padding: 1.5rem;
}

.article-body h1 {
  font-family: var(--font-head);
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.025em;
  line-height: 1.15;
  font-size: clamp(2rem, 1.6rem + 1.4vw, 3rem);
  margin: 0.5rem 0 0.75rem;
}

.summary-box {
  margin: 1rem 0;
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  background: var(--accent-soft);
  color: var(--text);
}

.prose {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.75;
}

.prose p {
  margin: 0 0 1.25rem;
}

.reader-brief {
  margin-top: 1rem;
}

.reader-brief .prose {
  margin: 0 0 0.95rem;
  line-height: 1.72;
}

.fact-table-wrap {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-muted);
  padding: 0.9rem;
}

.fact-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
}

.fact-table th,
.fact-table td {
  border-top: 1px solid var(--line);
  padding: 0.56rem 0.15rem;
  vertical-align: top;
  font-size: 0.9rem;
}

.fact-table th {
  width: 34%;
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  padding-right: 0.7rem;
  text-align: left;
}

.fact-table td {
  color: var(--text-secondary);
}

.meta-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.7rem;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
  font-size: 0.82rem;
}

.entity-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.entity-chip {
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: #f1f6fd;
  color: #2b3b54;
  font-size: 0.78rem;
  padding: 0.3rem 0.62rem;
}

.entity-chip:hover {
  text-decoration: none;
  background: #e4eefc;
  border-color: #c9daf4;
}

.comment-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.comment-card {
  background: #f5f8fc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.8rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

label {
  display: block;
  margin-bottom: 0.32rem;
  font-size: 0.82rem;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.72rem 0.85rem !important;
  line-height: 1.35 !important;
  font: inherit;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 120px;
  padding-top: 0.8rem !important;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #8c94a1;
  opacity: 1;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.24);
  border-color: var(--accent);
}

.form-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.notice {
  border-radius: 11px;
  border: 1px solid;
  padding: 0.65rem 0.8rem;
  font-size: 0.83rem;
  margin-bottom: 0.8rem;
}

.notice.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.notice.success {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
}

.footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  background: var(--bg-elevated);
}

[data-theme="dark"] .footer {
  background: var(--bg);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}

.footer strong {
  color: var(--text);
  font-weight: 600;
}

.footer a {
  color: var(--text-secondary);
  transition: var(--transition);
}

.footer a:hover {
  color: var(--accent);
}

@media (max-width: 1040px) {
  .header-row {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .nav-pills {
    justify-self: start;
  }

  .top-search {
    width: 100%;
    justify-self: start;
  }

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

  .hero-grid,
  .feed-layout,
  .article-layout,
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: calc(100% - 1.2rem);
  }

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

  .footer-grid {
    padding-left: 0.5rem;
  }

  .nav-pills {
    overflow-x: auto;
    width: 100%;
    flex-wrap: nowrap;
  }

  .nav-link {
    white-space: nowrap;
  }
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  padding: 0;
}

.theme-toggle:hover {
  color: var(--accent);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }

[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

.card-soft {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

input, textarea, select {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--text);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}
