:root {
  --ink: #0a1020;
  --ink-soft: #526078;
  --night: #050914;
  --line: #d8e0ec;
  --surface: #f4f7fb;
  --accent: #0078d4;
  --accent-2: #4cc2ff;
  --display: Bahnschrift, "Segoe UI Variable Display", "Segoe UI", Arial, sans-serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
body[data-category="automations"] { --accent: #5b5fc7; --accent-2: #a37beb; }
body[data-category="issues"] { --accent: #e64a19; --accent-2: #ff9b4a; }
body[data-category="diagnostics"] { --accent: #00a8c6; --accent-2: #42c78a; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.7rem 1rem;
  color: #fff;
  background: var(--accent);
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.resource-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0 clamp(1.25rem, 4vw, 4rem);
  background: rgba(5, 9, 20, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; width: 182px; }
.brand img { display: block; width: 100%; height: auto; }
.languages { display: flex; gap: 0.15rem; padding: 3px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px; }
.languages button {
  display: grid;
  min-width: 38px;
  min-height: 34px;
  padding: 0;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 3px;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: 1.15rem;
  cursor: pointer;
  opacity: 0.82;
  transition: opacity 150ms ease, background 150ms ease, transform 150ms ease;
}
.languages button:hover { opacity: 1; transform: translateY(-1px); }
.languages button.active { background: rgba(255, 255, 255, 0.12); opacity: 1; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.flag {
  display: block;
  width: 23px;
  height: 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
}
.flag-it { background: linear-gradient(90deg, #009246 0 33.333%, #fff 33.333% 66.666%, #ce2b37 66.666%); }
.flag-de { background: linear-gradient(#151515 0 33.333%, #dd0000 33.333% 66.666%, #ffce00 66.666%); }
.flag-gb {
  background: #012169 url("/brand/flag-gb.svg") center / cover no-repeat;
}

.resource-hero {
  position: relative;
  display: grid;
  min-height: 520px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 76% 32%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 28%),
    radial-gradient(circle at 88% 70%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 27%),
    linear-gradient(rgba(83, 118, 169, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 118, 169, 0.12) 1px, transparent 1px),
    var(--night);
  background-size: auto, auto, 70px 70px, 70px 70px, auto;
}
.hero-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(290px, 0.55fr);
  gap: clamp(3rem, 9vw, 10rem);
  width: min(1440px, 100%);
  margin: auto;
  padding: clamp(4rem, 8vw, 7rem) clamp(1.25rem, 5vw, 5rem);
}
.back-link { display: inline-flex; width: fit-content; align-items: center; gap: 0.6rem; margin-bottom: 3.5rem; color: rgba(255, 255, 255, 0.66); font-size: 0.76rem; font-weight: 750; }
.back-link:hover { color: #fff; }
.category-label { margin: 0 0 1rem; color: var(--accent-2); font-family: var(--mono); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.resource-hero h1 { max-width: 850px; margin: 0; font-family: var(--display); font-size: clamp(4rem, 8vw, 8.7rem); font-weight: 620; letter-spacing: -0.075em; line-height: 0.86; }
.hero-intro { max-width: 760px; margin: 2rem 0 0; color: rgba(255, 255, 255, 0.66); font-size: clamp(1rem, 1.35vw, 1.25rem); line-height: 1.6; }
.hero-status {
  align-self: end;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  backdrop-filter: blur(14px);
}
.status-light { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--accent-2); font-family: var(--mono); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.status-light::before { width: 0.55rem; height: 0.55rem; background: var(--accent-2); border-radius: 50%; box-shadow: 0 0 18px var(--accent-2); content: ""; }
.hero-status strong { display: block; margin-top: 1.35rem; font-family: var(--display); font-size: 2.8rem; font-weight: 620; letter-spacing: -0.05em; }
.hero-status p { margin: 0.45rem 0 0; color: rgba(255, 255, 255, 0.6); font-size: 0.84rem; line-height: 1.5; }
body[data-category="sops"] .hero-status { align-self: end; }
body[data-category="sops"] .hero-status strong { margin-bottom: 0; }

.library {
  padding: clamp(4rem, 8vw, 8rem) clamp(1.25rem, 5vw, 5rem);
  background:
    linear-gradient(rgba(61, 87, 132, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 87, 132, 0.055) 1px, transparent 1px),
    var(--surface);
  background-size: 70px 70px;
}
body[data-category="sops"] .library { padding-top: clamp(2.5rem, 5vw, 5rem); }
.library-shell { width: min(1440px, 100%); margin: 0 auto; }
.library-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr); gap: 3rem; align-items: end; margin-bottom: 3rem; }
.library-heading h2 { max-width: 800px; margin: 0; font-family: var(--display); font-size: clamp(2.8rem, 5.5vw, 6rem); font-weight: 620; letter-spacing: -0.065em; line-height: 0.92; }
.library-heading p { margin: 0; color: var(--ink-soft); font-size: 0.96rem; line-height: 1.65; }
.resource-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.resource-card {
  position: relative;
  display: flex;
  min-height: 310px;
  flex-direction: column;
  padding: 1.6rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(28, 44, 75, 0.06);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.resource-card[hidden], .resource-details[hidden] { display: none; }
.resource-card::before { position: absolute; top: 0; right: 0; left: 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); content: ""; }
.resource-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 24px 55px rgba(28, 44, 75, 0.12); transform: translateY(-5px); }
.resource-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--accent); font-family: var(--mono); font-size: 0.59rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.resource-card h3 { margin: 2.2rem 0 0.85rem; font-family: var(--display); font-size: clamp(1.65rem, 2.3vw, 2.45rem); font-weight: 620; letter-spacing: -0.05em; line-height: 1; }
.resource-card > p { margin: 0; color: var(--ink-soft); font-size: 0.84rem; line-height: 1.58; }
.resource-footer { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: 1.6rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tags span { padding: 0.32rem 0.42rem; color: #536076; background: #f2f5f9; border: 1px solid #dce3ed; border-radius: 3px; font-family: var(--mono); font-size: 0.52rem; }
.read-action { color: var(--accent); font-size: 1.15rem; font-weight: 800; transition: transform 150ms ease; }
.resource-card:hover .read-action { transform: translate(2px, -2px); }

body[data-category="sops"] .resource-card { cursor: pointer; }
body[data-category="sops"] .resource-card.is-expanded {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 24px 55px rgba(28, 44, 75, 0.12);
  transform: translateY(-2px);
}
.resource-toggle {
  display: grid;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.resource-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; }
.resource-details {
  min-height: 4.5rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.resource-preview-label,
.resource-references-label {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.resource-preview-copy { margin: 0.55rem 0 1rem; color: var(--ink-soft); font-size: 0.8rem; line-height: 1.55; }
.resource-full-link {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent-2) 72%, var(--accent)));
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 20%, transparent);
}
.resource-full-link::after { content: "↗"; flex: 0 0 auto; }
.resource-full-link:hover { filter: brightness(1.06); transform: translateY(-1px); }
.resource-references-label { margin-bottom: 0.6rem; color: var(--ink-soft); }
.resource-links { display: grid; gap: 0.55rem; }
.resource-links a {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}
.resource-links a::after { content: "↗"; flex: 0 0 auto; }
.resource-links a:hover { background: color-mix(in srgb, var(--accent) 13%, #fff); }

.team-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.5fr);
  gap: clamp(2rem, 8vw, 8rem);
  align-items: center;
  padding: clamp(4rem, 7vw, 7rem) clamp(1.25rem, 5vw, 5rem);
  color: #fff;
  background: var(--night);
  border-top: 3px solid var(--accent);
}
.team-callout > div { max-width: 820px; }
.team-callout h2 { margin: 0; font-family: var(--display); font-size: clamp(2.7rem, 5vw, 5.8rem); font-weight: 620; letter-spacing: -0.06em; line-height: 0.94; }
.team-callout p { margin: 1.4rem 0 0; color: rgba(255, 255, 255, 0.64); line-height: 1.65; }
.team-callout a { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1.1rem 1.25rem; color: var(--ink); background: #fff; border-radius: 5px; font-size: 0.78rem; font-weight: 800; transition: color 150ms ease, background 150ms ease, transform 150ms ease; }
.team-callout a:hover { color: #fff; background: var(--accent); transform: translateY(-2px); }
.resource-footerbar { display: flex; justify-content: space-between; gap: 2rem; padding: 1.2rem clamp(1.25rem, 5vw, 5rem); color: rgba(255, 255, 255, 0.45); background: var(--night); border-top: 1px solid rgba(255, 255, 255, 0.1); font-family: var(--mono); font-size: 0.58rem; }

@media (max-width: 1050px) {
  .hero-shell, .library-heading, .team-callout { grid-template-columns: 1fr; }
  .hero-status { max-width: 420px; }
  .resource-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .resource-header { min-height: 68px; padding: 0 1rem; }
  .brand { width: 145px; }
  .resource-hero { min-height: 570px; }
  .hero-shell { gap: 2.5rem; padding: 3rem 1.25rem; }
  .back-link { margin-bottom: 2.7rem; }
  .resource-hero h1 { font-size: clamp(3.6rem, 17vw, 5.7rem); }
  .library { padding: 4rem 1.25rem; }
  .resource-list { grid-template-columns: 1fr; }
  .resource-card { min-height: 285px; }
  .team-callout { padding: 4rem 1.25rem; }
  .resource-footerbar { flex-direction: column; gap: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
