/*
 * bkrhost brand — shared by index.html and the error pages.
 * Wordmark: Space Grotesk 700 "bkrhost.io" (W4). Motif: B-form, stem + two half-discs (M4).
 * Themes: dark + magenta (C4) everywhere; body.t-index centres the B (HC4) with the wordmark in the header.
 * Holidays: brand.js sets html[data-holiday=…]; each block below overrides the palette.
 * Cloudflare inlines this file into the stored custom error pages when they are (re)fetched.
 */

:root {
  --g: #0A0A0A;
  --fg: #FAFAFA;
  --muted: #C2C2C2;
  --dim: #9A9A9A;
  --card: #141414;
  --line: #333333;
  --line2: #262626;
  --acc: #FF2E88;   /* shadows, highlights */
  --acct: #FF2E88;  /* accent used as text: >= 4.5:1 on --g */
  --b: #FAFAFA;     /* B-form fill */
  --bs: #FF2E88;    /* B-form + wordmark shadow */
  --dot: #FF2E88;   /* the "." in bkrhost.io */
  --dsh: #FAFAFA;   /* shadow of the dot */
  --pad: 96px;
  --sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
}

/* ── Holidays ─────────────────────────────────────────────── */

html[data-holiday="christmas"] body,
html[data-holiday="halloween"] body,
html[data-holiday="newyear"] body,
html[data-holiday="stpatricks"] body,
html[data-holiday="birthday"] body {
  --g: #0A0A0A;
  --fg: #FAFAFA;
  --muted: #C2C2C2;
  --dim: #9A9A9A;
  --card: #141414;
  --line: #333333;
  --line2: #262626;
  --b: #FAFAFA;
  --dsh: #FAFAFA;
}
html[data-holiday="christmas"] body { --acc: #E3262E; --acct: #FF5A5F; --bs: #E3262E; --dot: #1FA34A; }
html[data-holiday="halloween"] body { --g: #140A1F; --card: #1D1229; --line: #3A2A4A; --line2: #2A1C38; --acc: #FF6A00; --acct: #FF6A00; --b: #FF6A00; --bs: #7A2BFF; --dot: #FF6A00; --dsh: #7A2BFF; }
html[data-holiday="newyear"] body,
html[data-holiday="birthday"] body { --acc: #FFC83D; --acct: #FFC83D; --bs: #FFC83D; --dot: #FFC83D; }
html[data-holiday="stpatricks"] body { --acc: #00A651; --acct: #00A651; --bs: #00A651; --dot: #00A651; }
html[data-holiday="stgeorge"] body {
  --g: #F5F5F2;
  --fg: #0A0A0A;
  --muted: #4A4A4A;
  --dim: #5C5C5C;
  --card: #FFFFFF;
  --line: #CFCFCA;
  --line2: #E2E2DE;
  --acc: #CE1124;
  --acct: #CE1124;
  --b: #0A0A0A;
  --bs: #CE1124;
  --dot: #CE1124;
  --dsh: #0A0A0A;
}

/* ── Base ─────────────────────────────────────────────────── */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--g);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* B-form motif: always the whole B, never cropped. Its height --bh is the smallest of the
 * viewport height, 60% of the width, and a cap tied to the type (4.5 x the error code, 7 x the
 * wordmark), so it grows smoothly and never dwarfs the text. Until the cap binds it is centred top
 * to bottom; once capped, its top stays on the content line (header 80 + 48). Error pages also keep
 * the stem clear of the text column (pad 96 + desc 520 + 16). */
body {
  --gut: max(24px, 3vw);
  --type: clamp(92px, 12vw, 160px);
  --cap: calc(4.5 * var(--type));
  --bh: min(100vh - 2 * var(--gut), 60vw, var(--cap), (100vw - 632px - var(--gut)) / 0.55);
}
.B {
  --bh: inherit;
  position: absolute;
  top: clamp(var(--gut), 128px, 50vh - var(--bh) / 2);
  right: var(--gut);
  z-index: 0;
  display: flex;
  pointer-events: none;
  filter: drop-shadow(calc(var(--bh) * 0.024) calc(var(--bh) * 0.024) 0 var(--bs));
}
.B .s { width: calc(var(--bh) * 0.3); height: var(--bh); margin-right: -1px; background: var(--b); } /* 1px overlap: no seam at fractional sizes */
.B .d { width: calc(var(--bh) * 0.25); height: calc(var(--bh) * 0.5); background: var(--b); border-radius: 0 999px 999px 0; }

/* Wordmark */
.wm { font-family: var(--display); font-weight: 700; letter-spacing: -0.035em; line-height: 1; }
.wm .dot { color: var(--dot); }
.shadow { text-shadow: 0.055em 0.055em 0 var(--bs); }
.shadow .dot { text-shadow: 0.055em 0.055em 0 var(--dsh); }

/* Small B mark */
.mk { display: flex; flex: none; filter: drop-shadow(2px 2px 0 var(--bs)); }
.mk .s { width: 9px; height: 22px; background: var(--fg); }
.mk .d { width: 6px; height: 11px; background: var(--fg); border-radius: 0 6px 6px 0; }

/* Half-disc rule */
.scl {
  height: 10px;
  background: radial-gradient(circle at 0 50%, var(--fg) 5px, transparent 5.5px) 0 0 / 13px 10px repeat-x;
  filter: drop-shadow(2px 2px 0 var(--bs));
}

/* ── Index (t-index) ───────────────────────────────────────── */

/* HC4 (2026-10-15): the B alone in the centre of the screen, the tagline under it, and the
 * wordmark flat in the header, as on the error pages. No halftone (BG0). The B sits in the flow;
 * --bh leaves room for the header (80), the tagline block and the gutters, and is capped at 640. */
body.t-index { --bh: min(100vh - 260px, 65vw, 640px); }
body.t-index .hdr .wm { margin: 0; }
body.t-index .B { position: relative; top: auto; right: auto; }
.home {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 4vh, 40px);
  padding: var(--gut) var(--gut) calc(80px + var(--gut));  /* the bottom mirrors the header, so the B centres on the screen */
}
.tagline {
  margin: 0;
  font: 500 13px/1.4 var(--mono);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
}

/* ── Error pages ──────────────────────────────────────────── */

.hdr {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 80px;
  padding: 0 var(--pad);
}
.hdr .wm { font-size: 19px; letter-spacing: -0.03em; }
.hlbl {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim);
}
.wrap {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  display: grid;
  align-content: start;
  grid-template-columns: minmax(0, 580px);
  gap: 48px 64px;
  align-items: start;
  padding: 48px var(--pad) 96px;
}
.main { display: flex; flex-direction: column; gap: 20px; }
.tag {
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--acct);
}
.code {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(112px, 14vw, 200px);
  letter-spacing: -0.05em;
  line-height: 0.82;
  text-shadow: 0.04em 0.04em 0 var(--acc);
}
.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 3.2vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.main .scl { width: 240px; }
.desc { margin: 0; max-width: 520px; font-size: 17px; line-height: 1.6; color: var(--muted); }

.card {
  margin-top: 8px;
  padding: 4px 22px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line), 8px 8px 0 var(--acc);
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line2);
}
.row:last-child { border-bottom: 0; }
.row[hidden] { display: none; }
.k { font: 500 11px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.v { font: 500 14px/1.3 var(--mono); color: var(--fg); text-align: right; overflow-wrap: anywhere; }
.v.hi { color: var(--acct); }

.btn {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  min-height: 44px;
  margin-top: 12px;
  padding: 0 22px;
  background: var(--fg);
  color: var(--g);
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 5px 5px 0 var(--acc);
}
.btn:hover, .btn:focus-visible { box-shadow: 2px 2px 0 var(--acc); transform: translate(3px, 3px); }

/* You → edge → origin */
.pipe { display: flex; align-items: flex-start; }
.pn { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 92px; }
.pc { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; }
.pc svg { width: 18px; height: 18px; }
.ok { background: var(--fg); color: var(--g); }
.bad { background: var(--acc); color: #0A0A0A; box-shadow: 4px 4px 0 var(--fg); }
.pl { font: 500 10px/1.2 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); text-align: center; }
.con { width: 56px; height: 2px; margin-top: 19px; flex: none; }
.con.up { background: var(--fg); }
.con.down { background: repeating-linear-gradient(90deg, var(--acc) 0 6px, transparent 6px 12px); }

/* Cloudflare-injected detail box */
.side { display: flex; flex-direction: column; gap: 14px; }
.side-l { font: 600 11px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--acct); }
.cfbox {
  min-height: 320px;
  padding: 24px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line), 10px 10px 0 var(--acc);
  font: 400 13px/1.7 var(--mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.cfbox .cf-error-details, .cfbox #cf-error-details {
  font: 400 13px/1.7 var(--mono) !important;
  color: var(--muted) !important;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}
.cfbox h1, .cfbox h2, .cfbox h3 {
  margin: 0 0 10px !important;
  font: 600 18px/1.2 var(--display) !important;
  letter-spacing: -0.01em !important;
  color: var(--fg) !important;
}
.cfbox p { margin: 0 0 12px !important; color: var(--muted) !important; }
.cfbox a { color: var(--acct) !important; }

.foot {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  padding: 0 var(--pad) 34px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ── Holiday decoration (injected by brand.js) ────────────── */

.deco, .scatter { position: absolute; z-index: 1; pointer-events: none; }
.deco { top: 24px; left: calc(var(--pad) + 640px); width: 260px; height: 220px; }
body.t-index .deco { top: 96px; left: var(--pad); }
.scatter { inset: 0; overflow: hidden; }
.deco svg { position: absolute; overflow: visible; }
.deco .moon { position: absolute; left: 28px; top: 22px; width: 124px; height: 124px; border-radius: 50%; background: #FAFAFA; box-shadow: 7px 7px 0 #FF6A00; }
.deco .flag { position: absolute; left: 30px; top: 40px; width: 175px; height: 105px; background: #FAFAFA; box-shadow: inset 0 0 0 2px #0A0A0A, 7px 7px 0 #0A0A0A; transform: rotate(-4deg); }
.deco .flag::before, .deco .flag::after { content: ""; position: absolute; background: #CE1124; }
.deco .flag::before { left: 0; right: 0; top: 42px; height: 21px; }
.deco .flag::after { top: 0; bottom: 0; left: 77px; width: 21px; }
.scatter i { position: absolute; display: block; }

/* ── Layout breakpoints ───────────────────────────────────── */

@media (min-width: 1180px) {
  .has-side .wrap { grid-template-columns: minmax(0, 560px) minmax(0, 400px); }
  .has-side .side { margin-top: 140px; }
  .has-side .code { font-size: clamp(104px, 11vw, 160px); }
}
@media (max-width: 1099px) {
  .deco { display: none; }
}
@media (max-width: 899px) {
  :root { --pad: 24px; }
  .hdr { height: 64px; }
  .hlbl { display: none; }
  .wrap { padding-top: 32px; padding-bottom: 64px; }
  .code { font-size: 120px; }
  .has-side .code { font-size: 92px; }
  .desc { font-size: 15px; }
  .card { padding: 2px 18px; box-shadow: inset 0 0 0 1px var(--line), 6px 6px 0 var(--acc); }
  .home { padding-bottom: calc(64px + var(--gut)); }
  .tagline { font-size: 11px; letter-spacing: 0.24em; }
}

/* Error pages, single column: on 5XX/1XXX the B is drawn at the top of the aside (same path, hard
 * shadow as a second layer) and the Cloudflare box layers over its lower third. 403/404 have no
 * aside, so their B stands at the foot of the page behind the card. The width term keeps the stem
 * right of the left-hand labels. */
@media (max-width: 899px) {
  body:not(.t-index) { --bh: min(var(--cap), (100vw - 2 * var(--gut) - 150px) / 0.55, 100vh - 2 * var(--gut)); }
  body:not(.t-index) .B { top: auto; bottom: calc(var(--gut) + 45px); }
  body.has-side .B { display: none; }
  .side { position: relative; padding-top: calc(var(--bh) * 0.62); }
  .side::before, .side::after {
    content: ""; position: absolute; z-index: -1; pointer-events: none;
    top: 0; right: 0; height: var(--bh); width: calc(var(--bh) * 0.55);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 100'%3E%3Cpath d='M0 0H30A25 25 0 0 1 30 50A25 25 0 0 1 30 100H0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 100'%3E%3Cpath d='M0 0H30A25 25 0 0 1 30 50A25 25 0 0 1 30 100H0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  }
  .side::before { background: var(--bs); transform: translate(calc(var(--bh) * 0.024), calc(var(--bh) * 0.024)); }
  .side::after { background: var(--b); }
}

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: transform 0.12s ease, box-shadow 0.12s ease; }
}
