/* ============================================================
   LOUPE — design tokens
   Light table / contact sheet vocabulary: paper, grease pencil,
   safelight amber, hairline grid. No dark mode by design.
   ============================================================ */

@font-face {
  font-family: 'Space Grotesk';
  src: local('Space Grotesk');
}

:root {
  /* color */
  --paper: #F4F5F0;
  --paper-raised: #FFFFFF;
  --ink: #15171B;
  --ink-soft: #3A3D42;
  --ash: #6B6F76;
  --line: #DBDCD4;
  --line-strong: #C7C8C0;
  --loupe-red: #E14F3A;
  --loupe-red-soft: #F7DAD3;
  --safelight: #F2A93B;
  --safelight-soft: #FBE8C7;
  --good: #3F7A53;
  --good-soft: #DCEBE0;

  /* type */
  --font-display: 'Space Grotesk', 'Archivo', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', monospace;

  /* scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.875rem;
  --space-4: 1.25rem;
  --space-5: 2rem;
  --space-6: 3.25rem;
  --space-7: 5rem;

  --radius-sm: 4px;
  --radius-md: 10px;
  --container: 1140px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0; }

button {
  font-family: var(--font-body);
  cursor: pointer;
}

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

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

/* ---------- layout shells ---------- */

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(244, 245, 240, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  max-width: var(--container);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

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

.nav-links {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.nav-link {
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ash);
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
}

.nav-link.is-active,
.nav-link:hover {
  color: var(--ink);
  border-bottom-color: var(--loupe-red);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn-primary:hover { background: var(--loupe-red); border-color: var(--loupe-red); }

.btn-accent {
  background: var(--loupe-red);
  color: #fff;
  border-color: var(--loupe-red);
}

.btn-accent:hover { background: #c43e2c; border-color: #c43e2c; }

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

.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.85rem; }

/* ---------- eyebrow / label / badge ---------- */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ash);
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  padding: 0.18rem 0.5rem;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  white-space: nowrap;
}

.badge-good { background: var(--good-soft); color: var(--good); }
.badge-soft { background: var(--safelight-soft); color: #9a6611; }
.badge-bad { background: var(--loupe-red-soft); color: var(--loupe-red); }
.badge-neutral { background: var(--line); color: var(--ink-soft); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: var(--space-7);
  padding: var(--space-5) 0;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.site-footer p {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ash);
}

/* ============================================================
   HOME
   ============================================================ */

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--space-6);
  align-items: center;
  padding: var(--space-7) 0 var(--space-6);
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.04;
}

.hero h1 .accent { color: var(--loupe-red); }

.hero p.lede {
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 34ch;
  margin-top: var(--space-4);
}

.hero-ctas {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

/* light-table demo graphic */

.light-table {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: 0 1px 0 var(--line);
}

.light-table-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.frame {
  position: relative;
  aspect-ratio: 4/5;
  background: linear-gradient(135deg, #e7e8e2, #d8dad2);
  border: 1px solid var(--ink);
  overflow: hidden;
}

.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.frame .frame-number {
  position: absolute;
  bottom: 4px;
  left: 5px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: rgba(21,23,27,0.55);
  z-index: 2;
}

.frame.is-keeper { z-index: 2; }

.circle-mark {
  position: absolute;
  inset: -10%;
  pointer-events: none;
}

.circle-mark path {
  fill: none;
  stroke: var(--loupe-red);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: draw-circle 0.9s ease forwards 0.4s;
}

@keyframes draw-circle {
  to { stroke-dashoffset: 0; }
}

.rolls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.roll-card {
  border: 1px solid var(--line);
  background: var(--paper-raised);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.roll-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}

.roll-card .roll-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ash);
  letter-spacing: 0.06em;
  display: flex;
  justify-content: space-between;
}

.roll-card h3 { font-size: 1.4rem; }

.roll-card p { color: var(--ink-soft); font-size: 0.95rem; }

.roll-card .roll-cta {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.roll-card .roll-cta svg { transition: transform 0.15s ease; }
.roll-card:hover .roll-cta svg { transform: translateX(3px); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: var(--space-6); }
  .rolls { grid-template-columns: 1fr; }
}

/* ============================================================
   SHARED TOOL HEADER (photos.html / notes.html)
   ============================================================ */

.tool-header {
  padding: var(--space-5) 0 var(--space-4);
  border-bottom: 1px solid var(--line);
}

.tool-header .eyebrow { margin-bottom: var(--space-2); }
.tool-header h1 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); }
.tool-header p { color: var(--ink-soft); margin-top: var(--space-2); max-width: 56ch; }

.tool-body { padding: var(--space-5) 0 var(--space-7); }

/* mode toggle (auto-scan / tap-to-scan) */

.mode-toggle {
  display: inline-flex;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.mode-toggle button {
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ash);
}

.mode-toggle button.is-active {
  background: var(--ink);
  color: var(--paper);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.scan-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ash);
}

.scan-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line-strong);
}

.scan-indicator.is-live .scan-dot {
  background: var(--safelight);
  animation: pulse-dot 1.1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242,169,59,0.5); }
  50% { box-shadow: 0 0 0 5px rgba(242,169,59,0); }
}

/* dropzone */

.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.is-dragover {
  border-color: var(--loupe-red);
  background: var(--loupe-red-soft);
}

.dropzone h3 { font-size: 1.1rem; margin-bottom: var(--space-1); }
.dropzone p { color: var(--ash); font-size: 0.9rem; margin-bottom: var(--space-3); }

/* ---------- top picks rail ---------- */

.picks-rail {
  margin: var(--space-5) 0;
}

.picks-rail h2 {
  font-size: 1rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: var(--space-3);
}

.picks-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

.pick-card {
  position: relative;
  border: 1px solid var(--ink);
  background: var(--paper-raised);
}

.pick-card img { aspect-ratio: 4/5; object-fit: cover; }

.pick-rank {
  position: absolute;
  top: 6px; left: 6px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 6px;
}

/* ---------- contact sheet grid ---------- */

.sheet-section {
  margin-top: var(--space-6);
}

.sheet-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-2);
}

.sheet-section-title h2 { font-size: 1.1rem; }
.sheet-section-title .count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ash); }

.contact-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.shot {
  position: relative;
  background: var(--paper-raised);
  border: 1px solid var(--line);
}

.shot.is-keeper { border-color: var(--ink); }

.shot-image-wrap {
  position: relative;
  aspect-ratio: 4/5;
  overflow: hidden;
  background: #e7e8e2;
}

.shot-image-wrap img { width: 100%; height: 100%; object-fit: cover; }

.shot-meta {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.shot-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ash);
}

.shot-badges { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.shot .circle-mark { inset: -6%; }

.cluster {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  background: rgba(255,255,255,0.5);
}

.cluster-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ash);
  margin-bottom: var(--space-2);
  display: block;
}

.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--space-2);
}

.empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--ash);
}

.empty-state svg { margin: 0 auto var(--space-3); display: block; }

/* progress bar for batch scanning */

.scan-progress {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin: var(--space-3) 0;
  display: none;
}

.scan-progress.is-active { display: block; }

.scan-progress-bar {
  height: 100%;
  background: var(--safelight);
  width: 0%;
  transition: width 0.2s ease;
}

/* ============================================================
   NOTES SCANNER
   ============================================================ */

.notes-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}

.pane {
  border: 1px solid var(--line);
  background: var(--paper-raised);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.pane-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scan-preview {
  position: relative;
  border: 1px solid var(--line-strong);
  overflow: hidden;
  background: #ececea;
}

.scan-preview img { width: 100%; display: block; }

.scan-line {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--safelight), transparent);
  box-shadow: 0 0 14px 2px rgba(242,169,59,0.6);
  display: none;
}

.scan-line.is-active {
  display: block;
  animation: scan-sweep 1.6s linear infinite;
}

@keyframes scan-sweep {
  0% { top: 0; }
  100% { top: calc(100% - 3px); }
}

.clean-doc {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.65;
  min-height: 200px;
}

.clean-doc h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 1.1em 0 0.4em;
}

.clean-doc h2:first-child { margin-top: 0; }

.clean-doc ul { margin: 0.4em 0 0.8em; padding-left: 1.3em; }
.clean-doc li { margin-bottom: 0.3em; }
.clean-doc p { margin: 0 0 0.8em; }

.clean-doc .placeholder {
  color: var(--ash);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.export-row {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .notes-layout { grid-template-columns: 1fr; }
}

/* hidden file input helper */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* install banner */
.install-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin: var(--space-4) 0;
}

.install-banner.is-visible { display: flex; }
.install-banner p { font-size: 0.88rem; }
.install-banner .btn { border-color: var(--paper); color: var(--paper); }
.install-banner .btn:hover { background: var(--paper); color: var(--ink); }
