/* =========================================
   Verdictly - Main Stylesheet
   ========================================= */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

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

/* Remove tap flash and 300ms click delay on all interactive elements */
a, button, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button, [role="button"] {
  -webkit-user-select: none;
  user-select: none;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f59e0b;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  overscroll-behavior-x: none;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.main-content { padding: 32px 0 64px; min-height: calc(100vh - 140px); }

/* ---- Header ---- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  padding-top: env(safe-area-inset-top, 0px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.logo-icon { font-size: 1.6rem; }
.logo-text { color: var(--primary); }

.main-nav { display: flex; align-items: center; gap: 20px; }

/* Home link */
.main-nav .nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: .9rem;
  white-space: nowrap;
  transition: color .2s;
}
.main-nav .nav-link:hover { color: var(--primary); text-decoration: none; }

/* Browse dropdown wrapper */
.nav-dropdown { position: relative; display: flex; align-items: center; }

/* Browse button */
.nav-dropdown-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  padding: 6px 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.4;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.nav-dropdown-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.nav-dropdown-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.nav-dropdown-arrow { font-size: .7rem; display: inline-block; transition: transform .2s; }
.nav-dropdown-btn.active .nav-dropdown-arrow { transform: rotate(180deg); }

/* Dropdown panel */
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 6px 0;
  z-index: 300;
}
.nav-dropdown-menu.open { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: 10px 18px;
  color: var(--text);
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav-dropdown-menu a:hover { background: var(--bg); color: var(--primary); text-decoration: none; }

/* ---- Breadcrumbs ---- */
.breadcrumb-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .875rem;
  color: var(--text-muted);
}
.breadcrumbs a { color: var(--primary); }
.breadcrumbs .sep { color: var(--border); }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

/* ---- Footer ---- */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: .875rem;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 64px 20px 56px;
  background: linear-gradient(135deg, #eff6ff 0%, #fef3c7 100%);
  border-radius: var(--radius);
  margin-bottom: 48px;
}
.hero-inner {
  max-width: 600px;
  margin: 0 auto;
}
.hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 14px;
}
.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 14px;
}
.hero-accent {
  color: var(--primary);
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 32px;
  line-height: 1.6;
}
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
  padding: 16px 24px;
  display: inline-flex;
}
.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px;
}
.hero-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.hero-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}
.hero-stat-divider {
  width: 1px;
  height: 36px;
  background: rgba(0,0,0,0.12);
}

/* ---- Section titles ---- */
.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.count-badge {
  background: var(--primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ---- Category grid ---- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.category-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: transform .2s, box-shadow .2s;
}
.category-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.category-card--img { padding: 0; overflow: hidden; }
.category-card-body { padding: 16px 20px 20px; }
.category-img-wrap { width: 100%; aspect-ratio: 16/9; overflow: hidden; background: #f3f4f6; }
.category-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.category-icon { font-size: 2.5rem; margin-bottom: 12px; }
.category-name { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }
.category-desc { font-size: .875rem; color: var(--text-muted); margin-bottom: 10px; }
.category-count { font-size: .8rem; color: var(--primary); font-weight: 500; }

/* ---- Page header ---- */
.page-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 0 32px;
}
.page-header-icon { font-size: 3rem; }
.page-header-img { width: 80px; height: 80px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.page-header-img img { width: 100%; height: 100%; object-fit: cover; }
.page-header h1 { font-size: 1.8rem; font-weight: 700; }
.page-desc { color: var(--text-muted); margin-top: 4px; }

/* ---- Subcategory section ---- */
.subcat-section { margin-bottom: 48px; }
.subcat-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 20px;
}

/* ---- Subject card ---- */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.subject-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform .2s, box-shadow .2s;
}
.subject-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }
.subject-img-wrap { aspect-ratio: 1; overflow: hidden; background: #f3f4f6; }
.subject-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.subject-img-placeholder {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: #f3f4f6;
}
.subject-card-body { padding: 12px; }
.subject-year-tag { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--text-muted); background: var(--border); border-radius: 4px; padding: 1px 5px; margin-bottom: 4px; }
.subject-name { font-size: .95rem; font-weight: 600; margin-bottom: 6px; }
.subject-meta { display: flex; align-items: center; gap: 4px; font-size: .8rem; flex-wrap: wrap; }
.stars { color: var(--accent); letter-spacing: -1px; }
.rating-num { font-weight: 600; }
.review-count { color: var(--text-muted); }
.no-reviews { font-size: .8rem; color: var(--text-muted); }
.category-hint { color: var(--text-muted); font-size: .9rem; margin-bottom: 16px; }
.subcat-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.subcat-sep { color: var(--border); }
.subcat-rating { color: var(--accent); font-weight: 600; font-size: .85rem; }
.subcat-pros-cons { display: flex; gap: 6px; margin-top: 6px; }
.subcat-pros, .subcat-cons { list-style: none; padding: 0; margin: 0; font-size: .75rem; flex: 1; }
.subcat-pros li::before { content: '✓ '; color: #16a34a; }
.subcat-cons li::before { content: '✗ '; color: #dc2626; }
.subcat-pros li, .subcat-cons li { line-height: 1.5; color: var(--text-muted); }

/* ---- Subject header ---- */
.subject-header {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 40px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
/* subject-header responsive handled in media queries below */

.subject-header-image img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}
.subject-header-placeholder {
  aspect-ratio: 1;
  background: #f3f4f6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}
.subcat-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
}
.subject-header-info h1 { font-size: 1.8rem; margin-bottom: 16px; }
.subject-description { color: var(--text-muted); line-height: 1.7; margin-top: 16px; }

.rating-summary { display: flex; align-items: center; gap: 16px; }
.big-rating {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stars-large { font-size: 1.4rem; letter-spacing: 1px; }
.star.filled { color: var(--accent); }
.star.half { color: var(--accent); opacity: .6; }
.star.empty { color: var(--border); }
.review-count-label { font-size: .875rem; color: var(--text-muted); margin-top: 4px; }

/* ---- Breed info section ---- */
.breed-info-section {
  margin-top: 32px;
  padding: 28px 32px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.breed-overview {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 24px;
}

.pros-cons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* pros-cons-grid responsive handled in ≤599px block below */

.pros-card,
.cons-card {
  border-radius: 10px;
  padding: 18px 20px;
}

.pros-card  { background: #f0fdf4; border: 1px solid #bbf7d0; }
.cons-card  { background: #fff7ed; border: 1px solid #fed7aa; }

.pros-cons-heading {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.pros-heading { color: #15803d; }
.cons-heading { color: #c2410c; }

.pros-cons-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pros-cons-list li {
  font-size: 0.92rem;
  line-height: 1.5;
  padding-left: 22px;
  position: relative;
  color: var(--text);
}

.pros-card .pros-cons-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #16a34a;
  font-weight: 700;
}

.cons-card .pros-cons-list li::before {
  content: '✗';
  position: absolute;
  left: 0;
  color: #ea580c;
  font-weight: 700;
}

/* ---- Reviews section ---- */
.reviews-section { margin-top: 40px; }
.reviews-list { display: flex; flex-direction: column; gap: 20px; }

.review-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow .2s;
}
.review-card:hover { box-shadow: var(--shadow-md); }

.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.review-author-info { display: flex; align-items: center; gap: 12px; }
.review-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.review-author-avatar.large { width: 52px; height: 52px; font-size: 1.2rem; }
.review-author-name { font-weight: 600; font-size: .95rem; }
.review-meta, .review-meta-detail { font-size: .8rem; color: var(--text-muted); }

.review-rating { display: flex; align-items: center; gap: 6px; }
.review-rating .star.filled { color: var(--accent); }
.review-rating .star.empty { color: var(--border); }
.review-rating .rating-num { font-size: .85rem; color: var(--text-muted); }

.review-title-link { text-decoration: none; color: var(--text); }
.review-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}
.review-title-link:hover .review-title { color: var(--primary); }

.review-excerpt { color: var(--text-muted); font-size: .95rem; line-height: 1.65; }
.read-more {
  display: inline-block;
  margin-top: 12px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--primary);
}
.read-more:hover { text-decoration: underline; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
}
.page-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 500;
  color: var(--primary);
  transition: background .2s;
}
.page-btn:hover { background: #eff6ff; text-decoration: none; }
.page-info { color: var(--text-muted); font-size: .9rem; }

/* ---- Full review ---- */
.review-full {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 800px;
  margin: 0 auto;
}
.review-subject-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  color: var(--primary);
  margin-bottom: 16px;
}
.review-subject-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
}
.review-full-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 20px;
}
.review-full-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.rating-display { text-align: center; }
.rating-label { font-size: .875rem; color: var(--text-muted); margin-top: 4px; }

.review-full-body { line-height: 1.8; color: var(--text); }
.review-full-body p { margin-bottom: 16px; }
.review-full-body p:last-child { margin-bottom: 0; }

.review-full-footer { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.back-link { color: var(--primary); font-weight: 500; }

/* ---- Empty states ---- */
.empty-state { color: var(--text-muted); font-size: .95rem; padding: 20px 0; }
.empty-reviews { text-align: center; padding: 48px; color: var(--text-muted); }
.empty-reviews .hint { font-size: .875rem; margin-top: 8px; }

/* ---- Admin table ---- */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 24px; font-size: .9rem; }
.admin-table th, .admin-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th { background: #f3f4f6; font-weight: 600; }
.admin-table button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: .8rem;
  margin-right: 4px;
}
.admin-table button:hover { background: var(--primary-dark); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Hamburger button — hidden on desktop */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 11px 10px;
  min-height: 44px;
  min-width: 44px;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  border-radius: 8px;
  transition: background .15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle:hover { background: var(--bg); }

/* ================================================================
   PHONE  ≤ 599px
   ================================================================ */
@media (max-width: 599px) {

  /* Prevent horizontal overflow from hero bleed */
  body { overflow-x: hidden; }

  /* Container + main */
  .container { padding: 0 14px; }
  .main-content { padding: 16px 0 calc(48px + env(safe-area-inset-bottom, 0px)); }

  /* ---- Header ---- */
  .site-header { padding: 0; padding-top: env(safe-area-inset-top, 0px); }
  .site-header .container { min-height: 54px; height: auto; padding: 0 14px; }
  .logo { font-size: 1.15rem; gap: 7px; }
  .logo-icon { font-size: 1.3rem; }
  .nav-toggle { display: flex; align-items: center; justify-content: center; }

  /* Nav full-screen dropdown */
  .main-nav {
    display: none;
    position: fixed;
    top: calc(54px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 2px solid var(--border);
    box-shadow: 0 12px 32px rgba(0,0,0,.14);
    flex-direction: column;
    z-index: 200;
    max-height: calc(100vh - 54px - env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - 54px - env(safe-area-inset-top, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .main-nav.open { display: flex; }
  .main-nav a, .main-nav .nav-link {
    padding: 16px 20px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    -webkit-tap-highlight-color: transparent;
  }
  .main-nav a:active { background: var(--bg); }

  /* Dropdown: flatten into nav list */
  .nav-dropdown { display: contents; }
  .nav-dropdown-btn { display: none; }
  .nav-dropdown-menu {
    display: flex !important;
    flex-direction: column;
    position: static;
    transform: none;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-width: 0;
    padding: 0;
  }
  .nav-dropdown-menu a {
    padding: 14px 20px 14px 30px;
    font-size: .95rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }
  .nav-dropdown-menu a:last-child { border-bottom: none; }

  /* ---- Breadcrumbs ---- */
  .breadcrumb-bar { padding: 5px 0; }
  .breadcrumbs {
    font-size: .73rem;
    flex-wrap: nowrap;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .breadcrumbs::-webkit-scrollbar { display: none; }
  .breadcrumbs a, .breadcrumbs .current { white-space: nowrap; }

  /* ---- Hero — edge-to-edge ---- */
  .hero {
    border-radius: 0;
    padding: 32px 20px 28px;
    margin: -16px -14px 22px;
  }
  .hero h1 { font-size: 1.75rem; }
  .hero-sub { font-size: .88rem; margin-bottom: 20px; }
  .hero-eyebrow { font-size: .7rem; margin-bottom: 10px; }
  .hero-stats {
    padding: 10px 12px;
    width: 100%;
    justify-content: space-around;
  }
  .hero-stat { padding: 0 6px; }
  .hero-stat-num { font-size: 1.05rem; }
  .hero-stat-label { font-size: .58rem; }
  .hero-stat-divider { height: 24px; }

  /* ---- Section title ---- */
  .section-title { font-size: 1.05rem; margin-bottom: 12px; }

  /* ---- Category grid: 1 column full-width ---- */
  .categories-grid { grid-template-columns: 1fr; gap: 12px; }
  .category-img-wrap { aspect-ratio: 16/7; }
  .category-card { padding: 20px 16px; }
  .category-card--img .category-card-body { padding: 12px 16px 16px; }
  .category-name { font-size: 1.05rem; }
  .category-desc { font-size: .82rem; }

  /* ---- Subjects grid: 1 column, horizontal list items ---- */
  .subjects-grid { grid-template-columns: 1fr; gap: 10px; }

  .subject-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    border-radius: 14px;
    min-height: 88px;
  }
  .subject-img-wrap {
    width: 88px;
    min-width: 88px;
    flex-shrink: 0;
    aspect-ratio: unset;
    align-self: stretch;
  }
  .subject-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
  .subject-img-placeholder {
    width: 88px;
    min-width: 88px;
    flex-shrink: 0;
    aspect-ratio: unset;
    height: auto;
    min-height: 88px;
    font-size: 2rem;
  }
  .subject-card-body {
    padding: 10px 13px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
  }
  .subject-name { font-size: .9rem; margin-bottom: 3px; }
  .subject-year-tag { font-size: .65rem; }
  .subject-meta { font-size: .75rem; gap: 3px; }
  .subcat-meta { font-size: .74rem; margin-bottom: 3px; }
  .subcat-pros-cons { display: none; }   /* hidden on phone, clean list view */

  /* ---- Page header ---- */
  .page-header { padding: 12px 0 16px; gap: 10px; }
  .page-header h1 { font-size: 1.3rem; }
  .page-header-icon { font-size: 1.9rem; }
  .page-header-img { width: 48px; height: 48px; }
  .page-desc { font-size: .83rem; }
  .category-hint { font-size: .8rem; margin-bottom: 10px; }

  /* ---- Subject detail header: stacked ---- */
  .subject-header {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 14px;
    margin-bottom: 24px;
  }
  .subject-header-image img { aspect-ratio: 16/9; border-radius: 8px; }
  .subject-header-placeholder { aspect-ratio: 16/9; border-radius: 8px; }
  .subject-header-info h1 { font-size: 1.3rem; margin-bottom: 12px; }
  .big-rating { font-size: 2.6rem; }
  .stars-large { font-size: 1.2rem; }

  /* ---- Breed / subject info section ---- */
  .breed-info-section { padding: 16px; margin-top: 16px; }
  .pros-cons-grid { grid-template-columns: 1fr; gap: 12px; }

  /* ---- Review list cards ---- */
  .reviews-section { margin-top: 24px; }
  .reviews-list { gap: 12px; }
  .review-card { padding: 14px; border-radius: 12px; }
  .review-author-avatar { width: 34px; height: 34px; font-size: .85rem; }
  .review-author-name { font-size: .9rem; }
  .review-title { font-size: .96rem; }
  .review-excerpt { font-size: .87rem; }

  /* ---- Full review page ---- */
  .review-full { padding: 16px; border-radius: 12px; }
  .review-full-title { font-size: 1.2rem; }
  .review-full-meta { flex-direction: column; gap: 10px; }
  .review-full-body { font-size: .95rem; }

  /* ---- Write review form ---- */
  .write-review-section { padding: 16px; margin-top: 28px; }
  .form-row { grid-template-columns: 1fr; }
  .btn-submit { width: 100%; text-align: center; }
  .star-picker label { font-size: 2.4rem; }

  /* ---- Pagination ---- */
  .pagination { gap: 8px; margin-top: 24px; }
  .page-btn { padding: 10px 16px; font-size: .85rem; }

  /* ---- Replies ---- */
  .replies-section { padding: 0; margin: 24px 0 40px; }
  .reply-card { padding: 12px; }

  /* ---- Footer safe area ---- */
  .site-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

  /* ---- Admin table: horizontal scroll ---- */
  .admin-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ================================================================
   TABLET  600px – 899px
   ================================================================ */
@media (min-width: 600px) and (max-width: 899px) {

  .container { padding: 0 20px; }
  .main-content { padding: 24px 0 56px; }

  /* ---- Header ---- */
  .site-header { padding-top: env(safe-area-inset-top, 0px); }
  .site-header .container { min-height: 60px; height: auto; }
  .nav-toggle { display: flex; align-items: center; justify-content: center; }

  /* Nav dropdown */
  .main-nav {
    display: none;
    position: fixed;
    top: calc(60px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 2px solid var(--border);
    box-shadow: 0 12px 32px rgba(0,0,0,.14);
    flex-direction: column;
    z-index: 200;
    max-height: calc(100vh - 60px - env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - 60px - env(safe-area-inset-top, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .main-nav.open { display: flex; }
  .main-nav a, .main-nav .nav-link {
    padding: 14px 24px;
    font-size: .95rem;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    -webkit-tap-highlight-color: transparent;
  }
  .main-nav a:active { background: var(--bg); }

  /* Dropdown: flatten into nav list */
  .nav-dropdown { display: contents; }
  .nav-dropdown-btn { display: none; }
  .nav-dropdown-menu {
    display: flex !important;
    flex-direction: column;
    position: static;
    transform: none;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-width: 0;
    padding: 0;
  }
  .nav-dropdown-menu a {
    padding: 12px 24px 12px 36px;
    font-size: .9rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }
  .nav-dropdown-menu a:last-child { border-bottom: none; }

  /* ---- Hero ---- */
  .hero { padding: 52px 24px 44px; margin-bottom: 36px; }
  .hero h1 { font-size: 2.2rem; }
  .hero-stat { padding: 0 18px; }
  .hero-stat-num { font-size: 1.35rem; }

  /* ---- 2-column grids ---- */
  .categories-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .subjects-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }

  /* ---- Subject header ---- */
  .subject-header { grid-template-columns: 180px 1fr; padding: 22px; gap: 24px; }
  .subject-header-info h1 { font-size: 1.6rem; }

  /* ---- Breed info ---- */
  .breed-info-section { padding: 22px 26px; }

  /* ---- Full review ---- */
  .review-full { padding: 26px; }

  /* ---- Admin table ---- */
  .admin-table { display: block; overflow-x: auto; }
}

/* ================================================================
   LARGE TABLET / SMALL DESKTOP  900px – 1099px
   ================================================================ */
@media (min-width: 900px) and (max-width: 1099px) {
  .categories-grid { grid-template-columns: repeat(3, 1fr); }
  .subjects-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =========================================
   Review Form + Image Upload
   ========================================= */

/* Write a Review section */
.write-review-section {
  margin-top: 48px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.write-review-btn {
  display: inline-block;
  margin-top: 16px;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  text-decoration: none;
}
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }

/* Form layout */
.review-form { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
/* .form-row responsive handled in ≤599px block below */

.form-label { font-size: .9rem; font-weight: 600; color: var(--text); }
.form-hint { font-weight: 400; color: var(--text-muted); font-size: .8rem; }
.required { color: #ef4444; }

.form-input, .form-textarea {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 1rem; /* ≥16px prevents iOS Safari auto-zoom on focus */
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-textarea { resize: vertical; min-height: 140px; }

.form-file {
  font-size: .9rem;
  color: var(--text-muted);
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  width: 100%;
}
.form-file:hover { border-color: var(--primary); }

.image-preview { margin-top: 10px; }
.image-preview img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.btn-submit { align-self: flex-start; padding: 12px 32px; font-size: 1rem; }

.form-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 16px;
  color: #b91c1c;
  font-size: .9rem;
}
.form-errors p { margin-bottom: 4px; }
.form-errors p:last-child { margin-bottom: 0; }

/* Star picker — CSS radio stars */
.star-picker {
  display: flex;
  flex-direction: row-reverse;
  gap: 4px;
  width: fit-content;
}
.star-picker input[type="radio"] { display: none; }
.star-picker label {
  font-size: 2rem;
  color: var(--border);
  cursor: pointer;
  transition: color .15s;
  line-height: 1;
}
.star-picker input:checked ~ label,
.star-picker label:hover,
.star-picker label:hover ~ label {
  color: var(--accent);
}

/* Review card thumbnail */
.review-card-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  margin: 10px 0;
  border: 1px solid var(--border);
}

/* Full review image */
.review-full-image {
  margin: 24px 0;
  text-align: center;
}
.review-full-image img {
  max-width: 100%;
  max-height: 480px;
  border-radius: 10px;
  object-fit: contain;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

/* Subject photo upload panel */
.subject-header-image { position: relative; }

.upload-photo-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: rgba(0,0,0,.5);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: .8rem;
  cursor: pointer;
  text-align: center;
  transition: background .2s;
}
.upload-photo-btn:hover { background: rgba(0,0,0,.7); }

.upload-photo-panel {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 8px;
  box-shadow: var(--shadow-md);
}
.upload-photo-panel.open { display: block; }
.upload-field { margin-bottom: 10px; }
.upload-field label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 4px; }
.upload-field input { width: 100%; font-size: .85rem; }
.upload-field input[type="password"] {
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
}

/* ---- Replies ---- */
.replies-section {
  max-width: 780px;
  margin: 48px auto 64px;
  padding: 0 20px;
}
.replies-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.replies-count {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 99px;
  padding: 2px 8px;
}
.reply-thread { margin-bottom: 4px; }
.reply-card {
  display: flex;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
}
.reply-card--child {
  background: var(--bg);
  border-color: transparent;
}
.reply-children {
  margin-top: 12px;
  padding-left: 8px;
  border-left: 3px solid var(--border);
}
.reply-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reply-avatar--sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
  font-size: 0.75rem;
}
.reply-body-wrap { flex: 1; min-width: 0; }
.reply-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.reply-author { font-weight: 600; font-size: 0.9rem; }
.reply-date { font-size: 0.78rem; color: var(--text-muted); }
.reply-body { font-size: 0.95rem; line-height: 1.6; color: var(--text); margin-bottom: 8px; }
.reply-toggle-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 10px;
}
.reply-toggle-btn:hover { text-decoration: underline; }

/* Reply forms */
.reply-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.reply-form.hidden { display: none; }
.reply-form--top {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.reply-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem; /* ≥16px prevents iOS Safari auto-zoom on focus */
  font-family: inherit;
  color: var(--text);
  background: #fff;
  resize: vertical;
  transition: border-color .15s;
}
.reply-input:focus { outline: none; border-color: var(--primary); }
.reply-submit-btn {
  align-self: flex-start;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.reply-submit-btn:hover { background: var(--primary-dark); }
.reply-new { margin-top: 40px; }

/* ---- Language switcher ---- */
.lang-switcher {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.lang-btn {
  font-size: 1.25rem;
  line-height: 1;
  padding: 9px 5px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity .15s, transform .15s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.lang-btn:hover { opacity: 1; transform: scale(1.15); text-decoration: none; }
.lang-btn--active { opacity: 1; }
.reply-new-heading { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }

/* ---- Review source / verified badge ---- */
.review-source {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  color: #15803d;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 99px;
  padding: 1px 7px;
  vertical-align: middle;
  line-height: 1.6;
  white-space: nowrap;
}

/* ================================================================
   VERY SMALL SCREENS  ≤ 360px  (iPhone SE 1st gen, narrow Androids)
   ================================================================ */
@media (max-width: 360px) {
  /* Hide inactive language flags to prevent header overflow */
  .lang-btn:not(.lang-btn--active) { display: none; }
  /* Slightly smaller hero headline */
  .hero h1 { font-size: 1.55rem; }
}
