/* Design tokens (SPEC 10.1) and shared base styles. */

/* Fonts served locally (SIL Open Font License, see /fonts/OFL-*.txt). */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/inter-latin-var.woff2") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin-var.woff2") format("woff2");
}

:root {
  /* ICCAS colours: blue of the logo (#1e88c8) and its greys; dark but friendly blue-grey. */
  --bg: #111923;
  --surface-wall: #172231;
  --surface-panel: #1a2533;
  --card: #213042;
  --card-top: #26384d;
  --placeholder: #2c3b4e;
  --line: #2a394b;
  --line-strong: #3d5068;
  --text: #eef3f8;
  --text-muted: #a5b2c2;
  --text-label: #cdd6e1;
  --text-faint: #8796a8;
  --accent: #2c93d6; /* borders, highlights on dark surfaces */
  --accent-strong: #1a75ae; /* filled buttons, white text 5:1 */
  --accent-light: #8ccaf2; /* accent text on dark surfaces */
  --accent-surface: #16334c;
  --accent-border: rgba(76, 163, 222, 0.42); /* calm card frame */
  --info: #9fd0f5;
  --info-surface: #17304a;
  --brand-grey: #b3b3b3;
  --brand-grey-light: #dadada;
  --surface-input: #1d2a3a;
  --danger: #e5675d;
  --danger-text: #ffb1a8;
  --danger-surface: #34201f;
  --radius-card: 14px;
  --radius-panel: 16px;
  --radius-dialog: 20px;
  --radius-chip: 20px;
  --font-heading: "Space Grotesk", system-ui, sans-serif;
  --font-text: "Inter", system-ui, sans-serif;
}

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

/* The hidden attribute must win over display rules of components. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  /* A soft blue glow from the top left makes the dark page less heavy. */
  background:
    radial-gradient(1100px 520px at 0% -10%, rgba(30, 136, 200, 0.2), transparent 65%),
    radial-gradient(900px 480px at 100% 110%, rgba(30, 136, 200, 0.08), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--info);
}

h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

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

.btn-primary {
  display: inline-block;
  box-shadow: 0 6px 18px rgba(26, 117, 174, 0.35);
  border: 0;
  border-radius: 10px;
  min-height: 44px;
  padding: 0.65rem 1.125rem;
  background: var(--accent-strong);
  color: #ffffff;
  font: 600 1rem var(--font-text);
  text-decoration: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: #1f86c4;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-quiet {
  border: 0;
  padding: 0.4rem 0.5rem;
  background: transparent;
  color: var(--text-label);
  font: 500 0.875rem var(--font-text);
  cursor: pointer;
  border-radius: 8px;
}

.btn-quiet:hover {
  color: var(--text);
  background: var(--surface-input);
}

.btn-text {
  border: 0;
  padding: 0 0.75rem;
  min-height: 40px;
  background: transparent;
  color: var(--accent);
  font: 500 0.8125rem var(--font-text);
  cursor: pointer;
}

.btn-chip {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: var(--surface-input);
  color: var(--text);
  font: 500 0.8125rem var(--font-text);
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 2000;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: var(--accent-strong);
  color: #ffffff;
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.75rem;
}

.btn-secondary {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 1.125rem;
  background: transparent;
  color: var(--text-label);
  font: 500 0.95rem var(--font-text);
  cursor: pointer;
}

/* Login pages */
.page-auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-dialog);
  padding: 2rem;
}

.brand {
  margin: 0 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-heading);
}

.brand-title {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1.25rem 0;
}

.auth-form label {
  color: var(--text-label);
  font-weight: 500;
}

.auth-form input {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: var(--card);
  color: var(--text);
  font: 1rem var(--font-text);
}

.auth-form button {
  margin-top: 0.4rem;
}

.dev-login {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px dashed var(--accent);
  border-radius: 12px;
  background: var(--accent-surface);
}

.dev-login h2 {
  margin: 0;
  font: 600 1rem var(--font-heading);
  color: var(--accent-light);
}

.form-error {
  margin: 0;
  color: var(--accent-light);
}

/* Long text pages (privacy) */
.auth-card.doc-page {
  max-width: 880px;
  line-height: 1.55;
}

.doc-page h1 {
  margin: 0 0 0.75rem;
}

.doc-page h2 {
  margin: 2rem 0 0.6rem;
  font: 600 1.15rem var(--font-heading);
  color: var(--text-label);
}

.doc-page ul,
.doc-page ol {
  padding-left: 1.25rem;
}

.doc-page li + li {
  margin-top: 0.35rem;
}

.doc-page a {
  color: var(--accent-light);
}

.doc-page mark {
  border-radius: 4px;
  padding: 0 0.2em;
  background: #5a4a12;
  color: #ffe9a6;
}

.draft-note {
  border-left: 4px solid #d9b23c;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: rgba(217, 178, 60, 0.12);
}

.todo-box {
  margin-top: 1rem;
  border: 2px dashed #d9b23c;
  border-radius: 10px;
  padding: 0.25rem 1.1rem 0.75rem;
  background: rgba(217, 178, 60, 0.08);
}

.doc-page .todo-box h2 {
  margin-top: 0.75rem;
  color: #ffe9a6;
}

.doc-toc ol {
  margin: 0.5rem 0 0;
}

.table-wrap {
  overflow-x: auto;
}

.doc-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.doc-page th,
.doc-page td {
  border-top: 1px solid var(--line);
  padding: 0.55rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.doc-page thead th {
  border-top: 0;
  color: var(--text-muted);
  font-weight: 600;
}

.doc-page tbody th {
  width: 36%;
  font-weight: 500;
  color: var(--text-label);
}

.notice {
  margin: 0;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  background: var(--info-surface);
  color: var(--info);
}

.hint {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-footer {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.auth-footer a {
  color: var(--text-muted);
}
