/* ============================================
   BELUGAPEDIA — style.css
   Like beluga whales, we carry bias everywhere.
   ============================================ */

/* Local fonts — no Google, no cloud, pure beluga 🦭 */

@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/lora-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Lora';
  font-style: italic;
  font-weight: 400;
  src: url('fonts/lora-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 600;
  src: url('fonts/lora-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 700;
  src: url('fonts/lora-latin-700-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/playfair-display-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 400;
  src: url('fonts/playfair-display-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  src: url('fonts/playfair-display-latin-700-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/cinzel-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 600;
  src: url('fonts/cinzel-latin-600-normal.woff2') format('woff2');
}

:root {
  /* Oceanic blue theme 🦭 */
  --bg-primary:     #0d1117;
  --bg-secondary:   #131c27;
  --bg-sidebar:     #101820;
  --bg-card:        #162030;
  --bg-toc:         #111a25;

  --text-primary:   #d4e8f0;
  --text-secondary: #7da8c0;
  --text-muted:     #3d6478;
  --text-accent:    #a8d8ea;
  --text-link:      #6bb8d4;
  --text-link-hover:#9dd4ea;

  --border:         #1a2f40;
  --border-accent:  #1f3a50;
  --divider:        #162535;

  --disclaimer-bg:  #0f1e2e;
  --disclaimer-border: #1e4060;
  --disclaimer-text: #7ab8d4;

  --sidebar-width:  240px;
  --content-max:    820px;

  --font-display:   'Lora', Georgia, serif;
  --font-body:      'Lora', Georgia, serif;
  --font-heading:   'Lora', Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.75;
  min-height: 100vh;
}

/* ── LAYOUT ─────────────────────────────────── */

.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-layout {
  display: flex;
  flex: 1;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  gap: 0;
}

/* ── HEADER ─────────────────────────────────── */

.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-accent);
  padding: 0.75rem 2rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-beluga {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(200, 169, 110, 0.3));
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  height: 2.6rem;
  justify-content: center;
}

.logo-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-accent);
  letter-spacing: 0.08em;
  transition: color 0.25s;
}

.logo-tagline {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: 0.02em;
  overflow: hidden;
  max-height: 1.2em;
  opacity: 1;
  transition: opacity 0.25s, max-height 0.25s;
}

.site-logo:hover .logo-tagline {
  opacity: 0;
  max-height: 0;
}

.site-logo:hover .logo-title {
  color: #e8f4fa;
}

/* ── HEADER NAV ─────────────────────────────── */

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: flex-end;
}

.header-nav a {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.header-nav a:hover {
  color: var(--text-accent);
  background: var(--border-accent);
}

/* ── HEADER SEARCH ──────────────────────────── */

.header-search {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
}

.header-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  pointer-events: none;
}

.header-search input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.45rem 0.85rem 0.45rem 2.5rem;
  width: 320px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search input:focus {
  border-color: var(--text-accent);
  box-shadow: 0 0 0 3px rgba(200, 169, 110, 0.1);
}

.header-search input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* ── SIDEBAR — hidden on article pages ──────── */

.sidebar {
  display: none;
}

/* ── TOC COLUMN ─────────────────────────────── */

.toc-column {
  width: 230px;
  min-width: 230px;
  flex-shrink: 0;
  padding: 1.5rem 0.75rem 1.5rem 1.25rem;
  background: var(--bg-primary);
  align-self: stretch;
}

.toc-column .toc {
  position: sticky;
  top: 80px;
  width: 100%;
  min-width: unset;
  max-width: 210px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  margin: 0;
  display: block;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.toc-column .toc::-webkit-scrollbar {
  width: 3px;
}

.toc-column .toc::-webkit-scrollbar-track {
  background: transparent;
}

.toc-column .toc::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.toc ol li a.toc-active {
  color: var(--text-accent);
  font-weight: 600;
  transition: color 0.12s;
}

/* ── MAIN CONTENT ─────────────────────────────── */

.content-area {
  flex: 1;
  padding: 1.5rem 7rem 3rem 1.5rem;
  min-width: 0;
  max-width: none;
}

/* ── DISCLAIMER BANNER ────────────────────────── */

.disclaimer-banner {
  background: var(--disclaimer-bg);
  border: 1px solid var(--disclaimer-border);
  border-radius: 4px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.disclaimer-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.disclaimer-text {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--disclaimer-text);
  font-style: italic;
  line-height: 1.5;
}

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

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

/* ── ARTICLE ──────────────────────────────────── */

.article-header {
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}

.article-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.article-subtitle {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.3rem;
}

.article-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-family: var(--font-body);
}

.article-meta a {
  color: var(--text-secondary);
  text-decoration: underline;
}

/* ── TABLE OF CONTENTS ────────────────────────── */

.toc {
  background: var(--bg-toc);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
  display: inline-block;
  min-width: 220px;
  max-width: 380px;
}

.toc-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  letter-spacing: 0.02em;
}

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

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

.toc ol li::before {
  content: counter(toc-counter) ". ";
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.toc ol li a {
  color: var(--text-link);
  text-decoration: none;
  font-family: var(--font-body);
  transition: color 0.12s;
}

.toc ol li a:hover {
  color: var(--text-accent);
  text-decoration: none;
}

.toc ol ol {
  padding-left: 1.2rem;
  counter-reset: toc-sub-counter;
  margin-top: 0.15rem;
}

.toc ol ol li {
  counter-increment: toc-sub-counter;
  font-size: 0.82rem;
}

.toc ol ol li::before {
  content: counter(toc-counter) "." counter(toc-sub-counter) " ";
}

/* ── ARTICLE BODY ─────────────────────────────── */

.article-body h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  margin: 2rem 0 0.75rem;
  clear: none;
  margin-right: 340px;
  scroll-margin-top: 90px;
}

.article-body h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 1.5rem 0 0.5rem;
  font-style: italic;
  scroll-margin-top: 90px;
}

.article-body p {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1rem;
}

.article-body a {
  color: var(--text-link);
  text-decoration: none;
  border-bottom: 1px solid rgba(122, 184, 212, 0.3);
  transition: color 0.15s, border-color 0.15s;
}

.article-body a:hover {
  color: var(--text-link-hover);
  border-bottom-color: var(--text-link-hover);
}

.article-body table tbody tr:hover td:not([colspan]) {
  color: var(--text-primary) !important;
  transition: color 0.15s;
}

/* ── TABLE CARD — matches infobox/TOC card style ── */
.table-card {
  overflow-x: auto;
  margin: 1.25rem 0;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  overflow: hidden;
}

.table-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.table-card thead tr {
  background: var(--bg-secondary);
  color: var(--text-accent);
}

.table-card thead th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.table-card thead th.right {
  text-align: right;
}

.table-card tbody td {
  padding: 0.4rem 0.75rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--divider);
}

.table-card tbody td.primary {
  color: var(--text-primary);
}

.table-card tbody td.right {
  text-align: right;
}

.table-card tbody tr:last-child td {
  border-bottom: none;
}

.article-body blockquote {
  border-left: 3px solid var(--text-accent);
  margin: 1.25rem 0;
  padding: 0.5rem 1.25rem;
  background: var(--bg-card);
  border-radius: 0 4px 4px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.article-body ul,
.article-body ol {
  margin: 0.75rem 0 1rem 1.5rem;
  color: var(--text-primary);
}

.article-body li {
  margin-bottom: 0.3rem;
}

/* ── INFOBOX ──────────────────────────────────── */

.infobox {
  float: right;
  clear: right;
  margin: 0 0 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  width: 320px;
  font-size: 0.85rem;
  overflow: hidden;
}

.infobox-title {
  background: var(--bg-secondary);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  text-align: center;
  color: var(--text-accent);
  border-bottom: 1px solid var(--border);
}

.infobox table {
  width: 100%;
  border-collapse: collapse;
  padding: 0.25rem 0;
}

.infobox td {
  padding: 0.45rem 0.75rem;
  vertical-align: top;
  line-height: 1.4;
}

.infobox td:first-child {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  width: 40%;
}

.infobox td:last-child {
  color: var(--text-primary);
}

/* ── FOOTER ───────────────────────────────────── */

.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 1.25rem 2rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-link);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ── UTILITIES ────────────────────────────────── */

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* ── SCROLLBAR ────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
