/*
  Kainos Care stylesheet

  This file defines the colour scheme, typography and layout for the
  Kainos Care website. The design prioritises readability and a calm,
  professional aesthetic, using warm purples and neutrals that echo
  the imagery. The layout is responsive, adapting gracefully from
  desktop to mobile.
*/

/* CSS Variables */
:root {
  /* Palette tuned to meet WCAG 2.2 contrast ratios (SC 1.4.3, 1.4.11) */
  --primary-color: #00796b;
  /* teal */
  --primary-900: #004d40;
  --primary-50: #e0f7fa;
  --brand-green: #00796b;
  --brand-green-700: #00695c;
  --secondary-color: #eaf6f7;
  --accent-color: #e0b35d;
  --text-color: #000000;
  --light-text: #333333;
  --white: #ffffff;
  --bg-color: #f5f5f5;
  --section-padding: 4rem 1rem;
  --max-width: 1140px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

  /* Fluid type & spacing */
  --fs-base: clamp(1.2rem, 0.5vw + 1.1rem, 1.35rem);
  --fs-h1: clamp(2.25rem, 3vw + 1rem, 3.5rem);
  --fs-h2: clamp(2rem, 2.5vw + 1rem, 3rem);
  --fs-h3: clamp(1.35rem, 1vw + 1rem, 1.75rem);
  --fs-h4: clamp(1.125rem, 0.5vw + 1rem, 1.35rem);
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
}

/* Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Lato', 'Inter', sans-serif;
  font-size: var(--fs-base);
  color: var(--text-color);
  background: var(--bg-color);
  line-height: 1.6;
}

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

/* Focus visibility: WCAG 2.2 SC 2.4.7 */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--brand-green);
  outline-offset: 2px;
}

/* Visually hidden utility: WAI-ARIA APG */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link: WCAG 2.2 SC 2.4.1 */
.skip-link {
  position: absolute;
  left: 0;
  top: -100%;
  background: var(--primary-color);
  color: var(--white);
  padding: 0.5rem 1rem;
  z-index: 2000;
}

.skip-link:focus {
  top: 0;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* Header & Navigation */
.header {
  background: var(--white);
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: var(--shadow);
}

/* Top contact bar mimicking target layout */
.topbar {
  background: var(--primary-900);
  color: var(--white);
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
}

.topbar .btn {
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
}

.topbar .btn:hover {
  background: rgba(255, 255, 255, .15);
}

.btn-call {
  background: var(--brand-green);
  color: var(--white);
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.btn-call:hover {
  background: var(--brand-green-700);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav-item {
  font-weight: 500;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--primary-color);
}

/* Hamburger toggle for mobile */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 8px;
  margin-left: auto;
}

.nav-toggle .bar {
  width: 24px;
  height: 2px;
  background: var(--primary-color);
}

/* Hero Section */
.hero {
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}

/* New: hero image element replaces CSS background for better LCP discovery */
.hero>img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero .overlay {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.45));
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
  padding-block: clamp(3rem, 8vh, 8rem);
}

.hero-content {
  text-align: center;
  padding: 2rem;
  max-width: 56rem;
  margin-inline: auto;
}

.hero-content h1 {
  font-size: var(--fs-h1);
  margin-bottom: 1rem;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  color: #ffffff;
  font-family: 'Playfair Display', serif;
}

.hero-content p {
  font-size: 1.125rem;
  margin-bottom: 2rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .5);
  color: #ffffff;
  font-weight: 500;
}

.hero-ctas {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Ensure CTA contrast on hero imagery */
.hero .btn-secondary {
  border: 2px solid #ffffff;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.3);
}

.hero .btn-secondary:hover {
  background: #ffffff;
  color: var(--primary-color);
}

@media (min-width: 900px) {
  .hero-content {
    text-align: left;
    margin-inline: 0;
  }

  .hero-ctas {
    justify-content: flex-start;
  }

  .trust-inline {
    justify-content: flex-start;
  }
}

/* Ratings and trust badges near hero CTA */
.trust-inline {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  color: var(--white);
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.trust-inline .rating {
  font-weight: 700;
}

.trust-inline .badges {
  display: inline-flex;
  gap: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Hero search form: WCAG labels, role=search region */
.hero-search {
  display: inline-flex;
  align-items: stretch;
  width: min(720px, 92vw);
  border-radius: 999px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}

.hero-search input[type="search"] {
  flex: 1;
  border: none;
  padding: 0.9rem 1rem;
  font-size: 1rem;
}

.hero-search button[type="submit"] {
  background: var(--brand-green);
  color: var(--white);
  padding: 0 1rem;
  border: none;
}

.hero-search button[type="submit"]:hover {
  background: var(--brand-green-700);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.3s, color 0.3s;
}

.btn-primary {
  background: var(--primary-color);
  color: var(--white);
  box-shadow: 0 6px 18px rgba(0, 121, 107, 0.35);
}

.btn-primary:hover {
  background: var(--brand-green-700);
}

.btn-secondary {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: var(--white);
}

/* Section headings */
.section-title {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--primary-900);
  text-align: center;
  margin-bottom: 2rem;
}

/* Dark mode - disabled
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f0f12;
    --text-color: #e9e9e9;
    --secondary-color: #15151a;
    --primary-50: #20182e;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  }

  .header,
  .footer {
    background: var(--secondary-color);
  }

  .card,
  .feature,
  .cta-card {
    background: #1a1a22;
  }
} */

/* Services Preview Section */
.services-preview {
  padding: var(--section-padding);
  background: var(--white);
  color: var(--text-color);
}

/* Ensure all section text is visible */
section {
  color: var(--text-color);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
  gap: var(--space-4);
}

.card {
  background: var(--white);
  border-radius: 12px;
  padding: 2rem;
  text-align: left;
  box-shadow: var(--shadow);
  border: 1px solid #ececec;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-icon {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.card h3 {
  font-size: var(--fs-h3);
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.card p {
  font-size: inherit;
  color: var(--light-text);
  margin-bottom: 1rem;
}

.card .link {
  font-weight: 600;
  color: var(--primary-color);
  align-self: flex-start;
  margin-top: auto;
}

.card .link:hover {
  text-decoration: underline;
}

/* Why Choose Us Section */
.why-us {
  background: var(--secondary-color);
  padding: var(--section-padding);
  color: var(--text-color);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
  gap: var(--space-4);
}

.feature {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid #ececec;
  text-align: left;
}

.feature-icon {
  font-size: 2rem;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

.feature h3 {
  font-size: var(--fs-h3);
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.feature p {
  font-size: inherit;
  color: var(--light-text);
}

/* How to Start Section */
.how-start {
  padding: var(--section-padding);
  background: var(--white);
  color: var(--text-color);
}

.steps-list {
  list-style: none;
  max-width: 900px;
  margin: 0 auto;
  padding-left: 0;
}

.steps-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.steps-list h3 {
  margin-bottom: 0.25rem;
  font-size: var(--fs-h3);
  color: var(--primary-color);
}

.steps-list p {
  color: var(--light-text);
  font-size: 0.95rem;
}

/* CTA Section */
.cta {
  background: var(--primary-color);
  color: var(--white);
  text-align: center;
  padding: 3rem 1rem;
}

.cta-container h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.cta-container p {
  max-width: 600px;
  margin: 0 auto 1.5rem;
  font-size: 1rem;
}

.cta .btn-secondary {
  background: var(--accent-color);
  color: var(--white);
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 600;
  transition: background 0.3s;
}

.cta .btn-secondary:hover {
  background: #c9984f;
}

/* Footer */
.footer {
  background: var(--secondary-color);
  padding: 2rem 1rem;
  color: var(--text-color);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.footer h3,
.footer h4 {
  color: var(--primary-900);
  margin-bottom: 0.5rem;
}

.footer p,
.footer a {
  font-size: 0.95rem;
  color: var(--light-text);
}

.footer a:hover {
  text-decoration: underline;
}

.footer-bottom {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--light-text);
}

/* Animation Classes and Keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes heroTitleAnimate {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes heroTextAnimate {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(79, 44, 130, 0.4);
  }

  70% {
    box-shadow: 0 0 0 20px rgba(79, 44, 130, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(79, 44, 130, 0);
  }
}

/* Animation utility classes */
.animated {
  animation-duration: 0.8s;
  animation-fill-mode: both;
}

.animated.fade-in {
  animation-name: fadeIn;
}

.animated.fade-up {
  animation-name: fadeUp;
}

.animated.slide-in-left {
  animation-name: slideInLeft;
}

.animated.slide-in-right {
  animation-name: slideInRight;
}

.animated.hero-title-animate {
  animation-name: heroTitleAnimate;
  animation-duration: 1s;
}

.animated.hero-text-animate {
  animation-name: heroTextAnimate;
  animation-duration: 1s;
  animation-delay: 0.3s;
}

/* Initial state for animated elements: don't hide content by default */
[data-animation] {
  opacity: 1;
}

.will-animate {
  opacity: 0;
}

/* Parallax container setup */
[data-parallax] {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* Enhanced card transitions */
.card,
.feature,
.cta-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.card:hover,
.feature:hover,
.cta-card:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Header scroll effect */
.header {
  transition: background 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}

.header.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header.scrolled .nav-container {
  padding: 0.75rem 1.5rem;
}

/* Enhanced button hover effects */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.btn::before {
  content: none;
}

.btn:hover {
  transform: none;
  box-shadow: none;
  filter: brightness(0.98);
}

/* Navigation item hover animation */
.nav-item {
  position: relative;
  transition: color 0.3s ease;
  cursor: pointer;
}

.nav-item::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-item:hover::after,
.nav-item.active::after {
  width: 100%;
}

/* Floating animation for icons */
.card-icon,
.feature-icon {
  animation: none;
}

/* Step number pulse effect */
.step-number {
  animation: pulse 2s infinite;
}

/* Hero search input animation */
.hero-search {
  animation: fadeUp 1s ease 0.5s both;
}

/* Loading state for body */
body:not(.animations-loaded) {
  overflow-x: hidden;
}

body.animations-loaded {
  transition: opacity 0.3s ease;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  [data-parallax] {
    transform: none !important;
  }
}

/* Utility Classes */
.btn {
  cursor: pointer;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .nav {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    flex-direction: column;
    width: min(90vw, 320px);
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    z-index: 1001;
  }

  .nav[hidden] {
    display: none;
  }

  .nav-item {
    padding: 0.5rem 0;
    display: block;
    width: 100%;
    text-align: left;
  }

  .nav-toggle {
    display: flex;
  }

  .hero-content h1 {
    font-size: 2rem;
  }

  .hero-content p {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.6rem;
  }
}

/* Comparison table styling */
.comparison {
  padding: var(--section-padding);
  background: var(--white);
  color: var(--text-color);
}

.comparison table {
  width: 100%;
  border-collapse: collapse;
}

.comparison caption {
  text-align: left;
  margin-bottom: 1rem;
  font-weight: 700;
  color: var(--primary-color);
}

.comparison th,
.comparison td {
  border: 1px solid #cfd8dc;
  padding: 0.9rem;
  color: var(--text-color);
}

.comparison thead th {
  background: #e0f2f1;
  color: var(--text-color);
}

/* Three CTA cards */
.cta-cards {
  padding: var(--section-padding);
  background: var(--white);
  color: var(--text-color);
}

.cta-cards .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  gap: var(--space-3);
}

.cta-card {
  background: var(--white);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.cta-card h3 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.cta-card p {
  color: var(--light-text);
  margin-bottom: 0.75rem;
}

/* Two-column section */
.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .two-col {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}

/* Ensure two-col copy has strong contrast */
.two-col p {
  color: var(--text-color);
}

.two-col h2,
.two-col h3,
.two-col h4 {
  color: var(--primary-900);
}

/* Vertical rhythm helpers */
.stack {
  display: grid;
  gap: var(--space-3);
}

:where(h1, h2, h3, h4, p, ul, ol) {
  margin-block: 0;
}

/* Media aspect ratio defaults for thumbnails */
.card img,
.feature img,
.cta-card img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Anchor offset so sticky header doesn’t cover titles */
:where(h2, h3, h4) {
  scroll-margin-top: 5rem;
}

/* Prevent sticky bar overlap on small screens */
@media (max-width: 900px) {
  main {
    padding-bottom: 4.25rem;
  }
}

/* Sticky mobile contact bar */
.sticky-contact {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 0;
  background: var(--white);
  border-top: 1px solid #e9e9e9;
  padding: env(safe-area-inset-bottom, 0);
  z-index: 1100;
}

.sticky-contact a {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0.75rem;
  background: transparent;
  color: var(--text-color);
  font-weight: 700;
  min-height: 44px;
}

.sticky-contact a.secondary {
  background: var(--brand-green);
  color: var(--white);
}

@media (min-width: 900px) {
  .sticky-contact {
    display: none;
  }
}

/* General image stability */
img {
  height: auto;
  max-width: 100%;
}

/* Testimonials */
.testimonials {
  padding: var(--section-padding);
  background: var(--white);
}

.testimonials {
  color: var(--text-color);
}

.testimonials .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.testimonial {
  background: var(--secondary-color);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.testimonial blockquote {
  margin: 0 0 .75rem 0;
  color: var(--text-color);
  font-size: 1rem;
}

.testimonial cite {
  display: block;
  color: var(--light-text);
  font-style: normal;
  font-size: .95rem;
}

/* Badges strip (trust/affiliations) */
.badges-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .25rem .5rem;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, .35);
}

.badge {
  font-size: 0.85rem;
}

.badge svg {
  width: 14px;
  height: 14px;
}

/* Light background variant */
.badges-strip.light {
  color: var(--text-color);
}

.badges-strip.light .badge {
  background: transparent;
  color: var(--primary-900);
  border-color: #e0dbee;
}

/* Smaller CTAs in hero only */
.hero-ctas .btn {
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
}