/*
 * Site-wide styles: fonts, design tokens, base typography and layout primitives.
 * Component styles live next to their components (*.razor.css, Blazor CSS isolation).
 * Tokens come from the Website page of the design file ("00 · Design system", v2).
 */

/* ── Fonts: self-hosted WOFF2 subsets (W-PERF-2, no third-party requests: W-PRIV-1) ───────── */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-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;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/montserrat-800-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;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/montserrat-800-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/instrument-serif-italic-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;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/instrument-serif-italic-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-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;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Tokens ──────────────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;

  /* Neutrals (dark-first) */
  --bg-page: #101214;
  --bg-band: #16191d;
  --bg-footer: #16191d;
  --surface-card: #1c1f24;
  --surface-raised: #24282e;
  --surface-sunken: #0b0d10;
  --line: #2c3036;
  --line-strong: #3a3f47;
  --line-on-dark: rgb(255 255 255 / 0.12);
  --text-head: #f5f6f8;
  --text-body: #b6bcc6;
  --text-muted: #80878f;
  --text-quiet: #8d949e;
  --text-dim: #6e7580;

  /* Colour blocks: each section owns one */
  --teal: #15ead6;
  --cyan: #35c8e4;
  --indigo: #6c74e8;
  --violet: #a322e0;
  --coral: #ff7a59;
  --paper: #f3f1ec;
  --ink: #121417;
  --ink-body: #2a2e34;
  --ink-muted: #4a4f57;
  --selection: #8a8ff5;
  --lavender: #b7a9ff;

  --success: #3ddc97;
  --warning: #f5b84b;
  --danger: #f06a6a;

  --link: var(--cyan);
  --focus: var(--cyan);

  --brand-gradient: linear-gradient(90deg, #15ead6 0%, #35c8e4 34%, #6c74e8 68%, #a322e0 100%);
  --brand-gradient-diagonal: linear-gradient(135deg, #15ead6 0%, #35c8e4 34%, #6c74e8 68%, #a322e0 100%);
  --agent-gradient: linear-gradient(90deg, #6c74e8, #a322e0);

  /* Type */
  --font-display: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --size-display: clamp(2.875rem, 1.2rem + 5.9vw, 6.25rem);   /* 46 → 100 */
  --size-cta: clamp(2.5rem, 1.1rem + 4.6vw, 5rem);              /* 40 → 80 */
  --size-h1: clamp(2.5rem, 1.6rem + 2.8vw, 4rem);                /* 40 → 64 */
  --size-h2: clamp(2.125rem, 1.3rem + 2.7vw, 3.75rem);           /* 34 → 60 */
  --size-h3: clamp(1.25rem, 1.1rem + 0.4vw, 1.4375rem);          /* 20 → 23 */
  --size-lead: clamp(1rem, 0.9rem + 0.45vw, 1.25rem);            /* 16 → 20 */
  --size-body: 1rem;
  --size-small: 0.875rem;
  --size-label: 0.75rem;

  /* Shape */
  --radius-control: 8px;
  --radius-card: 12px;
  --radius-panel: 16px;
  --radius-media: 20px;
  --radius-band: 28px;
  --radius-pill: 999px;

  --shadow-raised: 0 16px 48px rgb(0 0 0 / 0.4);
  --shadow-sticker: 0 6px 16px rgb(0 0 0 / 0.25);

  /* Layout: a 1200 container inside a 1440 frame, 8-pt rhythm */
  --container: 1200px;
  --gutter: clamp(1.5rem, 0.2rem + 5.6vw, 7.5rem);
  --section-y: clamp(4rem, 2.4rem + 5vw, 7rem);
  --nav-height: 80px;
}

/* ── Reset / base ────────────────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.625;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video, picture { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
table { border-collapse: collapse; }

h1, h2, h3, h4 {
  color: var(--text-head);
  font-family: var(--font-display);
  font-weight: 800;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

::selection { background: rgb(108 116 232 / 0.45); color: #fff; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.95em; }

/* ── Type utilities ──────────────────────────────────────────────────────────────────────── */

.t-display { font-size: var(--size-display); line-height: 1.04; letter-spacing: -0.03em; }
.t-cta     { font-size: var(--size-cta); line-height: 1.05; letter-spacing: -0.032em; }
.t-h1      { font-size: var(--size-h1); line-height: 1.06; letter-spacing: -0.03em; }
.t-h2      { font-size: var(--size-h2); line-height: 1.07; letter-spacing: -0.03em; }
.t-h3      { font-size: var(--size-h3); line-height: 1.3; letter-spacing: -0.02em; }
.t-lead    { font-size: var(--size-lead); line-height: 1.6; color: var(--text-body); }
.t-small   { font-size: var(--size-small); line-height: 1.45; }
.t-mono    { font-family: var(--font-mono); }

/* The mono label: "003 · THE EDITOR" */
.t-label {
  font-family: var(--font-mono);
  font-size: var(--size-label);
  font-weight: 500;
  line-height: 1.33;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* The grey second line of a two-line headline */
.dim { color: var(--text-dim); }

/* One serif-italic word per headline, never two. */
.accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1em;
  letter-spacing: -0.01em;
  line-height: 0.9;
  padding-inline-end: 0.04em;
}
.accent--teal { color: var(--teal); }
.accent--coral { color: var(--coral); }
.accent--indigo { color: var(--indigo); }
.accent--lavender { color: var(--lavender); }
.accent--yellow { color: #ffd23f; }
.accent--ink { color: var(--ink); }
.accent--white { color: #fff; }

.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.section { padding-block: var(--section-y); position: relative; }

.stack > * + * { margin-top: var(--stack-gap, 1rem); }

/* ── Canvas motifs ───────────────────────────────────────────────────────────────────────── */

/* The editor's dot grid: 24px cells, as the dotgrid material draws it. */
.dot-grid {
  background-color: var(--bg-page);
  background-image: radial-gradient(circle at center, #2a2e35 1.1px, transparent 1.6px);
  background-size: 24px 24px;
  background-position: -12px -12px;
}

/* Dot-grid heroes fade into the page instead of ending on a hard edge. */
.dot-grid--fade { position: relative; }
.dot-grid--fade::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 160px;
  background: linear-gradient(to bottom, transparent, var(--bg-page));
  pointer-events: none;
}

/* Soft brand glows: blurred gradients, no images. */
.glow {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.22;
  z-index: 0;
}
.glow--teal { background: var(--teal); }
.glow--violet { background: var(--violet); }
.glow--indigo { background: var(--indigo); }

/* ── Accessibility ───────────────────────────────────────────────────────────────────────── */

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
  background: var(--teal);
  color: var(--ink);
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Forms (shared by auth and account pages) ────────────────────────────────────────────── */

.field { display: grid; gap: 0.4rem; }
.field + .field { margin-top: 1rem; }
.field__label { color: var(--text-head); font-size: var(--size-small); font-weight: 600; }
.field__hint { color: var(--text-muted); font-size: 0.8125rem; }
.field__error, .validation-message { color: var(--danger); font-size: 0.8125rem; }

.input {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface-sunken);
  color: var(--text-head);
  font-size: 1rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input::placeholder { color: #5d646d; }
.input:hover { border-color: #4a505a; }
.input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgb(53 200 228 / 0.25); }
.input[aria-invalid="true"], .input.invalid { border-color: var(--danger); }

.form-actions { margin-top: 1.5rem; }

.checkbox { display: flex; gap: 0.625rem; align-items: flex-start; font-size: var(--size-small); line-height: 1.5; }
.checkbox input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal); flex: none; }

.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--line-strong);
  background: var(--surface-card);
  color: var(--text-head);
  font-size: var(--size-small);
}
.alert--error { border-color: rgb(240 106 106 / 0.5); background: rgb(240 106 106 / 0.08); }
.alert--success { border-color: rgb(61 220 151 / 0.45); background: rgb(61 220 151 / 0.08); }
.alert--info { border-color: rgb(53 200 228 / 0.4); background: rgb(53 200 228 / 0.07); }

/* Blazor's own error UI */
#blazor-error-ui {
  display: none;
  position: fixed;
  inset: auto 1rem 1rem 1rem;
  z-index: 1000;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-card);
  background: var(--surface-raised);
  border: 1px solid var(--danger);
  color: var(--text-head);
  box-shadow: var(--shadow-raised);
}
#blazor-error-ui .reload { color: var(--cyan); margin-left: 0.5rem; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
