/* =========================================================================
   istaawareness.life — editorial / journalistic redesign
   ========================================================================= */

/* ---------- Tokens ------------------------------------------------------- */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f5f3ee;
  --text: #1a1a1a;
  --text-muted: #5a5a5a;
  --text-faint: #8a8a8a;
  --border: #e5e3dd;
  --border-strong: #c9c6bd;
  --link: #1a4480;
  --link-hover: #0d2a52;
  --accent: #8a1c1c;
  --accent-bg: #fdf3f3;
  --focus: #1a4480;

  --serif: 'Charter', 'Iowan Old Style', 'Source Serif Pro', 'Georgia', 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --radius: 6px;
  --radius-sm: 3px;

  --measure: 68ch;
  --toc-w: 220px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111210;
    --surface: #1a1b18;
    --surface-2: #222320;
    --text: #ececea;
    --text-muted: #a8a8a3;
    --text-faint: #777772;
    --border: #2c2d28;
    --border-strong: #3e3f39;
    --link: #8ab4f8;
    --link-hover: #b3cdfc;
    --accent: #e08e8e;
    --accent-bg: #2a1313;
    --focus: #8ab4f8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

[data-theme="dark"] {
  --bg: #111210;
  --surface: #1a1b18;
  --surface-2: #222320;
  --text: #ececea;
  --text-muted: #a8a8a3;
  --text-faint: #777772;
  --border: #2c2d28;
  --border-strong: #3e3f39;
  --link: #8ab4f8;
  --link-hover: #b3cdfc;
  --accent: #e08e8e;
  --accent-bg: #2a1313;
  --focus: #8ab4f8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ---------- Reset / base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-5);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg, iframe { max-width: 100%; display: block; }
img { height: auto; }
iframe { border: 0; }

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 120ms ease;
}
a:hover { color: var(--link-hover); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* ---------- Skip link ---------------------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: var(--space-3);
  background: var(--surface);
  color: var(--text);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform 150ms ease;
  z-index: 100;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- Header / hero ----------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.site-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  text-decoration: none;
  color: inherit;
  flex: 1 1 auto;
  min-width: 0;
}
.brand img {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 50%;
  background: var(--surface);
}
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.brand__name {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.theme-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, border-color 120ms ease;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--surface-2); border-color: var(--text-muted); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ---------- Page hero ---------------------------------------------------- */
.page-hero {
  border-bottom: 1px solid var(--border);
  padding: var(--space-7) var(--space-5) var(--space-6);
  background: var(--bg);
}
.page-hero__inner {
  max-width: 1180px;
  margin: 0 auto;
}
.page-hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.85rem, 1.3rem + 2.4vw, 2.85rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-3);
  max-width: 22ch;
}
.page-hero__subtitle {
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  color: var(--text-muted);
  margin: 0;
  max-width: 60ch;
}
.page-hero__subtitle strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Layout ------------------------------------------------------- */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-8);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}
@media (min-width: 1100px) {
  .layout {
    grid-template-columns: var(--toc-w) minmax(0, 1fr);
    gap: var(--space-8);
    padding-top: var(--space-7);
  }
}

.article {
  min-width: 0;
  max-width: var(--measure);
}

/* ---------- Table of contents ------------------------------------------- */
.toc {
  font-size: 0.95rem;
}
.toc__details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}
.toc__details > summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toc__details > summary::-webkit-details-marker { display: none; }
.toc__details > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 150ms ease;
  margin-left: var(--space-2);
}
.toc__details[open] > summary::after { transform: rotate(-135deg); }
.toc__list {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  counter-reset: toc;
}
.toc__list li { margin: 0; counter-increment: toc; }
.toc__list a {
  display: block;
  padding: var(--space-2) 0 var(--space-2) var(--space-5);
  position: relative;
  text-decoration: none;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
  line-height: 1.4;
}
.toc__list a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  top: 50%;
  transform: translateY(-50%);
}
.toc__list a:hover { color: var(--text); }
.toc__list a.is-current {
  color: var(--text);
  border-left-color: var(--accent);
  font-weight: 500;
}

@media (min-width: 1100px) {
  .toc {
    position: sticky;
    top: var(--space-5);
    align-self: start;
    max-height: calc(100vh - var(--space-7));
    overflow-y: auto;
  }
  .toc__details {
    background: transparent;
    border: 0;
    padding: 0;
  }
  .toc__details > summary { display: none; }
  .toc__list { margin-top: 0; }
}

/* ---------- Article typography ------------------------------------------ */
.article h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.4rem, 1.2rem + 0.7vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: var(--space-8) 0 var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  scroll-margin-top: var(--space-5);
}
.article > section:first-of-type h2,
.article > h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.article h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  margin: var(--space-7) 0 var(--space-3);
  letter-spacing: -0.005em;
  scroll-margin-top: var(--space-5);
}

.article p { margin: 0 0 var(--space-4); }
.article p strong { font-weight: 600; color: var(--text); }
.article p em { font-style: italic; }

.back-to-toc {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  margin-left: var(--space-3);
  text-decoration: none;
  color: var(--text-faint);
  font-weight: 500;
  vertical-align: middle;
}
.back-to-toc:hover { color: var(--link); }
@media (min-width: 1100px) {
  .back-to-toc { display: none; }
}

/* ---------- Disclaimer callout ------------------------------------------ */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  padding: var(--space-4) var(--space-5);
  margin: 0 0 var(--space-6);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
}
.callout__label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-2);
}
.callout p { margin: 0; }

/* ---------- Media list / cards ------------------------------------------ */
.media-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.media-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.media-card__title {
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  letter-spacing: -0.005em;
}
.media-card__title a {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--link), var(--link));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 200ms ease, color 120ms ease;
  padding-bottom: 1px;
}
.media-card__title a:hover {
  color: var(--link);
  background-size: 100% 1px;
}

.media-card__meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  align-items: center;
}
.media-card__meta > * + *::before {
  content: "·";
  margin-right: var(--space-3);
  color: var(--text-faint);
}

.media-card__alt-lang {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin-left: var(--space-2);
  transition: color 120ms ease, border-color 120ms ease;
}
.media-card__alt-lang:hover {
  color: var(--link);
  border-color: var(--link);
}

.media-card__summary {
  color: var(--text-muted);
  font-size: 0.97rem;
  line-height: 1.6;
  margin: 0;
}

.media-card__preview {
  margin-top: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
}
.media-card__preview img {
  width: 100%;
  height: auto;
  display: block;
}
.media-card__preview--video {
  aspect-ratio: 16 / 9;
  background: #000;
  position: relative;
}
.media-card__preview--video img,
.media-card__preview--video iframe {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ---------- YouTube facade ---------------------------------------------- */
.yt-facade {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
  overflow: hidden;
  display: block;
}
.yt-facade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  transition: opacity 150ms ease, transform 200ms ease;
}
.yt-facade:hover img { opacity: 1; transform: scale(1.02); }
.yt-facade__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  background: rgba(0, 0, 0, 0.78);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: background 150ms ease;
}
.yt-facade:hover .yt-facade__play { background: #cc0000; }
.yt-facade__play::after {
  content: "";
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
}
.yt-facade__title {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: var(--space-5) var(--space-4) var(--space-3);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  line-height: 1.3;
}

/* ---------- Footer ------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: var(--space-8);
}
.site-footer__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.site-footer p { margin: 0; max-width: 70ch; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--link); }

/* ---------- Print -------------------------------------------------------- */
@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --text: #000;
    --text-muted: #333;
    --border: #999;
    --link: #000;
  }
  body { font-size: 11pt; line-height: 1.45; }
  .site-header, .toc, .theme-toggle, .skip-link, .back-to-toc { display: none !important; }
  .layout { display: block; padding: 0; max-width: none; }
  .page-hero { padding: 0 0 1em; border-bottom: 1px solid #000; }
  .article { max-width: none; }
  .article h2 { border-top: 1px solid #000; page-break-after: avoid; }
  .media-card { page-break-inside: avoid; }
  .media-card__preview { display: none; }
  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
    word-break: break-all;
  }
  .callout { background: transparent; border-left: 3px solid #000; }
}
