@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  /* Font Directory + совместимость с токенами темы */
  --background: #f3f4f6;
  --foreground: #1f2933;
  --card: #ffffff;
  --card-foreground: #1f2933;
  --popover: #ffffff;
  --popover-foreground: #1f2933;
  --primary: #2ec5d3;
  --primary-foreground: #ffffff;
  --secondary: #ff6fa5;
  --secondary-foreground: #ffffff;
  --muted: #f9fafb;
  --muted-foreground: #6b7280;
  --accent: #f3f4f6;
  --accent-foreground: #1f2933;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #e5e7eb;
  --input: #e5e7eb;
  --ring: #2ec5d3;
  --nav-bg: #111111;
  --nav-fg: #ffffff;
  --hero-bg: #2b2e3a;
  --hero-fg: #ffffff;
  --dark-surface: #2b2e3a;
  --gradient-1-start: #2ec5d3;
  --gradient-1-end: #4fd1c5;
  --gradient-2-start: #ff6fa5;
  --gradient-2-end: #ff8fb1;
  --gradient-3-start: #6c63ff;
  --gradient-3-end: #8b85ff;
  --footer-bg: #111111;
  --footer-fg: #9ca3af;
  --radius: 1rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.5rem;
  --radius-pill: 9999px;
  --container: 1100px;
  --content: 760px;
  --shadow-soft: 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 6px 14px rgba(0, 0, 0, 0.08);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
}

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

* {
  border-color: var(--border);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

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

.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;
}

/* ——— Layout ——— */
.page {
  padding: 24px 16px 64px;
}

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

.content-narrow {
  max-width: var(--content);
  margin-inline: auto;
}

/* ——— Navbar ——— */
.nav-wrap {
  position: sticky;
  top: 16px;
  z-index: 50;
  margin-bottom: 32px;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 20px;
  background: var(--nav-bg);
  color: var(--nav-fg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.navbar__logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gradient-1-start), var(--gradient-1-end));
  display: grid;
  place-items: center;
  font-size: 14px;
}

.navbar__menu {
  display: none;
  align-items: center;
  gap: 8px;
}

@media (min-width: 768px) {
  .navbar__menu {
    display: flex;
  }
}

.navbar__link {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  transition: background 0.2s, color 0.2s;
}

.navbar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar__search {
  display: none;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  max-width: 200px;
}

@media (min-width: 900px) {
  .navbar__search {
    display: flex;
  }
}

.navbar__search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.navbar__search input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3f4f6;
  color: var(--dark-surface);
  transition: background 0.2s, transform 0.15s;
}

.icon-btn:hover {
  background: #e5e7eb;
}

.icon-btn--nav {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.icon-btn--nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.btn-upload {
  display: none;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--gradient-1-start), var(--gradient-1-end));
  box-shadow: 0 4px 12px rgba(46, 197, 211, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}

@media (min-width: 640px) {
  .btn-upload {
    display: inline-flex;
  }
}

.btn-upload:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(46, 197, 211, 0.4);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gradient-2-start), var(--gradient-2-end));
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* ——— Hero ——— */
.hero {
  border-radius: 20px;
  padding: 32px 24px;
  background: var(--hero-bg);
  color: var(--hero-fg);
  text-align: center;
  margin-bottom: 40px;
  box-shadow: var(--shadow-soft);
}

.hero__title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero__subtitle {
  margin: 0 auto 28px;
  max-width: 520px;
  font-size: 15px;
  opacity: 0.88;
  line-height: 1.6;
}

.hero__search {
  max-width: 480px;
  margin-inline: auto;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.search-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46, 197, 211, 0.2);
}

.search-field svg {
  flex-shrink: 0;
  color: var(--muted-foreground);
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--foreground);
  outline: none;
}

.search-field input::placeholder {
  color: #9ca3af;
}

/* ——— Section ——— */
.section {
  margin-bottom: 48px;
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.section__hint {
  font-size: 13px;
  color: var(--muted-foreground);
}

/* ——— Font cards ——— */
.font-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.font-card {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.25s, transform 0.25s;
}

.font-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.font-card[data-hidden="true"] {
  display: none;
}

.font-card[data-lazy="1"] {
  display: none !important;
}

.font-card__main {
  flex: 1;
  min-width: min(100%, 280px);
}

.font-card__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.font-card__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--foreground);
}

.font-card__name a {
  color: inherit;
  text-decoration: none;
}

.font-card__name a:hover {
  color: var(--primary);
}

.font-card__author {
  font-size: 13px;
  color: var(--muted-foreground);
}

.license-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--muted);
  color: var(--muted-foreground);
}

.license-badge--free {
  background: rgba(46, 197, 211, 0.12);
  color: #0d9488;
}

.font-card__preview {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.35;
  color: var(--dark-surface);
  font-family: var(--preview-family, var(--font-sans));
}

.font-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: center;
}

.icon-btn--fav.is-active {
  background: rgba(255, 111, 165, 0.15);
  color: var(--secondary);
}

.icon-btn--fav.is-active svg {
  fill: currentColor;
}

/* ——— Category / Load more ——— */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 28px;
}

.chip {
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

.chip:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.chip.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--gradient-1-start), var(--gradient-1-end));
  box-shadow: 0 4px 12px rgba(46, 197, 211, 0.3);
}

a.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--gradient-3-start), var(--gradient-3-end));
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(108, 99, 255, 0.4);
}

.btn-primary--secondary-gradient {
  background: linear-gradient(135deg, var(--gradient-2-start), var(--gradient-2-end));
  box-shadow: 0 4px 14px rgba(255, 111, 165, 0.35);
}

.btn-primary--secondary-gradient:hover {
  box-shadow: 0 8px 20px rgba(255, 111, 165, 0.4);
}

/* ——— Designers ——— */
.designers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.designer-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.25s, transform 0.2s;
}

.designer-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.designer-card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--muted), var(--border));
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--muted-foreground);
}

.designer-card__name {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
}

.designer-card__meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted-foreground);
}

/* ——— Text block ——— */
.text-block {
  max-width: var(--content);
  margin-inline: auto;
  padding: 28px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.text-block h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 600;
}

.text-block p {
  margin: 0 0 12px;
  color: var(--muted-foreground);
  font-size: 15px;
  line-height: 1.65;
}

.text-block p:last-child {
  margin-bottom: 0;
}

.text-block code {
  font-size: 0.9em;
  font-family: ui-monospace, monospace;
  background: var(--muted);
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ——— Stats ——— */
.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px 48px;
  padding: 40px 16px;
  margin-top: 16px;
}

.stat {
  text-align: center;
}

.stat__value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--gradient-1-start), var(--gradient-3-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat__label {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted-foreground);
  font-weight: 500;
}

/* ——— Footer ——— */
.footer {
  margin-top: 48px;
  padding: 40px 24px 32px;
  background: var(--footer-bg);
  color: var(--footer-fg);
  border-radius: 20px 20px 0 0;
  text-align: center;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-bottom: 24px;
}

.footer__links a {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.2s;
}

.footer__links a:hover {
  color: #fff;
}

.footer__stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px 40px;
  font-size: 13px;
  color: var(--footer-fg);
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ——— Mobile menu toggle ——— */
.menu-toggle {
  display: flex;
}

@media (min-width: 768px) {
  .menu-toggle {
    display: none;
  }
}
