/* ============================================================
   FAZ OSC — Base: reset, document defaults, typography utilities
   Depends on tokens.css
   ============================================================ */

/* ---- Scope ----
   OSC pages will live inside the F.A.Z. header/footer template (added by the
   backend), whose own CSS styles <body>, links and headings.
   So our element-level defaults apply only inside .osc — never to the
   template's header/footer. Pages put .osc on <body>; when the backend
   adds the template, it wraps our <main> content (and the modals/toasts)
   in .osc instead. */

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }

.osc, .osc *, .osc *::before, .osc *::after { box-sizing: border-box; }

.osc {
  background: var(--c-bg);
  color: var(--c-text);
  font: var(--t-body-2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.osc :is(img, svg, video) { max-width: 100%; display: block; }

/* Figma "Meta 2 Link": same colour as the surrounding text, underlined */
.osc a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.osc a:hover { opacity: .7; }

/* Visible keyboard focus everywhere in OSC content (accessibility / BFSG) */
.osc :focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.osc :focus:not(:focus-visible) { outline: none; }

.osc :is(h1, h2, h3, h4, p) { margin: 0; }

/* [hidden] must win over components that set their own display (flex, grid …) */
.osc [hidden] { display: none !important; }

/* Content area inside the F.A.Z. template: the template's content column is
   1000px wide with no side padding, so add the 20px mobile margin until the
   viewport is wide enough (1000 + 2×20). */
.osc-page { padding-inline: 20px; }
@media (min-width: 1040px) {
  .osc-page { padding-inline: 0; }
}

/* ---- Typographic scale (utility classes map 1:1 to Figma ramp) ----
   Figma Typo page: headlines, subheads, body and intro are all
   "Farbe: MG-Dark" (--c-text), not FAZ-Darkblue. */
.t-headline-1 { font: var(--t-headline-1); color: var(--c-text); text-wrap: balance; letter-spacing: -.01em; }
.t-headline-2 { font: var(--t-headline-2); color: var(--c-text); text-wrap: balance; }
.t-headline-2-m { font: var(--t-headline-2-m); color: var(--c-text); text-wrap: balance; }
.t-headline-3 { font: var(--t-headline-3); color: var(--c-text); }
.t-subhead-1  { font: var(--t-subhead-1); }
.t-subhead-1-m { font: var(--t-subhead-1-m); }
.t-subhead-2  { font: var(--t-subhead-2); }
.t-subhead-3  { font: var(--t-subhead-3); }
.t-subhead-3-m { font: var(--t-subhead-3-m); }
.t-intro      { font: var(--t-intro); color: var(--c-text); }
.t-intro-m    { font: var(--t-intro-m); color: var(--c-text); }
.t-body-1     { font: var(--t-body-1); color: var(--c-text); max-width: var(--measure); }
.t-body-1-m   { font: var(--t-body-1-m); color: var(--c-text); max-width: var(--measure); }
.t-body-2     { font: var(--t-body-2); color: var(--c-text); max-width: var(--measure); }
.t-body-2-m   { font: var(--t-body-2-m); color: var(--c-text); max-width: var(--measure); }
.t-teaser-2   { font: var(--t-teaser-2); color: var(--c-text); }
.t-menu-item  { font: var(--t-menu-item); letter-spacing: .1px; }
.t-meta-0     { font: var(--t-meta-0); color: var(--c-text-muted); }
.t-meta-1     { font: var(--t-meta-1); color: var(--c-text-muted); }
.t-meta-1-5   { font: var(--t-meta-1-5); color: var(--c-text-muted); }
.t-meta-2     { font: var(--t-meta-2); color: var(--c-text-muted); }
.t-meta-2-link { font: var(--t-meta-2); text-decoration: underline; text-underline-offset: 2px; }
.t-meta-3     { font: var(--t-meta-3); color: var(--c-text-subtle); }
.t-overline-2-m { font: var(--t-overline-2-m); letter-spacing: .5px; }
/* Overline 3 — 13px, +0.2px tracking, sentence case (Figma has no caps/gold variant) */
.t-overline   { font: var(--t-overline); letter-spacing: .2px; color: var(--c-text-muted); }

.text-muted  { color: var(--c-text-muted); }
.text-subtle { color: var(--c-text-subtle); }
.tabular     { font-variant-numeric: tabular-nums; }

/* ---- Responsive type roles ----
   Each Figma style with an "M" companion switches to the M cut at 812px
   (Figma Typo page: "Mobile 0–811px" / "Desktop 812px+"). Use these -r
   classes for content that should scale; the plain classes stay fixed. */
.t-headline-2-r { font: var(--t-headline-2); color: var(--c-text); text-wrap: balance; }
.t-subhead-1-r  { font: var(--t-subhead-1); }
.t-subhead-3-r  { font: var(--t-subhead-3); }
.t-intro-r      { font: var(--t-intro); color: var(--c-text); }
.t-body-1-r     { font: var(--t-body-1); color: var(--c-text); max-width: var(--measure); }
@media (min-width: 812px) {
  .t-headline-2-r { font: var(--t-headline-2-m); }
  .t-subhead-1-r  { font: var(--t-subhead-1-m); }
  .t-subhead-3-r  { font: var(--t-subhead-3-m); }
  .t-intro-r      { font: var(--t-intro-m); }
  .t-body-1-r     { font: var(--t-body-1-m); }
}

/* ---- Layout helpers ---- */
/* Margins: 20px mobile, official 40px raster margin from tablet up */
.container { max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
@media (min-width: 768px) {
  .container { padding-inline: var(--grid-margin); }
}

/* FAZ Raster: 12 Spalten / 28px Gutter (Teaser-Sammelseiten).
   Single column on mobile; place items with .col-span-* from tablet up. */
.grid-12 { display: grid; grid-template-columns: 1fr; gap: var(--s-4) var(--grid-gutter); }
@media (min-width: 768px) {
  .grid-12 { grid-template-columns: repeat(12, 1fr); }
  .col-span-3  { grid-column: span 3; }
  .col-span-4  { grid-column: span 4; }
  .col-span-6  { grid-column: span 6; }
  .col-span-8  { grid-column: span 8; }
  .col-span-12 { grid-column: span 12; }
}
.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
/* Inside .osc the heading/paragraph reset (.osc :is(h1…p), 0,1,1) would otherwise win over the stack spacing */
.osc .stack > * + * { margin-top: var(--s-4); }
.osc .stack-sm > * + * { margin-top: var(--s-2); }
.row { display: flex; gap: var(--s-3); align-items: center; }
.row-wrap { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: var(--s-4); }

/* !important: a component class on the same element (e.g. .osc-app__heading with width: 100%)
   must not make the hidden text take space again */
.visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
  .osc, .osc *, .osc *::before, .osc *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* Page change between OSC pages: short crossfade instead of a hard cut (cross-document
   View Transitions; Chrome/Edge 126+, Safari 18.2+, other browsers navigate as before).
   Both pages need this rule, so it only applies between pages that load base.css.
   The whole page fades as one: a named menu would slide into place when the old page
   was scrolled, because the new page starts at the top. */
@view-transition { navigation: auto; }
::view-transition-group(root) { animation-duration: .2s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
