/* ─────────────────────────────────────────────────────────────────────────────
   Arabic Fonts WordPress Theme — Main Stylesheet
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --af-bg:           #faf8f4;
  --af-bg-alt:       #f5f2ec;
  --af-surface:      #ffffff;
  --af-border:       #e8e3d8;
  --af-text:         #2a2117;
  --af-text-muted:   #7a6e5a;
  --af-primary:      #8b6914;
  --af-primary-dark: #6b4f0f;
  --af-primary-bg:   #f9f3e3;
  --af-header-bg:    #ffffff;
  --af-fav-heart:    #e53e3e;
  --af-footer-bg:    #2a2117;
  --af-footer-text:  #ffffff;
  --af-cat-tile-bg:        #eaeef5;
  --af-cat-tile-font-size: 13px;
  --af-radius:       0.5rem;
  --af-radius-lg:    0.875rem;
  --af-shadow:       0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --af-shadow-md:    0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --af-font-sans:    'Tajawal', 'Segoe UI', system-ui, sans-serif;
  --af-font-serif:   'Amiri', Georgia, serif;
  --af-container:    1300px;
  --af-header-h:     64px;
}

/* ── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  font-family: var(--af-font-sans);
  background: var(--af-bg);
  color: var(--af-text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--af-primary); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.af-container {
  max-width: var(--af-container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.af-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--af-header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--af-border);
  height: var(--af-header-h);
}

.af-header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 100%;
}

.af-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--af-font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--af-text);
  flex-shrink: 0;
}

.af-logo__icon {
  width: 36px;
  height: 36px;
  background: var(--af-primary-bg);
  color: var(--af-primary);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* Custom logo image — uploaded via Appearance → Customize → Site Identity */
.af-logo--image {
  padding: 0;
  background: none;
  border: none;
}

.af-logo--image img,
.af-logo--image .custom-logo {
  max-height: 44px;
  width: auto;
  display: block;
  object-fit: contain;
}

.af-nav {
  display: flex;
  gap: 0.25rem;
  margin-right: auto;
}

.af-nav__link {
  padding: 0.375rem 0.875rem;
  border-radius: var(--af-radius);
  font-size: 0.9rem;
  color: var(--af-text-muted);
  transition: all 0.2s;
}

.af-nav__link:hover {
  background: var(--af-bg-alt);
  color: var(--af-text);
}

.af-header__search {
  position: relative;
}

.af-header__search form {
  display: flex;
  align-items: center;
}

.af-search-input {
  width: 260px;
  height: 38px;
  padding: 0 2.5rem 0 1rem;
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  background: var(--af-bg-alt);
  font-family: var(--af-font-sans);
  font-size: 0.875rem;
  color: var(--af-text);
  direction: rtl;
  transition: border-color 0.2s;
}

.af-search-input:focus {
  outline: none;
  border-color: var(--af-primary);
  background: #fff;
}

.af-search-input::placeholder { color: var(--af-text-muted); }

.af-search-btn {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--af-text-muted);
  display: flex;
  align-items: center;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.af-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--af-radius);
  font-family: var(--af-font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}

.af-btn--primary {
  background: var(--af-primary);
  color: #fff;
  border: 1px solid var(--af-primary);
}

.af-btn--primary:hover {
  background: var(--af-primary-dark);
  border-color: var(--af-primary-dark);
  color: #fff;
}

.af-btn--outline {
  background: transparent;
  color: var(--af-text);
  border: 1px solid var(--af-border);
}

.af-btn--outline:hover {
  background: var(--af-bg-alt);
  border-color: var(--af-primary);
  color: var(--af-primary);
}

.af-btn--lg { padding: 0.75rem 2rem; font-size: 1rem; }
.af-btn--full { width: 100%; justify-content: center; padding: 0.875rem; }

/* ── Badge ───────────────────────────────────────────────────────────────────── */
.af-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--af-primary-bg);
  color: var(--af-primary);
}

.af-badge--hero {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.af-badge--outline {
  background: transparent;
  color: var(--af-text-muted);
  border: 1px solid var(--af-border);
}

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.af-hero {
  position: relative;
  padding: 6rem 0 5rem;
  overflow: hidden;
  text-align: center;
}

.af-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../images/arabic-pattern.png');
  background-repeat: repeat;
  background-size: 420px 420px;
  opacity: 0.30;
  pointer-events: none;
  z-index: 0;
}

.af-hero > * {
  position: relative;
  z-index: 1;
}

.af-hero__bg-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--af-font-serif);
  font-size: 40vw;
  font-weight: 700;
  color: var(--af-primary);
  opacity: 0.04;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.af-hero__inner {
  position: relative;
  z-index: 1;
}

.af-hero__title {
  font-family: var(--af-font-serif);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  color: var(--af-text);
}

.af-hero__title--accent {
  color: var(--af-primary);
}

.af-hero__subtitle {
  font-size: 1.1rem;
  color: var(--af-text-muted);
  max-width: 540px;
  margin: 0 auto 2.5rem;
}

.af-hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.af-hero__preview {
  flex: 1;
  max-width: 360px;
  min-width: 200px;
}

.af-preview-input {
  width: 100%;
  height: 48px;
  padding: 0 1rem;
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  background: var(--af-surface);
  font-family: var(--af-font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--af-text);
  direction: rtl;
  box-shadow: var(--af-shadow);
  transition: border-color 0.2s;
}

.af-preview-input:focus { outline: none; border-color: var(--af-primary); }
.af-preview-input::placeholder { color: var(--af-text-muted); }

/* ── Stats ───────────────────────────────────────────────────────────────────── */
.af-stats {
  padding: 3rem 0;
  background: var(--af-surface);
  border-top: 1px solid var(--af-border);
  border-bottom: 1px solid var(--af-border);
}

.af-stats__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem;
}

.af-stat-card {
  text-align: center;
  padding: 1rem;
}

.af-stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--af-radius);
  background: var(--af-primary-bg);
  border: 1px solid var(--af-border);
  color: var(--af-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

.af-stat-card__value {
  font-family: var(--af-font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--af-text);
  line-height: 1;
}

.af-stat-card__label {
  font-size: 0.875rem;
  color: var(--af-text-muted);
  margin-top: 0.375rem;
}

/* ── Sections ────────────────────────────────────────────────────────────────── */
.af-section { padding: 4rem 0; }
.af-section--alt { background: var(--af-bg-alt); }

.af-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.af-section__title {
  font-family: var(--af-font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--af-text);
}

.af-section__link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.9rem;
  color: var(--af-primary);
  font-weight: 500;
}

/* ── Font Grid ───────────────────────────────────────────────────────────────── */
.af-fonts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.af-fonts-grid--4 {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ── Font Card ───────────────────────────────────────────────────────────────── */
.af-font-card {
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius-lg);
  padding: 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

/* ── Favorites Button ─────────────────────────────────────────────────────── */
.af-font-card__header-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.af-fav-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--af-text-muted);
  display: flex;
  align-items: center;
  transition: color 0.2s, transform 0.15s;
  line-height: 1;
}

.af-fav-btn:hover { color: var(--af-fav-heart); transform: scale(1.2); }

.af-fav-btn svg { fill: none; pointer-events: none; }

.af-fav-btn.is-faved { color: var(--af-fav-heart); }

.af-fav-btn.is-faved svg { fill: var(--af-fav-heart); }

/* ── Header Favorites Icon ────────────────────────────────────────────────── */
.af-header__fav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--af-fav-heart);
  transition: color 0.2s;
  padding: 0.35rem;
  flex-shrink: 0;
}

.af-header__fav:hover { color: var(--af-fav-heart); opacity: 0.8; }

.af-fav-count {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  background: var(--af-primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  border-radius: 999px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

/* ── Favorites Page ───────────────────────────────────────────────────────── */
.af-favorites-page { padding: 2rem 0 4rem; }

.af-favorites-page__title {
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  color: var(--af-text);
}

.af-favorites-page__sub {
  color: var(--af-text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.af-font-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.af-font-card__downloads {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--af-text-muted);
}

.af-font-card__preview {
  font-size: 1.75rem;
  line-height: 1.4;
  color: var(--af-text);
  padding: 0.75rem 0;
  border-top: 1px solid var(--af-border);
  border-bottom: 1px solid var(--af-border);
  direction: rtl;
  min-height: 80px;
  display: flex;
  align-items: center;
  word-break: break-word;
  transition: font-family 0.3s;
}

.af-font-card__info {
  flex: 1;
}

.af-font-card__name {
  font-family: var(--af-font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

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

.af-font-card__designer {
  font-size: 0.8rem;
  color: var(--af-text-muted);
}

.af-font-card__actions {
  display: flex;
  gap: 0.75rem;
}

.af-font-card__actions .af-btn { flex: 1; justify-content: center; }

/* ── Categories Grid ─────────────────────────────────────────────────────────── */
.af-cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.af-cat-card {
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius-lg);
  padding: 1.5rem 1rem;
  text-align: center;
  transition: all 0.2s;
  display: block;
}

.af-cat-card:hover {
  border-color: var(--af-primary);
  box-shadow: var(--af-shadow-md);
  transform: translateY(-2px);
}

.af-cat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--af-primary-bg);
  color: var(--af-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  transition: transform 0.2s;
}

.af-cat-card:hover .af-cat-card__icon { transform: scale(1.1); }

.af-cat-card__name {
  font-family: var(--af-font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--af-text);
  margin-bottom: 0.25rem;
}

.af-cat-card__count {
  font-size: 0.8rem;
  color: var(--af-text-muted);
}

/* ── Page Hero ───────────────────────────────────────────────────────────────── */
.af-page-hero {
  position: relative;
  overflow: hidden;
  background: var(--af-surface);
  border-bottom: 1px solid var(--af-border);
  padding: 3rem 0 2.5rem;
  text-align: center;
}

.af-page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../images/arabic-pattern.png');
  background-repeat: repeat;
  background-size: 420px 420px;
  opacity: 0.30;
  pointer-events: none;
  z-index: 0;
}

.af-page-hero > * {
  position: relative;
  z-index: 1;
}

.af-page-hero__title {
  font-family: var(--af-font-serif);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--af-text);
  margin-bottom: 0.75rem;
}

.af-page-hero__subtitle {
  font-size: 1rem;
  color: var(--af-text-muted);
  max-width: 500px;
  margin: 0 auto;
}

.af-page-hero__count {
  margin-top: 0.6rem;
  font-size: 0.95rem;
  color: var(--af-text-muted);
}

.af-page-hero__count strong {
  color: var(--af-primary);
  font-weight: 700;
}

/* ── Browse Layout ───────────────────────────────────────────────────────────── */
.af-browse-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding-top: 2rem;
  padding-bottom: 3rem;
  align-items: start;
}

@media (max-width: 768px) {
  .af-browse-layout { grid-template-columns: 1fr; }
  .af-sidebar { display: none; }
}

.af-sidebar__section { margin-bottom: 1rem; }

.af-sidebar__title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--af-text);
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--af-border);
}

.af-filter-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.af-filter-list li { display: contents; }

.af-filter-list__item {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.45rem 0.4rem;
  border-radius: 10px;
  font-size: var(--af-cat-tile-font-size, 13px);
  font-weight: 500;
  color: var(--af-text);
  background: var(--af-cat-tile-bg, #eaeef5);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  line-height: 1.3;
  word-break: break-word;
}

.af-filter-list__item:hover {
  background: var(--af-cat-tile-bg, #eaeef5);
  filter: brightness(0.92);
  color: var(--af-primary);
}

.af-filter-list__item.is-active {
  background: var(--af-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.af-filter-list__count { display: none; }

/* ── Sidebar Search Widget ───────────────────────────────────────────────────── */
.af-sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.af-sidebar-search__icon {
  position: absolute;
  right: 0.75rem;
  color: var(--af-text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.af-sidebar-search__input {
  width: 100%;
  height: 38px;
  padding: 0 2.25rem 0 2rem;
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  background: var(--af-bg-alt);
  font-family: var(--af-font-sans);
  font-size: 0.875rem;
  color: var(--af-text);
  transition: border-color 0.2s, background 0.2s;
}

.af-sidebar-search__input:focus {
  outline: none;
  border-color: var(--af-primary);
  background: #fff;
}

.af-sidebar-search__input::placeholder { color: var(--af-text-muted); }

/* Cancel/clear button (X) on the left side — matches RTL direction */
.af-sidebar-search__clear {
  position: absolute;
  left: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--af-text-muted);
  transition: color 0.15s;
  border-radius: 50%;
}

.af-sidebar-search__clear:hover { color: var(--af-text); }

.af-sidebar-search__label {
  font-size: 0.75rem;
  color: var(--af-text-muted);
  margin-top: 0.4rem;
  margin-bottom: 0;
}

/* Sidebar title flex row to allow icon + text */
.af-sidebar__title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ── Preview Bar ─────────────────────────────────────────────────────────────── */
.af-preview-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--af-shadow);
}

.af-preview-bar__label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  color: var(--af-text-muted);
  white-space: nowrap;
}

.af-preview-bar__input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--af-font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--af-text);
  direction: rtl;
}

.af-preview-bar__input:focus { outline: none; }
.af-preview-bar__input::placeholder { color: var(--af-text-muted); }

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.af-pagination {
  margin-top: 3rem;
  text-align: center;
}

.af-pagination .nav-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius-lg);
  padding: 0.35rem 0.5rem;
  box-shadow: var(--af-shadow);
}

.af-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.75rem;
  border-radius: var(--af-radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--af-text);
  background: transparent;
  border: none;
  transition: background 0.18s, color 0.18s;
}

.af-pagination .page-numbers:hover {
  background: var(--af-primary-bg);
  color: var(--af-primary);
}

.af-pagination .page-numbers.current {
  background: var(--af-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.af-pagination .page-numbers.dots {
  min-width: 24px;
  color: var(--af-text-muted);
  cursor: default;
  pointer-events: none;
}

.af-pagination .page-numbers.prev,
.af-pagination .page-numbers.next {
  color: var(--af-primary);
  font-weight: 700;
  font-size: 1rem;
  padding: 0 1rem;
}

.af-pagination .page-numbers.prev:hover,
.af-pagination .page-numbers.next:hover {
  background: var(--af-primary-bg);
}

/* ── Font Detail Page ────────────────────────────────────────────────────────── */
.af-font-detail { padding: 2rem 0 4rem; }

.af-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--af-text-muted);
  margin-bottom: 2rem;
}

.af-breadcrumb a:hover { color: var(--af-primary); }

.af-font-detail__preview-box {
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--af-shadow);
}

.af-font-detail__preview-text {
  font-size: 3rem;
  line-height: 1.4;
  color: var(--af-text);
  direction: rtl;
  min-height: 100px;
  padding: 1.5rem 0;
  border-top: 1px solid var(--af-border);
  border-bottom: 1px solid var(--af-border);
  margin: 1rem 0;
  word-break: break-word;
  transition: font-size 0.2s;
}

.af-font-detail__preview-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.af-input {
  flex: 1;
  min-width: 200px;
  height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  background: var(--af-bg-alt);
  font-family: var(--af-font-sans);
  font-size: 0.95rem;
  color: var(--af-text);
  direction: rtl;
  transition: border-color 0.2s;
}

.af-input:focus { outline: none; border-color: var(--af-primary); background: #fff; }

.af-font-detail__size-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--af-text-muted);
  white-space: nowrap;
}

.af-range { width: 100px; accent-color: var(--af-primary); }

.af-font-detail__layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 768px) {
  .af-font-detail__layout { grid-template-columns: 1fr; }
}

.af-font-detail__name {
  font-family: var(--af-font-serif);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.af-font-detail__title-en {
  font-size: 0.9rem;
  color: var(--af-text-muted);
  margin-bottom: 1rem;
}

.af-font-detail__desc {
  color: var(--af-text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.af-font-detail__meta {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.af-font-detail__meta tr { border-bottom: 1px solid var(--af-border); }

.af-font-detail__meta td {
  padding: 0.75rem 0.5rem;
  vertical-align: middle;
}

.af-font-detail__meta td:first-child { color: var(--af-text-muted); width: 24px; }
.af-font-detail__meta td:nth-child(2) { color: var(--af-text-muted); width: 100px; }
.af-font-detail__meta td:last-child { color: var(--af-text); font-weight: 500; }

.af-font-detail__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.af-font-detail__chars {
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius-lg);
  padding: 1.5rem;
}

.af-font-detail__chars h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--af-text-muted);
  margin-bottom: 1rem;
}

.af-char-set {
  direction: rtl;
  font-size: 1.75rem;
  line-height: 2.5;
  color: var(--af-text);
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
  word-break: break-all;
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.af-footer {
  background: var(--af-footer-bg);
  color: var(--af-footer-text);
  padding: 3rem 0 0;
  margin-top: 4rem;
}

/* No gap when footer follows the featured section */
.af-featured-section + .af-footer {
  margin-top: 0;
}

.af-footer .af-logo__text { color: var(--af-footer-text); }

.af-footer__grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  padding-bottom: 3rem;
}

@media (max-width: 640px) {
  .af-footer__grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

.af-footer__tagline {
  font-size: 0.875rem;
  color: color-mix(in srgb, var(--af-footer-text) 55%, transparent);
  margin-top: 0.75rem;
}

.af-footer__links h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--af-footer-text) 55%, transparent);
  margin-bottom: 1rem;
}

.af-footer__links ul { display: flex; flex-direction: column; gap: 0.625rem; }

.af-footer__links a {
  font-size: 0.9rem;
  color: color-mix(in srgb, var(--af-footer-text) 75%, transparent);
  transition: color 0.2s;
}

.af-footer__links a:hover { color: var(--af-footer-text); }

.af-footer__bottom {
  border-top: 1px solid color-mix(in srgb, var(--af-footer-text) 12%, transparent);
  padding: 1.25rem 0;
  font-size: 0.825rem;
  color: color-mix(in srgb, var(--af-footer-text) 45%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.af-footer__legal a {
  color: color-mix(in srgb, var(--af-footer-text) 55%, transparent);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.2s;
}

.af-footer__legal a:hover {
  color: var(--af-footer-text);
}

/* ── DMCA / Static Page ──────────────────────────────────────────────────────── */
.af-dmca-page {
  padding: 4rem 0 5rem;
}

.af-dmca-header {
  max-width: 780px;
  margin: 0 auto 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--af-border);
}

.af-dmca-title {
  font-family: var(--af-font-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--af-text);
  margin-bottom: 0.5rem;
}

.af-dmca-date {
  font-size: 0.85rem;
  color: var(--af-text-muted);
}

.af-dmca-content {
  max-width: 780px;
  margin: 0 auto;
  font-size: 1.025rem;
  line-height: 1.9;
  color: var(--af-text);
}

.af-dmca-content h2,
.af-dmca-content h3,
.af-dmca-content h4 {
  font-family: var(--af-font-serif);
  font-weight: 700;
  color: var(--af-text);
  margin: 2rem 0 0.75rem;
}

.af-dmca-content h2 { font-size: 1.5rem; }
.af-dmca-content h3 { font-size: 1.2rem; }

.af-dmca-content p  { margin-bottom: 1.1rem; }

.af-dmca-content a {
  color: var(--af-primary);
  text-decoration: underline;
}

.af-dmca-content a:hover { color: var(--af-primary-dark); }

.af-dmca-content ul,
.af-dmca-content ol {
  padding-right: 1.5rem;
  margin-bottom: 1.1rem;
}

.af-dmca-content li { margin-bottom: 0.4rem; }

.af-dmca-content blockquote {
  border-right: 4px solid var(--af-primary);
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--af-primary-bg);
  border-radius: 0 var(--af-radius) var(--af-radius) 0;
  color: var(--af-text-muted);
  font-style: italic;
}

/* ── Footer Social Icons ─────────────────────────────────────────────────────── */
.af-footer__about {
  font-size: 0.85rem;
  color: color-mix(in srgb, var(--af-footer-text) 65%, transparent);
  margin-top: 0.5rem;
  line-height: 1.6;
  max-width: 28ch;
}

.af-footer__social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

.af-social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--af-footer-text) 10%, transparent);
  color: color-mix(in srgb, var(--af-footer-text) 80%, transparent);
  transition: background 0.2s, color 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.af-social-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.af-social-icon:hover {
  background: var(--af-primary);
  color: #fff;
  transform: translateY(-2px);
}

/* ── Empty State ─────────────────────────────────────────────────────────────── */
.af-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--af-text-muted);
}

.af-empty-state__icon { margin: 0 auto 1.5rem; color: var(--af-border); }
.af-empty-state h3 { font-size: 1.25rem; color: var(--af-text); margin-bottom: 0.75rem; }
.af-empty-state p { margin-bottom: 1.5rem; }

/* ── 404 Page ────────────────────────────────────────────────────────────────── */
.af-404 { padding: 6rem 0; }
.af-404__inner { text-align: center; max-width: 500px; margin: 0 auto; }
.af-404__number {
  font-family: var(--af-font-serif);
  font-size: 8rem;
  font-weight: 700;
  color: var(--af-primary);
  opacity: 0.15;
  line-height: 1;
  margin-bottom: 1rem;
}
.af-404__title { font-size: 2rem; font-weight: 700; margin-bottom: 1rem; }
.af-404__desc { color: var(--af-text-muted); margin-bottom: 2rem; }

/* ── Generic Page ────────────────────────────────────────────────────────────── */
.af-page-content { padding: 3rem 0 5rem; }
.af-prose h1 { font-family: var(--af-font-serif); font-size: 2.25rem; margin-bottom: 1.5rem; }
.af-prose p { margin-bottom: 1rem; line-height: 1.8; color: var(--af-text-muted); }

/* ── Download Success State ──────────────────────────────────────────────────── */
.af-download-btn.is-success {
  background: #16a34a;
  border-color: #16a34a;
}

/* ── Featured Fonts Section ───────────────────────────────────────────────────── */
.af-featured-section {
  background: var(--af-primary-bg);
  border-top: 1px solid var(--af-border);
  padding: 2.5rem 0 2.5rem;
  margin-bottom: 0;
}

.af-featured-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
}

.af-featured-title {
  font-family: var(--af-font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--af-text);
  margin-bottom: 0.35rem;
}

.af-featured-subtitle {
  color: var(--af-text-muted);
  font-size: 0.95rem;
}

.af-featured-all-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1.25rem;
  border: 1.5px solid var(--af-primary);
  border-radius: 2rem;
  color: var(--af-primary);
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.2s, color 0.2s;
}
.af-featured-all-link:hover {
  background: var(--af-primary);
  color: #fff;
}

.af-featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}


/* ── Font Variants Download List ─────────────────────────────────────────────── */
.af-variants-download {
  margin-top: 1.25rem;
}

.af-variants-download__title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--af-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
}

.af-variants-download__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius-lg);
  overflow: hidden;
}

.af-variants-download__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--af-border);
  background: var(--af-surface);
  gap: 1rem;
}

.af-variants-download__row:last-child {
  border-bottom: none;
}

.af-variants-download__label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--af-text);
}

.af-btn--sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  gap: 0.3rem;
}

/* ── Font Variant Selector ───────────────────────────────────────────────────── */
.af-variant-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.af-variant-btn {
  padding: 0.35rem 1rem;
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  background: var(--af-surface);
  color: var(--af-text-muted);
  font-size: 0.85rem;
  font-family: var(--af-font-sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.af-variant-btn:hover {
  border-color: var(--af-primary);
  color: var(--af-primary);
}

.af-variant-btn.is-active {
  background: var(--af-primary);
  border-color: var(--af-primary);
  color: #fff;
  font-weight: 600;
}

/* ── Design Showcase Section ─────────────────────────────────────────────────── */
.af-showcase-section {
  background: var(--af-bg);
  border-top: 1px solid var(--af-border);
  padding: 2.5rem 0;
}

.af-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.af-showcase-grid--full {
  grid-template-columns: repeat(3, 1fr);
}

.af-showcase-item {
  background: var(--af-surface);
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: block;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

a.af-showcase-item:hover {
  box-shadow: var(--af-shadow-md);
  border-color: var(--af-primary);
  transform: translateY(-2px);
}

.af-showcase-item__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .af-featured-grid { grid-template-columns: repeat(2, 1fr); }
  .af-showcase-grid  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .af-hero { padding: 3.5rem 0 3rem; }
  .af-hero__title { font-size: 2.25rem; }
  .af-hero__actions { flex-direction: column; }
  .af-hero__preview { max-width: 100%; }
  .af-nav { display: none; }
  .af-fonts-grid { grid-template-columns: 1fr; }
  .af-cats-grid { grid-template-columns: repeat(2, 1fr); }
  .af-section__header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .af-featured-grid { grid-template-columns: 1fr; }
  .af-showcase-grid  { grid-template-columns: 1fr; }
  .af-featured-header { flex-direction: column; align-items: flex-start; }
}
