/**
 * CTSL Theme — Component & Layout Styles
 * Concrete Testing Solutions Limited
 * Built by Casbah Digital Ltd
 *
 * Note: Base tokens, reset, typography, header, and footer
 * styles live in style.css. This file adds component detail,
 * page-specific overrides, and utility classes.
 */

/* =====================================================
   SKIP LINK
   ===================================================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--amber);
  color: var(--dark-text);
  padding: .5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 700;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus {
  top: 0;
}

/* =====================================================
   ENTRY CONTENT (WP editor output)
   ===================================================== */
.entry-content h2,
.entry-content h3,
.entry-content h4 {
  color: var(--dark-text);
  margin-top: 2rem;
  margin-bottom: .75rem;
}
.entry-content p {
  color: var(--mid-grey);
  line-height: 1.8;
  margin-bottom: 1.1rem;
}
.entry-content ul,
.entry-content ol {
  list-style: disc;
  padding-left: 1.5rem;
  color: var(--mid-grey);
  line-height: 1.85;
  margin-bottom: 1rem;
}
.entry-content ol {
  list-style: decimal;
}
.entry-content a {
  color: var(--accent);
  text-decoration: underline;
}
.entry-content a:hover {
  color: var(--navy);
}
.entry-content strong {
  color: var(--dark-text);
  font-weight: 600;
}
.entry-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 1.25rem;
  color: var(--mid-grey);
  font-style: italic;
  margin: 1.5rem 0;
}

/* =====================================================
   HERO VARIANTS
   ===================================================== */
.hero-sm {
  padding: 72px 0 56px;
}
.hero-lg {
  padding: 120px 0 100px;
}

/* =====================================================
   SECTION BACKGROUNDS
   ===================================================== */
.bg-white    { background: var(--white); }
.bg-off-white { background: var(--off-white); }
.bg-navy     { background: var(--navy); }

/* =====================================================
   DIVIDER
   ===================================================== */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* =====================================================
   VISUALLY HIDDEN (screen-reader only)
   ===================================================== */
.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;
}

/* =====================================================
   CARD GRID LAYOUTS
   ===================================================== */

/* Service hub 4-up grid responsive */
.services-hub-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
@media (max-width: 1024px) {
  .services-hub-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .services-hub-grid {
    grid-template-columns: 1fr;
  }
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stats-grid .stat-item:last-child {
    grid-column: 1 / -1;
  }
}

/* =====================================================
   TWO-COL RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  .contact-widget {
    position: static;
  }
}

/* =====================================================
   TABS — extra responsive behaviour
   ===================================================== */
@media (max-width: 640px) {
  .tabs-nav {
    flex-direction: column;
    border-bottom: none;
    gap: .5rem;
  }
  .tab-btn {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0;
    text-align: left;
  }
  .tab-btn.active {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
  }
}

/* =====================================================
   TRUST TICKER — pause on reduced motion
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  .trust-ticker-track {
    animation: none;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* =====================================================
   FORM — inline error states
   ===================================================== */
.form-control:invalid:not(:placeholder-shown) {
  border-color: #dc2626;
}
.form-control:valid:not(:placeholder-shown) {
  border-color: #16a34a;
}

/* Submitted state */
.form-submitted .form-control:invalid {
  border-color: #dc2626;
  background: #fef2f2;
}

/* =====================================================
   MEGA DROPDOWN — responsive guard
   ===================================================== */
@media (max-width: 900px) {
  .mega-dropdown {
    display: none !important;
  }
}

/* =====================================================
   FOOTER RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}
@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: .5rem;
  }
}

/* =====================================================
   404 PAGE
   ===================================================== */
.page-404 {
  min-height: 55vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.error-code {
  font-size: 8rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  color: var(--navy);
  line-height: 1;
  opacity: .12;
  user-select: none;
}

/* =====================================================
   BREADCRUMB HERO OVERRIDE
   ===================================================== */
.hero .breadcrumb ol {
  padding: 0;
  margin: 0;
}

/* =====================================================
   ACCREDITATIONS PAGE
   ===================================================== */
.accred-logos-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 1.5rem;
}

/* =====================================================
   ABOUT PAGE — team photo fallback
   ===================================================== */
.team-photo-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--off-white);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  border: 2px dashed var(--border);
}

/* =====================================================
   CONTACT PAGE — map
   ===================================================== */
.map-container {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.map-container iframe {
  display: block;
  width: 100%;
  height: 400px;
  border: none;
}
@media (max-width: 640px) {
  .map-container iframe {
    height: 280px;
  }
}

/* =====================================================
   SERVICE PAGE — sidebar sticky on tall viewports
   ===================================================== */
@media (min-width: 900px) {
  .contact-widget {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }
}

/* =====================================================
   RELATED SERVICES ROW
   ===================================================== */
.related-services {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}
.related-services h3 {
  margin-bottom: 1.5rem;
  font-size: 1.35rem;
}

/* =====================================================
   UTILITY: centred text section
   ===================================================== */
.text-center { text-align: center; }
.text-navy   { color: var(--navy) !important; }
.text-white  { color: var(--white) !important; }
.text-grey   { color: var(--mid-grey) !important; }
.text-amber  { color: var(--amber) !important; }

.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: 1rem !important; }
.mb-1 { margin-bottom: 1rem !important; }
.mt-2 { margin-top: 2rem !important; }
.mb-2 { margin-bottom: 2rem !important; }

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
  #site-header,
  #site-footer,
  .cta-banner,
  .trust-ticker,
  .contact-widget,
  .related-services,
  .hamburger {
    display: none !important;
  }
  body {
    font-size: 12pt;
    color: #000;
  }
  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: .8em;
    color: #666;
  }
  .hero {
    background: #1e3a8a !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 2rem 0;
  }
}

/* =====================================================
   ANIMATION: fade-in on load
   ===================================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.hero-content {
  animation: fadeInUp .6s ease both;
}
@media (prefers-reduced-motion: reduce) {
  .hero-content {
    animation: none;
  }
}

/* =====================================================
   SCROLLBAR STYLING (Webkit)
   ===================================================== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--off-white);
}
::-webkit-scrollbar-thumb {
  background: #c1c9d4;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* =====================================================
   SELECTION
   ===================================================== */
::selection {
  background: rgba(68, 114, 184, 0.2);
  color: var(--dark-text);
}
