/*
 * Aspida Labs website styles.
 *
 * This stylesheet defines a simple, responsive design for the Aspida Labs
 * marketing site.  It supports both light and dark colour themes using
 * CSS variables and provides a consistent button hierarchy.  The layout
 * emphasises readability and accessibility: colour combinations meet
 * WCAG AA contrast requirements, focus outlines are visible, and
 * interactive elements are clearly distinguished.  Animations are
 * intentionally minimal to avoid disorienting users who prefer reduced
 * motion.
 */

/* Base variables for both themes */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  /* Greens for primary actions */
  --color-primary: #28d98b;
  --color-primary-hover: #24c37a;
  --color-primary-active: #1fa86b;
  /* Purples for links and highlights */
  --color-accent: #28730e;
  --color-accent-hover: #28730e;
  /* Text and background defaults; updated in themes below */
  --color-bg: #ffffff;
  --color-fg: #0f1729;
  --color-card: #f3f6fa;
  --color-border: #e0e6ef;
  --color-focus: #24c37a;
}

/* Dark theme overrides.  The `data-theme="dark"` attribute on the
 * `html` element activates these variables.  Users can toggle between
 * themes via the button in the header; if no explicit theme is chosen
 * then the system preference (prefers-color-scheme) will take effect.
 */
[data-theme="dark"] {
  --color-bg: #0a0e17;
  --color-fg: #e6ecf8;
  --color-card: #101726;
  --color-border: #1e2a40;
  --color-focus: #24c37a;
}

/* Override the hero grid pattern for dark mode to use light lines */
[data-theme="dark"] .hero::before {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

/* Global resets */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* Skip link for screen readers */
.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: -1000;
}
.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--color-accent);
  color: #fff;
  border-radius: 0.25rem;
  z-index: 1000;
}

/* Header styling */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Logo container */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--color-fg);
  text-decoration: none;
}
.logo svg {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

/* Navigation */
nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

nav a {
  font-weight: 500;
  color: var(--color-fg);
  text-decoration: none;
  position: relative;
}
nav a:hover::after,
nav a:focus::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2rem;
  width: 100%;
  height: 2px;
  background-color: var(--color-accent);
}
nav a:focus {
  outline: none;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  color: var(--color-fg);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Hide the mobile navigation toggle by default.  It will be
 * displayed only on narrow screens via a media query below. */
.mobile-nav-toggle {
  display: none;
}

/* Buttons */
.btn {
  display: inline-block;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  transition: background-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

/* Primary button (solid) */
.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
  border: 2px solid var(--color-primary);
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
}
.btn-primary:active {
  background-color: var(--color-primary-active);
}

/* Secondary button (outlined) */
.btn-outline {
  background-color: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline:hover {
  background-color: var(--color-primary);
  color: #fff;
}
.btn-outline:active {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

/* Tertiary button (ghost) */
.btn-ghost {
  background-color: transparent;
  border: 2px solid transparent;
  color: var(--color-primary);
}
.btn-ghost:hover {
  background-color: var(--color-card);
}
.btn-ghost:active {
  background-color: var(--color-border);
}

/* Sections */
main {
  padding: 2rem 1.5rem;
}

.hero {
  /* The hero becomes a flexible container.  Position relative so the
   * pseudo‑element grid can be positioned behind the content. */
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: flex-start;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.hero h1 {
  /* Larger headline for more impact */
  font-size: 3rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
}
.hero p {
  margin-top: 0.5rem;
  max-width: 55ch;
  font-size: 1.2rem;
}
.hero ul {
  margin-top: 1rem;
  padding-left: 1.25rem;
  list-style: disc;
  font-size: 1rem;
}

/* Draw a subtle grid behind the hero content.  The pattern uses
 * semi‑transparent lines spaced evenly in two directions. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Use dark lines on light theme by default; override below for dark theme */
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  /* Place the grid behind any additional effects */
  z-index: -2;
}

/* Add a soft, animated glow behind the hero content.  This radial gradient
 * pulses subtly to draw the eye without overwhelming the page.  The
 * animation uses transform scaling and opacity to create movement. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  /* A radial gradient that fades to transparent toward the edges */
  background: radial-gradient(circle at 30% 30%, rgba(40, 217, 139, 0.3) 0%, rgba(40, 217, 139, 0) 70%);
  /* Provide a subtle stationary glow.  Remove animation to avoid distraction. */
  opacity: 0.35;
  pointer-events: none;
  z-index: -1;
}

@keyframes heroPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.8;
  }
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.hero-image {
  /* Keep the original margin and sizing for the hero illustration so the
   * logo remains in its prior position.  Remove flex layout to avoid
   * shifting the logo when adding the animated text. */
  margin-top: 2rem;
  max-width: 100%;
  width: 400px;
  align-self: center;
  position: relative;
}

/* Animated name below the hero logo.  The text colour uses the primary
 * palette so it stands out on both light and dark themes.  A blinking
 * cursor is drawn via the ::after pseudo‑element.  When users
 * prefer reduced motion, animations are disabled via media query. */
.hero-type {
  /* Provide a small gap between the logo and the animated text by default.  This
   * margin will be adjusted on larger screens to better align the text with
   * the hero content and buttons without shifting the logo itself. */
  margin-top: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-type #typed {
  position: relative;
  padding-right: 0.1em;
}

.hero-type #typed::after {
  content: '';
  position: absolute;
  right: -0.05em;
  width: 0.1em;
  height: 1.1em;
  background-color: currentColor;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  50.01%, 100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-type #typed::after {
    animation: none;
  }
}

/* Trusted logos bar */
.trusted-bar {
  margin-top: 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.875rem;
  color: var(--color-fg);
}
.trusted-bar span {
  font-weight: 500;
  margin-right: 0.5rem;
}
.trusted-bar .badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  background-color: var(--color-card);
  color: var(--color-fg);
  border: 1px solid var(--color-border);
  font-weight: 500;
}

/* Section headings */
h2 {
  font-size: 2rem;
  margin-top: 3rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

/* Services overview grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.service-card {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.service-card img {
  width: 40px;
  height: 40px;
}
.service-card h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}
.service-card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}
.service-card a {
  margin-top: auto;
  align-self: flex-start;
}

/* Blueprint lists and phases */
.blueprint,
.phases {
  margin-top: 1.5rem;
}
.blueprint ul,
.phases ul {
  list-style: disc;
  margin-left: 1rem;
  padding-left: 1rem;
}
.phases-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}
.phase-item {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  color: var(--color-fg);
}

/* Pricing tables */
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
.pricing-table th,
.pricing-table td {
  border: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  text-align: left;
}
.pricing-table th {
  background-color: var(--color-card);
}
.pricing-table tr:nth-child(even) td {
  background-color: var(--color-card);
}
.pricing-table tr:nth-child(odd) td {
  background-color: var(--color-bg);
}

/* Feature cards for the "Why Aspida Labs" section */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature-card {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.feature-card img {
  width: 40px;
  height: 40px;
}
.feature-card h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}
.feature-card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-fg);
}

/* Ensure feature icons remain visible on dark backgrounds.  In dark
 * mode the base stroke is dark, so invert and brighten the SVG
 * referenced via <img>.  Without this the icons can disappear on
 * dark cards. */
/* Improve visibility of monochrome icons on dark mode by brightening and inverting their strokes */
[data-theme="dark"] .feature-card img,
[data-theme="dark"] .service-card img {
  filter: brightness(2) invert(1);
}

/* Case study preview cards */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.case-card {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.case-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.case-card h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}
.case-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}
.case-card a {
  margin-top: auto;
  align-self: flex-start;
}

/* Case study icons */
.case-card img {
  width: 40px;
  height: 40px;
  margin-bottom: 0.5rem;
  /* Match text colour for adaptability */
  filter: none;
}

/* Brighten case icons in dark mode like other icons */
[data-theme="dark"] .case-card img {
  filter: brightness(2) invert(1);
}

/* CTA (call to action) block */
.cta {
  margin-top: 3rem;
  padding: 2rem;
  border-radius: 0.75rem;
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}
.cta h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
}
.cta p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  max-width: 60ch;
}
.cta .btn {
  margin-top: 1rem;
}

/* FAQ (questions & answers) on contact page */
.faq {
  margin-top: 2rem;
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
}
.faq h2 {
  margin-top: 0;
  font-size: 1.5rem;
  font-weight: 700;
}
.faq dl {
  margin: 0;
}
.faq dt {
  font-weight: 600;
  margin-top: 1rem;
}
.faq dd {
  margin-left: 0;
  margin-bottom: 1rem;
}

/* Contact page container to display form and FAQ side by side */
.contact-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2rem;
}
.contact-container form {
  flex: 1 1 300px;
  max-width: 500px;
}
.contact-container .faq {
  flex: 1 1 300px;
  margin-top: 0;
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 500px;
}
form label {
  font-weight: 500;
}
form input,
form textarea {
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  background-color: var(--color-card);
  color: var(--color-fg);
  font-family: var(--font-sans);
  font-size: 1rem;
  width: 100%;
}
form input:focus,
form textarea:focus {
  outline: 2px solid var(--color-focus);
  outline-offset: 0;
}
form textarea {
  resize: vertical;
  min-height: 150px;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--color-border);
  background-color: var(--color-bg);
  color: var(--color-fg);
  text-align: center;
}
footer p {
  margin: 0.25rem 0;
  font-size: 0.875rem;
}

/* Optional styling for the company address in the footer.  This
 * ensures the address looks cohesive with other footer text while
 * remaining distinct.  Adjust the font size or style here as needed. */
footer .company-address {
  font-style: normal;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--color-fg);
}

/* Styling for the contact details section on the contact page. This
 * section displays the company's address, phone number and email in a
 * professional manner. */
.contact-details {
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
}
.contact-details h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.contact-details p {
  margin: 0.25rem 0;
}
.contact-details strong {
  font-weight: 600;
}

/* Story sections on the about page */
.story {
  margin-top: 3rem;
  max-width: 70ch;
  line-height: 1.6;
}
.story h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}
.story p {
  font-size: 1rem;
  margin: 0.5rem 0 1rem;
}
.story ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
}
.story li {
  margin-bottom: 0.5rem;
}

/* Responsive adjustments */
@media (min-width: 768px) {
  .hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .hero-content {
    flex: 1;
    max-width: 50%;
  }
  .hero-image {
    flex: 1;
    max-width: 50%;
    /* Preserve the original top margin on larger screens so the logo
     * stays in its initial vertical position.  The animated text will be
     * repositioned instead of shifting the image. */
    margin-top: 2rem;
  }

  /* On larger screens, raise the animated name so it aligns better with
   * the hero buttons.  A negative margin moves the text upward relative
   * to the logo without altering the logo’s position.  Adjust this
   * value to fine‑tune the alignment. */
  .hero-type {
    margin-top: -1.5rem;
  }
}

@media (max-width: 600px) {
  nav {
    display: none;
  }
  .mobile-nav-toggle {
    display: inline-flex;
    background-color: transparent;
    border: 2px solid var(--color-border);
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--color-fg);
  }
  .mobile-nav-toggle:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
  }
  /* Show nav when open */
  body.nav-open nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    background-color: var(--color-bg);
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    z-index: 99;
  }
}
/* FAQ accordion styles */
.faq details {
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background-color: var(--color-card);
  margin-bottom: 1rem;
  padding: 1rem;
}

.faq summary {
  font-weight: 600;
  cursor: pointer;
  position: relative;
  list-style: none;
  outline: none;
}

/* Hide the default disclosure triangle */
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::marker {
  content: "";
}

/* Add our own indicator */
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 0;
  font-weight: 700;
  transform: translateY(0.15rem);
}
.faq details[open] summary::after {
  content: "–";
}

.faq p {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-size: 0.95rem;
  color: var(--color-fg);
}

/* Cookie consent banner */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background-color: var(--color-card);
  border-top: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
}
.cookie-banner p {
  margin: 0;
  text-align: center;
}
.cookie-banner-buttons {
  display: flex;
  gap: 0.75rem;
}
.cookie-banner button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
}
.cookie-banner button.accept {
  background-color: var(--color-primary);
  color: #ffffff;
}
.cookie-banner button.decline {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-fg);
}
.cookie-banner button:hover {
  opacity: 0.9;
}
