/* TubToday shared component library — base layer (SHARED-05, master v3.0 E17 accessibility baseline).
 * Load order per page: ui/dist/<site>.css (tokens) → tt-base.css → tt-components.css → tt-components.js (defer).
 * Nothing here carries a brand: every color, font and size is a --tt-* token from the site's dist file. */

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

html {
  font-size: var(--tt-type-base, 112.5%);          /* 18 px reading text (E17); respects the visitor's own font-size setting */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
  scroll-padding-bottom: calc(var(--tt-size-bottombar, 64px) + 1rem);
}

body {
  margin: 0;
  font-family: var(--tt-font-body, system-ui, sans-serif);
  font-size: 1rem;
  line-height: var(--tt-line-height, 1.55);
  color: var(--tt-color-text, #1B1F23);
  background: var(--tt-color-surface, #FFFFFF);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;                           /* long labels and URLs reflow at 320 px instead of forcing horizontal scroll */
}

[hidden] { display: none !important; }

img, svg, video { max-width: 100%; height: auto; }
img { display: inline-block; }

h1, h2, h3, h4 { font-family: var(--tt-font-heading, inherit); line-height: 1.2; margin: 0 0 var(--tt-space-3, .75rem); text-wrap: balance; }
h1 { font-size: clamp(var(--tt-text-2xl, 1.728rem), 1.2rem + 2vw, var(--tt-text-3xl, 2.074rem)); }
h2 { font-size: var(--tt-text-xl, 1.44rem); }
h3 { font-size: var(--tt-text-lg, 1.2rem); }
p, ul, ol, dl { margin: 0 0 var(--tt-space-4, 1rem); }
small, .tt-small { font-size: var(--tt-text-sm, .9rem); }

a { color: var(--tt-color-link); text-decoration: underline; text-underline-offset: .15em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

/* One visible focus style everywhere: dark outer ring + light inner ring, so it reads on light and dark surfaces. */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--tt-color-focus, #1B1F23);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--tt-color-focus-inner, #FFFFFF);
}
.tt-focus-target:focus { outline: 3px solid var(--tt-color-focus, #1B1F23); outline-offset: 2px; } /* programmatic focus on summaries/dialog titles */

button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }
input, select, textarea { max-width: 100%; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--tt-space-4, 1rem); min-width: 0; }
legend { padding: 0; font-weight: 600; margin-bottom: var(--tt-space-2, .5rem); }
textarea { resize: vertical; }

table { border-collapse: collapse; }
th { text-align: left; }

/* Layout primitives */
.tt-container { width: 100%; max-width: var(--tt-size-content, 72rem); margin-inline: auto; padding-inline: var(--tt-space-4, 1rem); }
.tt-section { padding-block: var(--tt-space-6, 2rem); }
.tt-section--alt { background: var(--tt-color-surface-alt); }
.tt-prose { max-width: var(--tt-measure, 70ch); }
.tt-stack > * + * { margin-top: var(--tt-space-4, 1rem); }
.tt-cluster { display: flex; flex-wrap: wrap; gap: var(--tt-space-3, .75rem); align-items: center; }

/* Visually hidden but available to assistive technology */
.tt-vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Skip link: first focusable element on every page */
.tt-skip { position: absolute; left: -999px; top: 0; z-index: 1000; padding: var(--tt-space-3, .75rem) var(--tt-space-4, 1rem); background: var(--tt-color-surface); color: var(--tt-color-text); font-weight: 600; border: 2px solid var(--tt-color-text); border-radius: var(--tt-radius-md); }
.tt-skip:focus { left: var(--tt-space-4, 1rem); top: var(--tt-space-4, 1rem); }

/* Progressive enhancement switches: tt-components.js adds .tt-js to <html> */
html:not(.tt-js) .tt-js-only { display: none !important; }
html.tt-js .tt-nojs-only { display: none !important; }

/* Motion: every animation/transition collapses when the visitor asks for reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  html { scroll-behavior: auto; }
}

/* Print: the telephone/printable alternative (E17). Chrome and bars go away, link targets print. */
@media print {
  .tt-skip, .tt-nav__toggle, .tt-bottombar, .tt-btn--print-hide, dialog { display: none !important; }
  body { padding-bottom: 0 !important; color: #000; background: #fff; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
  .tt-print-only { display: block !important; }
}
.tt-print-only { display: none; }
