/* =============================================
   TITAURAS.NET — Main Stylesheet
   Wikipedia-style informational design
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=Source+Sans+3:wght@300;400;600;700&family=Playfair+Display:wght@700&display=swap');

:root {
  --bg: #f8f6f0;
  --surface: #ffffff;
  --border: #c8bfa8;
  --border-light: #e8e0d0;
  --text-primary: #1a1208;
  --text-secondary: #5a4e38;
  --text-muted: #8a7a5c;
  --accent: #8b1a1a;
  --accent-light: #c0392b;
  --accent-hover: #6b0f0f;
  --link: #5b1f1f;
  --link-hover: #c0392b;
  --nav-bg: #2c1810;
  --nav-text: #f0e8d8;
  --toc-bg: #f5f0e8;
  --infobox-bg: #faf7f2;
  --highlight: #fff8e7;
  --gold: #c9a84c;
  --shadow: rgba(44,24,16,0.12);
}

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

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

body {
  font-family: 'Source Sans 3', Georgia, serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

/* ── TOP HEADER ── */
#site-header {
  background: var(--nav-bg);
  color: var(--nav-text);
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.45rem;
  color: var(--nav-text);
  letter-spacing: 0.02em;
}
.logo-text span {
  color: var(--gold);
}
.logo-tagline {
  font-size: 0.68rem;
  color: #b09878;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-top: -4px;
}

/* NAV */
nav.main-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}

nav.main-nav a {
  color: var(--nav-text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}

nav.main-nav a:hover,
nav.main-nav a.active {
  background: var(--gold);
  color: var(--nav-bg);
}

/* SEARCH */
.header-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.header-search input {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(201,168,76,0.4);
  color: var(--nav-text);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.83rem;
  width: 180px;
  outline: none;
}
.header-search input::placeholder { color: #b09878; }
.header-search input:focus { border-color: var(--gold); background: rgba(255,255,255,0.18); }

.header-search button {
  background: var(--gold);
  border: none;
  color: var(--nav-bg);
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

/* ── BREADCRUMB ── */
.breadcrumb {
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.breadcrumb-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.breadcrumb a { color: var(--link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-muted); margin: 0 0.4rem; }

/* ── MAIN LAYOUT ── */
.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 2rem;
  align-items: start;
}

.page-wrap.full-width {
  grid-template-columns: 1fr;
}

/* ── ARTICLE CONTENT ── */
.article-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2.2rem 2.5rem;
  box-shadow: 0 1px 6px var(--shadow);
}

.article-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.2rem;
  color: var(--text-primary);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 0.6rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.article-subtitle {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.article-lead {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

/* SECTION HEADINGS */
.article-content h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.45rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  margin: 2rem 0 0.9rem;
}

.article-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1.5rem 0 0.6rem;
  padding-left: 0.6rem;
  border-left: 3px solid var(--gold);
}

.article-content h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 1.2rem 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.article-content ul, .article-content ol {
  margin: 0.5rem 0 1rem 1.5rem;
}
.article-content li {
  margin-bottom: 0.35rem;
  font-size: 0.97rem;
}

/* LINKS */
.article-content a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid rgba(91,31,31,0.3);
  transition: color 0.2s, border-color 0.2s;
}
.article-content a:hover {
  color: var(--link-hover);
  border-color: var(--link-hover);
}

/* EXTERNAL LINK BADGE */
.ext-link::after {
  content: " ↗";
  font-size: 0.75em;
  color: var(--text-muted);
}

/* ── TABLE OF CONTENTS ── */
.toc-box {
  background: var(--toc-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  margin: 0 0 1.5rem;
  display: inline-block;
  min-width: 220px;
  max-width: 340px;
  float: right;
  margin-left: 2rem;
}
.toc-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}
.toc-box ol {
  margin-left: 1.1rem;
}
.toc-box li {
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
}
.toc-box a {
  color: var(--link);
  text-decoration: none;
  border: none;
}
.toc-box a:hover { text-decoration: underline; }
.toc-box .toc-sub { margin-left: 0.8rem; font-size: 0.82rem; }

/* ── INFOBOX ── */
.infobox {
  float: right;
  clear: right;
  background: var(--infobox-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 0 0 1.5rem 2rem;
  padding: 0;
  width: 260px;
  font-size: 0.87rem;
  box-shadow: 0 1px 4px var(--shadow);
  overflow: hidden;
}
.infobox-header {
  background: var(--accent);
  color: #fff;
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  text-align: center;
  padding: 0.55rem 0.8rem;
  font-weight: 700;
}
.infobox-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.infobox-image-placeholder {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, #8b1a1a 0%, #c9a84c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}
.infobox table {
  width: 100%;
  border-collapse: collapse;
}
.infobox td {
  padding: 0.35rem 0.7rem;
  border-top: 1px solid var(--border-light);
  vertical-align: top;
}
.infobox td:first-child {
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  width: 40%;
}

/* ── CALLOUT / NOTE BOXES ── */
.callout {
  border-left: 4px solid var(--gold);
  background: var(--highlight);
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  border-radius: 0 4px 4px 0;
  font-size: 0.93rem;
}
.callout.info { border-color: #2980b9; background: #ebf5fb; }
.callout.tip { border-color: #27ae60; background: #eafaf1; }
.callout strong { display: block; margin-bottom: 0.2rem; }

/* ── DATA TABLES ── */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.wiki-table th {
  background: var(--accent);
  color: #fff;
  padding: 0.55rem 0.8rem;
  text-align: left;
  font-weight: 700;
}
.wiki-table td {
  padding: 0.45rem 0.8rem;
  border-bottom: 1px solid var(--border-light);
}
.wiki-table tr:nth-child(even) { background: var(--toc-bg); }
.wiki-table tr:hover { background: #f0e8d8; }

/* ── GALLERY ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}
.gallery-item {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  text-align: center;
  background: var(--infobox-bg);
}
.gallery-emoji {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #f5efe5, #ede0c8);
}
.gallery-caption {
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
}

/* ── RIGHT SIDEBAR ── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: sticky;
  top: 80px;
}

.sidebar-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px var(--shadow);
}

.sidebar-box-title {
  background: var(--nav-bg);
  color: var(--nav-text);
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--gold);
}

.sidebar-box ul {
  list-style: none;
  padding: 0.5rem 0;
}
.sidebar-box ul li a {
  display: block;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.sidebar-box ul li:last-child a { border-bottom: none; }
.sidebar-box ul li a:hover { background: var(--toc-bg); color: var(--link-hover); }

.sidebar-fact {
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
}
.sidebar-fact dt {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.6rem;
}
.sidebar-fact dd {
  color: var(--text-primary);
  margin: 0.1rem 0 0;
}

/* RELATED SITES */
.related-sites {
  padding: 0.6rem 0.8rem;
}
.related-sites a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.4rem;
  font-size: 0.85rem;
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
  border-radius: 3px;
}
.related-sites a:last-child { border-bottom: none; }
.related-sites a:hover { background: var(--toc-bg); color: var(--link-hover); }
.related-sites .site-icon {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: #fff;
  flex-shrink: 0;
}

/* ── FOOTER ── */
footer {
  background: var(--nav-bg);
  color: #b09878;
  border-top: 3px solid var(--gold);
  padding: 2.5rem 1.5rem 1.5rem;
  margin-top: 2rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-col h4 {
  color: var(--gold);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.8rem;
  font-weight: 700;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 0.35rem; }
.footer-col ul li a {
  color: #b09878;
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.footer-col ul li a:hover { color: var(--gold); }

.footer-bottom {
  border-top: 1px solid rgba(201,168,76,0.25);
  padding-top: 1.2rem;
  text-align: center;
  font-size: 0.8rem;
  color: #7a6a4e;
}
.footer-bottom a { color: #b09878; text-decoration: none; }
.footer-bottom a:hover { color: var(--gold); }

/* ── HERO SECTION (homepage) ── */
.hero {
  background: linear-gradient(135deg, #2c1810 0%, #5a2d1a 50%, #2c1810 100%);
  color: var(--nav-text);
  padding: 3.5rem 1.5rem 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(201,168,76,0.18) 0%, transparent 70%);
}
.hero-inner { position: relative; max-width: 800px; margin: 0 auto; }
.hero-emoji { font-size: 4rem; margin-bottom: 0.8rem; display: block; }
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  color: #fff;
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}
.hero-sub {
  font-family: 'Lora', serif;
  font-style: italic;
  color: var(--gold);
  font-size: 1.15rem;
  margin-bottom: 1.2rem;
}
.hero-desc {
  font-size: 0.97rem;
  color: #c8b898;
  max-width: 600px;
  margin: 0 auto 1.8rem;
  line-height: 1.7;
}
.hero-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
}
.hero-cats a {
  background: rgba(201,168,76,0.2);
  border: 1px solid var(--gold);
  color: var(--gold);
  text-decoration: none;
  padding: 0.5rem 1.1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.2s, color 0.2s;
}
.hero-cats a:hover { background: var(--gold); color: var(--nav-bg); }

/* TOPIC GRID (homepage) */
.topic-grid-section {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.section-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--accent);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 0.4rem;
  margin-bottom: 1.2rem;
}
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.1rem;
}
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.3rem 1.2rem;
  text-decoration: none;
  color: var(--text-primary);
  display: block;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  box-shadow: 0 1px 3px var(--shadow);
}
.topic-card:hover {
  box-shadow: 0 4px 16px var(--shadow);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.topic-card-icon { font-size: 2.2rem; margin-bottom: 0.6rem; display: block; }
.topic-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.topic-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .page-wrap { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .infobox { float: none; width: 100%; margin: 0 0 1.5rem; }
  .toc-box { float: none; width: 100%; max-width: 100%; margin: 0 0 1.2rem; }
  .hero h1 { font-size: 2.1rem; }
  .header-inner { flex-wrap: wrap; padding: 0.5rem 1rem; }
  nav.main-nav { order: 3; width: 100%; justify-content: center; padding-bottom: 0.4rem; }
  .header-search { order: 2; }
  .article-content { padding: 1.3rem 1.1rem; }
}

@media (max-width: 600px) {
  .topic-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 1.6rem; }
  .article-title { font-size: 1.5rem; }
  .header-search input { width: 110px; }
}

/* ── PRINT ── */
@media print {
  #site-header, .sidebar, .breadcrumb, footer { display: none; }
  .page-wrap { grid-template-columns: 1fr; }
  .article-content { box-shadow: none; border: none; }
}

/* ── UTILITIES ── */
.clearfix::after { content: ""; display: table; clear: both; }
.text-muted { color: var(--text-muted); font-size: 0.88rem; }
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 42px; height: 42px;
  cursor: pointer;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  display: none;
  z-index: 50;
  transition: background 0.2s;
}
.back-to-top:hover { background: var(--accent-light); }

/* CATEGORIES BAR */
.categories-bar {
  margin-top: 2rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-muted);
}
.categories-bar a {
  color: var(--link);
  text-decoration: none;
  margin-right: 0.5rem;
}
.categories-bar a:hover { text-decoration: underline; }

/* LAST UPDATED */
.last-updated {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}
