/* DebateGrader — shared design system
   Pulled directly from PRD v0.1 so the prototype reads the same. */

:root {
  --paper:   #f3eee2;
  --paper-2: #ece5d3;
  --paper-3: #f8f5ee;
  --ink:     #1a1612;
  --ink-2:   #4a4138;
  --ink-3:   #7d7268;
  --rule:    #c9bfa8;
  --accent:  #7a1f1f;   /* burgundy */
  --accent-2:#a23939;
  --aff:     #7a1f1f;   /* speaker A */
  --neg:     #1f4d3a;   /* speaker B */
  --flag:    #6b5e2a;
  --ok:      #065f46;
  --warn:    #92400e;
  --warn-bg: #fef3c7;
  --ok-bg:   #ecfdf5;
  --serif:   'Fraunces', Georgia, "Times New Roman", serif;
  --mono:    'JetBrains Mono', ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans:    ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ------------------------------------------------------------- */
/* Site chrome                                                   */
/* ------------------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.site-header .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand .mark {
  display: inline-block;
  width: 12px; height: 12px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateY(1px);
}
.brand .dot { color: var(--accent); }

nav.site-nav {
  display: flex;
  gap: 26px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
nav.site-nav a { color: var(--ink-2); }
nav.site-nav a.cta {
  color: var(--paper);
  background: var(--accent);
  padding: 6px 12px;
  border-radius: 3px;
}
nav.site-nav a.cta:hover { background: #5a1414; text-decoration: none; }
nav.site-nav a[aria-current="page"] { color: var(--ink); border-bottom: 2px solid var(--accent); padding-bottom: 2px; }

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 80px;
  padding: 24px 28px 36px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}
.site-footer a { color: var(--ink-3); }

/* ------------------------------------------------------------- */
/* Layout                                                        */
/* ------------------------------------------------------------- */
.page { max-width: 1080px; margin: 0 auto; padding: 56px 28px 32px; }
.page.narrow { max-width: 720px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: 52px;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: var(--ink);
}
@media (max-width: 720px) { h1 { font-size: 38px; } }

h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-variation-settings: "opsz" 72;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 48px 0 14px;
  color: var(--ink);
  position: relative;
  padding-top: 18px;
}
h2::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 48px; height: 2px;
  background: var(--accent);
}

h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  margin: 28px 0 8px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
h3 .num {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 13px;
  color: var(--accent);
  margin-right: 10px;
  letter-spacing: 0.05em;
}

p { margin: 0 0 14px; color: var(--ink-2); }
p strong, p b { color: var(--ink); font-weight: 600; }

.lede { font-size: 19px; line-height: 1.5; color: var(--ink-2); }

code, .mono {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--ink);
  border: 1px solid var(--rule);
}
.flow {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  background: var(--paper-2);
  border-left: 2px solid var(--accent);
  padding: 18px 22px;
  margin: 18px 0 28px;
  color: var(--ink);
  white-space: pre;
  overflow-x: auto;
}

/* ------------------------------------------------------------- */
/* Buttons                                                       */
/* ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--paper);
  border: none;
  padding: 12px 22px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover:not(:disabled) { background: #5a1414; text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { background: #b9a8a8; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn.ghost:hover { background: rgba(122,31,31,.06); }
.btn.sm { padding: 7px 14px; font-size: 14px; }

/* ------------------------------------------------------------- */
/* Badges                                                        */
/* ------------------------------------------------------------- */
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--ink-2);
  vertical-align: middle;
}
.badge.ok       { background: var(--ok-bg);   color: var(--ok);   border-color: #a7f3d0; }
.badge.prov     { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }
.badge.flag     { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.badge.unverified { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }

/* ------------------------------------------------------------- */
/* Cards / lists                                                 */
/* ------------------------------------------------------------- */
.card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 18px 20px;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.card .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.card h4 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  margin: 0 0 6px;
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.card h4 a { color: var(--ink); }
.card h4 a:hover { color: var(--accent); }
.card .roles {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px;
  color: var(--ink-2);
  margin-bottom: 10px;
}
.card .gap {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
}
.card .gap b { color: var(--ink); }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 18px 0 32px;
}
@media (max-width: 720px) { .cards-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- */
/* Run page (mirrors the four-part thread structure)             */
/* ------------------------------------------------------------- */
.run-header {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 22px 0 18px;
  margin-bottom: 32px;
}
.run-header .where {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.run-header h1 {
  font-size: 36px;
  margin-bottom: 6px;
}
.run-header .source {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
}
.run-header .source b { color: var(--ink-2); font-weight: 500; }

.part {
  border-left: 2px solid var(--rule);
  padding: 6px 0 6px 22px;
  margin: 28px 0;
  position: relative;
}
.part .label {
  position: absolute;
  left: -2px; top: 0;
  width: 24px; height: 24px;
  background: var(--accent);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 0 4px 0;
  transform: translateX(-12px);
}
.part h3 { margin-top: 0; padding-top: 0; }

.speaker-block {
  margin: 14px 0;
  padding: 14px 18px;
  background: #fff;
  border-left: 3px solid var(--rule);
  border-radius: 0 5px 5px 0;
}
.speaker-block.a { border-left-color: var(--aff); }
.speaker-block.b { border-left-color: var(--neg); }
.speaker-block .who {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.speaker-block .who b { color: var(--ink); font-weight: 500; }
.speaker-block .premises {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-2);
}
.speaker-block .premises p { margin: 0 0 6px; }

.rubric-applied {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 16px 18px;
  margin: 14px 0;
}
.rubric-applied .header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.rubric-applied .header .id {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
}
.rubric-applied ol {
  margin: 6px 0 8px 22px;
  padding: 0;
  color: var(--ink-2);
}
.rubric-applied .ref {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.scoretable {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 5px;
  overflow: hidden;
  margin: 14px 0;
}
.scoretable th, .scoretable td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--paper-2);
  font-size: 15px;
  vertical-align: top;
}
.scoretable th {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  background: var(--paper-3);
  font-weight: 500;
}
.scoretable th.r, .scoretable td.r { text-align: right; }
.scoretable td.crit { color: var(--ink); font-weight: 500; }
.scoretable td.s { font-family: var(--mono); font-size: 16px; color: var(--ink); width: 60px; }
.scoretable td.s.win { color: var(--ok); font-weight: 600; }
.scoretable .why {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-3);
  padding-top: 6px;
}
.scoretable tr.j td { padding-top: 0; padding-bottom: 14px; border-bottom: 1px solid var(--paper-2); }
.scoretable tr:last-child td { border-bottom: none; }

.synthesis {
  background: var(--paper-2);
  border-left: 3px solid var(--accent);
  padding: 16px 22px;
  border-radius: 0 5px 5px 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  margin: 14px 0;
}

/* ------------------------------------------------------------- */
/* Form                                                          */
/* ------------------------------------------------------------- */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.field .help {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-3);
  margin-top: 6px;
}
.field .help a { color: var(--accent); }
input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 11px 13px;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
textarea {
  font-family: var(--mono);
  font-size: 13px;
  min-height: 220px;
  resize: vertical;
  line-height: 1.55;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 11px 14px;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 16px;
}
.notice {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  color: var(--ink-2);
  padding: 11px 14px;
  border-radius: 4px;
  font-size: 13.5px;
  font-family: var(--serif);
  font-style: italic;
  margin-bottom: 16px;
}

.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Pipeline progress (submit page) */
.pipeline {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}
.pipeline .step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
}
.pipeline .step .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--rule);
  flex-shrink: 0;
}
.pipeline .step.active { color: var(--ink); }
.pipeline .step.active .dot { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.pipeline .step.done { color: var(--ink-2); }
.pipeline .step.done .dot { background: var(--ok); }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

/* ------------------------------------------------------------- */
/* Audit log                                                     */
/* ------------------------------------------------------------- */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 14px;
}
.audit-table th, .audit-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--paper-2);
  text-align: left;
  vertical-align: top;
  color: var(--ink-2);
}
.audit-table th {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--paper-3);
  font-weight: 500;
}
.audit-table td a { color: var(--accent); }
.audit-table td.id { color: var(--ink); }

/* ------------------------------------------------------------- */
/* Misc                                                          */
/* ------------------------------------------------------------- */
.divider { height: 1px; background: var(--rule); margin: 36px 0; }
.muted { color: var(--ink-3); }
.right { text-align: right; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
hr { border: none; border-top: 1px solid var(--rule); margin: 32px 0; }
