/* Shell and listing styles for the Flask-rendered pages (/boards, /pinners, /pins, /blog).
   Tokens come from tokens.css; the SPA uses the same tokens through Tailwind. */

*, *::before, *::after { box-sizing: border-box; }
h1, h2, h3, h4, p, figure, blockquote, ul, ol, pre, dl, dd { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main { flex: 1; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { letter-spacing: -0.02em; text-wrap: balance; }
::selection { background: hsl(var(--accent) / 0.16); }
:focus-visible { outline: 2px solid hsl(var(--ring) / 0.5); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: hsl(var(--border-strong)) transparent; }

.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: hsl(var(--subtle));
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-height);
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.72);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand img { height: 24px; width: auto; }

.site-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }

.site-nav a {
  padding: 6px 10px;
  border-radius: 6px;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
}

.site-nav a:hover { color: hsl(var(--foreground)); background: hsl(var(--surface-hover)); }
.site-nav a[aria-current="page"] { color: hsl(var(--foreground)); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.button:active { transform: translateY(0.5px); }
.button-lg { height: 42px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.button-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); box-shadow: var(--elevation-small); }
.button-primary:hover { background: hsl(var(--primary) / 0.88); }
.button-accent {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08), 0 6px 20px -8px hsl(var(--accent));
}
.button-accent:hover { background: hsl(var(--accent) / 0.9); }
.button-secondary { background: hsl(var(--card)); border-color: hsl(var(--border)); box-shadow: var(--elevation-small), var(--highlight); }
.button-secondary:hover { background: hsl(var(--surface-raised)); border-color: hsl(var(--border-strong)); }
.button-ghost { color: hsl(var(--muted-foreground)); }
.button-ghost:hover { background: hsl(var(--surface-hover)); color: hsl(var(--foreground)); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  transition: color 150ms ease, background-color 150ms ease;
}

.icon-button:hover { color: hsl(var(--foreground)); background: hsl(var(--surface-hover)); }
.icon-button svg { width: 16px; height: 16px; }

/* The toggle shows the theme it switches to: a moon in light, a sun in dark. */
.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-icon-moon { display: none; }
}

@media (max-width: 860px) {
  .site-header .container { gap: 12px; }
  .header-actions .button-ghost { display: none; }
}

@media (max-width: 640px) {
  .container { padding-inline: 16px; }
  .site-nav { overflow-x: auto; scrollbar-width: none; }
  .site-nav a { padding: 6px 8px; font-size: 13.5px; }
  .brand-name, .header-actions .button { display: none; }
}

/* Footer */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid hsl(var(--border));
  color: hsl(var(--subtle));
  font-size: 13.5px;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 32px;
}

.site-footer .footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a:hover { color: hsl(var(--foreground)); }

/* Page header */
.page-header { padding: 56px 0 32px; }
.page-header .eyebrow { margin-bottom: 16px; }
.page-header .eyebrow svg { width: 14px; height: 14px; }
.page-header h1 { font-size: clamp(30px, 4.4vw, 44px); font-weight: 650; line-height: 1.06; letter-spacing: -0.04em; }
.page-header p:not(.eyebrow) { max-width: 640px; margin-top: 16px; color: hsl(var(--muted-foreground)); font-size: 17px; line-height: 1.6; }

/* Search and sort */
.controls { display: flex; flex-wrap: wrap; gap: 16px 24px; margin-bottom: 20px; }
.search-form { flex: 1; min-width: 220px; }
.sort-form { width: 220px; flex-shrink: 0; }
.search-form label, .sort-form label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.search-wrap { position: relative; }

.search-input, .sort-select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 14px;
  box-shadow: var(--elevation-small), var(--highlight);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-input { padding-right: 92px; }
.search-input::placeholder { color: hsl(var(--subtle)); }
.search-input:hover, .sort-select:hover { border-color: hsl(var(--border-strong)); }
.search-input:focus, .sort-select:focus { outline: none; border-color: hsl(var(--accent)); box-shadow: 0 0 0 3px hsl(var(--accent) / 0.12); }

.sort-select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23878c93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.search-btn {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 14px;
  font-weight: 500;
}

.search-btn:hover { background: hsl(var(--primary) / 0.88); }

/* Board status legend */
.status-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding-bottom: 20px; color: hsl(var(--muted-foreground)); font-size: 12px; }
.status-legend .label { color: hsl(var(--subtle)); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: hsl(var(--success)); vertical-align: 1px; }
.status-dot.soft { background: hsl(var(--success) / 0.6); }
.ok { color: hsl(var(--success)); }

/* Results table */
.desktop-table {
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--card));
  box-shadow: var(--elevation-small), var(--highlight);
}

.board-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }

.board-table th {
  padding: 0 14px;
  height: 40px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background-subtle));
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.board-table th a:hover, .board-table th.active { color: hsl(var(--foreground)); }
.board-table th.right, .board-table td.right { text-align: right; }
.board-table tr.row { border-bottom: 1px solid hsl(var(--border)); transition: background-color 150ms ease; }
.board-table tr.row:last-child { border-bottom: 0; }
.board-table tr.row:hover { background: hsl(var(--background-subtle)); }
.board-table td { padding: 10px 14px; vertical-align: middle; }

.board-cell { display: flex; align-items: center; gap: 12px; }
.board-img { width: 40px; height: 40px; flex-shrink: 0; border: 1px solid hsl(var(--border)); border-radius: 8px; object-fit: cover; background: hsl(var(--surface-raised)); }
.board-name { max-width: 340px; overflow: hidden; font-weight: 500; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.board-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; color: hsl(var(--muted-foreground)); font-size: 11.5px; }
.board-meta .cat { padding: 0 6px; border: 1px solid hsl(var(--border)); border-radius: 6px; background: hsl(var(--background-subtle)); line-height: 18px; }
.board-meta .joinable { color: hsl(var(--success)); }

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; font-weight: 500; }
.growth-positive { color: hsl(var(--success)); }
.growth-negative { color: hsl(var(--destructive)); }
.growth-neutral { color: hsl(var(--muted-foreground)); }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; color: hsl(var(--muted-foreground)); font-size: 13.5px; }
.pagination .pages { display: flex; flex-wrap: wrap; gap: 4px; }
.pagination a, .pagination span.current, .pagination .gap {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.pagination a { border-color: hsl(var(--border)); background: hsl(var(--card)); color: hsl(var(--foreground)); box-shadow: var(--elevation-small); }
.pagination a:hover { border-color: hsl(var(--border-strong)); background: hsl(var(--surface-raised)); }
.pagination span.current { border-color: hsl(var(--accent) / 0.3); background: hsl(var(--accent) / 0.1); color: hsl(var(--accent-text)); font-weight: 600; }
.pagination-bottom { margin-top: 16px; }

/* Long-form copy under a listing */
.seo-content { max-width: 680px; margin-top: 64px; }
.seo-content h2 { margin: 32px 0 12px; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.seo-content h2:first-child { margin-top: 0; }
.seo-content p, .seo-content li { margin-bottom: 12px; color: hsl(var(--muted-foreground)); font-size: 15px; line-height: 1.7; }
.seo-content strong { color: hsl(var(--foreground)); font-weight: 600; }
.seo-content ul { margin-bottom: 16px; padding-left: 20px; }
.seo-content a { color: hsl(var(--accent-text)); text-decoration: underline; text-decoration-color: hsl(var(--accent) / 0.35); text-underline-offset: 3px; }
.seo-content a:hover { text-decoration-color: currentColor; }

/* Phone: cards instead of the table */
.mobile-cards { display: none; }

@media (max-width: 768px) {
  .page-header { padding: 40px 0 24px; }
  .page-header p:not(.eyebrow) { font-size: 16px; }
  .controls { flex-direction: column; }
  .sort-form { width: 100%; }
  .desktop-table { display: none; }
  .mobile-cards { display: flex; flex-direction: column; gap: 10px; }
  .m-card { padding: 16px; border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card)); box-shadow: var(--elevation-small), var(--highlight); transition: border-color 150ms ease; }
  .m-card:hover { border-color: hsl(var(--border-strong)); }
  .m-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
  .m-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 14px; }
  .m-card-stat-label { margin-bottom: 2px; color: hsl(var(--muted-foreground)); font-size: 12px; }
  .board-name { max-width: none; white-space: normal; }
}

/* Blog: sticky sign-up bar for anonymous readers (shown by blog.js) */
.signup-bar { position: fixed; inset: auto 0 0; z-index: 50; border-top: 1px solid hsl(var(--border)); background: hsl(var(--background) / 0.86); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); }
.signup-bar .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; }
.signup-bar-copy { display: flex; align-items: center; gap: 12px; min-width: 0; }
.signup-bar-copy strong { font-weight: 600; white-space: nowrap; }
.signup-bar-copy span { overflow: hidden; color: hsl(var(--muted-foreground)); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.signup-bar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
