/* ==========================================================================
   THEME — "the-bonding-space"
   --------------------------------------------------------------------------
   Studio-editorial paint layer for a literary magazine on adult intimacy,
   chosen family, and the small rituals that hold connection together.

   Palette (4 brand HEX, used twice — once per scheme):
     #FAFAF7  Studio White   — light page background
     #1B1C2A  Midnight Ink   — body text / dark page background
     #B05E9E  Orchid Plum    — primary accent (links, kickers, rules)
     #3DBFA3  Sage Teal      — secondary accent (hairlines, hero, surface highlights)

   Structure (grid/flex/spacing) is owned by layout.css ("journal"). This file
   only paints colors + fonts + accent flourishes on top. No layout written.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,500&family=Inter+Tight:wght@400;500;600;700&display=swap");

/* --- Font role tokens (theme-invariant) -------------------------------- */
:root {
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans:  "Inter Tight", "Helvetica Neue", Helvetica, sans-serif;
}

/* --- Light theme (default / no-JS) ------------------------------------- */
:root[data-theme="light"] {
  --color-bg:      #FAFAF7;
  --color-text:    #1B1C2A;
  --color-accent:  #B05E9E;
  --color-accent-2:#3DBFA3;
  --color-surface: #F1EFE9;  /* warm-paper tone of #FAFAF7 toward Midnight Ink */
  --color-border: #1B1C2A;
}

/* --- Dark theme -------------------------------------------------------- */
:root[data-theme="dark"] {
  --color-bg:      #14151F;  /* deeper than Midnight Ink so cards lift cleanly */
  --color-text:    #FAFAF7;
  --color-accent:  #B05E9E;
  --color-accent-2:#3DBFA3;
  --color-surface: #1B1C2A;  /* Midnight Ink as raised card surface */
  --color-border: #FAFAF7;
}

/* --- Page frame -------------------------------------------------------- */
.page {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "ss02", "kern";
}

body {
  font-family: var(--font-sans);
}

::selection {
  background: var(--color-accent);
  color: var(--color-bg);
}

/* --- Subtle borders soften the journal hairlines -------------------------- */
.site-header,
.site-footer,
.article-card,
.article-list__item,
.article-list__item:first-child {
  border-color: color-mix(in srgb, var(--color-border) 18%, transparent);
}

:root[data-theme="dark"] .site-header,
:root[data-theme="dark"] .site-footer,
:root[data-theme="dark"] .article-card,
:root[data-theme="dark"] .article-list__item,
:root[data-theme="dark"] .article-list__item:first-child {
  border-color: color-mix(in srgb, var(--color-border) 22%, transparent);
}

/* --- Site header / nav -------------------------------------------------- */
.site-header {
  background: var(--color-bg);
  position: relative;
}

.site-header::after {
  /* hairline Sage-Teal accent beneath the header — gives the bar its studio edge */
  content: "";
  display: block;
  height: 2px;
  width: 100%;
  background: linear-gradient(
    to right,
    transparent 0%,
    var(--color-accent-2) 30%,
    var(--color-accent) 70%,
    transparent 100%
  );
  opacity: 0.7;
}

.nav-brand {
  color: var(--color-text);
  letter-spacing: -0.01em;
  font-style: italic;
  transition: color 200ms ease;
}

.nav-brand:hover {
  color: var(--color-accent);
}

.nav-links a {
  color: var(--color-text);
  position: relative;
  transition: color 200ms ease;
}

.nav-links a:hover {
  color: var(--color-accent);
}

/* --- Theme toggle: pill, surface-filled, label "L"/"D" via glyph ---------- */
.theme-toggle {
  width: auto;
  min-width: 2.5rem;
  height: 2.5rem;
  padding-inline: var(--space-xs);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid color-mix(in srgb, var(--color-border) 14%, transparent);
  transition: background 200ms ease, color 200ms ease, transform 200ms ease;
}

.theme-toggle:hover {
  background: var(--color-accent);
  color: var(--color-bg);
  opacity: 1;
  transform: translateY(-1px);
}

.theme-toggle__icon {
  width: 1.05rem;
  height: 1.05rem;
}

/* --- Burger pill — matches the toggle's language -------------------------- */
.nav-toggle {
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid color-mix(in srgb, var(--color-border) 14%, transparent);
  transition: background 200ms ease, color 200ms ease;
}

.nav-toggle:hover {
  background: var(--color-accent);
  color: var(--color-bg);
  opacity: 1;
}

/* --- Hero --------------------------------------------------------------- */
.hero {
  padding-block: var(--space-2xl);
  position: relative;
  background:
    radial-gradient(
      ellipse 80% 60% at 50% 0%,
      color-mix(in srgb, var(--color-accent-2) 10%, transparent) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 60% 50% at 50% 100%,
      color-mix(in srgb, var(--color-accent) 8%, transparent) 0%,
      transparent 70%
    );
}

.hero::before {
  /* tiny editorial mark above the title */
  content: "";
  display: block;
  width: 2.5rem;
  height: 1px;
  margin: 0 auto var(--space-md);
  background: var(--color-accent);
}

.hero__title {
  color: var(--color-text);
  letter-spacing: -0.02em;
  font-style: italic;
  font-variation-settings: "opsz" 96, "SOFT" 50;
}

.hero__lead {
  color: var(--color-accent);
  font-weight: 400;
  letter-spacing: -0.005em;
}

/* --- Section + page titles --------------------------------------------- */
.section-title,
.page-title {
  color: var(--color-text);
  letter-spacing: -0.02em;
  font-style: italic;
  position: relative;
  padding-block-end: var(--space-md);
}

.section-title::after,
.page-title::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin: var(--space-sm) auto 0;
  background: var(--color-accent-2);
}

.page-hero {
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--color-accent-2) 6%, transparent),
    transparent
  );
}

/* --- Article cards (homepage grid) -------------------------------------- */
.article-card {
  background: var(--color-surface);
  position: relative;
  overflow: hidden;
  transition: transform 250ms ease, border-color 250ms ease, box-shadow 250ms ease;
}

.article-card::before {
  /* a sliver of Orchid Plum at the card's leading edge — editorial spine */
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  background: var(--color-accent);
  transform: scaleY(0.3);
  transform-origin: top;
  transition: transform 300ms ease;
}

.article-card:hover {
  /* contained — never bleeds into the grid gap (layout.css gap = --space-lg) */
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--color-accent) 50%, transparent);
  box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--color-text) 40%, transparent);
}

.article-card:hover::before {
  transform: scaleY(1);
}

.article-card__title {
  color: var(--color-text);
  letter-spacing: -0.015em;
}

.article-card__link {
  color: var(--color-text);
  background-image: linear-gradient(var(--color-accent), var(--color-accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 280ms ease, color 200ms ease;
}

.article-card__link:hover {
  color: var(--color-accent);
  background-size: 100% 1px;
  text-decoration: none;
}

/* Kicker eyebrow — secondary accent, the editorial cluster label */
.article-card__kicker,
.article-list__kicker {
  color: var(--color-accent-2);
  font-family: var(--font-sans);
  font-weight: 600;
}

.article-card__kicker::before,
.article-list__kicker::before {
  content: "";
  display: inline-block;
  width: 1.25rem;
  height: 1px;
  background: currentColor;
  vertical-align: middle;
  margin-inline-end: var(--space-2xs);
  opacity: 0.7;
}

/* --- Article list (articles.html) --------------------------------------- */
.article-list__item {
  transition: padding 200ms ease, background 200ms ease;
}

.article-list__item:hover {
  background: color-mix(in srgb, var(--color-accent) 5%, transparent);
  padding-inline: var(--space-sm);
}

.article-list__link {
  color: var(--color-text);
  font-style: italic;
  transition: color 200ms ease;
}

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

/* --- Article prose ------------------------------------------------------ */
.prose {
  color: var(--color-text);
  font-family: var(--font-serif);
}

.prose h1 {
  /* DS-6: long-form title must be readable in the narrow column */
  font-size: var(--text-2xl);
  color: var(--color-text);
  font-style: italic;
  letter-spacing: -0.015em;
  position: relative;
  padding-block-end: var(--space-md);
}

.prose h1::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  margin: var(--space-md) auto 0;
  background: var(--color-accent);
}

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

.prose h2,
.prose h3,
.prose h4 {
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.prose h2 {
  color: var(--color-accent);
  font-style: italic;
  font-weight: 600;
}

.prose h3 {
  color: var(--color-text);
}

.prose h4 {
  color: var(--color-accent-2);
  text-transform: uppercase;
  font-size: var(--text-base);
  letter-spacing: 0.06em;
  font-weight: 600;
  font-family: var(--font-sans);
}

.prose h5 {
  color: var(--color-text);
  font-family: var(--font-sans);
  font-weight: 600;
}

.prose p {
  color: var(--color-text);
  line-height: var(--leading-normal);
}

.prose p::first-letter {
  /* subtle editorial touch on opening graf — only the first p after h1 */
}

.prose > p:first-of-type {
  font-size: calc(var(--text-lg) * 1.05);
  color: color-mix(in srgb, var(--color-text) 92%, var(--color-accent));
}

.prose a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--color-accent) 40%, transparent);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 200ms ease;
}

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

.prose blockquote {
  border-inline-start: 2px solid var(--color-accent-2);
  padding-inline-start: var(--space-md);
  font-style: italic;
  color: color-mix(in srgb, var(--color-text) 85%, var(--color-accent-2));
}

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  background: var(--color-bg);
  position: relative;
}

.site-footer::before {
  content: "";
  display: block;
  width: 4rem;
  height: 1px;
  margin: 0 auto var(--space-md);
  background: var(--color-accent-2);
}

.footer-copy {
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  letter-spacing: 0.01em;
}

.footer-copy a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 200ms ease;
}

.footer-copy a:hover {
  color: var(--color-text);
}

/* --- Motion: gentle reveal on hero + cards ------------------------------- */
@keyframes theme-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__title,
.hero__lead {
  animation: theme-fade-up 600ms ease-out both;
}

.hero__lead {
  animation-delay: 120ms;
}

@keyframes theme-rule-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.hero::before,
.section-title::after,
.page-title::after,
.prose h1::after {
  transform-origin: center;
  animation: theme-rule-grow 500ms ease-out both;
}

/* --- Motion safety: honor user preference (DS-5) ------------------------- */
@media (prefers-reduced-motion: reduce) {
  .hero__title,
  .hero__lead,
  .hero::before,
  .section-title::after,
  .page-title::after,
  .prose h1::after {
    animation: none;
  }

  .article-card,
  .article-card::before,
  .article-card__link,
  .article-list__item,
  .article-list__link,
  .nav-links a,
  .nav-brand,
  .theme-toggle,
  .nav-toggle,
  .prose a {
    transition: none;
  }

  .article-card:hover {
    transform: none;
  }

  .article-card::before {
    transform: scaleY(1);
  }
}
