/*
  EasyTutorGuide — Business Directory
  Place this file beside /businesses/directory.php.
  All business content and PHP remain in directory.php.
  Responsive fix: each business listing fills one column on small screens.
*/
:root {
  --directory-ink: #1f304b;
  --directory-muted: #54657b;
  --directory-line: #dce7f2;
  --directory-blue: #087cdc;
  --directory-purple: #7145c8;
  --directory-surface: #ffffff;
  --directory-tint: #f3f8fe;
  --directory-radius: 17px;
  --directory-shadow: 0 9px 28px rgba(28, 64, 105, .10);
}

html { box-sizing: border-box; scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: inherit; }
html, body { max-width: 100%; }
body {
  margin: 0;
  min-width: 0;
  overflow-x: clip;
  background: linear-gradient(160deg, #f7fbff 0%, #eef5ff 54%, #f9f7ff 100%);
  color: var(--directory-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
body img, body svg { max-width: 100%; }
body a { text-underline-offset: 3px; }
body button, body input, body select { font: inherit; }
body :focus-visible { outline: 3px solid #fdba49; outline-offset: 3px; }

/* Page-wide background decorations never affect sizing. */
body .bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}
body .bg-decor .blob { position: absolute; width: 25rem; height: 25rem; border-radius: 50%; filter: blur(65px); opacity: .16; }
body .bg-decor .b1 { top: 10%; left: -14rem; background: #68afff; }
body .bg-decor .b2 { top: 30%; right: -16rem; background: #ba91f0; }
body .bg-decor .b3 { bottom: -15rem; left: 30%; background: #8ee3df; }
body .skip-link { position: fixed; top: -100px; left: 12px; z-index: 500; padding: 10px 16px; background: #fff; color: #084b92; border-radius: 10px; }
body .skip-link:focus { top: 12px; }

/* Keep the original navigation and links. */
body .announcement-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px clamp(12px, 3.3vw, 38px);
  background: linear-gradient(95deg, #117fe1 0%, #6550c5 100%);
  color: #fff;
  text-align: center;
}
body .announcement-bar p { margin: 0; color: inherit; font-size: .88rem; }
body .announcement-bar .badge { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; color: #fff; background: rgba(255,255,255,.15); font-size: .78rem; }
body > header {
  position: sticky;
  top: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-width: 0;
  padding: 9px clamp(12px, 3.2vw, 38px);
  border-bottom: 1px solid #d8e5f3;
  background: rgba(255,255,255,.96);
  box-shadow: 0 3px 12px rgba(33,67,116,.07);
}
body > header .logo { flex: 0 0 auto; display: inline-flex; align-items: center; max-width: 156px; }
body > header .logo img { display: block; width: auto; max-width: 156px; max-height: 54px; object-fit: contain; }
body > header .main-nav { flex: 1 1 auto; min-width: 0; }
body > header .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: clamp(6px, 1vw, 15px);
  padding: 0;
  margin: 0;
  list-style: none;
}
body > header .nav-links li { padding: 0; margin: 0; list-style: none; }
body > header .nav-links a { display: inline-block; padding: 7px 3px; color: #294261; text-decoration: none; font-size: clamp(.77rem, .95vw, .9rem); font-weight: 700; }
body > header .nav-links a:hover { color: #126fcc; }
body > header .menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: #e8f3ff;
  color: #126ec3;
  font-size: 24px;
  width: 44px;
  height: 44px;
  cursor: pointer;
}
body .sidebar {
  position: fixed;
  z-index: 300;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 88vw);
  max-width: 100vw;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 62px 18px 22px;
  background: #fff;
  border-left: 1px solid var(--directory-line);
  box-shadow: -15px 0 36px rgba(10,35,80,.16);
  transform: translateX(110%);
  visibility: hidden;
  transition: transform .24s ease, visibility .24s;
}
body .sidebar.is-open, body .sidebar.active, body .sidebar.open { transform: translateX(0); visibility: visible; }
body .sidebar .close-btn {
  position: absolute; right: 16px; top: 10px;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 8px;
  background: #fff0f0;
  color: #bd1e2d;
  font-size: 22px;
  cursor: pointer;
}
body .sidebar > ul { list-style: none; padding: 0; margin: 0; }
body .sidebar > ul li { margin: 0; padding: 0; }
body .sidebar > ul a { display: block; padding: 11px 10px; color: #27456a; font-weight: 700; text-decoration: none; border-bottom: 1px solid #ebf0f5; }
body .sidebar > ul a:hover { background: #f1f7ff; color: #116dcc; }
body .sidebar-social { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; padding-top: 22px; }
body .sidebar-social a { color: #2775c5; font-size: 20px; }
body.menu-open { overflow: hidden; }

/* Constrain content without setting fixed widths on mobile. */
body > main {
  width: min(1240px, calc(100% - 40px));
  max-width: 100%;
  margin: 22px auto 42px;
  min-width: 0;
}
body main > * { min-width: 0; }
body main .hero,
body main .card-box { border: 1px solid var(--directory-line); background: var(--directory-surface); border-radius: var(--directory-radius); box-shadow: var(--directory-shadow); }
body main .hero { padding: clamp(20px, 3vw, 32px); margin: 0 0 22px; }
body main .hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(17px, 2.7vw, 32px); align-items: center; }
body main .hero-grid > * { min-width: 0; }
body main .hero h1 { margin: 0 0 13px; font-size: clamp(1.7rem, 3.2vw, 2.65rem); line-height: 1.16; letter-spacing: -.03em; color: #183c72; }
body main .hero p { margin: 0 0 16px; color: var(--directory-muted); }
body main .hero-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
body main .hero-badges span { display: inline-flex; gap: 6px; align-items: center; border-radius: 999px; padding: 7px 12px; background: #eaf4ff; color: #225cac; font-size: .82rem; font-weight: 700; }
body main .hero-card { background: linear-gradient(132deg, #edf6ff, #f5f0ff); border: 1px solid #d8e5fa; border-radius: 14px; padding: 17px 20px; }
body main .hero-card h3 { margin: 0 0 8px; font-size: 1.12rem; color: #204479; }
body main .hero-card ul { padding-left: 19px; margin: 0; color: #3b536d; }
body main .hero-card li { margin: 5px 0; }
body main .btn, body main .upload-cta { display: inline-flex; align-items: center; justify-content: center; gap: 9px; max-width: 100%; padding: 12px 19px; border-radius: 11px; text-align: center; color: #fff; background: linear-gradient(105deg, #0588e5, #7554cd); font-weight: 800; text-decoration: none; box-shadow: 0 6px 16px rgba(35,91,170,.19); }
body main .upload-cta { margin-top: 18px; }
body main .upload-cta:hover { filter: brightness(1.08); }

/* Search + category controls */
body main .filter-wrap { padding: clamp(18px, 2.6vw, 27px); margin: 0 0 23px; }
body main .section-title { margin: 0 0 4px; font-size: 1.42rem; color: #174b8c; }
body main .section-sub { color: var(--directory-muted); margin: 0 0 14px; }
body main .filter-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); gap: 16px; }
body main .field { min-width: 0; }
body main .field label { display: block; margin: 0 0 7px; color: #2a4263; font-weight: 700; font-size: .92rem; }
body main .field input,
body main .field select { display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 45px; padding: 10px 12px; border: 1px solid #c8d8eb; border-radius: 9px; background: #fff; color: #1d3858; font-size: 16px; }
body main .field input:focus, body main .field select:focus { outline: 2px solid #489ff1; outline-offset: 1px; }

/* Business cards: fixed-width problems and narrow/vertical cards are prevented here. */
body main #directoryGrid.directory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(15px, 2vw, 23px);
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  margin: 0;
}
body main #directoryGrid > .business-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--directory-line);
  border-radius: 15px;
  box-shadow: var(--directory-shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
body main #directoryGrid > .business-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px rgba(31,66,114,.13); }
body main #directoryGrid > .business-card[hidden] { display: none !important; }
body main #directoryGrid .business-card-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 1.75 / 1;
  height: auto;
  padding: 10px;
  background: #f7faff;
  border-bottom: 1px solid #e2eaf3;
  overflow: hidden;
}
body main #directoryGrid .business-card-media > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  object-fit: contain;
  object-position: center;
  border: 0;
  border-radius: 7px;
}
body main #directoryGrid .pdf-card-preview { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 7px; width: 100%; height: 100%; color: #36587f; text-align: center; }
body main #directoryGrid .pdf-card-preview i { font-size: 2.4rem; color: #d14a63; }
body main #directoryGrid .pdf-card-preview a { color: #076ecb; font-weight: 750; }
body main #directoryGrid .business-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 11px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 17px;
  overflow-wrap: anywhere;
  word-break: normal;
}
body main #directoryGrid .business-card-body > h3 { margin: 0; line-height: 1.24; color: #183e70; font-size: clamp(1.08rem, 1.45vw, 1.27rem); }
body main #directoryGrid .business-meta { display: flex; flex-wrap: wrap; gap: 7px; max-width: 100%; min-width: 0; }
body main #directoryGrid .tag { display: inline-flex; align-items: center; max-width: 100%; padding: 5px 9px; background: #ecf4ff; border: 1px solid #dce8f9; border-radius: 999px; color: #315d96; font-weight: 700; font-size: .76rem; overflow-wrap: anywhere; }
body main #directoryGrid .business-desc { margin: 0; color: #4a5d75; font-size: .94rem; white-space: normal; overflow-wrap: anywhere; }
body main #directoryGrid .business-contact-list { display: grid; gap: 6px; min-width: 0; }
body main #directoryGrid .business-contact-list p { display: flex; gap: 8px; align-items: flex-start; min-width: 0; max-width: 100%; margin: 0; color: #39516c; overflow-wrap: anywhere; }
body main #directoryGrid .business-contact-list p i { flex: 0 0 16px; width: 16px; padding-top: 5px; color: #388cd4; }
body main #directoryGrid .business-contact-list a { min-width: 0; overflow-wrap: anywhere; color: #0d6fc4; }
body main #directoryGrid .business-date { margin: auto 0 0; padding-top: 9px; border-top: 1px solid #ebf1f7; font-size: .81rem; color: #74839a; }
body main #directoryGrid .empty-state { grid-column: 1 / -1; padding: 35px; text-align: center; }
body main #directoryGrid .empty-state h2 { margin-top: 0; }

/* Footer — retain current three columns, promo, socials and links. */
body > footer { width: 100%; max-width: 100%; background: #233d5b; color: #f7fbff; padding: 28px 20px 22px; }
body > footer .footer-wrap { width: min(1240px, 100%); max-width: 100%; margin: auto; min-width: 0; }
body > footer .footer-promo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 19px; margin: 0 0 22px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 13px; }
body > footer .footer-promo-text { margin: 0; flex: 1 1 270px; color: #ecf5ff; }
body > footer .footer-promo-actions { flex: 0 1 auto; }
body > footer .footer-btn { display: inline-block; max-width: 100%; padding: 11px 14px; text-align: center; text-decoration: none; border-radius: 10px; background: linear-gradient(95deg, #2a9cf3, #8b5bd4); color: #fff; font-weight: 750; }
body > footer .footer-btn:hover { filter: brightness(1.12); }
body > footer .footer-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 3vw, 38px); padding: 15px 0 20px; }
body > footer .footer-col { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
body > footer .footer-col a { color: #f0f7ff; text-decoration: none; overflow-wrap: anywhere; }
body > footer .footer-col a:hover { color: #a4d3ff; text-decoration: underline; }
body > footer .footer-social { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; padding: 10px 0; }
body > footer .footer-social a { color: #fff; font-size: 20px; }
body > footer .footer-social a:hover { color: #a6d6ff; }
body > footer .footer-copy { margin: 12px 0 0; text-align: center; color: #d8e6f7; font-size: .84rem; }
body #goTopBtn { position: fixed; right: 17px; bottom: 18px; z-index: 100; display: none; align-items: center; justify-content: center; width: 43px; height: 43px; padding: 0; border: 0; border-radius: 50%; background: linear-gradient(135deg, #167dd8, #7658d5); color: #fff; box-shadow: 0 6px 18px rgba(23,78,135,.22); cursor: pointer; }
body #goTopBtn.is-visible { display: flex; }

/* Tablet: two balanced columns, never narrow fixed-size cards. */
@media (max-width: 1050px) {
  body > header .main-nav { display: none; }
  body > header .menu-toggle { display: inline-flex; }
  body main #directoryGrid.directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  body > main { width: calc(100% - 24px); margin: 13px auto 29px; }
  body main .hero-grid { grid-template-columns: minmax(0, 1fr); }
  body main .filter-controls { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  body main #directoryGrid.directory-grid { grid-template-columns: minmax(0, 1fr); }
  body main #directoryGrid > .business-card { width: 100%; max-width: none; min-width: 0; }
  body main #directoryGrid .business-card-media { aspect-ratio: 1.75 / 1; }
  body main #directoryGrid .business-card-body { padding: 15px; }
  body main #directoryGrid .business-card-body > h3 { font-size: 1.17rem; }
  body .announcement-bar { justify-content: center; }
  body .announcement-bar p { font-size: .78rem; }
  body .announcement-bar .badge:last-child { display: none; }
}
@media (max-width: 400px) {
  body > main { width: calc(100% - 18px); }
  body main .hero { padding: 17px; }
  body main .filter-wrap { padding: 15px; }
  body main #directoryGrid .business-card-body { padding: 13px; }
  body main #directoryGrid .business-card-media { padding: 7px; }
  body > footer { padding-inline: 10px; }
  body > footer .footer-top { gap: 7px; }
  body > footer .footer-col a { font-size: .78rem; }
  body .announcement-bar .badge:first-child { font-size: .7rem; padding: 4px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body .sidebar, body main #directoryGrid > .business-card { transition: none; }
}
