/* Design tokens from hugo.toml */
:root {
  --color-primary: #1d4a63;
  --color-secondary: #6b93a8;
  --color-accent: #c05a3a;
  --color-surface: #f7fafb;
  --color-surface-card: #ffffff;
  --color-ink: #0f2836;
  --color-ink-muted: #4a6372;
  --color-border: #d4e0e6;
  --color-border-subtle: #e6eef2;
  
  --font-display: 'Libre Caslon Display', Georgia, serif;
  --font-body: 'Hind Kochi', system-ui, -apple-system, sans-serif;

  --max-width: 1140px;
  --content-width: 780px;
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.75rem;
  --spacing-lg: 3rem;
  --spacing-xl: 5rem;
}

/* Reset and foundational styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background-color: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Explicit list rules for BOTH article body and intro container */
.entry-content ul,
.entry-content ol,
.site-overview-text ul,
.site-overview-text ol,
.generic-page-body ul,
.generic-page-body ol {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.entry-content li,
.site-overview-text li,
.generic-page-body li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.entry-content p,
.site-overview-text p,
.generic-page-body p {
  margin-bottom: 1.25rem;
}

/* Base typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-primary);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--color-border-subtle);
  padding-bottom: 0.4rem;
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  margin-top: 1.8rem;
  margin-bottom: 0.75rem;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover, a:focus {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}

/* Layout container */
.site-wrapper {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* CHROME: Stacked split header */
.site-header {
  border-bottom: 3px solid var(--color-primary);
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
  margin-bottom: 3rem;
  background-color: var(--color-surface-card);
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Row 1: Nav links LEFT aligned */
.nav-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: 0.75rem;
}

.primary-menu {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-left: 0 !important;
  margin: 0 !important;
}

.primary-menu li {
  margin: 0 !important;
}

.primary-menu a {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-ink-muted);
  text-decoration: none;
  padding: 0.25rem 0;
  position: relative;
}

.primary-menu a:hover,
.primary-menu a.is-active {
  color: var(--color-primary);
}

.primary-menu a.is-active::after {
  content: '';
  position: absolute;
  bottom: -0.75rem;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-accent);
}

/* Row 2: Brand RIGHT aligned in large type */
.brand-row {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  text-align: right;
}

.brand-anchor {
  text-decoration: none;
  color: var(--color-primary);
}

.brand-title-text {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--color-primary);
  display: block;
}

.brand-subtext {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-secondary);
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* HOMEPAGE OPENING: Table of contents block */
.intro-block {
  margin-bottom: 3.5rem;
}

.page-title-single {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1.5rem;
  line-height: 1.15;
}

.table-of-sections {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--color-surface-card);
  border: 1px solid var(--color-border);
  margin: 1.5rem 0 2.5rem 0;
  box-shadow: 0 4px 12px rgba(15, 40, 54, 0.03);
}

.table-of-sections caption {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-secondary);
  text-align: left;
  padding-bottom: 0.5rem;
}

.table-of-sections th,
.table-of-sections td {
  padding: 1rem 1.25rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border-subtle);
}

.table-of-sections th {
  background-color: var(--color-surface);
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--color-primary);
  width: 25%;
  font-weight: 600;
}

.table-of-sections td {
  font-size: 0.98rem;
  color: var(--color-ink);
}

.table-of-sections tr:last-child th,
.table-of-sections tr:last-child td {
  border-bottom: none;
}

.site-overview-text {
  font-size: 1.08rem;
  color: var(--color-ink);
  line-height: 1.7;
  max-width: 820px;
  background: var(--color-surface-card);
  padding: 2rem;
  border-left: 4px solid var(--color-primary);
  border-top: 1px solid var(--color-border-subtle);
  border-right: 1px solid var(--color-border-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
}

/* SECTION HEADER / INTRO */
.section-banner {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-primary);
}

.section-banner p {
  font-size: 1.15rem;
  color: var(--color-ink-muted);
}

/* ARTICLE LIST: UNEVEN TILE MOSAIC */
.mosaic-section-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--color-primary);
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}

.mosaic-section-title::after {
  content: '';
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--color-accent);
  margin-top: 0.25rem;
}

.mosaic-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.mosaic-tile {
  background-color: var(--color-surface-card);
  border: 1px solid var(--color-border);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.mosaic-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 40, 54, 0.08);
  border-color: var(--color-secondary);
}

/* Uneven explicitly configured spans for 5 articles */
.mosaic-tile:nth-child(1) {
  grid-column: span 7;
  background-color: #ffffff;
  border-top: 4px solid var(--color-primary);
}

.mosaic-tile:nth-child(2) {
  grid-column: span 5;
  background-color: #f1f6f8;
  border-top: 4px solid var(--color-secondary);
}

.mosaic-tile:nth-child(3) {
  grid-column: span 4;
  background-color: #fcf9f7;
  border-top: 4px solid var(--color-accent);
}

.mosaic-tile:nth-child(4) {
  grid-column: span 8;
  background-color: #ffffff;
  border-top: 4px solid var(--color-primary);
}

.mosaic-tile:nth-child(5) {
  grid-column: span 12;
  background-color: #f1f6f8;
  border-top: 4px solid var(--color-secondary);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  align-items: center;
}

.tile-header {
  margin-bottom: 1rem;
}

.tile-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.tile-title a {
  color: var(--color-primary);
  text-decoration: none;
}

.tile-title a:hover {
  color: var(--color-accent);
}

.tile-excerpt {
  font-size: 0.95rem;
  color: var(--color-ink);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.tile-meta {
  font-size: 0.82rem;
  color: var(--color-ink-muted);
  font-weight: 500;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--color-border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* SINGLE ARTICLE / PAGE LAYOUT */
.article-layout {
  max-width: var(--content-width);
  margin: 0 auto 4rem auto;
}

.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-border-subtle);
}

.article-meta-bar {
  font-size: 0.9rem;
  color: var(--color-ink-muted);
  margin-bottom: 1rem;
  font-weight: 500;
}

.article-lead {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--color-ink);
  font-weight: 500;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background-color: var(--color-surface-card);
  border-left: 3px solid var(--color-accent);
}

.entry-content,
.generic-page-body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--color-ink);
}

.entry-content blockquote,
.generic-page-body blockquote {
  margin: 1.75rem 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--color-secondary);
  background-color: var(--color-surface-card);
  font-style: italic;
  color: var(--color-ink-muted);
}

.entry-content hr,
.generic-page-body hr {
  border: 0;
  height: 1px;
  background: var(--color-border);
  margin: 2.5rem 0;
}

/* FOOTER */
.site-footer {
  margin-top: auto;
  background-color: var(--color-primary);
  color: #ffffff;
  padding: 3rem 0 2rem 0;
  border-top: 4px solid var(--color-accent);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: #ffffff;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  padding-left: 0 !important;
}

.footer-nav a {
  color: var(--color-border-subtle);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-nav a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-bottom {
  font-size: 0.85rem;
  color: var(--color-secondary);
  line-height: 1.5;
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 900px) {
  .mosaic-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .mosaic-tile:nth-child(1),
  .mosaic-tile:nth-child(2),
  .mosaic-tile:nth-child(3),
  .mosaic-tile:nth-child(4),
  .mosaic-tile:nth-child(5) {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .site-wrapper {
    padding: 0 1rem;
  }

  .site-header {
    padding-top: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
  }

  .brand-row {
    justify-content: flex-start;
    text-align: left;
  }

  .table-of-sections th,
  .table-of-sections td {
    display: block;
    width: 100%;
  }

  .table-of-sections th {
    border-bottom: none;
    padding-bottom: 0.25rem;
    background-color: transparent;
  }

  .table-of-sections td {
    padding-top: 0;
  }

  .mosaic-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .mosaic-tile:nth-child(1),
  .mosaic-tile:nth-child(2),
  .mosaic-tile:nth-child(3),
  .mosaic-tile:nth-child(4),
  .mosaic-tile:nth-child(5) {
    grid-column: span 1;
  }

  .footer-top {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Ensure no horizontal scroll on 375px */
html, body {
  overflow-x: hidden;
}
