/* ============================================================
   Desynthetic — vintage "paper & ink" editorial theme
   ============================================================ */

@font-face {
  font-family: 'Fraunces';
  src: url('../vendor/fonts/fraunces.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('../vendor/fonts/dm-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('../vendor/fonts/dm-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

:root {
  --paper: #efe6d0;
  --paper-2: #e7dcc0;
  --paper-3: #ddd0ad;
  --ink: #211e18;
  --ink-soft: #4a4438;
  --muted: #837a62;
  --accent: #c0531f;
  --accent-deep: #993d13;
  --line: #2a261d;
  --serif: 'Fraunces', 'Hoefler Text', Georgia, serif;
  --mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* {
  box-sizing: border-box;
}

/* the hidden attribute must win over component display rules (e.g. .controls flex) */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(120% 90% at 12% -10%, rgba(192, 83, 31, 0.1), transparent 55%),
    radial-gradient(100% 80% at 110% 10%, rgba(40, 60, 80, 0.07), transparent 50%),
    radial-gradient(140% 120% at 50% 120%, rgba(33, 30, 24, 0.1), transparent 60%);
  background-attachment: fixed;
}

/* Paper grain — feTurbulence noise overlay, no images, fully offline */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Faint second pass for a softer "fibre" speckle */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.18' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

/* ---------- Layout ---------- */
main {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.5rem 1rem;
}

/* ---------- Brand block ---------- */
.brand {
  padding-top: 1.5rem;
  animation: rise 0.6s 0.02s both;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-optical-sizing: auto;
  font-variation-settings:
    'opsz' 144,
    'SOFT' 0,
    'WONK' 0;
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  line-height: 0.92;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.tagline {
  margin: 0.55rem 0 0;
  display: inline-block;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  border-top: 2px solid var(--accent);
  padding-top: 0.4rem;
}

/* ---------- Drop zone ---------- */
.drop {
  position: relative;
  margin: 1.8rem 0 0;
  padding: 2.8rem 1.5rem;
  text-align: center;
  background: var(--paper-2);
  border: 2.5px dashed var(--line);
  border-radius: 14px;
  transition:
    border-color 0.18s,
    background 0.18s,
    transform 0.18s;
  animation: rise 0.6s 0.18s both;
}
.drop.over {
  border-color: var(--accent);
  border-style: solid;
  background: var(--paper-3);
  transform: translateY(-2px);
}
.drop-hint {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink);
}
.drop-or {
  margin: 0.4rem 0 1rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}
.drop-or span {
  padding: 0 0.6rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--accent);
  border: 2px solid var(--line);
  border-radius: 9px;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--line);
  transition:
    transform 0.1s,
    box-shadow 0.1s,
    background 0.15s;
}
.btn:hover {
  background: var(--accent-deep);
}
.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--line);
}

.btn-ghost {
  color: var(--ink);
  background: var(--paper);
}
.btn-ghost:hover {
  background: var(--paper-3);
}
.btn-tag {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  padding: 0.05rem 0.4rem;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  opacity: 0.85;
}

.actions {
  margin: 1.5rem 0 0;
  animation: rise 0.5s both;
}

/* ---------- Results / cards ---------- */
.results {
  list-style: none;
  padding: 0;
  margin: 1.8rem 0 0;
  display: grid;
  gap: 1rem;
}
.card {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 1.1rem;
  align-items: center;
  padding: 0.95rem 1.1rem;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: 4px 4px 0 rgba(33, 30, 24, 0.13);
  animation: card-in 0.4s both;
}
.card img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: var(--paper-3);
}
.card .name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
  word-break: break-word;
}
.card .found {
  margin: 0.45rem 0 0;
  line-height: 1.5;
}

.card.skipped {
  background: var(--paper);
  border-style: dashed;
  box-shadow: none;
  opacity: 0.72;
}
.card.skipped .found {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Metadata tags (ink-stamped chips) ---------- */
.tag {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid rgba(42, 38, 29, 0.45);
  border-radius: 6px;
  padding: 0.12rem 0.5rem 0.12rem 0.45rem;
  margin: 0.2rem 0.25rem 0 0;
}
.tag::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-right: 0.45rem;
  background: var(--accent);
  align-self: center;
}

/* ---------- Colophon ---------- */
.colophon {
  max-width: 820px;
  margin: 2.5rem auto 0;
  padding: 1rem 1.5rem 2.5rem;
  border-top: 2px solid var(--line);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Motion ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 560px) {
  .card {
    grid-template-columns: 48px 1fr;
  }
  .card img {
    width: 48px;
    height: 48px;
  }
  .card .btn {
    grid-column: 2;
    justify-self: start;
    margin-top: 0.3rem;
  }
}

/* ---------- Mode switch ---------- */
.modes {
  display: flex;
  gap: 0.4rem;
  margin: 1.6rem 0 0;
}
.mode-btn {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 2px solid var(--line);
  border-radius: 9px;
}
.mode-btn.is-active {
  background: var(--accent);
  color: var(--paper);
  box-shadow: 3px 3px 0 var(--line);
}
.mode-desc {
  margin: 0.8rem 0 0;
  color: var(--ink-soft);
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: center;
  margin: 1.2rem 0 0;
  font-family: var(--mono);
  font-size: 0.82rem;
}
.controls select {
  font: inherit;
  padding: 0.35rem 0.5rem;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 7px;
}
.controls .check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.controls .check input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex: none;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.controls .check input[type='checkbox']:checked {
  background: var(--accent);
}
.controls .check input[type='checkbox']:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.controls .check input[type='checkbox']:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.card.report {
  grid-template-columns: 180px 1fr;
  align-items: start;
}
.card.report .residual {
  margin-top: 0.6rem;
}
.score-head {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.05;
}
.cat {
  margin: 0.5rem 0 0;
}
.cat-bar {
  height: 8px;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.cat-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.cat-reasons {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.residual {
  width: 100%;
  max-width: 220px;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  image-rendering: pixelated;
}
.verify-link {
  color: var(--accent-deep);
}

/* ---------- SEO / content section ---------- */
.seo {
  margin: 3rem 0 0;
  padding-top: 2.5rem;
  border-top: 2px solid var(--line);
}
.seo > h2:first-child {
  margin-top: 0;
}
.seo-intro {
  font-size: 1.02rem;
  color: var(--ink-soft);
}
.seo h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 2rem 0 0.6rem;
}
.seo details {
  border-top: 1px solid var(--line);
  padding: 0.7rem 0;
}
.seo summary {
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}
.seo summary::-webkit-details-marker {
  display: none;
}
.seo summary::before {
  content: '+';
  color: var(--accent);
  font-weight: 700;
  margin-right: 0.6rem;
}
.seo details[open] summary::before {
  content: '–';
}
.seo details p {
  margin: 0.6rem 0 0;
  color: var(--ink-soft);
}

/* ---------- Status badge (what was done) ---------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--accent);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 0.12rem 0.5rem;
  margin: 0 0 0.35rem;
}
.status::before {
  content: '✓';
  font-weight: 700;
}

.colophon a {
  color: var(--accent-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}
.colophon a:hover {
  color: var(--accent);
}
