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

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

:root {
  --black: #000000;
  --white: #ffffff;
  --grey-100: #f5f5f5;
  --grey-200: #e0e0e0;
  --grey-400: #999999;
  --grey-600: #555555;
  --grey-800: #222222;
  --accent: #e50000;
  --accent-dim: #8a0000;
  --font-display: 'Russo One', 'Chakra Petch', system-ui, sans-serif;
  --font-body: 'Chakra Petch', system-ui, sans-serif;
  --radius-card: 10px;
  --header-h: 64px;
  --aside-w: 220px;
  --transition: 0.22s ease;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.55);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: var(--black);
  color: var(--white);
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ===== LAYOUT WRAPPER ===== */
.site-wrapper {
  display: grid;
  grid-template-columns: var(--aside-w) 1fr;
  grid-template-areas: "aside main";
  min-height: 100vh;
}

.site-aside {
  grid-area: aside;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--grey-800);
  border-right: 2px solid var(--grey-600);
  padding: 1.5rem 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.site-aside nav ul {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.site-aside nav ul li a {
  display: block;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--grey-200);
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  line-height: 1.4;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.site-aside nav ul li a:hover,
.site-aside nav ul li a:focus {
  background: var(--black);
  color: var(--white);
  border-left-color: var(--accent);
}

.main-content-wrap {
  grid-area: main;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--black);
  border-bottom: 2px solid var(--grey-800);
  height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 100%;
  flex-wrap: nowrap;
}

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

.brand-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  color: var(--white);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.header-nav-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  overflow: hidden;
  flex-wrap: wrap;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.9rem;
  border: 1.5px solid var(--grey-600);
  border-radius: 999px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--grey-200);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  min-height: 32px;
  text-decoration: none;
}

.pill-btn:hover,
.pill-btn:focus {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  border: 1.5px solid var(--grey-600);
  border-radius: 999px;
  overflow: hidden;
  height: 36px;
}

.header-search input[type="search"] {
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0 0.75rem;
  width: 140px;
  height: 100%;
}

.header-search input[type="search"]::placeholder { color: var(--grey-400); }

.header-search button {
  background: var(--grey-800);
  border: none;
  color: var(--grey-200);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 0 0.9rem;
  height: 100%;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  min-height: 36px;
}

.header-search button:hover { background: var(--white); color: var(--black); }

/* ===== HERO (HOME) ===== */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 70vh;
  align-items: stretch;
  border-bottom: 2px solid var(--grey-800);
  overflow: hidden;
}

.hero-figure {
  position: relative;
  background: var(--grey-800);
  overflow: hidden;
  min-height: 340px;
}

.hero-figure .hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-placeholder {
  width: 100%;
  height: 100%;
  min-height: 340px;
  background: linear-gradient(135deg, var(--grey-800) 0%, #111 100%);
}

.hero-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: var(--black);
  gap: 1.25rem;
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 0.6rem;
}

.hero-h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.8rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--white);
  letter-spacing: -0.01em;
}

.hero-desc {
  font-size: 1rem;
  color: var(--grey-400);
  line-height: 1.6;
  max-width: 440px;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.5rem;
  background: var(--white);
  color: var(--black);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: background var(--transition), color var(--transition);
  min-height: 44px;
  text-decoration: none;
}

.btn-primary:hover { background: var(--accent); color: var(--white); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.5rem;
  background: transparent;
  color: var(--white);
  border: 2px solid var(--grey-600);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: border-color var(--transition), color var(--transition);
  min-height: 44px;
  text-decoration: none;
}

.btn-outline:hover { border-color: var(--white); color: var(--white); }

/* ===== CONTENT SECTIONS ===== */
.content-section,
.flat-body-section,
.faq-body-section,
.policy-body-section,
.changelog-body-section,
.article-body-section {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
  align-items: start;
  border-bottom: 2px solid var(--grey-800);
}

.editorial-body {
  grid-template-columns: 1fr 260px;
}

/* SECTION ASIDES (right sidebar) */
.section-aside,
.article-sidebar,
.page-sidebar {
  padding: 2rem 1.5rem;
  border-left: 2px solid var(--grey-800);
  background: var(--grey-800);
  position: sticky;
  top: var(--header-h);
  min-height: 200px;
  align-self: start;
}

.aside-heading {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-400);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--grey-600);
}

.aside-heading span { display: inline; }

.aside-sub-heading {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-400);
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

.aside-sub-heading span { display: inline; }

.aside-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.aside-links li a {
  display: block;
  padding: 0.4rem 0.5rem;
  font-size: 0.82rem;
  color: var(--grey-200);
  border-radius: 3px;
  transition: background var(--transition), color var(--transition);
  min-height: 32px;
  line-height: 1.4;
  display: flex;
  align-items: center;
}

.aside-links li a:hover { background: var(--black); color: var(--white); }

.aside-divider {
  height: 1px;
  background: var(--grey-600);
  margin: 1rem 0;
}

/* PROSE */
.prose-content {
  padding: 2.5rem 2rem;
  max-width: 760px;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--grey-200);
}

.prose-content h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--white);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--grey-800);
}

.prose-content h2 span { display: inline; }

.prose-content h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--white);
  margin: 1.5rem 0 0.5rem;
}

.prose-content h3 span { display: inline; }

.prose-content p { margin-bottom: 1rem; }

.prose-content ul, .prose-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.prose-content ul { list-style: disc; }
.prose-content ol { list-style: decimal; }

.prose-content li { margin-bottom: 0.4rem; }

.prose-content a {
  color: var(--white);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  transition: color var(--transition);
}

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

.prose-content blockquote {
  border-left: 4px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: var(--grey-800);
  color: var(--grey-200);
  font-style: italic;
  border-radius: 0 4px 4px 0;
}

.prose-content strong { color: var(--white); font-weight: 700; }

/* DROP CAPS */
.has-drop-cap > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 4rem;
  line-height: 0.85;
  float: left;
  margin: 0.1em 0.12em 0 0;
  color: var(--white);
  font-weight: 400;
}

/* ===== CARDS SECTION ===== */
.cards-section {
  padding: 2.5rem 2rem;
  border-bottom: 2px solid var(--grey-800);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.section-title {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--white);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.section-title span { display: inline; }

.card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-card);
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-card);
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.28);
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}

.card-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--white);
  line-height: 1.3;
}

.card-title span { display: inline; }

.card-desc {
  font-size: 0.85rem;
  color: var(--grey-400);
  line-height: 1.5;
  flex: 1;
}

.card time {
  font-size: 0.75rem;
  color: var(--grey-600);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--white);
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--grey-600);
  border-radius: 4px;
  align-self: flex-start;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  min-height: 36px;
  text-decoration: none;
}

.card-link:hover { background: var(--white); color: var(--black); border-color: var(--white); }

/* ===== ARTICLE HEADER ===== */
.article-header-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 50vh;
  align-items: stretch;
  border-bottom: 2px solid var(--grey-800);
  overflow: hidden;
}

.article-figure {
  position: relative;
  background: var(--grey-800);
  overflow: hidden;
  min-height: 260px;
}

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

.article-figure-placeholder {
  width: 100%;
  height: 100%;
  min-height: 260px;
  background: linear-gradient(135deg, #111 0%, var(--grey-800) 100%);
}

.article-figcaption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.7);
  font-size: 0.75rem;
  color: var(--grey-400);
}

.article-meta-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 2rem;
  gap: 1rem;
  background: var(--black);
}

.article-label,
.page-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 0.6rem;
}

.article-h1 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  line-height: 1.15;
  color: var(--white);
}

.article-desc {
  font-size: 0.95rem;
  color: var(--grey-400);
  line-height: 1.6;
}

.article-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.article-date,
.article-modified {
  font-size: 0.78rem;
  color: var(--grey-600);
}

/* ===== PAGE HERO (about/privacy/faq/changelog) ===== */
.page-hero-section,
.faq-header-section,
.policy-header-section,
.changelog-header-section {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  border-bottom: 2px solid var(--grey-800);
  min-height: 200px;
  overflow: hidden;
}

.page-hero-deco,
.faq-deco,
.policy-deco,
.changelog-deco {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  padding: 2rem 1rem;
  background: var(--grey-800);
  height: 100%;
  min-height: 200px;
}

.deco-bar {
  width: 60px;
  height: 8px;
  background: var(--white);
}

.deco-bar--sm {
  width: 36px;
  height: 4px;
  background: var(--accent);
}

.deco-stripe {
  width: 60px;
  height: 60px;
  background: repeating-linear-gradient(
    45deg,
    var(--grey-600),
    var(--grey-600) 4px,
    transparent 4px,
    transparent 12px
  );
}

.deco-grid {
  width: 60px;
  height: 60px;
  background:
    linear-gradient(var(--grey-600) 1px, transparent 1px) 0 0 / 15px 15px,
    linear-gradient(90deg, var(--grey-600) 1px, transparent 1px) 0 0 / 15px 15px;
}

.deco-timeline-bar {
  width: 4px;
  height: 80px;
  background: linear-gradient(to bottom, var(--accent), var(--grey-600));
  border-radius: 2px;
}

.page-hero-text,
.faq-meta,
.policy-meta,
.changelog-meta {
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.page-hero-text h1,
.faq-meta h1,
.policy-meta h1,
.changelog-meta h1 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.2;
  color: var(--white);
}

.page-desc {
  font-size: 0.95rem;
  color: var(--grey-400);
  line-height: 1.6;
}

/* ===== PULL QUOTE BLOCK ===== */
.pull-quote-block {
  padding: 2.5rem 2rem;
  border-bottom: 2px solid var(--grey-800);
  max-width: 680px;
}

.pull-quote-block blockquote p {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.45;
  color: var(--white);
  quotes: none;
}

.pull-quote-block blockquote {
  border: none;
  padding: 0;
  background: none;
  font-style: normal;
  border-left: 5px solid var(--accent);
  padding-left: 1.25rem;
}

.pull-quote-block figcaption {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--grey-600);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ===== PROSE SECTION (standalone) ===== */
.prose-section {
  border-bottom: 2px solid var(--grey-800);
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  font-size: 0.8rem;
  color: var(--grey-400);
  background: var(--grey-800);
  border-bottom: 1px solid var(--grey-600);
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--grey-400); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--white); }
.breadcrumb span[aria-hidden] { color: var(--grey-600); }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--black);
  border-top: 2px solid var(--grey-800);
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
  margin-top: auto;
}

.footer-cta {
  margin-bottom: 1rem;
}

.footer-cta a {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 2.5rem;
  background: var(--white);
  color: var(--black);
  font-family: var(--font-display);
  font-size: 1rem;
  border-radius: 4px;
  font-weight: 400;
  transition: background var(--transition), color var(--transition);
  min-height: 48px;
  text-decoration: none;
}

.footer-cta a:hover { background: var(--accent); color: var(--white); }

.site-footer small {
  display: block;
  font-size: 0.78rem;
  color: var(--grey-600);
  line-height: 1.6;
}

.site-footer small a {
  color: var(--grey-400);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition);
}

.site-footer small a:hover { color: var(--white); }

/* ===== SCROLL REVEAL ===== */
.card,
.prose-content,
.section-title {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.card.visible,
.prose-content.visible,
.section-title.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .prose-content,
  .section-title {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .site-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
  }

  .site-aside {
    display: none;
  }

  .hero-section,
  .article-header-section {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-figure,
  .article-figure {
    min-height: 220px;
    max-height: 300px;
  }

  .hero-text,
  .article-meta-aside {
    padding: 1.75rem 1.25rem;
  }

  .content-section,
  .flat-body-section,
  .faq-body-section,
  .policy-body-section,
  .changelog-body-section,
  .article-body-section,
  .editorial-body {
    grid-template-columns: 1fr;
  }

  .section-aside,
  .article-sidebar,
  .page-sidebar {
    position: static;
    border-left: none;
    border-top: 2px solid var(--grey-800);
    border-bottom: 2px solid var(--grey-800);
    order: 2;
  }

  .prose-content {
    order: 1;
    padding: 1.5rem 1.25rem;
  }

  .cards-section {
    padding: 1.5rem 1rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .page-hero-section,
  .faq-header-section,
  .policy-header-section,
  .changelog-header-section {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .page-hero-deco,
  .faq-deco,
  .policy-deco,
  .changelog-deco {
    min-height: 80px;
    flex-direction: row;
    padding: 1rem;
  }

  .header-inner {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  .header-nav-pills {
    display: none;
  }

  .brand-name {
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  .hero-h1 { font-size: 1.5rem; }
  .article-h1 { font-size: 1.3rem; }

  .hero-actions {
    flex-direction: column;
    gap: 0.6rem;
  }

  .btn-primary,
  .btn-outline {
    width: 100%;
    justify-content: center;
  }

  .cards-section {
    grid-template-columns: 1fr;
  }

  .header-search input[type="search"] {
    width: 90px;
  }

  .breadcrumb {
    padding: 0.6rem 1rem;
  }

  .prose-content {
    padding: 1.25rem 1rem;
  }

  .pull-quote-block {
    padding: 1.5rem 1rem;
  }
}
