/* SharedKit.Web — shared stylesheet. No framework, no dependency on any one site.
   Everything is driven by tokens (CSS variables): a theme is a different set of values for
   the same names. A host site may override any token after loading this file. */

/* ---------- tokens ---------- */
:root {
  /* brand — the four values a theme changes */
  --ink: #0b1020;
  --primary: #2563eb;
  --accent: #7c3aed;
  --highlight: #22d3ee;

  /* surfaces — light */
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #5b6b82;
  --border: #e2e8f0;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lift: 0 2px 4px rgba(15, 23, 42, .08), 0 16px 36px rgba(15, 23, 42, .12);

  /* derived from the brand tokens, so they follow a theme automatically */
  --gradient: linear-gradient(90deg, var(--primary), var(--accent));
  --tint: color-mix(in srgb, var(--primary) 10%, var(--card));
  --tint-strong: color-mix(in srgb, var(--accent) 16%, var(--card));
  --icon-ink: color-mix(in srgb, var(--primary) 80%, var(--text));

  --radius: 16px;
  --radius-small: 10px;
  --container: 1200px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* dark surfaces: when the device asks for dark and the visitor has not chosen light… */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #0f172a;
    --surface-soft: #0b1220;
    --card: #162033;
    --text: #e2e8f0;
    --text-muted: #9fb0c8;
    --border: #25324a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 16px 36px rgba(0, 0, 0, .45);
    --icon-ink: color-mix(in srgb, var(--primary) 45%, #ffffff);
  }
}

/* …or when the visitor has chosen dark. (Same values; CSS cannot share the two rules.) */
:root[data-theme="dark"] {
  --surface: #0f172a;
  --surface-soft: #0b1220;
  --card: #162033;
  --text: #e2e8f0;
  --text-muted: #9fb0c8;
  --border: #25324a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 16px 36px rgba(0, 0, 0, .45);
  --icon-ink: color-mix(in srgb, var(--primary) 45%, #ffffff);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

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

/* ---------- layout helpers ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.container.narrow { max-width: 760px; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: #fff; color: #0b1020; padding: .5rem 1rem; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 1rem; }

.gradient-text {
  background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 45%, #fff), color-mix(in srgb, var(--highlight) 75%, #fff));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- aurora surface: soft coloured light over the dark ink colour ---------- */
.aurora {
  color: #fff;
  background:
    radial-gradient(60% 80% at 12% 8%, color-mix(in srgb, var(--accent) 60%, transparent), transparent 60%),
    radial-gradient(50% 70% at 88% 18%, color-mix(in srgb, var(--highlight) 38%, transparent), transparent 60%),
    radial-gradient(70% 90% at 60% 105%, color-mix(in srgb, var(--primary) 60%, transparent), transparent 60%),
    var(--ink);
}

/* ---------- icons ---------- */
.icon {
  width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.icon-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; border-radius: 12px; font-size: 1.125rem;
  background: linear-gradient(135deg, var(--tint), var(--tint-strong)); color: var(--icon-ink);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .5rem 1.25rem; border-radius: 999px;
  border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .9375rem;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-light { background: #fff; color: color-mix(in srgb, var(--primary) 85%, #000); }
.btn-ghost { background: rgba(255, 255, 255, .10); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-ghost:hover { background: rgba(255, 255, 255, .18); }
.btn-outline { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-small { min-height: 36px; padding: .25rem .875rem; font-size: .8125rem; }

.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; font-size: 1rem;
}
.icon-button:hover { background: rgba(255, 255, 255, .18); }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); min-width: 0;
  transition: transform .2s ease, box-shadow .2s ease;
}
a.card { display: block; text-decoration: none; color: inherit; }
.card-lift:hover, a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card-tint { background: linear-gradient(135deg, var(--tint), var(--tint-strong)); }
.card h3 { font-size: 1.0625rem; font-weight: 700; margin: .75rem 0 .25rem; }
.card p { color: var(--text-muted); font-size: .9375rem; }

/* ---------- small pieces ---------- */
.tag { display: inline-block; padding: .125rem .625rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.tag-ok { background: #dcfce7; color: #166534; }
.tag-warn { background: #fef3c7; color: #92400e; }
.tag-info { background: #e0f2fe; color: #075985; }
.tag-off { background: #e2e8f0; color: #475569; }

.pill-filter {
  min-height: 36px; padding: .25rem .875rem; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: .8125rem; font-weight: 700;
  background: var(--card); color: var(--text-muted); border: 1px solid var(--border);
}
.pill-filter.is-on { background: var(--gradient); color: #fff; border-color: transparent; }

.segment { display: flex; width: fit-content; padding: .25rem; background: var(--border); border-radius: 999px; }
.segment button {
  min-height: 40px; padding: .25rem 1.25rem; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: .9375rem; background: transparent; color: var(--text-muted);
}
.segment button.is-on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.search-box {
  display: flex; align-items: center; gap: .625rem; padding: .375rem .875rem;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.search-box .icon { color: var(--text-muted); }
.search-box input {
  flex: 1; min-width: 0; min-height: 44px; border: 0; outline: 0; background: transparent;
  font: inherit; color: inherit;
}

.accordion { background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin-bottom: .625rem; }
.accordion summary {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  min-height: 52px; padding: .75rem 1.25rem; cursor: pointer; font-weight: 700; list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: "+"; font-size: 1.375rem; font-weight: 400; color: var(--text-muted); }
.accordion[open] summary::after { content: "\2212"; }
.accordion > p, .accordion > div { padding: 0 1.25rem 1.125rem; color: var(--text-muted); }

.empty-state { text-align: center; padding: 2rem 1rem; color: var(--text-muted); }

mark { background: color-mix(in srgb, var(--highlight) 40%, transparent); color: inherit; border-radius: 3px; padding: 0 .1em; }

/* ---------- scroll reveal (only once the script has switched it on) ---------- */
.reveal-ready .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal-ready .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- responsive defaults ---------- */
@media (max-width: 1023px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 599px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .card { transition: none; }
  .btn:hover, .card-lift:hover, a.card:hover { transform: none; }
  .reveal-ready .reveal { opacity: 1; transform: none; transition: none; }
}
