@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --c-bg: #0D0D0D;
  --c-surface: #141414;
  --c-surface2: #1a1a1a;
  --c-text: #E8E0D0;
  --c-text-muted: #9e9791;
  --c-accent: #7B5EA7;
  --c-accent-light: #9b7ec7;
  --c-accent-dim: rgba(123, 94, 167, 0.15);
  --c-border: rgba(232, 224, 208, 0.1);
  --c-overlay: rgba(13, 13, 13, 0.72);

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --r-card: 10px;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.6), 0 1px 4px rgba(0,0,0,0.4);
  --shadow-hover: 0 8px 40px rgba(123,94,167,0.25), 0 2px 8px rgba(0,0,0,0.5);
  --transition-base: 0.25s ease;
  --header-h: 64px;
  --max-content: 860px;
  --max-wide: 1200px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background: var(--c-bg);
  color: var(--c-text);
}

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

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

a {
  color: var(--c-accent-light);
  text-decoration: none;
  transition: color var(--transition-base);
}
a:hover { color: var(--c-text); }

ul, ol { list-style: none; }

/* ============================================================
   SITE WRAP
   ============================================================ */
.site-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: var(--header-h);
  gap: 1rem;
}

.nav-left,
.nav-right {
  flex: 1;
}

.nav-left ol,
.nav-right ol {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-right ol { justify-content: flex-end; }

.nav-left ol li a,
.nav-right ol li a {
  display: block;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--c-text-muted);
  border-radius: 4px;
  white-space: nowrap;
  min-height: 40px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  transition: color var(--transition-base), background var(--transition-base);
}
.nav-left ol li a:hover,
.nav-right ol li a:hover {
  color: var(--c-text);
  background: var(--c-accent-dim);
}

.site-brand {
  flex-shrink: 0;
  text-align: center;
  text-decoration: none;
}

.brand-text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-text);
  white-space: nowrap;
}

.brand-logo {
  height: 36px;
  width: auto;
}

.header-search {
  border-top: 1px solid var(--c-border);
  padding: 0.4rem 1.5rem;
  display: flex;
  justify-content: center;
  background: rgba(13,13,13,0.8);
}

.search-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 480px;
}

.search-form input {
  flex: 1;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: var(--font-body);
  min-height: 40px;
  transition: border-color var(--transition-base);
}
.search-form input:focus {
  outline: none;
  border-color: var(--c-accent);
}
.search-form input::placeholder { color: var(--c-text-muted); }

.search-form button {
  background: var(--c-accent);
  border: none;
  color: var(--c-text);
  padding: 0.4rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  font-family: var(--font-body);
  transition: background var(--transition-base);
}
.search-form button:hover { background: var(--c-accent-light); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-media .hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(13,13,13,0.85) 0%,
    rgba(13,13,13,0.55) 50%,
    rgba(13,13,13,0.8) 100%
  );
}

.hero-bg-text {
  position: absolute;
  bottom: -0.1em;
  right: -0.05em;
  font-size: clamp(6rem, 18vw, 18rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(123,94,167,0.18);
  text-stroke: 1px rgba(123,94,167,0.18);
  line-height: 1;
  z-index: 1;
  user-select: none;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 860px;
  width: 100%;
}

.hero-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--c-accent-light);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero-eyebrow a {
  color: var(--c-accent-light);
}
.hero-eyebrow a:hover { color: var(--c-text); }

.hero-title {
  font-size: clamp(2rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--c-text);
  margin-bottom: 1.25rem;
}

.hero-sub {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: var(--c-text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-cta {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--c-accent);
  color: var(--c-text);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  border-radius: 4px;
  min-height: 44px;
  line-height: 1.2;
  transition: background var(--transition-base), box-shadow var(--transition-base);
}
.hero-cta:hover {
  background: var(--c-accent-light);
  color: var(--c-text);
  box-shadow: 0 4px 20px rgba(123,94,167,0.4);
}

.article-meta {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.meta-label { color: var(--c-text-muted); font-weight: 500; }
.meta-sep { opacity: 0.5; }

/* Typing animation */
.type-anim {
  display: inline-block;
}

@keyframes typing-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0% 0 0); }
}

.hero-title .type-anim {
  animation: typing-reveal 1s steps(20, end) both;
}

/* ============================================================
   STICKY ANCHOR NAV
   ============================================================ */
.sticky-anchor {
  position: sticky;
  top: calc(var(--header-h) + 41px);
  z-index: 80;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}

.sticky-anchor ol {
  display: flex;
  gap: 0;
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sticky-anchor ol li a {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--c-text-muted);
  min-height: 40px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-base), border-color var(--transition-base);
}
.sticky-anchor ol li a:hover {
  color: var(--c-accent-light);
  border-bottom-color: var(--c-accent);
}

/* ============================================================
   PAGE TITLE BAR (privacy)
   ============================================================ */
.page-title-bar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 3rem 1.5rem 2rem;
  text-align: center;
}

.page-title-bar-h1 {
  font-size: clamp(1.6rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-text);
  margin-bottom: 0.5rem;
}

.page-date {
  font-size: 0.82rem;
  color: var(--c-text-muted);
}

/* ============================================================
   MAIN LAYOUT: CONTENT SECTION WITH SIDEBAR
   ============================================================ */
.page-content-area {
  display: flex;
  gap: 2rem;
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  align-items: flex-start;
  width: 100%;
}

.sidebar-left {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-h) + 41px + 50px);
  max-height: calc(100vh - var(--header-h) - 140px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
}

.sidebar-inner {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  padding: 1.25rem;
}

.sidebar-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--c-accent-light);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.sidebar-inner nav ol {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-inner nav ol li a {
  display: block;
  padding: 0.4rem 0.5rem;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  border-radius: 4px;
  min-height: 40px;
  line-height: 1.3;
  display: flex;
  align-items: center;
  transition: color var(--transition-base), background var(--transition-base);
}
.sidebar-inner nav ol li a:hover {
  color: var(--c-text);
  background: var(--c-accent-dim);
}

.sidebar-parent,
.sidebar-cta {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--c-border);
}

.sidebar-parent h3,
.sidebar-cta h3 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--c-accent-light);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.parent-link {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  display: block;
  padding: 0.3rem 0.5rem;
}

.sidebar-cta ul {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-cta ul li a {
  display: block;
  padding: 0.4rem 0.5rem;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  border-radius: 4px;
  min-height: 36px;
  display: flex;
  align-items: center;
  transition: color var(--transition-base), background var(--transition-base);
}
.sidebar-cta ul li a:hover {
  color: var(--c-text);
  background: var(--c-accent-dim);
}

.content-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Figure in div */
.topic-figure,
.article-figure,
.about-figure,
.privacy-figure {
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
}

.topic-figure img,
.article-figure img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: var(--r-card) var(--r-card) 0 0;
}

.topic-figure figcaption,
.article-figure figcaption,
.about-figure figcaption,
.privacy-figure figcaption {
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  color: var(--c-text-muted);
  letter-spacing: 0.06em;
}

/* Aside within content */
.article-info-aside,
.about-meta-aside,
.privacy-info-aside {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-card);
  padding: 1.25rem;
}

.article-info-aside .article-meta {
  justify-content: flex-start;
  margin-top: 0.5rem;
}

.article-info-aside h2,
.about-meta-aside h2,
.privacy-info-aside h2 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--c-accent-light);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.info-parent {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  margin-top: 0.5rem;
}
.info-parent a { color: var(--c-accent-light); }

.meta-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.85rem;
}
.meta-dl dt { color: var(--c-text-muted); font-weight: 500; }
.meta-dl dd { color: var(--c-text); }

/* ============================================================
   PROSE
   ============================================================ */
.prose {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--c-text);
  max-width: var(--max-content);
}

.prose h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  color: var(--c-text);
  letter-spacing: -0.01em;
}

.prose h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--c-text);
}

.prose p { margin-bottom: 1.25rem; }

.prose ul, .prose ol {
  margin: 1rem 0 1.25rem 1.5rem;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 0.4rem; }

.prose blockquote {
  border-left: 3px solid var(--c-accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--c-accent-dim);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  font-style: italic;
  color: var(--c-text-muted);
}

.prose a { color: var(--c-accent-light); text-decoration: underline; text-decoration-color: rgba(155,126,199,0.3); }
.prose a:hover { color: var(--c-text); text-decoration-color: var(--c-accent-light); }

.prose strong { color: var(--c-text); font-weight: 600; }

.prose code {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: 3px;
  padding: 0.15em 0.4em;
  font-size: 0.9em;
}

.prose pre {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-header {
  text-align: center;
  padding: 0 1.5rem 2rem;
}

.section-header h2 {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-text);
  margin-bottom: 0.5rem;
}

.section-header p {
  font-size: 0.9rem;
  color: var(--c-text-muted);
}

/* ============================================================
   TOPICS GRID / CARDS
   ============================================================ */
.topics-section,
.about-topics-section,
.related-articles-section,
.more-articles-section,
.articles-section,
.related-section,
.all-articles-section {
  padding: 4rem 1.5rem;
  max-width: var(--max-wide);
  margin: 0 auto;
  width: 100%;
}

.topics-grid,
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.topic-card,
.related-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.topic-card:hover,
.related-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.topic-card .card-thumb,
.related-card .related-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card-body {
  padding: 1.25rem;
}

.card-date {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  margin-bottom: 0.5rem;
}

.topic-card h3,
.related-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.topic-card h3 a,
.related-card h3 a {
  color: var(--c-text);
  text-decoration: none;
}
.topic-card h3 a:hover,
.related-card h3 a:hover { color: var(--c-accent-light); }

.card-desc {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.card-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-accent-light);
  letter-spacing: 0.02em;
}
.card-link:hover { color: var(--c-text); }

/* ============================================================
   DL ARTICLE LIST
   ============================================================ */
.articles-dl,
.child-dl {
  max-width: var(--max-wide);
  margin: 0 auto;
}

.articles-dl dt,
.child-dl dt {
  margin-bottom: 0.2rem;
}

.articles-dl dt a,
.child-dl dt a {
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-text);
  text-decoration: none;
  display: inline-block;
  padding: 0.1rem 0;
  transition: color var(--transition-base);
}
.articles-dl dt a:hover,
.child-dl dt a:hover { color: var(--c-accent-light); }

.articles-dl dd,
.child-dl dd {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  margin-bottom: 1.25rem;
  padding-left: 0;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.dl-thumb {
  width: 80px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.dl-desc { flex: 1; min-width: 0; }

.dl-date {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  white-space: nowrap;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  margin-top: auto;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
}

.footer-brand,
.footer-links {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1rem;
}

.site-footer > .footer-brand,
.site-footer > .footer-links {
  display: block;
}

/* footer > div×n layout */
.site-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "brand links"
    "copy  copy";
}

.footer-brand { grid-area: brand; padding: 2.5rem 2rem 1.5rem 2rem; max-width: none; }
.footer-links { grid-area: links; padding: 2.5rem 2rem 1.5rem 2rem; max-width: none; }

.footer-brand-inner {}

.footer-logo-link {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.75rem;
}
.footer-logo-link:hover { color: var(--c-accent-light); }

.footer-desc {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  max-width: 320px;
}

.footer-links nav ol {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-links nav ol li a {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  display: block;
  min-height: 40px;
  line-height: 40px;
  transition: color var(--transition-base);
}
.footer-links nav ol li a:hover { color: var(--c-text); }

.footer-copy {
  grid-area: copy;
  border-top: 1px solid var(--c-border);
  padding: 1rem 2rem;
  font-size: 0.78rem;
  color: var(--c-text-muted);
  text-align: center;
}

.footer-copy a { color: var(--c-text-muted); }
.footer-copy a:hover { color: var(--c-accent-light); }

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.reveal-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .reveal-up {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-title .type-anim {
    animation: none;
  }
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .page-content-area {
    flex-direction: column;
    padding: 2rem 1rem;
  }

  .sidebar-left {
    width: 100%;
    position: static;
    max-height: none;
  }

  .sidebar-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .site-footer {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "links"
      "copy";
  }

  .footer-brand,
  .footer-links {
    padding: 1.5rem 1.5rem 0.5rem;
  }
}

@media (max-width: 700px) {
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  .nav-left, .nav-right {
    flex: none;
    width: 100%;
  }

  .nav-left ol, .nav-right ol {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.15rem;
  }

  .nav-right ol { justify-content: flex-start; }

  .site-brand {
    order: -1;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0;
  }

  .hero {
    min-height: 60vh;
  }

  .hero-bg-text {
    font-size: clamp(4rem, 22vw, 8rem);
  }

  .hero-title {
    font-size: clamp(1.6rem, 7vw, 2.5rem);
  }

  .topics-grid,
  .related-grid {
    grid-template-columns: 1fr;
  }

  .sticky-anchor ol {
    flex-wrap: wrap;
    gap: 0;
  }

  .topics-section,
  .about-topics-section,
  .related-articles-section,
  .more-articles-section,
  .articles-section,
  .related-section,
  .all-articles-section {
    padding: 2.5rem 1rem;
  }
}

@media (max-width: 400px) {
  .nav-left ol li a,
  .nav-right ol li a {
    font-size: 0.72rem;
    padding: 0.5rem 0.5rem;
  }
}
