/* ==========================================================================
   unohn — Fontshare-style font library
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f8f8f8;
  --text: #0a0a0a;
  --text-muted: #737373;
  --text-light: #a3a3a3;
  --border: #eaeaea;
  --border-light: #f0f0f0;
  --accent: #0a0a0a;
  --radius: 4px;
  --radius-pill: 100px;
  --font-ui: "Figtree", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --space-xs: .25rem;
  --space-sm: .5rem;
  --space-md: 1rem;
  --space-lg: 1.25rem;
  --space-xl: 1.5rem;
  --space-2xl: 2.5rem;
  --space-3xl: 4rem;
  --max-width: 1280px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --bg-card: #0a0a0a;
    --bg-hover: #141414;
    --text: #fafafa;
    --text-muted: #a3a3a3;
    --text-light: #525252;
    --border: #262626;
    --border-light: #1a1a1a;
    --accent: #fafafa;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Main
   ========================================================================== */

.main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl);
  width: 100%;
}

/* ==========================================================================
   Toolbar — minimal, single row where possible (Fontshare-style)
   ========================================================================== */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  margin-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-xl);
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-sm);
}

.toolbar-row:last-child {
  margin-bottom: 0;
}

.search-wrap {
  flex: 0 1 280px;
  min-width: 0;
  position: relative;
}

.sample-text-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 480px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-light);
  pointer-events: none;
}

.search-input,
.sample-text-input {
  width: 100%;
  padding: 10px 14px 10px 34px;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 400;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}

.sample-text-input {
  padding-left: 14px;
}

.search-input::placeholder,
.sample-text-input::placeholder {
  color: var(--text-light);
}

.search-input:hover,
.sample-text-input:hover {
  border-color: var(--text-light);
}

.search-input:focus,
.sample-text-input:focus {
  outline: none;
  border-color: var(--text);
  background: var(--bg);
}

/* Sample presets — Fontshare-style Cities / Excerpts / Names */
.sample-presets-row {
  margin-bottom: var(--space-sm);
}

.sample-presets-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-right: var(--space-sm);
  font-weight: 500;
}

.sample-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
}

.sample-preset {
  padding: 4px 12px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}

.sample-preset:hover {
  color: var(--text);
  background: var(--border-light);
}

.sample-preset.active {
  color: var(--text);
  background: var(--border);
}

/* Results bar — count, view toggle, sort (Fontshare-style) */
.results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.results-count {
  font-weight: 600;
  color: var(--text);
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.view-btn {
  padding: 6px 14px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}

.view-btn:hover {
  color: var(--text);
}

.view-btn.active {
  background: var(--accent);
  color: var(--bg);
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sort-label {
  color: var(--text-muted);
}

.sort-options {
  display: flex;
  gap: 2px;
}

.sort-btn {
  padding: 4px 12px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}

.sort-btn:hover {
  color: var(--text);
  background: var(--border-light);
}

.sort-btn.active {
  color: var(--text);
  background: var(--border);
}

/* Category filters — text-style pills, no heavy fill (Fontshare) */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.filter-pill {
  padding: 6px 14px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}

.filter-pill:hover {
  color: var(--text);
  background: var(--border-light);
}

.filter-pill.active {
  color: var(--text);
  background: var(--accent);
  color: var(--bg);
}

@media (prefers-color-scheme: dark) {
  .filter-pill.active {
    background: var(--accent);
    color: var(--bg);
  }
}


/* ==========================================================================
   Font grid — airy, minimal cards (Fontshare-style)
   ========================================================================== */

.font-grid {
  display: grid;
  margin-bottom: var(--space-3xl);
}

.font-grid[data-view="grid"] {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
}

.font-grid[data-view="list"] {
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
}

.font-card {
  position: relative;
  background: var(--bg-card);
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  transition: background .15s ease;
}

/* Download icon — bottom-right, visible on card hover */
.font-card-download {
  position: absolute;
  bottom: var(--space-md);
  right: var(--space-md);
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease, background .15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.font-card:hover .font-card-download {
  opacity: 1;
}

.font-card-download:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.font-card-download:focus {
  outline: none;
  opacity: 1;
}

.font-card-download svg {
  display: block;
  flex-shrink: 0;
}

.font-grid[data-view="list"] .font-card {
  border-bottom: 1px solid var(--border);
}

.font-grid[data-view="grid"] .font-card:hover {
  background: var(--bg-hover);
}

.font-grid[data-view="list"] .font-card:hover {
  background: var(--bg-hover);
}

.font-grid[data-view="list"] .font-card {
  display: grid;
  grid-template-columns: 1fr 2fr;
  align-items: center;
  gap: var(--space-xl);
  border-right: none;
}

.font-card-preview {
  padding: var(--space-xl) var(--space-lg);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.font-grid[data-view="list"] .font-card-preview {
  min-height: 100px;
  padding: var(--space-lg) var(--space-xl);
  justify-content: flex-start;
  text-align: left;
}

.font-card-preview-text {
  font-size: 1.875rem;
  line-height: 1.35;
  color: var(--text);
  word-break: break-word;
  max-width: 100%;
}

.font-grid[data-view="list"] .font-card-preview-text {
  font-size: 1.25rem;
}

.font-card-meta {
  padding: var(--space-sm) var(--space-lg) var(--space-lg);
  border-top: none;
}

.font-grid[data-view="grid"] .font-card-meta {
  padding: var(--space-md) var(--space-lg) var(--space-xl);
}

.font-grid[data-view="list"] .font-card-meta {
  border-left: none;
  padding-left: var(--space-xl);
}

.font-card-name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0 0 2px;
  color: var(--text);
}

.font-card-category {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  margin: 0;
}

/* ==========================================================================
   Loading & empty state
   ========================================================================== */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
}

.loading.hidden {
  display: none;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-bottom: var(--space-md);
}

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

.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.empty-state p {
  margin: 0;
}

/* ==========================================================================
   Footer — minimal (Fontshare-style)
   ========================================================================== */

.site-footer {
  padding: var(--space-xl) var(--space-xl) var(--space-2xl);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  font-weight: 500;
}

.site-footer p {
  margin: 0;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}
