/* ============================================================
   Polyform Playground — Shared Design System
   Consume this in any sub-project via:
     <link rel="stylesheet" href="../shared/polyform.css">
   ============================================================ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ── */
:root {
  --bg:           #F4F1EC;
  --surface:      #FEFEFE;
  --navy:         #233154;
  --text:         #1A1916;
  --text-muted:   #8A8680;
  --text-faint:   #B8B4AE;
  --accent:       #233154;
  --accent-dark:  #1a2540;
  --border:       #DDD9D2;
  --border-light: #EAE7E1;

  /* status colours */
  --ok:   #16a34a;
  --warn: #d97706;
  --bad:  #dc2626;
}

/* ── Google Fonts — loaded once here ── */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* ── Base ── */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Subtle grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.028;
  pointer-events: none;
  z-index: 9999;
}

/* ── Layout wrapper ── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 48px;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  padding: 32px 0;
  border-bottom: 1px solid var(--border-light);
  animation: fadeDown 0.6s ease both;
}

.logo {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: inherit;
}

.logo-mark { width: 26px; height: 26px; flex-shrink: 0; }

.logo-text {
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}

.logo-text span { color: var(--text-muted); font-weight: 400; }

.topbar-badge {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* ── Page header (sub-page variant of hero) ── */
.page-header {
  padding: 64px 0 48px;
  animation: fadeUp 0.8s ease 0.1s both;
}

.page-header-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.page-header-eyebrow-line {
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.page-header-eyebrow-text {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

.page-header-title {
  font-family: 'Roboto', sans-serif;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin-bottom: 16px;
}

.page-header-title em {
  font-style: normal;
  color: var(--accent);
}

.page-header-tagline {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.7;
}

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  animation: fadeUp 0.8s ease 0.2s both;
}

.section-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}

.section-count {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-faint);
}

/* ── Surface card ── */
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* ── Toolbar (sticky controls bar) ── */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  animation: fadeDown 0.6s ease both;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 48px;
  flex-wrap: wrap;
}

.toolbar-row + .toolbar-row {
  padding-top: 0;
  padding-bottom: 12px;
  border-top: none;
}

.toolbar-title {
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}

.spacer { flex: 1; min-width: 0; }

/* ── Form controls ── */
.input {
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 3px;
  font-size: 12px;
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  color: #fff;
  background: rgba(255,255,255,0.1);
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.input:focus {
  border-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.15);
}

.input::placeholder { color: rgba(255,255,255,0.45); }

.select {
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 3px;
  font-size: 12px;
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  color: #fff;
  background: rgba(255,255,255,0.1);
  outline: none;
  cursor: pointer;
  transition: border-color 0.18s ease;
}

.select:focus { border-color: rgba(255,255,255,0.6); }
.select option { background: var(--navy); color: #fff; }

/* ── Toggle button group ── */
.btn-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
}

.btn-group { display: flex; gap: 5px; flex-wrap: wrap; }

.btn {
  padding: 5px 13px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  font-size: 11px;
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.7);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: rgba(255,255,255,0.6);
  color: #fff;
  background: rgba(255,255,255,0.15);
}

.btn.active {
  background: #fff;
  color: var(--navy);
  border-color: #fff;
  font-weight: 700;
}

/* ── Pagination ── */
.pag {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pag-btn {
  padding: 5px 10px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-family: 'Roboto', sans-serif;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.pag-btn:hover:not(:disabled) {
  border-color: rgba(255,255,255,0.6);
  color: #fff;
  background: rgba(255,255,255,0.15);
}

.pag-btn:disabled { opacity: 0.3; cursor: default; }

.pag-info {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border-light);
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeUp 0.8s ease 0.4s both;
}

.footer-text {
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
  margin: 0 10px;
  vertical-align: middle;
}

/* ── Back link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  margin-left: auto;
  transition: color 0.2s ease, gap 0.2s ease;
}

.back-link:hover { color: #fff; gap: 14px; }

.back-arrow {
  display: block;
  width: 20px;
  height: 1px;
  background: currentColor;
  position: relative;
  flex-shrink: 0;
  transform: scaleX(-1);
}

.back-arrow::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -3px;
  width: 7px;
  height: 7px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}

/* ── Status indicator dot ── */
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.dot-ok   { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-bad  { background: var(--bad); }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .page            { padding: 0 24px; }
  .toolbar-row     { padding-inline: 24px; }
  .topbar-badge    { display: none; }
}
