/* ==========================================================================
   Time Ledger Theory — Research Paper Stylesheet
   Dark theme: black bg, white text, cobalt blue headings
   Adapted from Prometheus Research Group paper styles
   ========================================================================== */

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cobalt: #1B4F9B;
  --cobalt-light: #2E6FCF;
  --cobalt-dark: #0D2F66;
  --purple: #6B3FA0;
  --purple-light: #9B59B6;
  --white: #FFFFFF;
  --off-white: #E8E8EC;
  --black: #0A0A0A;
  --gray-dark: #1A1A1A;
  --gray-mid: #AAAAAA;
  --gray-light: #CCCCCC;
  --text: rgba(255, 255, 255, 0.88);
  --text-dim: rgba(255, 255, 255, 0.6);
  --border: rgba(46, 111, 207, 0.3);
  --surface: rgba(27, 79, 155, 0.08);
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Georgia', 'Times New Roman', 'Palatino Linotype', serif;
  line-height: 1.75;
  color: var(--text);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.paper-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Back to TLT link */
.back-to-site {
  display: inline-block;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cobalt-light);
  text-decoration: none;
  padding: 1rem 0;
  letter-spacing: 0.05em;
}

.back-to-site:hover {
  color: var(--purple-light);
  text-decoration: underline;
}

/* Header */
.paper-header {
  text-align: center;
  padding: 2rem 0 2rem;
  border-bottom: 2px solid var(--cobalt-light);
  margin-bottom: 2.5rem;
}

.paper-header .org-name {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cobalt-light);
  margin-bottom: 1.5rem;
}

.paper-header h1 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--white);
  margin-bottom: 1rem;
}

.paper-header .author {
  font-size: 1.05rem;
  color: var(--gray-light);
  margin-bottom: 0.25rem;
}

.paper-header .affiliation {
  font-size: 0.85rem;
  color: var(--gray-mid);
  font-style: italic;
}

.paper-header .date {
  font-size: 0.85rem;
  color: var(--gray-mid);
  margin-top: 0.5rem;
}

/* Table of Contents */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
}

.toc h2 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cobalt-light);
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

.toc ol {
  list-style-type: none;
  counter-reset: toc-counter;
  padding-left: 0;
}

.toc > ol > li {
  counter-increment: toc-counter;
  margin-bottom: 0.35rem;
}

.toc > ol > li::before {
  content: counter(toc-counter) ". ";
  font-weight: 600;
  color: var(--cobalt-light);
}

.toc > ol > li > ol {
  list-style-type: none;
  counter-reset: toc-sub-counter;
  padding-left: 1.5rem;
  margin-top: 0.2rem;
}

.toc > ol > li > ol > li {
  counter-increment: toc-sub-counter;
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
}

.toc > ol > li > ol > li::before {
  content: counter(toc-counter) "." counter(toc-sub-counter) " ";
  color: var(--cobalt-light);
  opacity: 0.7;
}

.toc a {
  color: var(--cobalt-light);
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

/* Abstract */
.abstract {
  background: var(--surface);
  border-left: 4px solid var(--cobalt-light);
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  border-radius: 0 6px 6px 0;
}

.abstract h2 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cobalt-light);
  margin-bottom: 0.75rem;
}

.abstract p {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-dim);
}

/* Section Headings */
h2.section-heading {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cobalt-light);
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

h3.subsection-heading {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--cobalt-light);
  opacity: 0.85;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h4.subsubsection-heading {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cobalt-light);
  opacity: 0.7;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Paragraphs */
p {
  margin-bottom: 1rem;
  text-align: justify;
  hyphens: auto;
}

/* Links */
a {
  color: var(--cobalt-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  color: var(--purple-light);
}

/* Equations */
.equation {
  text-align: center;
  margin: 1.5rem 0;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.equation-numbered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.equation-numbered .eq-content {
  flex: 0 1 auto;
  text-align: center;
}

.equation-numbered .eq-number {
  flex: 0 0 auto;
  font-size: 0.9rem;
  color: var(--gray-mid);
}

/* Lists */
ul, ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

li {
  margin-bottom: 0.4rem;
}

/* Description Lists */
dl {
  margin: 0.75rem 0 1rem 0;
}

dt {
  font-weight: 700;
  color: var(--gray-light);
  margin-top: 0.75rem;
}

dd {
  margin-left: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Block Quotes */
blockquote {
  border-left: 3px solid var(--cobalt-light);
  margin: 1.25rem 0 1.25rem 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-radius: 0 4px 4px 0;
}

blockquote p {
  margin-bottom: 0.5rem;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

table caption {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-light);
  text-align: left;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0;
}

thead {
  background: var(--cobalt);
  color: var(--white);
}

thead th {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

tbody tr:nth-child(even) {
  background: rgba(27, 79, 155, 0.05);
}

tbody tr:hover {
  background: rgba(27, 79, 155, 0.12);
}

tbody td {
  padding: 0.5rem 0.75rem;
  vertical-align: top;
}

table.compact {
  width: auto;
}

table.compact td,
table.compact th {
  padding: 0.35rem 0.75rem;
}

/* Figures */
figure {
  margin: 1.5rem 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

figcaption {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  font-style: italic;
}

/* Footnotes & Notes */
.note {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 0.5rem 0;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  font-style: italic;
}

/* Verification Status Tags */
.status-supported {
  display: inline-block;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: rgba(40, 167, 69, 0.2);
  color: #5dd57a;
}

.status-qualitative {
  display: inline-block;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

.status-speculative {
  display: inline-block;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: rgba(220, 53, 69, 0.2);
  color: #ff6b7a;
}

.status-open {
  display: inline-block;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--gray-mid);
}

/* Assumption / Limitation / Failure Boxes */
.disclosure {
  background: rgba(139, 105, 20, 0.1);
  border: 1px solid rgba(139, 105, 20, 0.3);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.disclosure strong {
  color: #d4a840;
}

/* References Section */
.references {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--cobalt-light);
}

.references h2 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cobalt-light);
  margin-bottom: 1rem;
}

.references ol {
  list-style-type: none;
  counter-reset: ref-counter;
  padding-left: 0;
}

.references ol li {
  counter-increment: ref-counter;
  padding-left: 2.5rem;
  text-indent: -2.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.references ol li::before {
  content: "[" counter(ref-counter) "] ";
  font-weight: 700;
  color: var(--cobalt-light);
}

/* Cite This Paper Box */
.cite-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}

.cite-box h3 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cobalt-light);
  margin-bottom: 0.75rem;
}

.cite-box pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-dim);
}

/* Related Papers */
.related-papers {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}

.related-papers h3 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cobalt-light);
  margin-bottom: 0.75rem;
}

.related-papers ul {
  list-style: none;
  padding-left: 0;
}

.related-papers li {
  margin-bottom: 0.5rem;
}

.related-papers a {
  font-weight: 600;
}

/* Explore More — CTA at bottom */
.explore-more {
  margin-top: 3rem;
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.explore-more p {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.explore-more a.cta-link {
  display: inline-block;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cobalt-light);
  border: 2px solid var(--cobalt-light);
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: background 0.2s, color 0.2s;
}

.explore-more a.cta-link:hover {
  background: var(--cobalt-light);
  color: var(--white);
  text-decoration: none;
}

/* Footer */
.paper-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--cobalt-light);
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray-mid);
}

.paper-footer .footer-logo {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--cobalt-light);
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.paper-footer p {
  text-align: center;
  margin-bottom: 0.25rem;
}

/* Acknowledgments */
.acknowledgments {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.acknowledgments h2 {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cobalt-light);
  margin-bottom: 0.75rem;
}

.acknowledgments p {
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* Appendix */
.appendix h2.section-heading {
  color: #7aad6a;
  border-bottom-color: rgba(122, 173, 106, 0.3);
}

/* Inline Code / Math Emphasis */
code {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  color: var(--off-white);
}

/* Strong emphasis */
strong {
  font-weight: 700;
}

/* Emphasis */
em {
  font-style: italic;
}

/* Small Caps */
.sc {
  font-variant: small-caps;
  font-weight: 600;
}

/* MathJax overrides */
mjx-container {
  overflow-x: auto;
  overflow-y: hidden;
  color: var(--white) !important;
}

/* Responsive */
@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  .paper-container {
    padding: 1rem 1rem 3rem;
  }

  .paper-header h1 {
    font-size: 1.4rem;
  }

  h2.section-heading {
    font-size: 1.2rem;
  }

  h3.subsection-heading {
    font-size: 1.05rem;
  }

  table {
    font-size: 0.8rem;
  }

  thead th, tbody td {
    padding: 0.4rem 0.5rem;
  }

  .toc {
    padding: 1rem 1.25rem;
  }

  .abstract {
    padding: 1rem 1.25rem;
  }

  .equation-numbered {
    flex-direction: column;
    gap: 0.25rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .paper-header h1 {
    font-size: 1.2rem;
  }

  .paper-container {
    padding: 0.75rem 0.75rem 2rem;
  }
}
