:root {
  color-scheme: light;
  --bg: #163843;
  --surface: #ffffff;
  --surface-alt: #f7fafb;
  --surface-soft: #ecf4f5;
  --border: #cad7dc;
  --border-strong: #2f7b87;
  --text: #1f2b2f;
  --text-strong: #17333a;
  --muted: #587179;
  --accent: #11798a;
  --accent-strong: #0b5c69;
  --accent-soft: #d7eaed;
}

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

html {
  background: var(--bg);
}

body,
body.site-home,
body.site-body {
  margin: 0;
  background: linear-gradient(180deg, #123741 0%, #173f49 24rem, #1b4651 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.58;
}

body.paper-page,
body.paper-shell {
  margin: 0;
  background: linear-gradient(180deg, #123741 0%, #173f49 22rem, #1b4651 100%);
  color: #202020;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.72;
}

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

a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.page,
.site-page,
.site-shell,
.page-shell,
body.paper-shell .paper-page {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0 clamp(1rem, 4vw, 3rem) 3rem;
  background: var(--surface);
  border: 0;
}

.page-shell,
body.paper-shell .paper-page {
  max-width: none;
}

.site-shell-wide {
  max-width: none;
}

h1,
h2,
h3,
.site-title,
.site-section-title,
.site-card-title,
.site-hero-title {
  margin: 0;
  color: var(--text-strong);
  font-weight: 700;
}

h1,
.site-title,
.site-hero-title {
  font-size: clamp(1.9rem, 3.4vw, 2.45rem);
  line-height: 1.18;
}

.hero-subtitle,
.site-hero-subtitle {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 400;
}

body.paper-page h1,
body.paper-shell h1 {
  font-size: clamp(1.9rem, 3vw, 2.25rem);
  line-height: 1.2;
}

h2,
.site-section-title {
  font-size: 1.22rem;
}

h3,
.site-card-title,
.paper-title {
  font-size: 1.1rem;
  line-height: 1.35;
}

.hero,
.hero-card,
.site-hero,
.hero-panel,
.paper-header {
  margin-top: 1rem;
  padding: 1.15rem 0 1rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.eyebrow,
.badge,
.chip,
.site-eyebrow,
.site-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: Arial, Helvetica, sans-serif;
}

.eyebrow,
.site-eyebrow,
.badge {
  margin-bottom: 0.9rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.73rem;
  font-weight: 700;
  border-radius: 0;
}

.badge {
  background: #e1e8ef;
}

.chip,
.site-chip {
  padding: 0.18rem 0.45rem;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: #41576a;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 0;
}

.hero-copy,
.lead,
.site-hero-copy,
.site-lead,
.section-copy,
.site-section-copy,
.paper-summary,
.paper-authors,
.muted,
.site-muted,
.byline,
.series-line,
.small {
  color: var(--muted);
}

.hero-copy,
.lead,
.site-hero-copy,
.site-lead {
  max-width: 68ch;
  margin-top: 0.75rem;
  font-size: 0.98rem;
}

.section,
.site-section {
  margin-top: 1.5rem;
}

.section-header,
.section-head,
.site-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-strong);
}

.section-copy,
.site-section-copy {
  max-width: 74ch;
  margin-top: 0.35rem;
}

.grid,
.site-grid {
  display: grid;
  gap: 0.75rem;
}

.paper-grid,
.site-paper-grid {
  grid-template-columns: 1fr;
}

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

.meta-grid,
.site-info-grid,
.site-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.site-card,
.meta,
.source-note,
.paper-nav,
.abstract,
.footer,
.footer-bar,
.site-footer,
.paper-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 2px solid var(--border-strong);
  border-radius: 0;
  box-shadow: none;
}

.card,
.site-card {
  padding: 0.95rem 1rem;
}

.paper-card {
  display: grid;
  gap: 0.38rem;
  min-height: 100%;
  padding: 1rem 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
}

.paper-grid > .paper-card:first-child,
#paper-list > .paper-card:first-child {
  padding-top: 0.2rem;
  border-top: 0;
}

.paper-title {
  margin-top: 0.1rem;
  font-size: 1.12rem;
}

.paper-meta,
.site-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.82rem;
}

.paper-authors,
.paper-summary {
  margin: 0;
}

.paper-authors::before {
  content: "Authors: ";
  color: var(--text-strong);
  font-weight: 700;
}

.paper-summary::before {
  content: "Abstract: ";
  color: var(--text-strong);
  font-weight: 700;
}

.paper-link-groups {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.paper-link-group {
  display: grid;
  gap: 0.15rem;
}

.paper-link-label {
  color: var(--text-strong);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.paper-link-note {
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
}

.paper-links-secondary {
  color: var(--muted);
  font-size: 0.88rem;
}

.paper-links-secondary a {
  font-weight: 600;
}

.hero-actions,
.quick-links,
.paper-links,
.package-links,
.button-row,
.site-actions,
.site-link-row,
.site-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
}

.hero-actions,
.site-actions {
  margin-top: 0.85rem;
}

.button,
.site-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 0.78rem;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button:hover,
.site-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
  text-decoration: none;
}

.button.secondary,
.button.ghost,
.site-button.site-button-secondary {
  background: var(--surface);
  color: var(--accent);
}

.quick-links a,
.paper-links a,
.package-links a,
.paper-nav a,
.site-link-row a,
.site-link-list a,
.site-breadcrumb {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: 700;
  border-radius: 0;
}

.paper-links,
.package-links,
.site-link-row,
.site-link-list,
.quick-links {
  align-items: baseline;
}

.paper-links a::after,
.package-links a::after,
.site-link-row a::after,
.site-link-list a::after,
.quick-links a::after {
  content: " |";
  color: var(--border-strong);
}

.paper-links a:last-child::after,
.package-links a:last-child::after,
.site-link-row a:last-child::after,
.site-link-list a:last-child::after,
.quick-links a:last-child::after {
  content: "";
}

.list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.list li + li {
  margin-top: 0.45rem;
}

.footer,
.footer-bar,
.site-footer,
.paper-footer {
  margin-top: 2rem;
  padding: 1rem 0 0;
  border: 0;
  border-top: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  font-size: 0.93rem;
}

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

body.paper-page header,
body.paper-page main,
body.paper-page footer,
body.paper-shell header,
body.paper-shell main,
body.paper-shell footer,
body.paper-shell .paper-page > header,
body.paper-shell .paper-page > main,
body.paper-shell .paper-page > footer {
  max-width: none;
  margin: 0;
}

.paper-nav,
.breadcrumb,
.page-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin: 0.85rem 0 1rem;
  padding: 0 0 0.55rem;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-family: Arial, Helvetica, sans-serif;
}

.series-line {
  display: block;
  margin-bottom: 0.65rem;
  font-size: 0.88rem;
  font-family: Arial, Helvetica, sans-serif;
}

.byline,
.meta,
.source-note,
.footer,
.paper-footer {
  font-family: Arial, Helvetica, sans-serif;
}

.byline {
  font-size: 0.97rem;
  margin: 1rem 0 1.4rem;
}

.abstract,
.meta,
.source-note,
.paper-panel {
  margin: 0.9rem 0;
  padding: 0.85rem 1rem;
}

.abstract,
.paper-panel {
  background: #f8fafc;
  border-left-color: var(--accent);
}

.abstract strong,
.env strong,
.paper-callout strong {
  display: block;
  margin-bottom: 0.35rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta,
.source-note {
  font-size: 0.92rem;
}

body.paper-page main,
body.paper-shell main {
  padding-top: 0.6rem;
}

body.paper-page h2,
body.paper-shell h2 {
  margin-top: 2.1rem;
  padding-bottom: 0.28rem;
  border-bottom: 1px solid var(--border-strong);
  font-size: 1.28rem;
}

body.paper-page h3,
body.paper-shell h3 {
  margin-top: 1.7rem;
  font-size: 1.08rem;
}

body.paper-page p,
body.paper-shell p {
  margin: 0.85rem 0;
}

body.paper-page ul,
body.paper-shell ul,
body.paper-page ol,
body.paper-shell ol {
  padding-left: 1.3rem;
}

body.paper-page figure,
body.paper-shell figure {
  margin: 1.7rem 0 2rem;
  text-align: center;
}

body.paper-page figure img,
body.paper-shell figure img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #ffffff;
}

body.paper-page figcaption,
body.paper-shell figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.env,
.paper-callout {
  margin: 1.3rem 0;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid #4d666d;
  border-radius: 0;
  background: #fafbfc;
}

.env.definition,
.paper-callout.definition {
  border-left-color: var(--accent);
  background: #f3f7fb;
}

.env.proposition,
.paper-callout.theorem {
  border-left-color: #4a5561;
}

.env.remark {
  border-left-color: #8a7100;
  background: #fffdf4;
}

.display {
  display: block;
  margin: 1rem auto;
  text-align: center;
  font-style: italic;
}

.math {
  font-style: italic;
  white-space: nowrap;
}

.proof {
  margin: 0.5rem 0 1.5rem 1.4rem;
  color: #333333;
}

.proof::before {
  content: "Proof. ";
  font-weight: 700;
}

.proof::after {
  content: " \25A0";
}

code,
pre {
  font-family: "Courier New", monospace;
  background: #f3f5f7;
  border-radius: 0;
}

code {
  padding: 0.08rem 0.25rem;
  font-size: 0.9em;
}

pre {
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.94rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.84rem;
  text-align: left;
}

.refs li,
.references li {
  margin-bottom: 0.55rem;
}

@media (max-width: 900px) {
  .index-grid,
  .info-grid,
  .meta-grid,
  .site-info-grid,
  .site-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page,
  .site-page,
  .site-shell,
  .page-shell,
  body.paper-shell .paper-page {
    padding: 0 1rem 2.5rem;
  }

  h1,
  .site-title,
  .site-hero-title {
    font-size: 1.8rem;
  }

  body.paper-page h1,
  body.paper-shell h1 {
    font-size: 1.9rem;
  }

  .hero,
  .site-hero,
  .hero-panel,
  .paper-header {
    padding-top: 1.1rem;
  }
}
