@import url('https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Merriweather:wght@300;400;700&display=swap');

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Merriweather', 'Noto Serif SC', Georgia, serif;
  background: #fff;
  color: #000;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* ===== Scroll Margin for sections ===== */
div[id] {
  scroll-margin-top: 80px;
}

/* ===== Layout: Sidebar + Main ===== */
.page-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 60px);
  max-width: 1440px;
  margin: 0 auto;
}

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 2rem 1.5rem;
  z-index: 100;
  border-right: 2px solid #000;
  overflow-y: auto;
}

.header-brand {
  margin-bottom: 2.5rem;
}

.brand-link {
  display: flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
}

.site-logo,
.site-logo-mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.logo-text {
  font-family: 'Abril Fatface', serif;
  font-size: 2rem;
  color: #fff;
  line-height: 1;
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 2px solid #fff;
  text-align: center;
  line-height: 36px;
}

/* ===== Nav ===== */
.site-nav {
  width: 100%;
  flex: 1;
}

.nav-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: block;
  color: #fff;
  font-family: 'Merriweather', serif;
  font-size: 0.85rem;
  font-weight: 400;
  padding: 0.6rem 0.75rem;
  border-left: 2px solid transparent;
  letter-spacing: 0.02em;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
  min-height: 40px;
  line-height: 1.4;
}

.nav-link:hover,
.nav-link:focus-visible {
  border-left-color: #fff;
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ===== Header Search ===== */
.header-search {
  width: 100%;
  margin-top: auto;
  padding-top: 1.5rem;
}

.search-form {
  display: flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  overflow: hidden;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: 'Merriweather', serif;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  min-height: 40px;
}

.search-input::placeholder {
  color: rgba(255,255,255,0.5);
}

.search-btn {
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  cursor: pointer;
  padding: 0.5rem 0.6rem;
  min-height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.search-btn:hover {
  background: rgba(255,255,255,0.15);
}

/* ===== Hero ===== */
.hero-section {
  position: relative;
  margin-left: 240px;
  min-height: 45vh;
  background: #000;
  color: #fff;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.dot-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.18) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  padding: 3rem 4rem 3rem 2rem;
  text-align: right;
}

.hero-h1 {
  font-family: 'Abril Fatface', serif;
  font-size: clamp(2.8rem, 7vw, 6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 1rem;
}

.hero-desc {
  font-family: 'Merriweather', serif;
  font-size: 1rem;
  font-weight: 300;
  color: rgba(255,255,255,0.75);
  max-width: 560px;
  margin-left: auto;
  line-height: 1.7;
}

/* ===== Sidebar ===== */
.sidebar {
  display: none;
}

/* ===== Main Content ===== */
.main-content {
  margin-left: 240px;
  min-width: 0;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.content-section {
  width: 100%;
}

.content-article {
  font-size: 1rem;
  line-height: 1.8;
  color: #000;
}

/* ===== Article Content Typography ===== */
.content-article h1,
.content-article h2,
.content-article h3,
.content-article h4 {
  font-family: 'Abril Fatface', serif;
  line-height: 1.2;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.content-article h2 {
  font-size: 1.9rem;
  border-bottom: 2px solid #000;
  padding-bottom: 0.4rem;
}

.content-article h3 {
  font-size: 1.35rem;
}

.content-article h4 {
  font-size: 1.1rem;
  font-family: 'Merriweather', serif;
  font-weight: 700;
}

.content-article p {
  margin-bottom: 1.2rem;
  font-size: 1rem;
}

.content-article ul,
.content-article ol {
  margin: 1rem 0 1.2rem 1.5rem;
  list-style: disc;
}

.content-article ol {
  list-style: decimal;
}

.content-article li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.content-article a {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease;
}

.content-article a:hover {
  opacity: 0.6;
}

.content-article blockquote {
  border-left: 3px solid #000;
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: #f5f5f5;
  font-style: italic;
}

.content-article code {
  font-family: 'Courier New', monospace;
  background: #f0f0f0;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

.content-article pre {
  background: #111;
  color: #eee;
  padding: 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.content-article pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.content-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.content-article th,
.content-article td {
  border: 1px solid #ccc;
  padding: 0.6rem 0.8rem;
  text-align: left;
}

.content-article th {
  background: #000;
  color: #fff;
  font-family: 'Merriweather', serif;
  font-weight: 700;
}

.content-article tr:nth-child(even) td {
  background: #f8f8f8;
}

.content-article img {
  max-width: 100%;
  border-radius: 6px;
  margin: 1.5rem 0;
}

/* Section dividers within content */
.content-article div {
  margin-bottom: 3rem;
  padding-top: 1rem;
}

.content-article div + div {
  border-top: 1px solid #e0e0e0;
  padding-top: 2.5rem;
}

/* ===== Eyebrow / small labels ===== */
small {
  display: block;
  font-family: 'Merriweather', serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 0.5rem;
}

/* ===== Footer ===== */
.site-footer {
  margin-left: 240px;
  background: #000;
  color: #fff;
  padding: 3rem 4rem 1.5rem;
}

.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.footer-eyebrow {
  color: rgba(255,255,255,0.5);
  margin-bottom: 0.75rem;
}

.footer-brand-name {
  font-family: 'Abril Fatface', serif;
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 0.75rem;
}

.footer-tagline {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.6;
  font-weight: 300;
}

.footer-address {
  font-style: normal;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.9;
}

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

.footer-nav-list li a,
.footer-link {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
  transition: color 0.2s ease;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.footer-nav-list li a:hover,
.footer-link:hover {
  color: #fff;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ===== TOC / Sidebar (desktop layout option) ===== */
.sidebar-eyebrow {
  color: #666;
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.toc-link {
  font-size: 0.82rem;
  color: #444;
  padding: 0.3rem 0;
  border-bottom: 1px solid #f0f0f0;
  transition: color 0.2s ease;
  display: block;
}

.toc-link:hover {
  color: #000;
}

.sidebar-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 1.5rem 0;
}

.sidebar-about {
  font-size: 0.82rem;
  color: #666;
  line-height: 1.6;
}

/* ===== Glass Card (for any card elements in content) ===== */
.glass-card {
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  padding: 1.5rem;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

/* ===== Stagger animation ===== */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-link {
  animation: fadeSlideUp 0.3s ease both;
  animation-delay: calc(var(--i, 0) * 0.05s);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 1024px) {
  .site-header {
    width: 200px;
  }
  .hero-section {
    margin-left: 200px;
  }
  .main-content {
    margin-left: 200px;
  }
  .page-body {
    grid-template-columns: 200px 1fr;
  }
  .site-footer {
    margin-left: 200px;
    padding: 2.5rem 2rem 1.5rem;
  }
  .footer-top {
    gap: 2rem;
  }
  .hero-inner {
    padding: 2.5rem 2rem 2.5rem 1.5rem;
  }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
  }

  div[id] {
    scroll-margin-top: 64px;
  }

  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0 1rem;
    min-height: 60px;
    border-right: none;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    overflow: visible;
    z-index: 200;
  }

  .header-brand {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .site-nav {
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-row {
    flex-direction: row;
    gap: 0;
    white-space: nowrap;
    padding: 0 0.5rem;
  }

  .nav-link {
    display: inline-flex;
    align-items: center;
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
    min-height: 48px;
    animation: none;
  }

  .nav-link:hover,
  .nav-link:focus-visible {
    border-left-color: transparent;
    border-bottom-color: #fff;
    background: rgba(255,255,255,0.08);
  }

  .header-search {
    display: none;
  }

  .hero-section {
    margin-left: 0;
    margin-top: 60px;
    min-height: 45vh;
    align-items: center;
  }

  .hero-inner {
    padding: 2.5rem 1.25rem;
    text-align: right;
  }

  .hero-h1 {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }

  .hero-desc {
    font-size: 0.9rem;
  }

  .page-body {
    display: block;
    margin-top: 0;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .wrap {
    padding: 2rem 1.25rem 3rem;
  }

  .content-article h2 {
    font-size: 1.5rem;
  }

  .content-article h3 {
    font-size: 1.15rem;
  }

  .site-footer {
    margin-left: 0;
    padding: 2rem 1.25rem 1rem;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

@media (max-width: 375px) {
  .hero-h1 {
    font-size: 2rem;
  }

  .nav-link {
    font-size: 0.72rem;
    padding: 0.5rem 0.45rem;
  }

  .wrap {
    padding: 1.5rem 1rem 2.5rem;
  }
}
