/* DM Sans (SIL Open Font License), self-hosted so no visitor data goes to a font service */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  /* ICO Isle of Man brand */
  --brand-purple: #6e42a3;
  --brand-gold: #c8a72b;
  --brand-green: #619585;
  --brand-teal: #1f8abe;
  --brand-gradient: linear-gradient(90deg, #7b4db3 0%, #c8a72b 50%, #1f8abe 100%);
  --brand-red: #e30613;

  --page: #f6f6f4;
  --page-shade: #eeeeea;
  --page-shade-2: #ebebe6;
  --surface: #ffffff;
  --surface-2: #f1eff5;
  --text-primary: #1d1a24;
  --text-secondary: #4f4b57;
  --text-muted: #85818c;
  --grid: #e6e4e9;
  --axis: #c9c5cf;
  --border: rgba(29, 26, 36, 0.08);
  --series-1: #6e42a3;
  --series-1-track: #e4dcef;
  --series-2: #1f8abe;
  --good: #2f7a5f;
  --critical: #c0392b;
  --focus: #6e42a3;
  --shadow: 0 1px 2px rgba(29, 26, 36, 0.04), 0 8px 24px rgba(29, 26, 36, 0.05);
  --radius: 16px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-purple); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Masthead */
.masthead { padding-top: 24px; position: relative; overflow: hidden; }
/* Soft curved panels echoing the ICO slide template */
.masthead::before, .masthead::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; background: var(--page-shade); pointer-events: none; }
.masthead::before { width: 760px; height: 760px; right: -260px; top: -520px; }
.masthead::after { width: 520px; height: 520px; right: 160px; bottom: -430px; background: var(--page-shade-2); }
.masthead > * { position: relative; }
.brand-bar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand-bar img { display: block; height: auto; }
.logo-ico { width: 120px; }
.logo-ocsia { width: 116px; }
.brand-divider { width: 1px; align-self: stretch; background: var(--axis); }
.brand-partnership { margin: 0 0 0 auto; font-size: 13px; color: var(--text-secondary); text-align: right; flex: 1 1 320px; }
.masthead-inner { padding-top: 28px; padding-bottom: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--brand-purple); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
h1 {
  margin: 0; font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.02em; font-weight: 700;
  background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
  width: fit-content; max-width: 100%;
}
.rule { display: block; width: 160px; height: 3px; border-radius: 3px; background: var(--brand-gradient); margin: 16px 0 0; }
.lede { margin: 16px 0 0; max-width: 70ch; color: var(--text-secondary); font-size: 16px; }

.section-nav-wrap {
  position: sticky; top: 0; z-index: 5;
  background: var(--page);
  border-bottom: 1px solid var(--border);
}
.section-nav {
  display: flex; gap: 4px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; scrollbar-width: none;
}
.section-nav a {
  color: var(--text-secondary); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.section-nav a:hover { background: var(--page-shade); color: var(--brand-purple); }
.section-nav a[aria-current] { color: var(--brand-purple); font-weight: 600; background: var(--surface-2); }

/* Sections */
.section { padding-top: 40px; }
h2 { font-size: 24px; margin: 0 0 18px; letter-spacing: -0.01em; color: var(--brand-purple); font-weight: 700; }
h2::after { content: ""; display: block; width: 56px; height: 3px; border-radius: 3px; background: var(--brand-purple); margin-top: 8px; }
.h2-sub { color: var(--text-muted); font-weight: 500; font-size: 16px; }
h3 { font-size: 15px; margin: 0; font-weight: 700; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.card-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-dept { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* Overview */
.overview { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 16px; }
.hero { display: flex; flex-direction: column; }
.hero-value { color: var(--brand-purple); margin: 6px 0 0; font-size: clamp(48px, 7vw, 64px); font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.hero-spark { margin-top: auto; padding-top: 16px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.span-all { grid-column: 1 / -1; }
.tile-label { margin: 0; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.tile-value { margin: 4px 0 0; font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.tile-sub { margin: 6px 0 0; font-size: 13px; color: var(--text-secondary); }
.tile-avg { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--critical); }
.delta.neutral { color: var(--text-primary); }
.meter { margin-top: 12px; height: 6px; border-radius: 999px; background: var(--series-1-track); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--series-1); }

/* Controls */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
input[type="search"], select {
  font: inherit; font-size: 14px; color: var(--text-primary);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 12px; min-width: 0;
}
input[type="search"] { width: 240px; max-width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; user-select: none; }
.check input { accent-color: var(--series-1); margin: 0; }
.card > .check { margin-bottom: 4px; }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  background: transparent; border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
.segmented button:hover { color: var(--text-primary); }
.segmented button[aria-pressed="true"] { background: var(--brand-purple); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.ghost-btn {
  font: inherit; font-size: 12px; font-weight: 500; color: var(--text-secondary);
  background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; cursor: pointer; flex-shrink: 0;
}
.ghost-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.ghost-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text-primary); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: var(--font); }
.axis-label { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.value-label { fill: var(--text-primary); font-size: 12px; font-weight: 600; }
.note-label { fill: var(--text-secondary); font-size: 11px; }
.gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.crosshair { stroke: var(--axis); stroke-width: 1; pointer-events: none; }
.hit { fill: transparent; cursor: default; outline: none; }
.hit:focus-visible { stroke: var(--focus); stroke-width: 2; }
.mark { transition: opacity 120ms ease; }
.chart.is-hovering .mark:not(.is-active) { opacity: 0.55; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-secondary); margin: 2px 0 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.key-rect { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.key-line { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }

/* Bar lists */
.bar-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.bar-row {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 2.5rem; align-items: center; gap: 12px;
  width: 100%; padding: 5px 8px; margin: 0 -8px; width: calc(100% + 16px);
  font: inherit; font-size: 13px; text-align: left; color: var(--text-primary);
  background: transparent; border: 0; border-radius: 8px; cursor: pointer;
}
.bar-row:hover { background: var(--page); }
.bar-row[aria-pressed="true"] { background: var(--surface-2); }
.bar-row.is-linked { background: var(--surface-2); }
.bar-row.is-static { cursor: default; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.bar-row[aria-pressed="true"] .bar-name, .bar-row.is-linked .bar-name { color: var(--text-primary); font-weight: 600; }
.bar-tag { margin-left: 6px; font-size: 11px; color: var(--text-muted); font-weight: 500; }
.bar-track { height: 14px; position: relative; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; min-width: 2px; transition: width 300ms ease; }
.bar-fill.zero { min-width: 0; }
.bar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { color: var(--text-muted); font-size: 13px; padding: 12px 0; }

/* Profile */
.profile { position: sticky; top: 16px; }
.profile h3 { font-size: 17px; line-height: 1.3; margin-top: 2px; }
.profile-kicker { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-top: 16px; }
.profile-stat .tile-value { font-size: 26px; }
.profile-text { margin: 16px 0 0; font-size: 13px; color: var(--text-secondary); }

/* Tables */
.table-view { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--grid); text-align: left; }
th { color: var(--text-secondary); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 600; border-bottom: 0; }

.reasons { margin: 12px 0 0; border-top: 1px solid var(--grid); padding-top: 12px; font-size: 13px; }
.reasons a { font-weight: 600; }
.footnote { margin: 12px 0 0; font-size: 12px; color: var(--text-muted); }

/* Notes */
.notes ul { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 14px; }
.notes li + li { margin-top: 8px; }

/* Downloads */
.downloads-intro { margin: 0 0 16px; color: var(--text-secondary); font-size: 14px; max-width: 70ch; }
.download-all { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.download-all { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.download-name { margin: 0; font-weight: 600; font-size: 14px; }
.download-desc { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }
.download-btn {
  flex-shrink: 0; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--brand-purple); background: var(--surface); border: 1px solid var(--series-1-track); border-radius: 8px; padding: 6px 14px;
}
.download-btn:hover { background: var(--surface-2); }
.download-btn.primary { color: #fff; background: var(--brand-purple); border-color: var(--brand-purple); }
.download-btn.primary:hover { background: #5d378b; }

.site-footer { padding-top: 32px; padding-bottom: 40px; font-size: 13px; color: var(--text-muted); }
.site-footer p { margin: 0 0 6px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }

.link-btn { font: inherit; color: var(--brand-purple); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

/* Analytics consent banner */
.consent {
  position: fixed; z-index: 20; left: 16px; right: 16px; bottom: 16px; max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(29, 26, 36, 0.16); padding: 16px 20px;
}
.consent[hidden] { display: none; }
.consent-text { margin: 0; flex: 1 1 320px; font-size: 14px; color: var(--text-secondary); }
.consent-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* Both choices share one style so neither is nudged. */
.consent-btn {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--brand-purple); background: var(--surface); border: 1.5px solid var(--brand-purple); border-radius: 8px; padding: 8px 16px;
}
.consent-btn:hover { background: var(--surface-2); }

/* Privacy notice */
.prose { max-width: 760px; padding: 24px 28px; margin-top: 24px; }
.prose h2 { font-size: 20px; margin-top: 28px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--text-secondary); font-size: 15px; }
.prose ul { padding-left: 20px; }
.prose li + li { margin-top: 4px; }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 10; pointer-events: none; min-width: 120px; max-width: 260px;
  background: var(--surface); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14); font-size: 12px;
}
.tip-title { color: var(--text-secondary); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row + .tip-row { margin-top: 2px; }
.tip-value { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.tip-label { color: var(--text-secondary); }

@media (max-width: 900px) {
  .overview, .grid-2, .grid-dept { grid-template-columns: minmax(0, 1fr); }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile { position: static; }
}
@media (max-width: 560px) {
  .tiles, .tiles-3, .tiles-4 { grid-template-columns: minmax(0, 1fr); }
  .brand-partnership { margin-left: 0; text-align: left; flex-basis: 100%; }
  .logo-ico { width: 84px; }
  .logo-ocsia { width: 68px; }
  .bar-row { grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) 2rem; gap: 8px; }
  .card { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar-fill, .mark { transition: none; }
}

@media (forced-colors: active) {
  .bar-fill, .meter > span { background: CanvasText; }
}
