/* CrewPort Monochrome Theme - Adapted for AI Research & Philosophy
   Original: style-original.css (backup for easy revert)

   To revert: Replace this file with style-original.css contents
   Or: Change head.html to reference style-original.css instead
*/

/* ── Light theme (default) ────────────────────────────────── */

:root,
[data-theme="light"] {
  --bg-primary:   #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary:  #ebebeb;

  --text-primary:   #0a0a0a;
  --text-secondary: #555555;
  --text-muted:     #777777;
  --text-tertiary:  #999999;

  --border-color:  rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.04);

  --accent-primary: #0a0a0a;
  --accent-hover:   rgba(0, 0, 0, 0.7);
  --link-color:     #333333;
  --link-hover:     #000000;

  --code-bg: #f5f5f5;

  --shadow:    0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);

  --hover-tint:       rgba(0, 0, 0, 0.03);
  --hover-tint-strong: rgba(0, 0, 0, 0.06);
  --active-tint:      rgba(0, 0, 0, 0.02);
  --section-tint:     rgba(0, 0, 0, 0.02);
}

/* ── Dark theme ───────────────────────────────────────────── */

[data-theme="dark"] {
  --bg-primary:   #150f11;
  --bg-secondary: #1c1618;
  --bg-tertiary:  #241e20;

  --text-primary:   #ffffff;
  --text-secondary: #aaaaaa;
  --text-muted:     #888888;
  --text-tertiary:  #666666;

  --border-color:  rgba(255, 255, 255, 0.07);
  --border-subtle: rgba(255, 255, 255, 0.04);

  --accent-primary: #ffffff;
  --accent-hover:   rgba(255, 255, 255, 0.7);
  --link-color:     #cccccc;
  --link-hover:     #ffffff;

  --code-bg: #1c1618;

  --shadow:    0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.7);

  --hover-tint:       rgba(255, 255, 255, 0.03);
  --hover-tint-strong: rgba(255, 255, 255, 0.06);
  --active-tint:      rgba(255, 255, 255, 0.02);
  --section-tint:     rgba(21, 15, 17, 0.25);
}

/* ── Component tokens ─────────────────────────────────────── */

:root {
  --border: 1px solid var(--border-color);
  --radius: 4px;
  --radius-sm: 2px;
  --transition: 150ms ease;
}

/* ── Reset and base ───────────────────────────────────────── */

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

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

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Typography ───────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

h2 {
  font-size: 1.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

p {
  margin-bottom: 1.25rem;
}

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

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

/* ── Layout ───────────────────────────────────────────────── */

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Site Header ──────────────────────────────────────────── */

.site-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.site-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
}

.site-title:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.site-nav a:hover {
  color: var(--text-primary);
  background: var(--hover-tint);
  text-decoration: none;
}

/* ── Search ───────────────────────────────────────────────── */

.search-wrapper {
  position: relative;
  width: 100%;
  order: 3;
}

@media (min-width: 769px) {
  .search-wrapper {
    width: auto;
    order: 0;
    margin-left: auto;
  }
}

#site-search {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  width: 140px;
  transition: width 0.2s ease, border-color 0.2s ease;
}

#site-search:focus {
  outline: none;
  border-color: var(--accent-primary);
  width: 200px;
}

#site-search::placeholder {
  color: var(--text-tertiary);
}

.search-results {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-top: 0.5rem;
  display: none;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.search-results.active {
  display: block;
}

.search-result {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
  transition: background-color var(--transition);
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover {
  background-color: var(--hover-tint);
  text-decoration: none;
}

.search-result-title {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.search-result-excerpt {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-no-results {
  padding: 1rem;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
}

/* ── Site Footer ──────────────────────────────────────────── */

.site-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

/* ── Paper page ───────────────────────────────────────────── */

.paper-header {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.paper-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.paper-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.paper-meta a {
  color: var(--link-color);
}

.paper-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.keyword {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
}

.paper-links {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
  border: 1px solid var(--text-primary);
}

.btn-primary:hover {
  background: transparent;
  color: var(--text-primary);
  text-decoration: none;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--hover-tint);
  border-color: var(--text-secondary);
  text-decoration: none;
}

/* ── Abstract box ─────────────────────────────────────────── */

.abstract {
  background-color: var(--bg-secondary);
  border-left: 3px solid var(--text-tertiary);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.abstract h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
  color: var(--text-secondary);
}

/* ── Paper content ────────────────────────────────────────── */

.paper-content {
  font-size: 1.05rem;
}

.paper-content h2 {
  margin-top: 3rem;
}

.paper-content h3 {
  margin-top: 2rem;
}

/* ── Code blocks ──────────────────────────────────────────── */

pre, code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
}

code {
  background-color: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

pre {
  background-color: var(--code-bg);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

pre code {
  background: none;
  padding: 0;
  border: none;
}

/* ── Blockquotes ──────────────────────────────────────────── */

blockquote {
  border-left: 3px solid var(--text-tertiary);
  margin: 1.5rem 0;
  padding: 0.5rem 1.5rem;
  background-color: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-style: italic;
}

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

/* ── Tables ───────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

tr:hover {
  background-color: var(--hover-tint);
}

/* ── Lists ────────────────────────────────────────────────── */

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ── Paper cards (for index pages) ────────────────────────── */

.paper-grid {
  display: grid;
  gap: 1px;
  margin-top: 2rem;
  background: var(--border-color);
  border: 1px solid var(--border-color);
}

.paper-card {
  background-color: var(--bg-primary);
  padding: 1.5rem;
  transition: all var(--transition);
}

.paper-card:hover {
  background-color: var(--hover-tint);
}

.paper-card h3 {
  margin-top: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.paper-card h3 a {
  color: var(--text-primary);
}

.paper-card h3 a:hover {
  color: var(--link-hover);
  text-decoration: none;
}

.paper-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.paper-card .meta {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
  letter-spacing: 0.03em;
}

.paper-card .card-link {
  display: inline-block;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  transition: color var(--transition);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2px;
}

.paper-card .card-link:hover {
  color: var(--link-hover);
  border-color: var(--text-primary);
  text-decoration: none;
}

/* ── Article hero images - mobile optimized ───────────────── */

.article-hero {
  display: block;
  width: 100%;
  max-width: 500px;
  height: auto;
  margin: 1.5rem auto 2rem auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .article-hero {
    max-width: 280px;
    margin: 1rem auto 1.5rem auto;
  }
}

@media (max-width: 480px) {
  .article-hero {
    max-width: 220px;
    margin: 0.75rem auto 1rem auto;
  }
}

/* ── Hero banner with full-width band ─────────────────────── */

.hero-banner-wrapper {
  background-color: var(--bg-secondary);
  margin: 0 -9999px 1.5rem -9999px;
  padding: 1.5rem 9999px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.hero-banner {
  margin: 0 auto;
  text-align: center;
  max-width: 500px;
}

.hero-banner img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  .hero-banner-wrapper {
    margin-bottom: 1rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .hero-banner {
    max-width: 280px;
  }
}

/* ── Topic hub pages ──────────────────────────────────────── */

.topic-header {
  text-align: center;
  padding: 3rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.topic-header h1 {
  margin-bottom: 0.5rem;
}

.topic-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ── Related papers section ───────────────────────────────── */

.related-papers {
  background-color: var(--bg-secondary);
  padding: 2rem;
  border-radius: var(--radius);
  margin-top: 3rem;
  border: 1px solid var(--border-color);
}

.related-papers h2 {
  margin-top: 0;
  border-bottom: none;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.related-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.related-list li:last-child {
  border-bottom: none;
}

/* ── Math (MathJax) ───────────────────────────────────────── */

.MathJax {
  font-size: 1.1em !important;
}

/* ── Footnotes ────────────────────────────────────────────── */

.footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ── Coming Soon banner ───────────────────────────────────── */

.coming-soon-banner {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  margin: 2rem 0;
}

.coming-soon-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  filter: grayscale(100%);
}

.coming-soon-banner h2 {
  color: var(--text-primary);
  border-bottom: none;
  margin-top: 0;
  font-size: 1.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.coming-soon-banner > p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem auto;
  font-size: 1rem;
}

.coming-soon-topics {
  background-color: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  display: inline-block;
  text-align: left;
  border: 1px solid var(--border-color);
}

.coming-soon-topics h3 {
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.coming-soon-topics ul {
  margin: 0;
  padding-left: 1.25rem;
}

.coming-soon-topics li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.coming-soon-topics li:last-child {
  margin-bottom: 0;
}

/* ── Feedback form ────────────────────────────────────────── */

.feedback-form input:focus,
.feedback-form textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.feedback-form input::placeholder,
.feedback-form textarea::placeholder {
  color: var(--text-tertiary);
}

.feedback-form button[type="submit"] {
  transition: all var(--transition);
}

.feedback-form button[type="submit"]:hover {
  background-color: var(--hover-tint);
  border-color: var(--accent-primary);
}

/* ── Theme Toggle ─────────────────────────────────────────── */

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.theme-toggle:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* ── Scrollbar ────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ── Responsive ───────────────────────────────────────────── */

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

  .container {
    padding: 0 1rem;
  }

  .site-header .container {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .site-title {
    width: 100%;
    text-align: center;
  }

  .site-nav {
    justify-content: center;
    gap: 1rem;
  }

  .search-wrapper {
    width: 100%;
  }

  #site-search {
    width: 100%;
  }

  #site-search:focus {
    width: 100%;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.4rem; }

  .paper-links {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }

  .search-wrapper {
    width: 100%;
    margin: 0.5rem 0 0 0;
  }

  #site-search {
    width: 100%;
  }

  #site-search:focus {
    width: 100%;
  }

  .search-results {
    width: 100%;
    left: 0;
    right: 0;
  }
}

/* ── Print styles ─────────────────────────────────────────── */

@media print {
  .site-header,
  .site-footer,
  .paper-links,
  .related-papers,
  .theme-toggle {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }
}
