/* ==========================================================================
   RealConnectionOnline — theme.css
   Paint layer only. No grid/flex layout structure — that belongs to layout.css.
   Palette: #FAF7F4 / #1C1917 / #C0623A / #6B8F71
   Scheme: light
   ========================================================================== */

/* --- Color-variable contract --------------------------------------------- */
:root {
  --color-bg:      #FAF7F4;  /* Parchment White — page background */
  --color-text:    #1C1917;  /* Obsidian Ink — body text */
  --color-accent:  #C0623A;  /* Ember — links, CTAs, editorial highlights */
  --color-surface: #6B8F71;  /* Sage — raised surfaces, secondary accent */
  --color-border:  #1C1917;  /* Obsidian Ink (low-opacity applied inline) */

  /* Font role assignments — system stacks, no CDN */
  --font-serif: Georgia, "Times New Roman", "Palatino Linotype", Palatino, serif;
  --font-sans:  system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* --- Base page paint ---------------------------------------------------- */
.page {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
}

/* --- Links -------------------------------------------------------------- */
a {
  color: var(--color-accent);
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

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

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  a {
    transition: none;
  }
}

/* --- Site header & nav -------------------------------------------------- */
.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid rgba(28, 25, 23, 0.15);
  padding-block: var(--space-md);
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .site-header {
    padding-inline: var(--space-xl);
  }
}

.site-nav {
  max-width: var(--container);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.nav-brand:hover,
.nav-brand:focus-visible {
  color: var(--color-accent);
  text-decoration-color: transparent;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text);
  text-decoration: none;
  padding-block-end: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a[aria-current="page"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  .nav-brand,
  .nav-links a {
    transition: none;
  }
}

/* --- Hero --------------------------------------------------------------- */
.hero {
  padding-block: var(--space-2xl);
  padding-inline: var(--space-md);
  background: var(--color-bg);
  border-bottom: 3px solid var(--color-accent);
}

@media (min-width: 768px) {
  .hero {
    padding-inline: var(--space-xl);
  }
}

.hero__title {
  font-family: var(--font-serif);
  font-size: var(--text-4xl);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--color-text);
  max-width: 20ch;
}

.hero__lead {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  color: var(--color-text);
  max-width: 52ch;
  margin-block-start: var(--space-md);
  opacity: 0.8;
}

/* --- Page hero (thematic + article pages) -------------------------------- */
.page-hero {
  padding-block: var(--space-2xl);
  padding-inline: var(--space-md);
  border-bottom: 1px solid rgba(28, 25, 23, 0.15);
}

@media (min-width: 768px) {
  .page-hero {
    padding-inline: var(--space-xl);
  }
}

.page-title {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--color-text);
}

/* Ember rule beneath page titles */
.page-title::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  background: var(--color-accent);
  margin-block-start: var(--space-sm);
}

/* --- Section titles ----------------------------------------------------- */
.section-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-text);
  position: relative;
  padding-block-end: var(--space-xs);
}

.section-title::after {
  content: "";
  display: block;
  width: 2rem;
  height: 2px;
  background: var(--color-surface); /* Sage accent */
  margin-block-start: var(--space-xs);
}

/* --- Articles section --------------------------------------------------- */
.articles-section {
  padding-block: var(--space-2xl);
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .articles-section {
    padding-inline: var(--space-xl);
  }
}

/* --- Article cards ------------------------------------------------------ */
.article-card {
  background: transparent;
  border-top: 1px solid rgba(28, 25, 23, 0.15);
  padding-block: var(--space-lg);
  transition: border-color 0.2s ease;
}

.article-card:hover {
  border-top-color: var(--color-accent);
}

.article-card__title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: var(--leading-snug);
  color: var(--color-text);
  margin-block-end: var(--space-xs);
}

.article-card__link {
  color: var(--color-text);
  text-decoration: none;
}

.article-card__link:hover,
.article-card__link:focus-visible {
  color: var(--color-accent);
  text-decoration-color: transparent;
}

.article-card__excerpt {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  opacity: 0.75;
  margin-block-end: var(--space-sm);
}

.article-card__meta {
  font-size: var(--text-xs);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-surface); /* Sage */
}

@media (prefers-reduced-motion: reduce) {
  .article-card {
    transition: none;
  }
}

/* --- Article list (articles.html listing) -------------------------------- */
.articles-index {
  padding-block: var(--space-2xl);
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .articles-index {
    padding-inline: var(--space-xl);
  }
}

.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-list__item {
  border-top: 1px solid rgba(28, 25, 23, 0.12);
  padding-block: var(--space-md);
}

.article-list__item:last-child {
  border-bottom: 1px solid rgba(28, 25, 23, 0.12);
}

.article-list__link {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-block;
}

.article-list__link:hover,
.article-list__link:focus-visible {
  color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  .article-list__link {
    transition: none;
  }
}

/* --- Prose (article body) ----------------------------------------------- */
.prose {
  font-family: var(--font-sans);
  color: var(--color-text);
}

.prose h1 {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  color: var(--color-text);
}

@media (min-width: 768px) {
  .prose h1 {
    font-size: var(--text-3xl);
  }
}

.prose h2,
.prose h3,
.prose h4,
.prose h5 {
  font-family: var(--font-serif);
  color: var(--color-text);
}

.prose h2 {
  font-size: var(--text-xl);
}

.prose h3 {
  font-size: var(--text-lg);
}

/* Accent rule above h2 sections in prose */
.prose h2::before {
  content: "";
  display: block;
  width: 1.5rem;
  height: 2px;
  background: var(--color-accent);
  margin-block-end: var(--space-xs);
}

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

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

/* --- Article page wrapper ----------------------------------------------- */
.article-body {
  padding-block: var(--space-2xl);
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .article-body {
    padding-inline: var(--space-xl);
  }
}

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  background: var(--color-text);       /* Obsidian Ink */
  color: var(--color-bg);              /* Parchment White on dark */
  padding-block: var(--space-lg);
  padding-inline: var(--space-md);
  border-top: 3px solid var(--color-surface); /* Sage accent stripe */
}

@media (min-width: 768px) {
  .site-footer {
    padding-inline: var(--space-xl);
  }
}

.footer-copy {
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-bg);
  opacity: 0.75;
  text-align: center;
}

/* --- Micro-interaction: article card hover lift (expensive, tasteful) --- */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .article-card {
    transform: translateY(0);
    transition:
      border-color 0.25s ease,
      transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .article-card:hover {
    transform: translateY(-2px);
  }
}

/* Slow cinematic fade-in for page elements (reduced-motion safe) */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero__title,
  .hero__lead,
  .page-title {
    animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .hero__lead {
    animation-delay: 0.15s;
  }
}

/* ===== Mobile nav — CSS-only burger ====================================== */
/* layout.css (editorial) loads AFTER theme.css and sets:
     .site-nav { flex-direction: column; align-items: center }
     .nav-links { display: flex }
   These override the simple selectors in theme.css. The fix: use compound
   selectors (.site-header .site-nav, .site-nav .nav-links) whose specificity
   (0,2,0) beats layout.css (0,1,0). */

.nav-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem; height: 2.5rem;
  flex: 0 0 auto;
  cursor: pointer;
  color: var(--color-text);
}

.nav-burger span {
  display: block;
  width: 22px; height: 2px;
  background: currentColor;
  border-radius: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .nav-burger span { transition: transform 200ms ease, opacity 160ms ease; }
}

.nav-toggle:focus-visible ~ .nav-burger {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

@media (max-width: 767px) {
  /* Override editorial column layout — brand + burger must sit in one row.
     column-gap and padding-block are explicit so the header height is identical
     across pages regardless of whether layout.css is loaded. */
  .site-header .site-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    column-gap: var(--space-2xs);
    row-gap: var(--space-xs);
    text-align: left;
    padding-inline: 0;    /* site-header already provides 24px side padding */
    padding-block: 0;     /* cancel layout.css nav padding-block (16px each side) */
  }

  /* Brand: flex-basis:0 ensures brand+burger share one row (flex-basis:auto
     would make the brand ~246px wide by default, leaving no room for the
     burger so it wraps to line 2). Then flex-grow:1 fills leftover space.
     Specificity 0,3,0 beats layout.css .nav-brand (0,1,0). */
  .site-header .site-nav .nav-brand {
    flex: 1 1 0%;
    min-width: 0;
    font-size: var(--text-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-burger { display: inline-flex; }

  /* Specificity 0,2,0 beats layout.css .nav-links (0,1,0) */
  .site-nav .nav-links {
    display: none;
    flex-basis: 100%;
    width: 100%;
    text-align: left;
    justify-content: flex-start;
  }

  .site-nav .nav-toggle:checked ~ .nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2xs);
    padding-block: var(--space-xs) var(--space-2xs);
    border-top: 1px solid rgba(28, 25, 23, 0.15);
  }

  .nav-links li { width: 100%; }

  /* ☰ → ✕ */
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Hero title: "Realconnectiononline" (19 chars) — at ~26px the word breaks
     cleanly as "Realconnection" / "online" instead of mid-character. */
  .hero__title {
    font-size: clamp(1.65rem, 1rem + 3.5vw, 2.75rem);
    overflow-wrap: break-word;
  }
}

/* ===== Fluid type scale at narrow widths ================================ */
@media (max-width: 30rem) {
  :root {
    --text-4xl: clamp(1.85rem, 1.2rem + 4.5vw, 2.75rem);
    --text-3xl: clamp(1.55rem, 1.1rem + 3.2vw, 2.25rem);
    --text-2xl: clamp(1.35rem, 1rem + 2.2vw, 1.95rem);
  }
  h1, h2, h3 { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
}
