/* ═══════════════════════════════════════════
   Texlode — Design System
   ═══════════════════════════════════════════ */

:root {
  --color-bg: #0a0a0f;
  --color-bg-alt: #111118;
  --color-bg-card: #16161f;
  --color-bg-card-hover: #1c1c28;
  --color-surface: #1e1e2a;
  --color-border: #2a2a3a;
  --color-border-light: #333346;

  --color-text: #e4e4ed;
  --color-text-muted: #8888a0;
  --color-text-dim: #5a5a72;

  --color-accent: #f59e0b;
  --color-accent-hover: #d97706;
  --color-accent-glow: rgba(245, 158, 11, 0.15);

  --color-green: #22c55e;
  --color-red: #ef4444;
  --color-blue: #3b82f6;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --max-width: 1100px;
  --max-width-narrow: 720px;

  --radius: 8px;
  --radius-lg: 12px;
}

/* ── Reset ── */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

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

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

h1 { font-size: 3rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); }

/* ── Buttons ── */

.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

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

.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--color-accent-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-light);
}

.btn-secondary:hover {
  border-color: var(--color-text-muted);
  color: #fff;
  transform: translateY(-2px);
}

.btn-small {
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
}

/* ── Header ── */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  text-decoration: none;
}

.logo-tex {
  color: var(--color-text);
}

.logo-lode {
  color: var(--color-accent);
}

/* Inline brand name in running text: tex + colored lode in mono font */
.brand {
  font-family: var(--font-mono);
  font-weight: 600;
}

.brand-lode {
  color: var(--color-accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #fff;
}

.nav-links .btn {
  color: #000;
}

.nav-links .btn:hover {
  color: #000;
}

/* ── Hero ── */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 8rem 1.5rem 4rem;
  gap: 3rem;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(245, 158, 11, 0.06) 0%, transparent 70%),
    var(--color-bg);
}

.hero-inner {
  text-align: center;
  max-width: 700px;
}

.hero-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-accent);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 100px;
  margin-bottom: 1.5rem;
  background: rgba(245, 158, 11, 0.08);
}

.hero h1 {
  margin-bottom: 1.25rem;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Editor Mockup ── */

.hero-visual {
  max-width: 580px;
  width: 100%;
}

.editor-mockup {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px var(--color-accent-glow);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.editor-dots {
  display: flex;
  gap: 6px;
}

.editor-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border-light);
}

.editor-dots span:first-child { background: var(--color-red); opacity: 0.7; }
.editor-dots span:nth-child(2) { background: var(--color-accent); opacity: 0.7; }
.editor-dots span:last-child { background: var(--color-green); opacity: 0.7; }

.editor-filename {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.editor-body {
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--color-text-muted);
}

.editor-line {
  min-height: 1.8em;
}

.tex-cmd {
  color: var(--color-blue);
}

.tex-math {
  color: var(--color-green);
}

.editor-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--color-accent);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.editor-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-dim);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-green);
}

.status-right {
  margin-left: auto;
}

/* ── Sections ── */

.section {
  padding: 5rem 1.5rem;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-centered .section-inner {
  max-width: var(--max-width-narrow);
  text-align: center;
}

.section h2 {
  text-align: center;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto 3rem;
  font-size: 1.05rem;
}

/* ── Comparison Grid ── */

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.comparison-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.comparison-card h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.comparison-card ul {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.comparison-card li {
  padding-left: 1.5rem;
  position: relative;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.comparison-card li::before {
  position: absolute;
  left: 0;
  font-size: 0.85rem;
}

.comparison-old li::before {
  content: "✕";
  color: var(--color-red);
}

.comparison-alt li::before {
  content: "~";
  color: var(--color-accent);
}

.comparison-new {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), transparent);
}

.comparison-new li::before {
  content: "✓";
  color: var(--color-green);
}

.comparison-new h3 {
  color: var(--color-accent);
}

/* ── Features Grid ── */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color 0.3s, transform 0.3s;
}

.feature-card:hover {
  border-color: var(--color-border-light);
  transform: translateY(-2px);
}

.feature-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 1rem;
  color: var(--color-accent);
}

.feature-icon svg {
  width: 100%;
  height: 100%;
}

.feature-card h3 {
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ── Stats Grid ── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: border-color 0.3s, transform 0.3s;
}

.stat-card:hover {
  border-color: rgba(245, 158, 11, 0.3);
  transform: translateY(-2px);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-unit {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.stat-label {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ── CTA Section ── */

.section-cta {
  padding: 5rem 1.5rem;
}

.cta-box {
  max-width: 580px;
  margin: 0 auto;
  text-align: center;
  padding: 3rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.02));
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-lg);
}

.cta-box h2 {
  margin-bottom: 0.5rem;
}

.cta-box p {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

/* ── Newsletter Form ── */

.newsletter-form {
  display: flex;
  gap: 0.5rem;
}

.newsletter-form-inline {
  max-width: 420px;
  margin: 0 auto 0.75rem;
}

.newsletter-form input[type="email"] {
  flex: 1;
  padding: 0.65rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}

.newsletter-form input[type="email"]:focus {
  border-color: var(--color-accent);
}

.newsletter-form input[type="email"]::placeholder {
  color: var(--color-text-dim);
}

.newsletter-consent-row {
  margin-top: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-dim);
  cursor: pointer;
  text-align: left;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--color-accent);
}

.checkbox-label a {
  color: var(--color-text-muted);
  text-decoration: underline;
}

.newsletter-message {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}

.newsletter-message.success {
  color: var(--color-green);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.newsletter-message.error {
  color: var(--color-red);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ── Footer ── */

.footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: 3rem 1.5rem 1.5rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

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

.footer-brand {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.footer-tagline {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.footer-company {
  color: var(--color-text-dim);
  font-size: 0.85rem;
}

.footer-company a {
  color: var(--color-text-muted);
}

.footer h4 {
  margin-bottom: 0.75rem;
}

.footer ul {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer ul a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.footer ul a:hover {
  color: #fff;
}

.footer .newsletter-form input[type="email"] {
  background: var(--color-bg-card);
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  margin-bottom: 0.25rem;
}

.footer-bottom a {
  color: var(--color-text-muted);
}

/* ── Confirm Page ── */

.confirm-box {
  text-align: center;
  padding: 4rem 2rem;
}

.confirm-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  color: var(--color-green);
}

.confirm-icon svg {
  width: 100%;
  height: 100%;
}

.confirm-box h1 {
  margin-bottom: 0.75rem;
  font-size: 2rem;
}

.confirm-box p {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

/* ── Legal Content ── */

.legal-content {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 6rem 0 2rem;
  text-align: left;
}

.legal-content h2 {
  text-align: left;
  margin-bottom: 1.5rem;
}

.legal-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.legal-content p {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.legal-content a {
  text-decoration: underline;
}

/* ── Comparison Table ── */

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

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

.comparison-table th {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

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

.comparison-table tbody tr {
  transition: background-color 0.2s;
}

.comparison-table tbody tr:hover {
  background: var(--color-bg-card);
}

.comparison-table-highlight {
  background: rgba(245, 158, 11, 0.05);
}

.comparison-table-highlight:hover {
  background: rgba(245, 158, 11, 0.08) !important;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 100px;
}

.badge-green {
  color: var(--color-green);
  background: rgba(34, 197, 94, 0.1);
}

.badge-yellow {
  color: var(--color-accent);
  background: rgba(245, 158, 11, 0.1);
}

.badge-red {
  color: var(--color-red);
  background: rgba(239, 68, 68, 0.1);
}

.table-footnote {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-dim);
  font-style: italic;
}

/* ── Audience Grid ── */

.audience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

/* ── Book Section ── */

.section-inner-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
}

.book-topics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.book-topic {
  padding: 1.5rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: border-color 0.3s;
}

.book-topic:hover {
  border-color: var(--color-border-light);
}

.book-topic h4 {
  margin-bottom: 0.25rem;
}

.book-topic h3 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.book-topic p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Fade Animations ── */

.fade-target {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.6rem; }

  .hero {
    padding: 6rem 1.25rem 3rem;
    min-height: auto;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .nav-links {
    gap: 1rem;
  }

  .nav-links a:not(.btn) {
    display: none;
  }

  .section {
    padding: 3rem 1.25rem;
  }

  .comparison-grid,
  .features-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

  .stat-value {
    font-size: 2.5rem;
  }

  .editor-body {
    font-size: 0.75rem;
    padding: 1rem;
  }

  .cta-box {
    padding: 2rem 1.5rem;
  }

  .newsletter-form {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 1.8rem; }

  .hero-badge {
    font-size: 0.7rem;
  }

  .editor-mockup {
    font-size: 0.8rem;
  }
}

/* ── Nav Avatar ── */

.nav-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.4rem;
}

/* ── Projects Page ── */

.projects-section {
  min-height: 60vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6rem;
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

.projects-login {
  text-align: center;
  padding: 4rem 0;
}

.projects-login h2 {
  margin-bottom: 0.75rem;
}

.projects-login p {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.projects-auth h2 {
  margin-bottom: 0.25rem;
}

.projects-subtitle {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.projects-loading {
  color: var(--color-text-muted);
  text-align: center;
  padding: 2rem 0;
}

.projects-empty {
  text-align: center;
  padding: 3rem 0;
  color: var(--color-text-muted);
}

.projects-empty .btn {
  margin-top: 1.25rem;
}

.project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
}

.project-card:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-border-light);
}

.project-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.project-name {
  font-size: 1rem;
  font-weight: 600;
}

.project-owner {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.project-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
}

.badge-private {
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.project-desc {
  width: 100%;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-updated {
  color: var(--color-text-dim);
  font-size: 0.8rem;
  width: 100%;
}

.project-open {
  flex-shrink: 0;
  margin-left: 1rem;
}

.projects-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.projects-manage-link {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.projects-logout {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
