/* Built with Rust — hand-written, no build step. Light/dark via data-theme. */
:root {
  --bg: #ffffff;
  --bg-soft: #fafaf9;
  --fg: #1c1917;
  --fg-muted: #78716c;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --accent: #b7410e;
  --accent-fg: #ffffff;
  --accent-soft: #fdf1ea;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.04);
  --radius: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c0a09;
  --bg-soft: #141211;
  --fg: #f5f5f4;
  --fg-muted: #a8a29e;
  --border: #292524;
  --border-strong: #3f3a37;
  --accent: #e8794a;
  --accent-fg: #0c0a09;
  --accent-soft: #2a1a12;
  --card: #141211;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--fg-muted); }
.small { font-size: 13px; }
.icon { width: 1em; height: 1em; vertical-align: -0.15em; flex: none; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 24px; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand-icon { width: 20px; height: 20px; color: var(--accent); }
.nav { display: flex; gap: 20px; font-size: 14px; color: var(--fg-muted); }
.nav a:hover { color: var(--fg); text-decoration: none; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-mini input { width: 160px; height: 32px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 13px; background: var(--bg-soft); color: var(--fg); }
.search-mini input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--fg); cursor: pointer; }
.icon-btn:hover { background: var(--bg-soft); }
.icon-sun { display: none; } .icon-moon { display: block; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; font-size: 14px; font-weight: 500; background: var(--card); color: var(--fg); cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--bg-soft); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-small { height: 30px; font-size: 13px; }

/* Hero */
.hero { text-align: center; padding: 72px 0 40px; background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 22px 22px; background-position: center; -webkit-mask-image: radial-gradient(ellipse at center, #000 40%, transparent 75%); mask-image: radial-gradient(ellipse at center, #000 40%, transparent 75%); }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 500; color: var(--fg-muted); border: 1px solid var(--border); background: var(--card); padding: 3px 10px; border-radius: 999px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(34px, 5.5vw, 52px); font-weight: 600; letter-spacing: -0.02em; }
.lede { font-size: 17px; color: var(--fg-muted); max-width: 620px; margin: 16px auto 0; }
.lede strong { color: var(--fg); font-weight: 600; }
.search { display: flex; gap: 8px; max-width: 520px; margin: 28px auto 0; }
.search input { flex: 1; height: 40px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 14px; font: inherit; font-size: 14px; background: var(--card); color: var(--fg); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.search .btn { height: 40px; }

/* Sections */
.section-label { text-align: center; font-size: 13px; color: var(--fg-muted); margin-bottom: 14px; }
.section-label a { text-decoration: underline; text-underline-offset: 3px; }
.listing { padding: 16px 0 64px; }
.listing-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.listing-head h1, .listing-head h2 { font-size: 20px; font-weight: 600; }
.category-links { margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip { font-size: 13px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--fg-muted); background: var(--card); }
.chip:hover { text-decoration: none; color: var(--fg); border-color: var(--border-strong); }
.chip.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .count { margin-left: 5px; opacity: .6; font-variant-numeric: tabular-nums; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.card:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); }
.card-featured { --fg-muted: #695044; background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
:root[data-theme="dark"] .card-featured { --fg-muted: #d6bfb2; }
.card-featured:hover { border-color: var(--accent); }
.card-compact { gap: 4px; }
.card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-head h3 { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: var(--bg-soft); flex: none; }
.logo-lg { width: 56px; height: 56px; border-radius: 12px; }
.badge-verified { color: #d97706; display: inline-flex; }
.badge-verified .icon { width: 16px; height: 16px; }
.tagline { color: var(--fg-muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.stats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.stats li { display: flex; align-items: center; gap: 8px; }
.stats li > span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-muted); }
.stats .leader { flex: 1; border-bottom: 1px dotted var(--border-strong); height: 1px; margin-top: 2px; }
.stats .value { font-weight: 500; font-variant-numeric: tabular-nums; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--fg-muted); font-family: var(--mono); }
.pill-featured { background: var(--accent); color: var(--accent-fg); font-weight: 600; flex-shrink: 0; border-color: transparent; font-family: var(--font); margin-left: auto; }
.empty { color: var(--fg-muted); padding: 40px 0; text-align: center; }

/* Project page */
.project { padding: 40px 0 64px; }
.project-head { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.project-head h1 { font-size: 28px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.project-head .pill-featured { margin-left: 0; }
.tagline-lg { color: var(--fg-muted); font-size: 16px; margin-top: 4px; }
.project-actions { display: flex; gap: 8px; }
.project-body { display: grid; grid-template-columns: 1fr 280px; gap: 40px; padding-top: 28px; }
.prose p { margin-bottom: 1em; font-size: 16px; }
.project-meta { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--card); align-self: start; }
.project-meta dl { margin: 0 0 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.project-meta dt { color: var(--fg-muted); }
.project-meta dd { margin: 0; text-align: right; font-weight: 500; }
.project-meta h3 { font-size: 13px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
.project-meta .btn { margin-top: 16px; width: 100%; justify-content: center; }
.related { margin-top: 48px; }
.related h2 { font-size: 20px; font-weight: 600; margin-bottom: 14px; }

/* Generic pages & forms */
.page { padding: 56px 0 64px; }
.page h1 { font-size: 32px; font-weight: 600; }
.page .lede { margin-left: 0; }
.page .grid { margin-top: 28px; }
.narrow { max-width: 560px; }
.form { display: flex; flex-direction: column; gap: 16px; margin-top: 28px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.form input, .form textarea, .form select { font: inherit; font-size: 14px; font-weight: 400; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--card); color: var(--fg); width: 100%; }
.form input:focus, .form textarea:focus, .form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.form .btn { align-self: flex-start; }
.req { color: var(--accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-top: 20px; }
.page > .btn { margin-top: 24px; }
.pricing { margin-top: 24px; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; background: var(--card); }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.checks li::before { content: "✓"; color: var(--accent); font-weight: 700; margin-right: 10px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 36px 0; font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 32px; }
.footer-inner .muted { max-width: 360px; margin-top: 10px; }
.footer-links { display: flex; flex-direction: column; gap: 6px; color: var(--fg-muted); }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-body { grid-template-columns: 1fr; }
  .nav { display: none; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .search-mini { display: none; }
  .hero { padding-top: 48px; }
  .project-head { grid-template-columns: auto 1fr; }
  .project-actions { grid-column: 1 / -1; }
  .footer-inner { flex-direction: column; }
}

/* Newsletter: static markup keeps the directory's pre-compressed hot path. */
.newsletter { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; margin: 0 0 36px; padding: 28px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.newsletter h2 { font-size: 22px; margin-bottom: 10px; }
.newsletter p { line-height: 1.5; }
.newsletter-form { min-width: 0; }
.newsletter-form label { display: block; font-weight: 500; margin-bottom: 6px; }
.newsletter-fields { display: flex; gap: 8px; margin-bottom: 8px; }
.newsletter-fields input { min-width: 0; width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; background: var(--card); color: var(--fg); }
.newsletter-fields .btn { height: 42px; }
.newsletter-fields input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 720px) { .newsletter { grid-template-columns: 1fr; gap: 20px; padding: 20px; } }
@media (max-width: 380px) { .newsletter-fields { flex-direction: column; } .newsletter-fields .btn { justify-content: center; } }

/* Server-rendered directory controls: usable with keyboard and without JS. */
#projects { scroll-margin-top: 76px; }
.browse { padding: 20px; margin-bottom: 20px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-soft); }
.browse-primary, .browse-secondary { display: grid; grid-template-columns: 2fr 1fr 1.3fr; gap: 14px; }
.browse-secondary { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 14px 0; }
.browse label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; font-weight: 600; }
.browse input[type="search"], .browse select { width: 100%; min-width: 0; height: 42px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--card); color: var(--fg); font: inherit; font-size: 14px; }
.browse :is(input, select, button, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.browse-more { margin-top: 16px; }
.browse-more summary { cursor: pointer; font-size: 14px; font-weight: 500; padding: 4px 0; }
.browse .browse-check { flex-direction: row; align-items: center; gap: 8px; }
.browse-check input { accent-color: var(--accent); width: 18px; height: 18px; }
.browse-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.browse-actions .btn { height: 42px; }
.browse-results { font-size: 14px; margin-bottom: 14px; color: var(--fg-muted); }
.browse-results strong { color: var(--fg); }
.browse-note { margin: -6px 0 18px; }
.browse-empty { padding: 24px; text-align: center; background: var(--bg-soft); border-radius: var(--radius); }
.browse-empty a { text-decoration: underline; }
@media (max-width: 800px) {
  .browse-primary, .browse-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .browse-search { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .browse { padding: 14px; }
  .browse-primary, .browse-secondary { grid-template-columns: minmax(0, 1fr); }
  .browse-actions { align-items: flex-start; flex-direction: column; }
  .listing-head { flex-wrap: wrap; }
}

/* Task guidance belongs to the canonical category, not filtered result sets. */
.guide-intro { max-width: 76ch; color: var(--fg-muted); margin: 0 0 10px; }
.guide-jump { margin: 0 0 24px; }
.workflow-guides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
.workflow-guides a { display: block; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft); }
.workflow-guides strong { display: block; text-decoration: underline; text-underline-offset: 3px; }
.workflow-guides span { display: block; color: var(--fg-muted); margin-top: 6px; font-size: 14px; }
@media (max-width: 600px) {
  .workflow-guides { grid-template-columns: minmax(0, 1fr); }
}
.task-guide { padding: 32px 0 48px; border-top: 1px solid var(--border); scroll-margin-top: 90px; }
.task-guide h2 { margin: 0 0 8px; }
.fish-context > * { max-width: 80ch; }
.fish-context li + li { margin-top: 14px; }
.fish-context a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.task-table-wrap { overflow-x: auto; margin: 20px 0; }
.task-table { width: 100%; border-collapse: collapse; text-align: left; }
.task-table caption { text-align: left; margin-bottom: 12px; }
.task-table th, .task-table td { padding: 16px; vertical-align: top; border-bottom: 1px solid var(--border); }
.task-table thead { background: var(--bg-soft); }
.task-table th:first-child { width: 22%; }
.task-table td:nth-child(2) { width: 16%; }
.task-table a, .guide-jump a, .task-guide > a { text-decoration: underline; text-underline-offset: 3px; }
.guide-note { max-width: 80ch; color: var(--fg-muted); margin-bottom: 16px; }
@media (max-width: 600px) {
  .task-table th, .task-table td { padding: 10px 6px; font-size: 14px; overflow-wrap: anywhere; }
  .task-table th:first-child { width: 25%; }
  .task-table td:nth-child(2) { width: 18%; }
}

/* Readable, server-rendered guides; no client-side content or layout dependency. */
.python-guide { max-width: 820px; margin: 36px auto 64px; }
.python-guide h1 { max-width: 760px; font-size: clamp(28px, 5vw, 42px); }
.python-guide > * + * { margin-top: 20px; }
.python-guide .guide-lead { font-size: 19px; line-height: 1.65; }
.python-guide section { margin-top: 38px; scroll-margin-top: 90px; }
.python-guide section > * + * { margin-top: 18px; }
.python-guide h2 { font-size: 25px; }
.python-guide h3 { font-size: 18px; margin-top: 26px; }
.python-guide p, .python-guide li { line-height: 1.75; }
.python-guide li + li { margin-top: 12px; }
.python-guide p a, .python-guide td a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.python-guide .task-table { min-width: 640px; }
.python-guide .task-table th:first-child { width: auto; }
.python-guide .task-table caption { text-align: left; padding: 0 0 12px; font-weight: 600; }
.python-layers { max-width: 420px; margin-left: auto; margin-right: auto; }
.python-layers svg { display: block; height: auto; }
.python-layers figcaption { margin-top: 12px; text-align: center; }
.python-guide .task-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.python-table-hint { display: none; }
@media (max-width: 600px) { .python-table-hint { display: block; } }
