:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-quiet: #f5f5f4;
  --ink: #0a0a0a;
  --ink-soft: #1f1f1f;
  --muted: #737373;
  --muted-soft: #a3a3a3;
  --line: rgba(10, 10, 10, 0.08);
  --line-strong: rgba(10, 10, 10, 0.14);
  --line-soft: rgba(10, 10, 10, 0.04);
  --accent: #b4451c;
  --font-serif: "Instrument Serif", ui-serif, "Times New Roman", Georgia, serif;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Monaco, monospace;
  --topbar-h: 64px;
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* ====== TOPBAR ====== */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
  color: var(--ink);
}

.brand-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-family: var(--font-serif);
  font-size: 16px;
  font-style: italic;
  line-height: 1;
}

.brand-text {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.5px;
  font-style: italic;
}

.brand-sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  justify-self: center;
  padding: 4px;
  background: var(--bg-quiet);
  border-radius: 999px;
}

.nav-item {
  height: 30px;
  min-width: 0;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 160ms ease, background 160ms ease;
}

.nav-item:hover {
  color: var(--ink);
}

.nav-item.active {
  color: var(--ink);
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.06), 0 0 0 1px var(--line);
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-badge {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
}

.nav-item.active .nav-badge {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}

.actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-self: end;
}

.text-button {
  display: inline-flex;
  height: 30px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.text-button:hover {
  background: var(--bg-quiet);
}

.reset-button {
  color: var(--muted);
}

.reset-button:hover {
  color: var(--ink);
}

/* ====== APP SHELL ====== */

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.canvas-view,
.panel-view {
  display: none;
}

.canvas-view.active,
.panel-view.active {
  display: block;
}

.canvas-view {
  position: absolute;
  inset: 0;
}

/* ====== FILTER RAIL ====== */

.filter-rail {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.search-wrap {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 260px;
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.search-wrap input::placeholder {
  color: var(--muted-soft);
  font-style: italic;
}

.chip-row {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.chip:hover {
  color: var(--ink);
  background: var(--bg-quiet);
}

.chip.active {
  color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

/* ====== CANVAS ====== */

.canvas-surface {
  position: absolute;
  inset: 0;
  top: calc(var(--topbar-h) + 56px);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background:
    radial-gradient(circle at 50% 40%, rgba(10, 10, 10, 0.03) 0.5px, transparent 0.6px);
  background-size: 28px 28px;
  background-color: var(--bg);
}

.canvas-surface:active {
  cursor: grabbing;
}

.canvas-grid {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 0 0;
  will-change: transform;
}

.site-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  width: 480px;
  user-select: none;
}

.site-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
}

.card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-quiet);
  box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow 220ms ease, transform 220ms ease;
}

.site-card:hover .card-thumb {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 1px var(--line-strong),
    0 24px 60px rgba(10, 10, 10, 0.12),
    0 6px 16px rgba(10, 10, 10, 0.06);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
  transition: transform 600ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

.site-card:hover .card-thumb img {
  transform: scale(1.02);
}

.card-hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

.card-visit {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 200ms ease, transform 200ms ease, background 160ms ease;
}

.site-card:hover .card-visit,
.site-card:focus-within .card-visit {
  opacity: 1;
  transform: translateY(0);
}

.card-visit:hover {
  background: var(--ink);
  color: var(--bg);
}

.card-visit svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.card-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.card-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.card-tags {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.card-save {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--muted-soft);
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.card-save:hover {
  color: var(--accent);
  background: var(--bg-quiet);
}

.card-save:active {
  transform: scale(0.9);
}

.card-save[aria-pressed="true"] {
  color: var(--accent);
}

.card-save svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: fill 220ms ease;
}

.card-save[aria-pressed="true"] svg {
  fill: currentColor;
}

.library-save {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 32px;
  height: 32px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 200ms ease, transform 200ms ease, background 160ms ease, color 160ms ease;
}

.library-card:hover .library-save,
.library-card[data-saved="true"] .library-save,
.library-save:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.library-save:hover {
  background: var(--ink);
  color: var(--bg);
}

.library-card[data-saved="true"] .library-save {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.96);
}

.library-thumb {
  position: relative;
}

/* ====== CANVAS FOOTNOTE ====== */

.canvas-footnote {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 22;
  transform: translateX(-50%);
  color: var(--muted-soft);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  pointer-events: none;
}

/* ====== PANEL VIEWS (Library / About) ====== */

.panel-view {
  min-height: 100vh;
  overflow-y: auto;
  padding: calc(var(--topbar-h) + 72px) 40px 80px;
  background: var(--bg);
}

.panel-head {
  max-width: 1180px;
  margin: 0 auto 64px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel-head h1 {
  max-width: 920px;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(48px, 7vw, 92px);
  font-weight: 400;
  font-style: italic;
  line-height: 0.98;
  letter-spacing: -1.5px;
  color: var(--ink);
}

.panel-lead {
  max-width: 640px;
  margin: 32px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
}

.panel-footer {
  display: flex;
  align-items: center;
  max-width: 1180px;
  margin: 96px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.panel-footer a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 160ms ease;
}

.panel-footer a:hover {
  border-color: var(--ink);
}

.panel-footer .dot {
  opacity: 0.4;
}

/* ====== LIBRARY GRID ====== */

.library-list {
  display: grid;
  max-width: 1180px;
  margin: 0 auto;
  gap: 48px 32px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.library-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  cursor: pointer;
}

.library-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-quiet);
  box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow 220ms ease, transform 220ms ease;
}

.library-card:hover .library-thumb {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 1px var(--line-strong),
    0 24px 60px rgba(10, 10, 10, 0.1),
    0 6px 16px rgba(10, 10, 10, 0.05);
}

.library-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
  transition: transform 600ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

.library-card:hover .library-thumb img {
  transform: scale(1.02);
}

.library-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 16px;
  padding: 0 2px;
}

.library-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.5px;
  margin: 0;
  grid-column: 1;
}

.library-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-soft);
  letter-spacing: 0.04em;
  grid-column: 2;
  grid-row: 1;
}

.library-domain {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: -0.01em;
}

.library-tags {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--muted-soft);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ====== ABOUT VIEW ====== */

.about-grid {
  display: grid;
  max-width: 1180px;
  margin: 0 auto 96px;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.about-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: start;
  gap: 24px;
  padding: 40px 32px 40px 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background 220ms ease;
}

.about-card:nth-child(odd) {
  border-right: 1px solid var(--line);
  padding-left: 0;
}

.about-card:nth-child(even) {
  padding-left: 32px;
}

.about-card .eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-soft);
}

.about-card h2 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.4px;
  color: var(--ink);
}

.about-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.about-section {
  max-width: 1180px;
  margin: 0 auto 96px;
}

.about-section h2 {
  margin: 8px 0 12px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 44px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.6px;
}

.about-sample-lead {
  margin-bottom: 24px;
}

.about-section .spec-example {
  min-height: 360px;
  margin: 0;
  overflow: auto;
  padding: 28px 32px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.about-contact .panel-lead {
  margin-bottom: 24px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-link {
  display: inline-flex;
  height: 36px;
  align-items: center;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.contact-link:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.empty-state {
  max-width: 540px;
  margin: 40px auto 0;
  padding: 64px 32px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
  background: var(--bg-soft);
}

.empty-title {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.4px;
  color: var(--ink);
}

.empty-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ====== DETAIL DRAWER ====== */

.detail-drawer,
.collect-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.detail-drawer.open,
.collect-modal.open {
  display: block;
}

.drawer-backdrop,
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.drawer-card {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: min(1040px, calc(100vw - 48px));
  max-height: min(880px, calc(100vh - 48px));
  transform: translate(-50%, -50%);
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 10px;
  background: var(--bg);
  box-shadow:
    0 40px 120px rgba(10, 10, 10, 0.3),
    0 12px 28px rgba(10, 10, 10, 0.12);
}

.drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  cursor: pointer;
  transition: background 160ms ease;
}

.drawer-close:hover {
  background: var(--bg);
}

.drawer-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.drawer-media {
  height: clamp(320px, 48vh, 520px);
  overflow: hidden;
  background: var(--bg-quiet);
}

.drawer-media a {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.drawer-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
}

.media-visit-badge {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--bg);
  background: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.media-visit-badge svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.drawer-body {
  padding: 40px 48px 48px;
}

.drawer-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.drawer-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.action-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: fill 220ms ease;
}

.action-button:hover {
  background: var(--bg-quiet);
}

.action-button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.action-button[aria-pressed="true"] svg {
  fill: currentColor;
}

.action-count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
  color: var(--muted);
}

.action-button[aria-pressed="true"] .action-count {
  color: var(--accent);
}

.drawer-title-row .eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--muted-soft);
}

.drawer-title-row h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 48px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.8px;
}

.visit-button {
  display: inline-flex;
  height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.visit-button:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.visit-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.drawer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 32px;
}

.drawer-tags span {
  display: inline-flex;
  height: 24px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-quiet);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 32px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.insight-card {
  padding: 24px;
  background: var(--bg);
}

.insight-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.insight-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.markdown-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}

.box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.box-actions {
  display: flex;
  gap: 4px;
}

.mini-button {
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--bg-quiet);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: -0.01em;
  transition: background 160ms ease, color 160ms ease;
}

.mini-button:hover {
  background: var(--ink);
  color: var(--bg);
}

.markdown-box pre {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  padding: 20px 22px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink-soft);
  background: var(--bg-soft);
}

/* ====== COLLECT MODAL (owner mode) ====== */

.collect-modal {
  z-index: 60;
}

.modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(540px, calc(100vw - 32px));
  gap: 18px;
  transform: translate(-50%, -50%);
  padding: 32px;
  border-radius: 10px;
  background: var(--bg);
  box-shadow:
    0 40px 120px rgba(10, 10, 10, 0.3),
    0 12px 28px rgba(10, 10, 10, 0.12);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.4px;
}

.modal-head .eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  text-transform: none;
  color: var(--muted-soft);
}

.modal-head .icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-quiet);
  cursor: pointer;
  color: var(--ink);
}

.modal-head .icon-button:hover {
  background: var(--ink);
  color: var(--bg);
}

.modal-head .icon-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.modal-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.url-drop {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 16px;
  background: var(--bg-soft);
  transition: border-color 160ms ease, background 160ms ease;
}

.url-drop > span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.url-drop input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: -0.01em;
}

.url-drop input::placeholder {
  color: var(--muted-soft);
}

.url-drop.dragging {
  border-color: var(--ink);
  background: var(--bg);
}

.intake-preview {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: start;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.preview-shot {
  display: grid;
  width: 140px;
  aspect-ratio: 16 / 10;
  place-items: center;
  overflow: hidden;
  border-radius: 4px;
  color: var(--muted-soft);
  background: var(--bg-quiet);
}

.preview-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.preview-shot svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.preview-copy {
  min-width: 0;
}

.preview-title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.preview-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.preview-tags,
.pipeline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.preview-tags span {
  height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg-quiet);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 500;
}

.pipeline-list {
  margin-top: 4px;
}

.pipeline-list span {
  display: inline-flex;
  height: 24px;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-quiet);
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  transition: background 220ms ease, color 220ms ease, transform 220ms ease;
}

.pipeline-list span::before {
  content: "○";
  font-size: 10px;
}

.pipeline-list span.running {
  background: var(--bg);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  animation: pipeline-pulse 1.2s ease-in-out infinite;
}

.pipeline-list span.running::before {
  content: "◐";
  animation: pipeline-spin 1.2s linear infinite;
}

.pipeline-list span.done {
  background: var(--ink);
  color: var(--bg);
}

.pipeline-list span.done::before { content: "●"; }

.pipeline-list span.error {
  background: var(--accent);
  color: var(--bg);
}

.pipeline-list span.error::before { content: "✕"; }

@keyframes pipeline-pulse {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-1px); }
}

@keyframes pipeline-spin {
  to { transform: rotate(360deg); }
}

.preview-palette {
  display: flex;
  gap: 4px;
  margin: 8px 0 6px;
  min-height: 0;
}

.preview-palette:empty { display: none; }

.palette-swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.08);
}

.spec-hint {
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--bg-quiet);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

.spec-hint.hidden { display: none; }

.submit-button {
  height: 44px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: opacity 160ms ease, transform 160ms ease;
}

.submit-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.submit-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* ====== TOAST ====== */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%) translateY(12px);
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--bg);
  background: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ====== RESPONSIVE ====== */

@media (max-width: 900px) {
  .library-list {
    grid-template-columns: 1fr;
  }

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

  .about-card:nth-child(odd) {
    border-right: 0;
    padding-right: 0;
  }

  .about-card:nth-child(even) {
    padding-left: 0;
  }
}

@media (max-width: 760px) {
  html,
  body {
    overflow: auto;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 16px;
    height: 56px;
    --topbar-h: 56px;
  }

  .nav-pill {
    grid-column: 1 / -1;
    justify-self: stretch;
    margin-top: 8px;
  }

  .actions {
    justify-self: end;
  }

  .brand-sub {
    display: none;
  }

  .brand-name {
    font-size: 22px;
  }

  .filter-rail {
    top: 56px;
    padding: 0 16px;
    gap: 14px;
    height: 52px;
  }

  .search-wrap {
    min-width: 0;
    flex: 1;
  }

  .canvas-surface {
    top: calc(56px + 52px);
  }

  .site-node {
    width: 300px;
  }

  .card-title {
    font-size: 18px;
  }

  .panel-view {
    padding: 120px 20px 60px;
  }

  .panel-head {
    margin-bottom: 40px;
  }

  .panel-head h1 {
    font-size: clamp(40px, 9vw, 56px);
    letter-spacing: -1px;
  }

  .panel-lead {
    font-size: 15px;
    margin-top: 24px;
  }

  .about-section h2 {
    font-size: 32px;
  }

  .drawer-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .drawer-media {
    height: 240px;
  }

  .drawer-body {
    padding: 28px 24px 32px;
  }

  .drawer-title-row {
    flex-direction: column;
    align-items: start;
    gap: 12px;
  }

  .drawer-title-row h2 {
    font-size: 36px;
  }

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

  .intake-preview {
    grid-template-columns: 1fr;
  }

  .preview-shot {
    width: 100%;
  }
}
