/* ============================================
   ROMAN NUMERALS — style.css
   Non-critical / above-fold continuation
   ============================================ */

/* ── Variables (duplicated for non-inline context) ── */
:root {
  --c-primary: #1a1a2e;
  --c-accent: #e94560;
  --c-accent-light: #ff6b6b;
  --c-bg: #ffffff;
  --c-bg-soft: #f8f9fa;
  --c-text: #1a1a1a;
  --c-text-muted: #6c757d;
  --c-border: #dee2e6;
  --c-success: #198754;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
  --max-w: 800px;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #0f0f1a;
    --c-bg-soft: #1a1a2e;
    --c-text: #e8e8f0;
    --c-text-muted: #9999bb;
    --c-border: #2d2d4e;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 2px 8px rgba(0,0,0,0.4);
  }
}
[data-theme="dark"] {
  --c-bg: #0f0f1a;
  --c-bg-soft: #1a1a2e;
  --c-text: #e8e8f0;
  --c-text-muted: #9999bb;
  --c-border: #2d2d4e;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
}
[data-theme="light"] {
  --c-bg: #ffffff;
  --c-bg-soft: #f8f9fa;
  --c-text: #1a1a1a;
  --c-text-muted: #6c757d;
  --c-border: #dee2e6;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  font-size: 16px;
  padding-bottom: 80px; /* space for mobile bottom nav */
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--c-accent);
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  font-weight: 600;
  z-index: 1000;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { top: 0; }

/* ── Header ── */
.site-header {
  background: var(--c-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.site-logo span { color: var(--c-accent); }

/* Desktop nav */
.site-nav {
  display: none;
}
@media (min-width: 768px) {
  .site-nav {
    display: flex;
    gap: 4px;
    align-items: center;
  }
  body { padding-bottom: 0; }
}
.site-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Theme toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.8);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  min-width: 44px;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.theme-toggle:hover {
  border-color: rgba(255,255,255,0.6);
  color: #fff;
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* Mobile bottom nav */
.mobile-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--c-primary);
  border-top: 1px solid rgba(255,255,255,0.1);
  z-index: 100;
}
@media (min-width: 768px) {
  .mobile-nav { display: none; }
}
.mobile-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.625rem;
  font-weight: 500;
  gap: 3px;
  min-height: 56px;
  transition: color 0.15s;
}
.mobile-nav a:hover,
.mobile-nav a[aria-current="page"] { color: var(--c-accent); }
.mobile-nav .nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* ── Layout ── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
}

main { min-height: 60vh; }

/* ── Tool Section ── */
.tool-section {
  padding: 24px 0 16px;
}

.tool-card {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.tool-toggle {
  display: flex;
  background: var(--c-border);
  border-radius: 20px;
  padding: 3px;
  margin-bottom: 20px;
  width: fit-content;
}
.tool-toggle button {
  border: none;
  background: transparent;
  padding: 6px 16px;
  border-radius: 18px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--c-text-muted);
  transition: background 0.15s, color 0.15s;
  min-height: 36px;
}
.tool-toggle button.active {
  background: var(--c-accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.tool-toggle button:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.tool-input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  display: block;
}

.tool-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.25rem;
  font-family: var(--font-sans);
  font-weight: 600;
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-bg);
  color: var(--c-text);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.tool-input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(233,69,96,0.15);
}
.tool-input.error { border-color: #dc3545; }

.tool-output-group {
  position: relative;
}

.tool-output {
  width: 100%;
  padding: 14px 56px 14px 16px;
  font-size: 1.5rem;
  font-family: var(--font-mono);
  font-weight: 700;
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-bg-soft);
  color: var(--c-accent);
  min-height: 56px;
  word-break: break-all;
  display: flex;
  align-items: center;
}

.copy-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-width: 44px;
  min-height: 36px;
  white-space: nowrap;
}
.copy-btn:hover { background: var(--c-accent); }
.copy-btn.copied { background: var(--c-success); }
.copy-btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.tool-error {
  font-size: 0.875rem;
  color: #dc3545;
  min-height: 20px;
  display: block;
}

.tool-hint {
  font-size: 0.8125rem;
  color: var(--c-text-muted);
  text-align: center;
  margin-top: 8px;
}

/* ── Ad slots ── */
.ad-slot {
  margin: 20px 0;
  text-align: center;
  overflow: hidden;
}
.ad-slot--top {
  min-height: 50px;
}
.ad-slot--in-content {
  min-height: 280px;
}
.ad-slot--bottom {
  min-height: 50px;
}
@media (min-width: 768px) {
  .ad-slot--top, .ad-slot--bottom { min-height: 90px; }
}

/* ── Sections ── */
section { padding: 32px 0; }

.section-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--c-accent);
  display: inline-block;
}
[data-theme="dark"] .section-title,
@media (prefers-color-scheme: dark) {
  .section-title { color: var(--c-text); }
}

/* ── Quick Reference Table ── */
.symbols-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.symbols-table th {
  background: var(--c-primary);
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.symbols-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}
.symbols-table tr:last-child td { border-bottom: none; }
.symbols-table tr:nth-child(even) td { background: var(--c-bg-soft); }
.symbol-cell {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--c-accent);
}
.symbols-table td:last-child {
  color: var(--c-text-muted);
  font-size: 0.875rem;
}

/* ── pSEO Grid ── */
.pseo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 4px;
}
@media (min-width: 768px) {
  .pseo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
}
.pseo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--c-text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  gap: 2px;
}
.pseo-card:hover {
  border-color: var(--c-accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.pseo-card .num { font-size: 1rem; font-weight: 700; }
.pseo-card .roman { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--c-accent); font-weight: 600; }

/* ── FAQ ── */
.faq-list { display: flex; flex-direction: column; gap: 8px; }

.faq-item {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-bg);
}

.faq-item summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  user-select: none;
  transition: background 0.15s;
}
.faq-item summary:hover { background: var(--c-bg-soft); }
.faq-item summary:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--c-accent);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-item[open] summary { background: var(--c-bg-soft); }

.faq-answer {
  padding: 0 16px 14px;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--c-text);
}
.faq-answer p + p { margin-top: 8px; }

/* ── Roman Result (pSEO pages) ── */
.roman-result {
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 700;
  color: var(--c-accent);
  letter-spacing: 0.05em;
  text-align: center;
  padding: 1.5rem;
  background: var(--c-bg-soft);
  border-radius: var(--radius);
  border: 2px solid var(--c-border);
  margin: 20px 0;
  font-family: var(--font-mono);
  display: block;
}

/* ── Breakdown ── */
.breakdown {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
}
.breakdown-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-muted);
  margin-bottom: 10px;
}
.breakdown-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.breakdown-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
}
.step-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--c-accent);
  min-width: 60px;
}
.step-arrow { color: var(--c-text-muted); }
.step-value { font-weight: 600; }
.step-equals { color: var(--c-text-muted); margin: 0 4px; }
.breakdown-total {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--c-border);
  font-weight: 700;
  font-size: 1rem;
}
.breakdown-total span { color: var(--c-accent); }

/* ── Nearby Table ── */
.nearby-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.nearby-table th {
  background: var(--c-primary);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.nearby-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}
.nearby-table tr:last-child td { border-bottom: none; }
.nearby-table tr:nth-child(even) td { background: var(--c-bg-soft); }
.nearby-table .current-row td { background: rgba(233,69,96,0.08); font-weight: 700; }
.nearby-table .roman-col { font-family: var(--font-mono); font-weight: 700; color: var(--c-accent); }
.nearby-table a { color: var(--c-text); text-decoration: none; }
.nearby-table a:hover { color: var(--c-accent); text-decoration: underline; }

/* ── Pagination nav ── */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0;
}
.page-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--c-text);
  font-weight: 600;
  font-size: 0.875rem;
  transition: border-color 0.15s, background 0.15s;
  flex: 1;
  max-width: 200px;
}
.page-nav a:first-child { justify-content: flex-start; }
.page-nav a:last-child { justify-content: flex-end; margin-left: auto; }
.page-nav a:hover {
  border-color: var(--c-accent);
  background: var(--c-bg);
}

/* ── Related links ── */
.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.related-links a {
  padding: 6px 14px;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  text-decoration: none;
  color: var(--c-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
}
.related-links a:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}

/* ── Content article ── */
.content-article h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--c-primary);
}
[data-theme="dark"] .content-article h2 { color: var(--c-text); }
.content-article h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 20px 0 8px;
}
.content-article p {
  margin-bottom: 14px;
  line-height: 1.7;
}
.content-article ul, .content-article ol {
  padding-left: 24px;
  margin-bottom: 14px;
}
.content-article li { margin-bottom: 6px; line-height: 1.65; }
.content-article .example-box {
  background: var(--c-bg-soft);
  border-left: 3px solid var(--c-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}
.content-article strong { color: var(--c-accent); }

/* ── Chart page ── */
.chart-section { margin: 24px 0; }
.chart-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--c-primary);
}
[data-theme="dark"] .chart-section h2 { color: var(--c-text); }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
}
@media (min-width: 768px) {
  .chart-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
}
.chart-cell {
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color 0.15s;
}
.chart-cell:hover { border-color: var(--c-accent); }
.chart-cell .cc-num { font-size: 0.875rem; font-weight: 700; color: var(--c-text); }
.chart-cell .cc-roman { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--c-accent); font-weight: 600; }

/* ── List table (1-100, 1-1000) ── */
.list-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.list-table th {
  background: var(--c-primary);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.list-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}
.list-table tr:last-child td { border-bottom: none; }
.list-table tr:nth-child(even) td { background: var(--c-bg-soft); }
.list-table .roman-col { font-family: var(--font-mono); font-weight: 700; color: var(--c-accent); }
.list-table a { color: var(--c-text); text-decoration: none; }
.list-table a:hover { color: var(--c-accent); text-decoration: underline; }

/* ── Hero text ── */
.hero-meta {
  font-size: 1rem;
  color: var(--c-text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Footer ── */
.site-footer {
  background: var(--c-primary);
  color: rgba(255,255,255,0.7);
  padding: 24px 0;
  margin-top: 32px;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}
@media (min-width: 768px) {
  .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }
}
.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--c-accent); }
.footer-copy { font-size: 0.8125rem; }

/* ── Breadcrumb ── */
.breadcrumb {
  font-size: 0.8125rem;
  color: var(--c-text-muted);
  padding: 10px 0 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.breadcrumb a { color: var(--c-text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-accent); text-decoration: underline; }
.breadcrumb span { color: var(--c-text-muted); }

/* ── Page header ── */
.page-header {
  padding: 20px 0 0;
}
.page-header h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
}
.page-header .subtitle {
  font-size: 1rem;
  color: var(--c-text-muted);
  margin-bottom: 0;
}

/* ── Focus styles ── */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* ── Utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.text-accent { color: var(--c-accent); }
.mt-0 { margin-top: 0 !important; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
