/*
 * Centipod brand stylesheet. Source: Centipod Brand Bible.
 * https://brand.centipod.io/css/centipod.css  (fonts at /fonts/, icons at /icons/, logos at /logo/)
 *
 * Contents: 1 fonts  2 tokens (light default, dark on request)  3 base  4 layout  5 components  6 utilities
 * Light is the default. Dark applies only with <html data-theme="dark"> (Brand Bible 2.1); this file never
 * follows the operating system's dark setting.
 */

/* 1 ---------------------------------------------------------------------------------------- fonts */
@font-face { font-family: "Albert Sans"; src: url("../fonts/albert-sans.woff2") format("woff2");
  font-weight: 500 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("../fonts/source-code-pro.woff2") format("woff2");
  font-weight: 400 600; font-style: normal; font-display: swap; }

/* 2 --------------------------------------------------------------------------------------- tokens */
:root {
  /* colour, as RGB channels so they work with alpha: rgb(var(--color-ink) / 40%) */
  --color-base: 255 255 255;          /* #FFFFFF */
  --color-surface: 248 250 252;       /* #F8FAFC */
  --color-ink: 15 33 51;              /* #0F2133 Harbour Midnight */
  --color-ink-2: 71 85 105;           /* #475569 */
  --color-ink-3: 100 116 139;         /* #64748B */
  --color-line: 226 232 240;          /* #E2E8F0 */
  --color-block: 15 33 51;            /* #0F2133 */
  --color-on-block: 248 250 252;      /* #F8FAFC */
  --color-action: 194 77 0;           /* #C24D00 Burnt Orange */
  --color-action-hover: 169 67 0;     /* #A94300 */
  --color-action-pressed: 143 57 0;   /* #8F3900 */
  --color-on-action: 255 255 255;     /* #FFFFFF */
  --color-mark: 194 77 0;             /* #C24D00 */
  --color-error: 163 18 58;           /* #A3123A */
  --color-error-tint: 251 241 243;    /* #FBF1F3 */
  --color-success: 30 107 69;         /* #1E6B45 */
  --color-success-tint: 241 247 243;  /* #F1F7F3 */
  --color-warning: 122 82 0;          /* #7A5200 */
  --color-warning-tint: 251 246 234;  /* #FBF6EA */

  /* type */
  --font-heading: "Albert Sans", Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-code: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* space: a 4 px grid */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px; --space-6: 24px;
  --space-8: 32px; --space-12: 48px; --space-16: 64px; --space-24: 96px; --space-32: 128px;

  /* shape */
  --radius-sm: 2px;
  --radius-md: 4px;
  --hairline: 1px;
  --measure: 68ch;
  --container: 1280px;

  /* icons: the ground behind hatching knock-outs */
  --cp-icon-ground: #FFFFFF;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --color-base: 15 33 51;             /* #0F2133 */
  --color-surface: 18 41 63;          /* #12293F */
  --color-ink: 248 250 252;           /* #F8FAFC */
  --color-ink-2: 172 191 210;         /* #ACBFD2 */
  --color-ink-3: 138 155 176;         /* #8A9BB0 */
  --color-line: 30 58 87;             /* #1E3A57 */
  --color-block: 248 250 252;
  --color-on-block: 15 33 51;
  --color-error: 240 138 160;         /* #F08AA0 */
  --color-success: 124 200 160;       /* #7CC8A0 */
  --color-warning: 227 178 90;        /* #E3B25A */
  --color-error-tint: 18 41 63;
  --color-success-tint: 18 41 63;
  --color-warning-tint: 18 41 63;
  --cp-icon-ground: #0F2133;
  color-scheme: dark;
}

/* 3 ----------------------------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* the hidden attribute always wins (Brand Bible 8.2) */

html {
  background: rgb(var(--color-base));
  color: rgb(var(--color-ink));
  font-family: var(--font-body);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}
body { margin: 0; font-size: 1rem; line-height: 1.5; }

h1, h2, h3, .cp-display {
  font-family: var(--font-heading); font-weight: 700; color: rgb(var(--color-ink));
  margin: 0 0 var(--space-2); text-wrap: balance;
}
.cp-display { font-size: clamp(2.25rem, 5vw, 3.5rem); line-height: 1.07; letter-spacing: -0.025em; font-weight: 800; }
h1 { font-size: clamp(1.875rem, 4vw, 2.5rem); line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 1.75rem); line-height: 1.21; letter-spacing: -0.015em; margin-top: var(--space-12); }
h3 { font-size: 1.25rem; line-height: 1.4; letter-spacing: -0.01em; margin-top: var(--space-8); }
p { margin: 0 0 var(--space-6); max-width: var(--measure); }
.cp-lead { font-size: 1.125rem; line-height: 1.56; }
small, .cp-small { font-size: 0.875rem; line-height: 1.43; color: rgb(var(--color-ink-2)); }

a { color: inherit; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { color: rgb(var(--color-ink-2)); }

code, kbd, pre, .cp-code { font-family: var(--font-code); font-size: 0.875rem; }
pre { background: rgb(var(--color-surface)); border: var(--hairline) solid rgb(var(--color-line));
  border-radius: var(--radius-sm); padding: var(--space-4); overflow-x: auto; line-height: 1.43; }

hr { border: 0; border-top: var(--hairline) solid rgb(var(--color-line)); margin: var(--space-12) 0; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid rgb(var(--color-ink)); outline-offset: 2px; }
::selection { background: rgb(var(--color-ink) / 15%); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* 4 --------------------------------------------------------------------------------------- layout */
.cp-container { max-width: var(--container); margin: 0 auto; padding: 0 var(--space-4); }
@media (min-width: 768px) { .cp-container { padding: 0 var(--space-8); } }
@media (min-width: 1024px) { .cp-container { padding: 0 var(--space-12); } }

/* The 8 + 4 split with the Mondrian axis. Below 1024 px: one column with an axis on the left. */
.cp-split { border-left: var(--hairline) solid rgb(var(--color-ink)); padding-left: var(--space-4); }
.cp-split > .cp-rail { margin-top: var(--space-8); border-top: var(--hairline) solid rgb(var(--color-line)); padding-top: var(--space-4); }
@media (min-width: 1024px) {
  .cp-split { border-left: 0; padding-left: 0; display: grid; grid-template-columns: 2fr 1fr; }
  .cp-split > .cp-main { padding-right: var(--space-6); }
  .cp-split > .cp-rail { margin-top: 0; border-top: 0; padding-top: 0; padding-left: var(--space-6);
    border-left: var(--hairline) solid rgb(var(--color-line)); }
}
.cp-section { border-top: var(--hairline) solid rgb(var(--color-line)); padding: var(--space-12) 0; }
@media (min-width: 1024px) { .cp-section { padding: var(--space-16) 0; } }
.cp-block { background: rgb(var(--color-block)); color: rgb(var(--color-on-block)); padding: var(--space-8); }
.cp-block :is(h1, h2, h3) { color: rgb(var(--color-on-block)); }
.cp-surface { background: rgb(var(--color-surface)); }

/* 5 ----------------------------------------------------------------------------------- components */
/* Label: Inter 600 capitals, 12 px, tracked */
.cp-label { font-family: var(--font-body); font-size: 0.75rem; line-height: 1rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: rgb(var(--color-ink-2)); }

p.cp-label { margin-bottom: var(--space-2); }

/* Buttons */
.cp-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-sm); border: var(--hairline) solid transparent;
  font: 600 0.875rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background-color 150ms, color 150ms; }
.cp-button--sm { height: 32px; padding: 0 var(--space-3); }
.cp-button--lg { height: 48px; padding: 0 var(--space-6); }
.cp-button--primary { background: rgb(var(--color-action)); color: rgb(var(--color-on-action)); }
.cp-button--primary:hover { background: rgb(var(--color-action-hover)); color: rgb(var(--color-on-action)); }
.cp-button--primary:active { background: rgb(var(--color-action-pressed)); }
.cp-button--secondary { background: transparent; color: rgb(var(--color-ink)); border-color: rgb(var(--color-ink)); }
.cp-button--secondary:hover { background: rgb(var(--color-surface)); color: rgb(var(--color-ink)); }
.cp-button--quiet { background: none; color: rgb(var(--color-ink)); padding: 0; height: auto;
  text-decoration: underline; text-underline-offset: 4px; }
.cp-button:disabled, .cp-button[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

/* Fields */
.cp-field-label { display: block; margin-bottom: var(--space-2); }
.cp-input, .cp-select, .cp-textarea { display: block; width: 100%; min-height: 40px; padding: var(--space-2) var(--space-3);
  border: var(--hairline) solid rgb(var(--color-ink-3)); border-radius: var(--radius-sm);
  background: rgb(var(--color-base)); color: rgb(var(--color-ink)); font: 400 1rem/1.5 var(--font-body); }
.cp-input::placeholder, .cp-textarea::placeholder { color: rgb(var(--color-ink-3)); }
.cp-input:focus-visible, .cp-select:focus-visible, .cp-textarea:focus-visible {
  border: 2px solid rgb(var(--color-ink)); outline: 2px solid rgb(var(--color-ink)); outline-offset: 2px; }
.cp-input:disabled, .cp-select:disabled, .cp-textarea:disabled { background: rgb(var(--color-surface));
  border-color: rgb(var(--color-line)); color: rgb(var(--color-ink-3)); }
.cp-input[aria-invalid="true"], .cp-textarea[aria-invalid="true"] { border: 2px solid rgb(var(--color-error)); }
.cp-help { margin-top: var(--space-1); font-size: 0.875rem; color: rgb(var(--color-ink-2)); }
.cp-error { margin-top: var(--space-1); font-size: 0.875rem; font-weight: 500; color: rgb(var(--color-error)); }

/* Steady navigation and tabs: the active state never moves the layout (Brand Bible 6.7) */
.cp-nav { display: flex; flex-wrap: wrap; gap: var(--space-6); list-style: none; margin: 0; padding: 0; }
.cp-nav a { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; color: rgb(var(--color-ink-2)); }
.cp-nav a::before { content: ""; width: 6px; height: 6px; flex: none; }       /* the reserved dot slot */
.cp-nav a[aria-current="page"] { color: rgb(var(--color-ink)); font-weight: 600; }
.cp-nav a[aria-current="page"]::before { background: rgb(var(--color-mark)); }
.cp-steady-label { display: inline-flex; flex-direction: column; align-items: flex-start; }
.cp-steady-label::after { content: attr(data-label); content: attr(data-label) / "";
  font-weight: 600; height: 0; overflow: hidden; visibility: hidden; user-select: none; pointer-events: none; }
.cp-tabs { display: flex; gap: var(--space-6); border-bottom: var(--hairline) solid rgb(var(--color-line)); }
.cp-tabs [role="tab"] { padding: var(--space-3) 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: rgb(var(--color-ink-2)); font: 400 1rem var(--font-body); cursor: pointer; }
.cp-tabs [role="tab"][aria-selected="true"] { color: rgb(var(--color-ink)); font-weight: 600; border-bottom-color: rgb(var(--color-mark)); }

/* Tags and status */
.cp-tag { display: inline-flex; align-items: center; height: 24px; padding: 0 var(--space-2);
  border: var(--hairline) solid rgb(var(--color-ink-3)); border-radius: var(--radius-sm); }
.cp-status { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 600; }
.cp-status--success { background: rgb(var(--color-success-tint)); color: rgb(var(--color-success)); }
.cp-status--warning { background: rgb(var(--color-warning-tint)); color: rgb(var(--color-warning)); }
.cp-status--error { background: rgb(var(--color-error-tint)); color: rgb(var(--color-error)); }

/* Notices: a 2 px rule, the tint as ground, icon plus text */
.cp-notice { border-left: 2px solid rgb(var(--color-ink)); background: rgb(var(--color-surface));
  padding: var(--space-3) var(--space-4); margin: var(--space-4) 0; }
.cp-notice--success { border-color: rgb(var(--color-success)); background: rgb(var(--color-success-tint)); }
.cp-notice--warning { border-color: rgb(var(--color-warning)); background: rgb(var(--color-warning-tint)); }
.cp-notice--error { border-color: rgb(var(--color-error)); background: rgb(var(--color-error-tint)); }
.cp-notice > strong { display: block; }

/* Data table */
.cp-table th { text-align: left; padding: var(--space-2) var(--space-3) var(--space-2) 0;
  border-bottom: 2px solid rgb(var(--color-ink)); }
.cp-table td { padding: var(--space-3) var(--space-3) var(--space-3) 0; border-bottom: var(--hairline) solid rgb(var(--color-line)); vertical-align: top; }
.cp-table td.cp-num, .cp-table th.cp-num { text-align: right; }

/* Icons: inline SVG inherits the text colour */
.cp-icon { display: inline-block; width: 48px; height: 48px; color: rgb(var(--color-ink)); }
.cp-icon svg { width: 100%; height: 100%; }

/* Theme switch: two segments, the filled one is active */
.cp-theme-switch { display: inline-flex; height: 32px; border: var(--hairline) solid rgb(var(--color-ink)); border-radius: var(--radius-sm); }
.cp-theme-switch button { border: 0; background: none; color: rgb(var(--color-ink)); padding: 0 var(--space-3);
  font: 600 0.875rem var(--font-body); cursor: pointer; }
.cp-theme-switch button[aria-pressed="true"] { background: rgb(var(--color-ink)); color: rgb(var(--color-base)); }

/* 6 ------------------------------------------------------------------------------------ utilities */
.cp-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.cp-mark { display: inline-block; width: 6px; height: 6px; background: rgb(var(--color-mark)); }
.cp-measure { max-width: var(--measure); }
