/* ===========================
    GLOBAL RESET & SETUP
=========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-padding-top: var(--header-height);   /* anchors no longer hide under sticky header */
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: var(--font-family);
  font-size: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

.container {
  width: 90%;
  max-width: var(--container);
  margin: auto;
}

h1 {
  font-size: var(--font-heading);
  color: var(--color-dark);
  line-height: 1.2;
}

h2 {
  font-size: var(--font-subheading);
  color: var(--color-dark);
}

h3 {
  color: var(--color-dark);
}

section {
  padding: var(--space-xl) 0;
}

.btn {
  display: inline-block;
  padding: 14px 28px;
  border: 2px solid transparent;
  border-radius: var(--radius-round);
  transition: var(--transition);
  font-family: inherit;
  font-size: 1rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

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

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

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

.card,
.price-card,
.testimonial {
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Hover lift: one shared rule instead of two copies */
.card,
.price-card {
  transition: var(--transition);
}

.card:hover,
.price-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-lg);
}

/* Keyboard focus only (no ring on mouse click) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.footer a:focus-visible {
  outline-color: #ffffff;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 2000;
  padding: 0.75rem 1.25rem;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-bold);
}

.skip-link:focus {
  top: 1rem;
}

/* ===========================
    HEADER & NAVIGATION
=========================== */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-light);
  box-shadow: var(--shadow-sm);
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-height);
}

.logo {
  font-size: 1.6rem;
  font-weight: var(--fw-bold);
  color: var(--color-primary);
}

.nav ul {
  display: flex;
  gap: 2rem;
}

.nav a {
  font-weight: var(--fw-medium);
  color: var(--color-dark);
  transition: var(--transition);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a[aria-current="true"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-round);
  color: var(--color-dark);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hamburger {
  display: none;
}

/* Fixed, invisible anchor: linking to it closes the menu without scrolling the page */
.menu-anchor {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* Focus ring for the hidden dark-mode checkbox, shown on its label */
body:has(#theme-toggle:focus-visible) .theme-toggle {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

/* Icon swap (CSS only) */
.theme-toggle .icon-dark {
  display: none;
}

:root:has(#theme-toggle:checked) .theme-toggle .icon-light {
  display: none;
}

:root:has(#theme-toggle:checked) .theme-toggle .icon-dark {
  display: inline;
}

/* ===========================
    HERO SECTION
=========================== */
.hero {
  min-height: 100vh;
  min-height: 100svh;      /* stable on mobile browsers with collapsing address bars */
  display: flex;
  align-items: center;
}

.hero-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4rem;
  align-items: center;
}

.hero-text h1 {
  margin-bottom: 1.5rem;
}

.hero-text p {
  color: var(--color-muted);
  margin-bottom: 2rem;
  max-width: 550px;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-image img {
  width: 100%;
}

:root:has(#theme-toggle:checked) .hero-image img {
  filter: invert(1) hue-rotate(180deg) brightness(0.95);
}

/* ===========================
    FEATURES SECTION
=========================== */
.features {
  background: var(--color-light);
}

.section-title {
  text-align: center;
  margin-bottom: 1rem;
}

.section-text {
  text-align: center;
  color: var(--color-muted);
  margin-bottom: 3rem;
}

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

.card {
  padding: 2rem;
  text-align: center;
}

.card img {
  display: block;
  width: 80px;                 /* matches width="80" in HTML */
  height: 80px;
  margin: 0 auto 1.5rem;       /* centers the icon above the heading */
  object-fit: contain;
  object-position: center;
}

/* Dark mode: black icons become white */
:root:has(#theme-toggle:checked) .card img {
  filter: invert(1);
}

.card h3 {
  margin-bottom: 1rem;
}

.card p {
  color: var(--color-muted);
}

/* ===========================
    PRICING SECTION
=========================== */
.pricing {
  background: var(--color-bg);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.price-card {
  padding: 2rem;
  text-align: center;
  position: relative;
}

.price-card h3 {
  margin-bottom: 1rem;
}

.price-amount {
  font-size: 2rem;
  font-weight: var(--fw-bold);
  color: var(--color-primary);
  margin-bottom: 1.5rem;
}

.price-amount span {
  font-size: 1rem;
  color: var(--color-muted);
}

.price-card ul {
  margin-bottom: 2rem;
}

.price-card li {
  margin: 0.8rem 0;
  color: var(--color-text);
}

.featured {
  border: 2px solid var(--color-primary);
}

.badge {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: var(--fw-bold);
  white-space: nowrap;
}

/* ===========================
    TESTIMONIALS SECTION
=========================== */
.testimonials {
  background: var(--color-light);
}

.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.testimonial {
  padding: 2rem;
}

.rating {
  color: var(--color-star);
  letter-spacing: 0.15em;
  font-size: 1.25rem;
}

.testimonial blockquote {
  margin: 1rem 0;
  font-style: italic;
  color: var(--color-muted);
}

/* ===========================
    CONTACT SECTION
=========================== */
.contact form {
  max-width: 700px;
  margin: auto;
}

.contact label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--color-text);
}

input,
textarea {
  width: 100%;
  padding: 1rem;
  margin-bottom: 1.5rem;
  color: var(--color-text);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
}

.contact textarea {
  resize: vertical;
}

/* ===========================
    FOOTER SECTION
=========================== */
.footer {
  background: var(--color-footer);
  color: #ffffff;
  text-align: center;
  padding: 3rem 0;
}

.footer h3 {
  color: #ffffff;
  margin-bottom: 1rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.footer-links a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: transparent;
  transition: var(--transition);
}

.footer-links a:hover {
  text-decoration-color: #ffffff;
}

.copyright {
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ===========================
    MOTION (all optional)
=========================== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-15px); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  /* One load-in moment for the hero only */
  .hero-text {
    animation: fadeUp 0.9s ease both;
  }

  .hero-image img {
    animation: float 5s ease-in-out infinite;
  }

}

/* Scroll reveal, pure CSS. Browsers without support just show the content. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      animation: fadeUp linear backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 35%;
    }
  }
}

/* ===========================
    MEDIA QUERIES
=========================== */
@media (max-width: 768px) {
  /* Menu is open only while #primary-nav is the URL target.
     Clicking any nav link changes the target, so the menu closes by itself. */
  .hamburger-open {
    display: inline-flex;
  }

  .header:has(#primary-nav:target) .hamburger-open {
    display: none;
  }

  .header:has(#primary-nav:target) .hamburger-close {
    display: inline-flex;
  }

  .nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: var(--color-light);
    box-shadow: var(--shadow-md);
  }

  .nav:target {
    display: block;
  }

  .nav ul {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
    padding: 2rem;
  }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-text p {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-buttons {
    justify-content: center;
  }

  .hero-image {
    order: -1;
  }
}

@media (max-width: 480px) {
  .section-title {
    font-size: 1.8rem;
  }

  /* Full-width only where it helps, not on every .btn */
  .hero-buttons .btn,
  .price-card .btn,
  .contact .btn {
    width: 100%;
    text-align: center;
  }

  .hero {
    min-height: auto;
    padding: 4rem 0;
  }
}

/* Reduced motion: switch everything off */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .card:hover,
  .price-card:hover {
    transform: none;
  }
}