/* Optional component refinements intentionally kept separate for maintainability. */
.page-intro::after { content: ""; display: block; width: 100%; height: 1px; margin-top: 46px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.media-card, .list-card, .curated-block, .quiet-banner, .focus-panel, .image-note, .brand-strip { contain: layout paint; }
.media-card a, .compact-row a, .list-card a, .site-footer a { transition: color .18s ease, border-color .18s ease, background .18s ease; }
.search-panel { box-shadow: 0 24px 50px rgba(0,0,0,.24); }
.detail-copy .breadcrumbs { margin-bottom: 10px; }
.faq-list details[open] { border-color: rgba(245,158,11,.32); background: rgba(245,158,11,.035); }
@supports (text-wrap: balance) {
  .hero-copy h1, .page-intro h1, .section-heading h2, .split-copy h2, .brand-strip h2, .curated-copy h2, .detail-copy h1 { text-wrap: balance; }
}
@supports not (backdrop-filter: blur(1px)) {
  .site-header.scrolled, .media-badge { background: #07101e; }
}
@media print {
  .site-header, .site-footer, .button-row, .filter-bar, .search-panel, .search-toggle, .menu-button { display: none !important; }
  body { background: #fff; color: #111; }
  .media-card, .curated-block, .list-card, .detail-body aside { break-inside: avoid; border-color: #bbb; background: #fff; }
  a { color: #111; text-decoration: underline; }
}

/* Dense media layouts */
.media-grid > div { min-width: 0; }
.media-card .media-copy { min-height: 220px; display: flex; flex-direction: column; }
.media-card .media-actions { margin-top: auto; padding-top: 18px; }
.media-card .text-link { display: inline-flex; align-items: center; gap: 8px; }
.media-card .text-link::after { content: "→"; text-decoration: none; }
.media-card:focus-within { border-color: rgba(245,158,11,.48); box-shadow: 0 0 0 3px rgba(245,158,11,.08); }

/* Headings and rhythm */
.section-heading > div { min-width: 0; }
.section-heading h2 { max-width: 900px; }
.page-intro > .eyebrow + h1 { margin-top: 12px; }
.page-intro .breadcrumbs + .eyebrow { margin-top: 4px; }
.chapter + .chapter { border-top-color: rgba(245,158,11,.14); }
.chapter:nth-of-type(even) .chapter-head > span { background: rgba(148,163,184,.08); border-color: var(--line-strong); color: #cbd5e1; }

/* Long form content */
.detail-body article p + p { margin-top: 1.3em; }
.detail-body article p { text-wrap: pretty; }
.detail-body article h2 { scroll-margin-top: 110px; }
.detail-body aside a::after { content: "↗"; float: right; color: #64748b; }
.highlight-box strong { color: #f8fafc; letter-spacing: .04em; }

/* Search usability */
.search-page-form .search-box input::placeholder,
.search-form .search-box input::placeholder { color: #64748b; opacity: 1; }
.search-box button:active { transform: translateY(1px); }
.empty-state .tag-row { margin-top: 22px; }
.empty-state .tag-row a { background: var(--panel); }

/* Navigation details */
.primary-nav a[aria-current="page"] { box-shadow: inset 0 0 0 1px rgba(245,158,11,.13); }
.site-header:not(.scrolled) .primary-nav a { text-shadow: 0 1px 12px rgba(0,0,0,.32); }
.search-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.menu-button[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-button[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-button[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.menu-button span { transition: transform .18s ease, opacity .18s ease; }

/* Footer robustness */
.footer-brand { max-width: 560px; }
.footer-bottom span:last-child { font-variant-numeric: tabular-nums; }
.site-footer a:focus-visible { border-radius: 4px; }

/* Details element */
.faq-list details { transition: border-color .18s ease, background .18s ease; }
.faq-list summary:hover { background: rgba(255,255,255,.018); }
.faq-list details[open] summary { color: #f8fafc; }
.faq-list details[open] p { animation: faqFade .18s ease-out; }
@keyframes faqFade { from { opacity: .3; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* Visual balance for image panels */
.split-visual, .quiet-banner, .focus-panel, .image-note { position: relative; }
.split-visual::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, transparent 65%, rgba(15,23,42,.18)); }
.quiet-banner > img, .focus-panel > img, .image-note > img { filter: saturate(.92) contrast(1.02); }
.hero-visual img, .detail-poster img, .brand-story img { background: linear-gradient(145deg, #172033, #0F172A); }

/* Fine grained responsive adaptations */
@media (min-width: 1260px) {
  .media-grid { gap: 24px; }
  .media-copy { padding: 22px; }
  .hero-section { gap: 68px; }
  .page-intro { padding-top: 86px; }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .header-inner { width: min(calc(100% - 32px), var(--container)); }
  .section-heading { margin-bottom: 26px; }
  .media-copy h3 { font-size: 19px; }
  .detail-copy h1 { font-size: clamp(42px,6vw,64px); }
}

@media (max-width: 900px) {
  .brand-strip { gap: 24px; }
  .brand-strip .button { justify-self: start; }
  .curated-items .compact-row { padding-block: 20px; }
  .detail-body { padding-top: 42px; }
  .faq-section { padding-bottom: 84px; }
}

@media (max-width: 620px) {
  .hero-lead, .page-intro > p, .detail-summary { font-size: 16px; }
  .hero-visual { min-height: 420px; }
  .hero-caption small { line-height: 1.55; }
  .media-copy { min-height: 0; }
  .section-heading h2, .split-copy h2, .brand-strip h2, .focus-panel h2, .image-note h2, .chapter-head h2, .brand-story h2, .faq-section h2 { font-size: 30px; }
  .compact-row h3 { font-size: 19px; }
  .compact-row p { font-size: 13px; line-height: 1.7; }
  .list-card { padding: 22px; }
  .list-card h3 { font-size: 21px; }
  .page-intro::after { margin-top: 32px; }
  .detail-body article p { font-size: 16px; line-height: 1.85; }
  .detail-body article h2 { font-size: 26px; }
  .footer-grid { padding-block: 42px; }
}

@media (max-width: 390px) {
  .container { width: min(calc(100% - 22px), var(--container)); }
  .brand strong { font-size: 15px; }
  .hero-copy h1, .page-intro h1, .detail-copy h1, .error-panel h1 { font-size: 36px; }
  .hero-visual { min-height: 390px; }
  .hero-caption strong { font-size: 24px; }
  .media-copy { padding: 18px; }
  .filter-bar button { padding: 8px 11px; font-size: 13px; }
  .quiet-banner > div, .focus-panel > div, .image-note > div { padding: 24px 20px; }
  .chapter { padding-block: 44px; }
  .chapter-head { grid-template-columns: 42px 1fr; }
  .chapter-head > span { width: 38px; height: 38px; font-size: 12px; }
}

@media (hover: none) {
  .media-card:hover .poster-link img { transform: none; }
  .button:hover { transform: none; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(226,232,240,.42); --line-strong: rgba(226,232,240,.62); --muted: #b8c4d4; }
  .button.ghost, .filter-bar button, .tag-row a { border-width: 2px; }
  .media-badge { background: #020617; }
}

/* Additional layout safeguards for real-world content variation */
.media-copy h3, .compact-row h3, .list-card h3, .curated-copy h2 { overflow-wrap: anywhere; }
.media-copy p, .compact-row p, .brand-strip p, .page-intro p { text-wrap: pretty; }
.poster-link::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; box-shadow: inset 0 -70px 90px rgba(2,6,23,.08); }
.media-badge { z-index: 2; }
.media-card .media-meta span:last-child { font-variant-numeric: tabular-nums; }
.hero-caption, .media-badge { pointer-events: none; }

/* Better long title behavior */
.hero-copy h1, .page-intro h1, .detail-copy h1 { hyphens: auto; overflow-wrap: break-word; }
.brand-strip > div, .split-copy, .curated-copy, .detail-copy { min-width: 0; }
.compact-row > div { min-width: 0; }
.chapter-head > div { min-width: 0; }

/* Touch target sizing */
.primary-nav a, .footer-grid a, .tag-row a, .text-link, .arrow-link { min-height: 36px; }
.primary-nav a, .tag-row a { display: inline-flex; align-items: center; }
.footer-grid a { display: inline-flex; align-items: center; }
.arrow-link { min-width: 38px; align-items: center; justify-content: center; }

/* Loading image behavior */
img[loading="lazy"] { content-visibility: auto; }
.poster-link img, .detail-poster img, .hero-visual img { object-position: center; }

/* Search panel focus context */
.search-open .site-main { filter: none; }
.search-panel form:focus-within label { color: #dbeafe; }
.search-panel .search-box { max-width: 880px; }
.search-page-form .search-box { width: 100%; }

/* Card emphasis without fake metrics */
.media-card:nth-child(4n+1) .media-badge { border-color: rgba(245,158,11,.35); }
.list-card:nth-child(2n) { background: linear-gradient(145deg, rgba(23,32,51,.72), rgba(15,23,42,.86)); }
.curated-block:nth-child(2n) { background: linear-gradient(155deg, rgba(23,32,51,.58), rgba(15,23,42,.85)); }

/* Breadcrumb resiliency */
.breadcrumbs { overflow-x: auto; scrollbar-width: none; }
.breadcrumbs::-webkit-scrollbar { display: none; }
.breadcrumbs ol { min-width: max-content; }
.breadcrumbs a { color: #a8b4c5; }
.breadcrumbs span[aria-current="page"] { color: #64748b; }

/* Structured content spacing */
.brand-story-copy > *:first-child, .split-copy > *:first-child, .focus-panel > div > *:first-child, .image-note > div > *:first-child { margin-top: 0; }
.brand-story-copy > *:last-child, .split-copy > *:last-child, .focus-panel > div > *:last-child, .image-note > div > *:last-child { margin-bottom: 0; }
.detail-facts div { min-width: 0; }
.detail-facts dd { overflow-wrap: anywhere; }

/* Wide screen reading comfort */
@media (min-width: 1500px) {
  :root { --container: 1320px; }
  .hero-section { grid-template-columns: minmax(0,.9fr) minmax(520px,1.1fr); }
  .hero-lead { max-width: 720px; }
  .media-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .detail-body article { max-width: 880px; }
}

/* Landscape tablet tuning */
@media (min-width: 820px) and (max-width: 1024px) and (orientation: landscape) {
  .hero-section { grid-template-columns: .9fr 1.1fr; gap: 30px; }
  .hero-visual { min-height: 470px; }
  .hero-copy h1 { font-size: 52px; }
  .hero-lead { font-size: 17px; }
  .detail-hero { align-items: start; }
}

/* Small landscape screens */
@media (max-height: 520px) and (orientation: landscape) {
  .site-header { position: relative; }
  .hero-section { min-height: 0; padding-block: 34px; }
  .hero-visual { min-height: 340px; }
  .primary-nav { top: 10px; }
}

/* Safe area support */
@supports (padding: max(0px)) {
  .site-header .header-inner { padding-left: max(0px, env(safe-area-inset-left)); padding-right: max(0px, env(safe-area-inset-right)); }
  .site-footer .footer-bottom { padding-bottom: max(0px, env(safe-area-inset-bottom)); }
}

/* Forced colors accessibility */
@media (forced-colors: active) {
  .button, .filter-bar button, .tag-row a, .media-card, .list-card, .curated-block, .faq-list details { border: 1px solid CanvasText; }
  .eyebrow, .text-link, .arrow-link { color: LinkText; }
  .media-badge { background: Canvas; color: CanvasText; }
  .hero-points span::before { background: Highlight; box-shadow: none; }
}
