/* Provenance Check — exhibit-binder direction. Tokens mirror docs/DESIGN.md. */

:root {
  --bg: #f4efe2;
  --surface-1: #fbf8f0;
  --surface-2: #eae1cc;
  --text: #2a241c;
  --text-muted: #6e6353;
  --accent: #1f3a5f;
  --accent-support: #a9812e;
  --success: #2f6b4f;
  --warning: #b8842c;
  --danger: #b23a2e;

  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-ui: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --step--1: 0.8rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.563rem;
  --step-3: 1.953rem;
  --step-4: 2.441rem;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;

  --radius: 3px;
  --shadow-paper: 0 1px 2px rgba(42, 36, 28, 0.08), 0 4px 12px rgba(42, 36, 28, 0.1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, rgba(169, 129, 46, 0.08), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(31, 58, 95, 0.06), transparent 50%);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.wordmark__text {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0;
}

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

::selection {
  background: var(--accent-support);
  color: var(--surface-1);
}

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

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

/* ---------- App shell ---------- */

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-3) var(--space-6);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--surface-2);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  text-decoration: none;
  color: var(--text);
}

.wordmark__mark {
  width: 40px;
  height: 40px;
  flex: none;
}

.wordmark__ring-outer {
  fill: var(--surface-1);
  stroke: var(--accent);
  stroke-width: 3.5;
}

.wordmark__ring-inner {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}

.wordmark__monogram {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  fill: var(--accent);
  text-anchor: middle;
}

.wordmark__text {
  font-size: var(--step-3);
  letter-spacing: -0.01em;
}

.masthead__tagline {
  color: var(--text-muted);
  font-size: var(--step--1);
  max-width: 46ch;
}

.masthead__github {
  margin-left: auto;
  align-self: center;
  text-decoration: none;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(280px, 320px) 1fr;
  align-items: start;
  gap: var(--space-4);
}

.site-footer {
  border-top: 1px solid var(--surface-2);
  padding-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--step--1);
  max-width: 70ch;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

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

.site-footer__cross-promo a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-support);
}

.site-footer__cross-promo a:hover {
  color: #16304f;
}

@media (max-width: 768px) {
  .app {
    padding: var(--space-2) var(--space-2) var(--space-4);
  }

  .layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Learn / SEO section ---------- */

.learn {
  border-top: 1px solid var(--surface-2);
  margin-top: var(--space-4);
  padding-top: var(--space-6);
}

.learn__col {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.learn__title {
  font-size: var(--step-3);
  max-width: 30ch;
}

.learn__lede {
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: 68ch;
}

.learn h2 {
  font-size: var(--step-1);
  color: var(--accent);
}

.learn__col > h2,
.learn__col > p {
  max-width: 68ch;
}

.learn p {
  line-height: 1.65;
}

.learn__faq {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: var(--space-3);
  align-items: start;
}

.learn__faq-title {
  grid-column: 1 / -1;
}

.faq-item {
  background: var(--surface-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-paper);
  border-left: 3px solid var(--accent-support);
  padding: var(--space-3);
}

.faq-item h3 {
  font-size: var(--step-1);
  margin-bottom: var(--space-1);
}

.learn__cta {
  align-self: flex-start;
  text-decoration: none;
  margin-top: var(--space-2);
}

/* ---------- Panel (paste form) ---------- */

.panel {
  background: var(--surface-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-paper);
  padding: var(--space-3);
  position: sticky;
  top: var(--space-3);
}

.collapse-toggle {
  display: none;
}

.panel label {
  display: block;
  font-size: var(--step--1);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.panel textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.6;
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.panel textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

.panel textarea:hover {
  border-color: var(--accent-support);
}

.panel textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.15);
}

.panel__row {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.button {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: var(--radius);
  padding: var(--space-1) var(--space-3);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 150ms var(--ease-out), box-shadow 150ms var(--ease-out),
    background-color 150ms var(--ease-out), border-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.button--primary {
  background: var(--accent);
  color: var(--surface-1);
  box-shadow: var(--shadow-paper);
}

.button--primary:hover {
  background: #16304f;
}

.button--primary:active {
  transform: translateY(1px);
  box-shadow: none;
}

.button--primary:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.button--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--surface-2);
}

.button--ghost:hover {
  border-color: var(--accent-support);
  color: var(--text);
}

.button--ghost:active {
  transform: translateY(1px);
}

.button--ghost:disabled {
  color: var(--text-muted);
  border-color: var(--surface-2);
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.status-line {
  margin-top: var(--space-2);
  font-size: var(--step--1);
  color: var(--text-muted);
  min-height: 1.5em;
}

@media (max-width: 768px) {
  .panel {
    position: static;
    padding: var(--space-2);
  }

  .collapse-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--font-display);
    font-size: var(--step-1);
    font-weight: 600;
    padding: var(--space-1) 0;
    cursor: pointer;
  }

  .collapse-toggle__chevron {
    width: 16px;
    height: 16px;
    transition: transform 180ms var(--ease-out);
  }

  .collapse-toggle[aria-expanded="false"] .collapse-toggle__chevron {
    transform: rotate(-90deg);
  }

  .panel__body {
    overflow: hidden;
    transition: grid-template-rows 200ms var(--ease-out);
  }

  .panel__body[hidden] {
    display: none;
  }
}

/* ---------- Exhibit grid ---------- */

.grid-wrap {
  min-height: 60vh;
}

.exhibit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  align-content: start;
}

@media (max-width: 768px) {
  .exhibit-grid {
    grid-template-columns: 1fr;
  }
}

.exhibit-card {
  background: var(--surface-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-paper);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border: 1px solid transparent;
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.exhibit-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(42, 36, 28, 0.1), 0 8px 20px rgba(42, 36, 28, 0.12);
}

.exhibit-card--clear {
  border-left: 3px solid var(--success);
}

.exhibit-card--caution {
  border-left: 3px solid var(--warning);
}

.exhibit-card--restricted {
  border-left: 3px solid var(--danger);
}

.exhibit-card--error {
  border-left: 3px solid var(--text-muted);
}

.exhibit-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.exhibit-card__index {
  font-size: var(--step--1);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.exhibit-card__url {
  font-size: var(--step--1);
  word-break: break-all;
  color: var(--text);
}

.exhibit-card__meta {
  margin: 0;
}

.exhibit-card__meta-row {
  display: flex;
  gap: var(--space-1);
  font-size: var(--step--1);
}

.exhibit-card__meta-row dt {
  color: var(--text-muted);
}

.exhibit-card__meta-row dd {
  margin: 0;
  font-weight: 600;
}

.exhibit-card__toggle {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: var(--space-1) 0;
}

.exhibit-card__toggle:hover {
  color: #16304f;
}

.exhibit-card__clause {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: var(--space-2);
}

.exhibit-card__clause-source {
  font-size: var(--step--1);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.exhibit-card__clause-text {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--text);
  border-left: 2px solid var(--accent-support);
  padding-left: var(--space-2);
}

/* ---------- Verdict stamp ---------- */

.stamp {
  width: 56px;
  height: 56px;
  flex: none;
  transform: rotate(-8deg);
}

.stamp__ring-outer,
.stamp__ring-inner {
  fill: none;
  stroke: currentColor;
}

.stamp__ring-outer {
  stroke-width: 3;
}

.stamp__ring-inner {
  stroke-width: 1.25;
}

.stamp__label {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.02em;
  fill: currentColor;
  text-anchor: middle;
}

.stamp--clear {
  color: var(--success);
}

.stamp--caution {
  color: var(--warning);
}

.stamp--restricted {
  color: var(--danger);
}

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

.stamp--hit {
  animation: stampHit 260ms var(--ease-out);
}

@keyframes stampHit {
  0% {
    transform: rotate(-8deg) scale(1.6);
    opacity: 0;
  }
  60% {
    transform: rotate(-8deg) scale(0.94);
    opacity: 1;
  }
  100% {
    transform: rotate(-8deg) scale(1);
    opacity: 1;
  }
}

.stamp--loading {
  color: var(--text-muted);
  animation: stampPulse 1.4s ease-in-out infinite;
}

@keyframes stampPulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.8;
  }
}

/* ---------- Loading shimmer ---------- */

.exhibit-card--loading .exhibit-card__url,
.exhibit-card--loading .exhibit-card__license {
  color: transparent;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--surface-2) 25%, #f2ead3 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* ---------- Empty state ---------- */

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-3);
  min-height: 60vh;
  color: var(--text-muted);
  border: 1.5px dashed var(--surface-2);
  border-radius: var(--radius);
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 27px,
    rgba(110, 99, 83, 0.06) 28px
  );
}

.empty-state__illustration {
  width: 220px;
  height: 165px;
}

.empty-state__page {
  fill: var(--surface-1);
  stroke: var(--surface-2);
  stroke-width: 1.5;
}

.empty-state__page--back {
  fill: var(--surface-2);
}

.empty-state__rule {
  stroke: var(--surface-2);
  stroke-width: 2;
}

.empty-state__stamp {
  fill: none;
  stroke: var(--accent-support);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.empty-state__stamp-text {
  font-family: var(--font-display);
  font-size: 20px;
  fill: var(--accent-support);
  text-anchor: middle;
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--text);
}

.empty-state__body {
  max-width: 40ch;
  font-size: var(--step--1);
}
