:root {
  color-scheme: light;
  --paper: #f5f4f1;
  --paper-raised: #ffffff;
  --ink: #16181c;
  --ink-soft: #51545c;
  --ink-faint: #696c73;
  --line: #dcdad4;
  --accent: #174ea6;
  --accent-soft: #dce8fb;
  --signal: #c63e2f;
  --inverse: #17191e;
  --inverse-ink: #f5f4f1;
  --shadow: 0 12px 30px rgba(24, 31, 43, 0.1);
  --display: "Gloock", Georgia, serif;
  --editorial: "Instrument Serif", Georgia, serif;
  --body: "Hanken Grotesk", Arial, sans-serif;
  --mono: "Spline Sans Mono", Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101114;
  --paper-raised: #181a1f;
  --ink: #f1f0ed;
  --ink-soft: #b8bbc2;
  --ink-faint: #858991;
  --line: #2d3037;
  --accent: #8ab5ff;
  --accent-soft: #1b2b45;
  --signal: #f07867;
  --inverse: #edf0f4;
  --inverse-ink: #13151a;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: 0;
  transition: background-color 180ms ease, color 180ms ease;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 3px;
}

.reading-progress {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 80;
  width: 0;
  height: 3px;
  background: var(--signal);
}

.page-controls {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-toggle {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

.language-toggle button {
  min-width: 46px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

.language-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}

.masthead {
  padding: 78px 22px 28px;
  border-bottom: 1px solid var(--line);
}

.masthead-inner,
.news-page {
  width: min(100%, 720px);
  margin: 0 auto;
}

.eyebrow,
.section-label,
.story-tags,
.story-meta,
.edition-line,
.dialog-kicker,
.dialog-meta,
.load-status,
.site-footer {
  font-family: var(--mono);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--signal);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.masthead h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: 52px;
  font-weight: 400;
  line-height: 1.08;
}

.edition-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  color: var(--ink-faint);
  font-size: 12px;
}

.edition-line time {
  color: var(--ink-soft);
  font-weight: 600;
}

.edition-count {
  color: var(--accent);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  color: var(--ink-faint);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.search-field input::placeholder {
  color: var(--ink-faint);
}

.filter-bar {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.country-filter-block {
  min-width: 0;
}

.filter-label {
  display: block;
  margin: 0 2px 7px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.country-toggles {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 1px 2px 7px;
  scrollbar-width: thin;
}

.country-toggle {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

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

.country-toggle[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.filter-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(100%, 360px);
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.filter-field select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
}

.load-status {
  min-height: 19px;
  margin: 10px 2px 0;
  color: var(--signal);
  font-size: 11px;
}

.news-page {
  padding: 32px 22px 48px;
}

.top-story {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--inverse);
  box-shadow: var(--shadow);
  color: var(--inverse-ink);
}

.top-story::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--signal);
  content: "";
}

.story-button {
  width: 100%;
  padding: 26px 24px 24px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.story-button:hover h2,
.story-button:hover h3 {
  color: var(--accent);
}

.top-story .story-button:hover h2 {
  color: #9fc2ff;
}

.story-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.story-tag {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 9px;
  border: 1px solid currentColor;
  border-radius: 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.top-story .story-tag {
  color: #9fc2ff;
}

.story-tag.signal {
  border-color: var(--signal);
  background: var(--signal);
  color: #fff;
}

.story-button h2,
.story-button h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  text-wrap: pretty;
  transition: color 150ms ease;
}

.story-button h2 {
  font-size: 30px;
  line-height: 1.18;
}

.story-button h3 {
  font-size: 22px;
  line-height: 1.25;
}

.story-summary {
  margin: 12px 0 0;
  color: #b9c9e8;
  font-family: var(--editorial);
  font-size: 19px;
  font-style: italic;
  line-height: 1.45;
  text-wrap: pretty;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 14px;
  color: var(--ink-faint);
  font-size: 11px;
}

.top-story .story-meta {
  color: #aeb8ca;
}

.region-section {
  margin-top: 42px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.section-label::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: "";
}

.section-number {
  color: var(--signal);
}

.story-list {
  display: grid;
}

.story-item {
  border-bottom: 1px solid var(--line);
}

.story-item:last-child {
  border-bottom: 0;
}

.story-item .story-button {
  padding: 20px 0 18px;
}

.empty-state,
.loading-state {
  padding: 44px 0;
  color: var(--ink-faint);
  font-family: var(--editorial);
  font-size: 20px;
  font-style: italic;
  text-align: center;
}

.loading-line {
  width: 72%;
  height: 16px;
  margin: 12px auto;
  border-radius: 4px;
  background: var(--line);
  animation: pulse 1.4s ease-in-out infinite alternate;
}

.loading-line.wide {
  width: 92%;
  height: 30px;
}

.loading-line.short {
  width: 48%;
}

@keyframes pulse {
  to { opacity: 0.4; }
}

.site-footer {
  display: grid;
  gap: 3px;
  padding: 26px 22px 42px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 11px;
  text-align: center;
}

.site-footer strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.article-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  color: var(--ink);
}

.article-dialog::backdrop {
  background: rgba(10, 12, 16, 0.7);
  backdrop-filter: blur(4px);
}

.dialog-shell {
  position: relative;
  padding: 38px 34px 40px;
}

.dialog-close {
  position: sticky;
  top: 0;
  z-index: 2;
  float: right;
  margin: -24px -20px 0 14px;
  box-shadow: none;
  font-size: 24px;
}

.dialog-kicker {
  margin: 0 0 10px;
  color: var(--signal);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.article-dialog h2 {
  margin: 0;
  padding-right: 28px;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.18;
  text-wrap: pretty;
}

.dialog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 13px;
  margin: 18px 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 11px;
}

.article-body {
  color: var(--ink);
  font-family: var(--editorial);
  font-size: 20px;
  line-height: 1.72;
  white-space: pre-wrap;
}

.article-body p {
  margin: 0 0 1.1em;
}

.article-body h3 {
  margin: 1.6em 0 0.6em;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  text-transform: uppercase;
}

.source-link {
  display: inline-flex;
  margin-top: 20px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

html[data-lang="cn"] body {
  font-family: "Noto Sans SC", var(--body);
}

html[data-lang="cn"] .masthead h1,
html[data-lang="cn"] .story-button h2,
html[data-lang="cn"] .story-button h3,
html[data-lang="cn"] .article-dialog h2 {
  font-family: "Noto Serif SC", var(--display);
}

@media (max-width: 600px) {
  .masthead {
    padding-top: 72px;
  }

  .masthead h1 {
    font-size: 43px;
  }

  .story-button h2 {
    font-size: 27px;
  }

  .story-button h3 {
    font-size: 21px;
  }

  .dialog-shell {
    padding: 34px 22px 34px;
  }

  .article-dialog h2 {
    font-size: 28px;
  }

  .article-body {
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Eternalgy publisher logo — dark/white variant swapped by theme */
.eternalgy-logo {
  display: inline-block;
  width: auto;
  vertical-align: middle;
}
.eternalgy-logo--white {
  display: none;
}
html[data-theme="dark"] .eternalgy-logo--dark {
  display: none;
}
html[data-theme="dark"] .eternalgy-logo--white {
  display: inline-block;
}

.eyebrow--logo {
  line-height: 0;
}
.eyebrow--logo a {
  display: inline-block;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}
.eyebrow--logo a:hover {
  opacity: 1;
}
.eyebrow--logo .eternalgy-logo {
  height: 20px;
}

/* Footer publisher block */
.footer-logo {
  display: inline-block;
  margin: 0 auto 12px;
  line-height: 0;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}
.footer-logo:hover {
  opacity: 1;
}
.footer-logo .eternalgy-logo {
  height: 24px;
}
.footer-note {
  margin: 0;
}
.footer-company {
  margin: 10px 0 0;
  color: var(--ink-soft);
}
.footer-contact,
.footer-legal {
  margin: 4px 0 0;
  line-height: 1.6;
}
.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.site-footer a:hover {
  color: var(--ink-soft);
}

/* Tag Trigger & Tag Modal Dialog */
.tag-filter-block {
  min-width: 0;
}

.tag-trigger-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(100%, 360px);
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.tag-trigger-button:hover {
  border-color: var(--accent);
}

.tag-trigger-button .dropdown-icon {
  color: var(--ink-faint);
  font-size: 11px;
}

/* Tag Modal Popup */
.tag-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 1;
  transition: opacity 180ms ease;
}

.tag-modal-backdrop[hidden] {
  display: none;
  opacity: 0;
}

.tag-modal {
  width: min(94vw, 480px);
  max-height: 82vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-raised);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: tagModalPop 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tagModalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.tag-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.tag-modal-header h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
}

.modal-close-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: background 120ms ease, color 120ms ease;
}

.modal-close-button:hover {
  background: var(--paper);
  color: var(--ink);
}

.tag-modal-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-faint);
}

.tag-modal-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.tag-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 4px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}

.text-button:hover {
  text-decoration: underline;
}

.tag-modal-body {
  padding: 14px 20px 20px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 360px;
  scrollbar-width: thin;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 100ms ease;
}

.tag-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-chip:active {
  transform: scale(0.97);
}

.tag-chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.tag-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.selected-count-badge {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.primary-button {
  padding: 8px 22px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 120ms ease;
}

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

.modal-empty-state {
  width: 100%;
  margin: 20px 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}

/* Internal Article Modal */
.article-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.article-modal-backdrop[hidden] {
  display: none !important;
}

.article-modal-content {
  position: relative;
  width: 100%;
  max-width: 760px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--paper, #171717);
  color: var(--ink, #f0f0f0);
  border: 1px solid var(--line, #333);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line, #2a2a2a);
}

.article-modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-title-primary {
  font-family: var(--display, serif);
  font-size: 26px;
  line-height: 1.3;
  margin: 0;
  color: var(--ink, #fff);
}

.modal-title-secondary {
  font-family: var(--body, sans-serif);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
  color: var(--ink-faint, #a0a0a0);
}

.modal-story-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-faint, #888);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #2a2a2a);
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--signal, #3b82f6);
  margin: 0;
}

.modal-summary-text {
  font-size: 16px;
  line-height: 1.65;
  margin: 0;
  color: var(--ink, #e0e0e0);
}

.modal-summary-subtext {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  color: var(--ink-faint, #999);
}

.modal-facts-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-fact-item {
  line-height: 1.5;
}

.modal-fact-main {
  font-size: 15px;
  color: var(--ink, #e0e0e0);
}

.modal-fact-sub {
  font-size: 13px;
  color: var(--ink-faint, #999);
  margin-top: 2px;
}

.modal-link-section {
  padding-top: 12px;
  border-top: 1px solid var(--line, #2a2a2a);
}

.source-link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--line, #444);
  border-radius: 6px;
  color: var(--ink-faint, #ccc);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.source-link-button:hover {
  border-color: var(--ink, #fff);
  color: var(--ink, #fff);
  background: rgba(255, 255, 255, 0.05);
}


