/* SPDX-FileCopyrightText: 2026 Science Against Authoritarianism Contributors */
/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Standalone stylesheet for Pharos Research, Researchers & University Partnerships Portal (/universities) */

:root {
  color-scheme: dark;
  --bg: #080b12;
  --surface: #0f1523;
  --surface-2: #141c2e;
  --ink: #f8fafc;
  --soft: #cbd5e1;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(250, 204, 21, 0.42);
  --gold: #facc15;
  --sky: #38bdf8;
  --emerald: #34d399;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --rose: #fb7185;
  --btn-bg: rgba(250, 204, 21, 0.14);
  --btn-ink: #fef08a;
  --code-bg: #050810;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --soft: #334155;
  --muted: #475569;
  --line: rgba(15, 23, 42, 0.14);
  --line-strong: rgba(180, 83, 9, 0.45);
  --gold: #b45309;
  --sky: #0369a1;
  --emerald: #047857;
  --violet: #6d28d9;
  --amber: #b45309;
  --rose: #be123c;
  --btn-bg: rgba(180, 83, 9, 0.1);
  --btn-ink: #92400e;
  --code-bg: #0f172a;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--gold);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--gold);
  color: #080b12;
  padding: 10px 16px;
  font-weight: 700;
  z-index: 200;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

.u-shell {
  width: min(1160px, 100% - 32px);
  margin: 0 auto;
}

/* Top Institutional Navigation */
.u-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.u-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.u-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.u-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #facc15 0%, #38bdf8 100%);
  color: #080b12;
  font-weight: 900;
  font-size: 0.95rem;
}

.u-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.u-brand-text strong {
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.u-brand-text small {
  font-size: 0.75rem;
  color: var(--muted);
}

.u-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.u-nav a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--soft);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 6px;
}

.u-nav a:hover {
  color: var(--gold);
  background: var(--surface-2);
}

.u-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons & Badges */
.u-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}

.u-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.u-btn-primary {
  background: var(--gold);
  color: #080b12;
  border-color: var(--gold);
}

.u-btn-primary:hover {
  background: #fde047;
  color: #080b12;
}

.u-btn-soft {
  background: var(--btn-bg);
  color: var(--btn-ink);
  border-color: var(--line-strong);
}

.u-btn.is-active {
  background: var(--gold);
  color: #080b12;
  border-color: var(--gold);
}

.u-eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.u-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--soft);
}

.u-badge-robust {
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--emerald);
}

.u-badge-contested {
  border-color: rgba(251, 191, 36, 0.45);
  color: var(--amber);
}

.u-badge-open {
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--sky);
}

/* Hero */
.u-hero {
  padding: 46px 0 32px;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(900px 360px at 15% 0%, rgba(250, 204, 21, 0.08), transparent 65%),
              radial-gradient(800px 340px at 85% 10%, rgba(56, 189, 248, 0.08), transparent 60%);
}

.u-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.85rem, 3.6vw, 2.85rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  max-width: 24ch;
}

.u-hero-lead {
  margin: 0 0 20px;
  max-width: 72ch;
  font-size: 1.05rem;
  color: var(--soft);
}

.u-url-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.u-url-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.u-url-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  word-break: break-all;
}

.u-cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.u-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.u-kpi {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.u-kpi strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.15;
  color: var(--gold);
}

.u-kpi span {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Sections */
.u-section {
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
}

.u-section-head {
  margin-bottom: 22px;
}

.u-section-head h2 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  line-height: 1.2;
}

.u-section-head p {
  margin: 0;
  max-width: 72ch;
  color: var(--soft);
}

.u-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 18px;
}

.u-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.u-card {
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.u-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.3;
}

.u-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--soft);
}

.u-card-foot {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Controls & Forms */
.u-controls-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}

.u-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 210px;
  flex: 1 1 210px;
}

.u-field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--soft);
}

.u-select,
.u-input {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.9rem;
}

.u-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.u-code-box {
  margin: 0;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--code-bg);
  color: #e2e8f0;
  font: 0.85rem/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.u-textarea {
  width: 100%;
  min-height: 290px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: 0.85rem/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  resize: vertical;
}

.u-status {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--emerald);
  min-height: 1.2em;
}

/* Tables (WCAG scrollable region) */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.u-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.u-table th,
.u-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.u-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-2);
}

.u-table tr:last-child td {
  border-bottom: none;
}

/* Peer Directory Cards */
.u-peer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.u-peer-card {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.u-peer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.u-peer-region {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.u-peer-card h4 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.3;
}

.u-peer-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--soft);
}

.u-callout {
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
  font-size: 0.9rem;
  color: var(--soft);
}

.u-footer {
  padding: 36px 0 56px;
  font-size: 0.86rem;
  color: var(--muted);
}

.u-footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

@media print {
  .u-topbar,
  .u-actions,
  .u-btn,
  .u-tabs,
  .u-controls-row {
    display: none !important;
  }
  body {
    background: #ffffff;
    color: #0f172a;
  }
  .u-card,
  .u-peer-card,
  .table-wrap {
    box-shadow: none;
    break-inside: avoid;
  }
}
