/* ========================================
   Own IT Services - Styles
   Mobile-first responsive design
   ======================================== */

/* --- CSS Variables --- */
:root {
  --color-primary: #1a2a4a;
  --color-primary-light: #2a3f6a;
  --color-accent: #0d7c8f;
  --color-accent-light: #10a3ba;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-white: #ffffff;
  --color-bg-light: #f8f9fa;
  --color-bg-dark: #1a2a4a;
  --color-border: #e0e0e0;
  --font-heading: 'Maven Pro', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --radius: 8px;
  --transition: 0.3s ease;
  --header-height: 70px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-white);
  -webkit-font-smoothing: antialiased;
}

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

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

a:hover {
  color: var(--color-accent-light);
}

ul {
  list-style: none;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  height: var(--header-height);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: box-shadow var(--transition);
}

.header--scrolled {
  box-shadow: var(--shadow-md);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header__logo img {
  height: 40px;
  width: auto;
}

.header__toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.header__toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--color-primary);
  transition: var(--transition);
  border-radius: 2px;
}

.header__toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.header__toggle.active span:nth-child(2) {
  opacity: 0;
}

.header__toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.header__nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100vh;
  background: var(--color-white);
  padding: calc(var(--header-height) + 20px) 30px 30px;
  transition: right var(--transition);
  overflow-y: auto;
}

.header__nav.active {
  right: 0;
}

.header__menu {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.header__link {
  display: block;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1rem;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: color var(--transition), padding-left var(--transition);
}

.header__link:hover,
.header__link.active {
  color: var(--color-accent);
  padding-left: 8px;
}

.header__link--cta {
  margin-top: 10px;
  background: var(--color-accent);
  color: var(--color-white);
  text-align: center;
  padding: 12px 24px;
  border-radius: var(--radius);
  border-bottom: none;
}

.header__link--cta:hover {
  background: var(--color-accent-light);
  color: var(--color-white);
  padding-left: 0;
}

.header__link--lang {
  margin-top: 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  text-align: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  border-bottom: none;
  color: var(--color-primary);
}

.header__link--lang:hover {
  background: var(--color-bg-light);
  border-color: var(--color-accent);
  color: var(--color-accent);
  padding-left: 16px;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--color-white);
  text-align: center;
}

.hero__slideshow {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__slide {
  position: absolute;
  inset: 0;
  background-size: 125%;
  background-position: top;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

@media (max-width: 768px) {
  .hero__slide {
    background-size: cover;
    background-position: center 30%;
  }
}

.hero__slide--active {
  opacity: 1;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(135deg, rgba(26, 42, 74, 0.7), rgba(13, 124, 143, 0.4));
}

.hero__particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 2;
  padding: 100px 20px 60px;
}

.hero__logo {
  max-width: 320px;
  margin: 0 auto 30px;
}

.hero__title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.hero__subtitle {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 300;
  opacity: 0.9;
  margin-bottom: 40px;
  min-height: 1.8em;
}

.typed-cursor {
  font-weight: 300;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero__cta {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 14px 36px;
  border-radius: var(--radius);
  transition: background var(--transition), transform var(--transition);
}

.hero__cta:hover {
  background: var(--color-accent-light);
  color: var(--color-white);
  transform: translateY(-2px);
}

/* --- Sections --- */
.section {
  padding: 60px 0;
}

.section--light {
  background: var(--color-bg-light);
}

.section--dark {
  position: relative;
  background: url('../images/seguridad.jpg') center/cover no-repeat;
  color: var(--color-white);
}

.section--dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(26, 42, 74, 0.92);
}

.section--dark > .container {
  position: relative;
  z-index: 1;
}

.section--accent {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: var(--color-white);
}

.section__title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
  color: var(--color-primary);
}

.section__title--light {
  color: var(--color-white);
}

.section__title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--color-accent);
  margin: 16px auto 0;
  border-radius: 2px;
}

/* --- About --- */
.about {
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
}

.about__text {
  max-width: 600px;
}

.about__description {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--color-text-light);
}

.about__image img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 500px;
}

/* --- What We Do --- */
.what-we-do {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.what-we-do p {
  font-size: 1.05rem;
  line-height: 1.8;
  opacity: 0.9;
  margin-bottom: 16px;
}

/* --- Values Grid --- */
.values-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.value-card {
  background: var(--color-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.value-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.value-card__image {
  overflow: hidden;
  position: relative;
}

.value-card__image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(26, 42, 74, 0.6), rgba(13, 124, 143, 0.4));
  opacity: 0;
  transition: opacity var(--transition);
}

.value-card:hover .value-card__image::after {
  opacity: 1;
}

.value-card__image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.value-card:hover .value-card__image img {
  transform: scale(1.08);
}

.value-card__content {
  padding: 24px;
}

.value-card__title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 10px;
}

.value-card__text {
  color: var(--color-text-light);
  line-height: 1.7;
}

/* --- Services Grid --- */
.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.service-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), background var(--transition);
}

.service-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.15);
}

.service-card__image {
  overflow: hidden;
}

.service-card__image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.service-card:hover .service-card__image img {
  transform: scale(1.08);
}

.service-card__content {
  padding: 24px;
}

.service-card__title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.service-card__text {
  opacity: 0.9;
  line-height: 1.7;
}

/* --- Contact --- */
.contact-centered {
  max-width: 900px;
  margin: 0 auto;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.contact__detail {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.contact__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--color-accent);
  margin-top: 3px;
}

.contact__detail p {
  margin: 0;
  line-height: 1.5;
}

.contact__detail a {
  color: var(--color-accent);
}

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

.contact__map {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.contact__map iframe {
  display: block;
}

/* --- Contact Form --- */
.contact-form__honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.contact-form__group {
  margin-bottom: 20px;
}

.contact-form__label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--color-text);
}

.contact-form__label span {
  color: #e74c3c;
}

.contact-form__input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.contact-form__input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(13, 124, 143, 0.15);
}

.contact-form__input::placeholder {
  color: #aaa;
}

.contact-form__textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-form__submit {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 14px 36px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  width: 100%;
}

.contact-form__submit:hover {
  background: var(--color-accent-light);
  transform: translateY(-2px);
}

.contact-form__submit:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.contact-form__status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  display: none;
}

.contact-form__status.success {
  display: block;
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.contact-form__status.error {
  display: block;
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* --- Footer --- */
.footer {
  background: var(--color-primary);
  color: rgba(255, 255, 255, 0.7);
  padding: 30px 0;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer__logo {
  height: 40px;
  width: auto;
  opacity: 0.8;
}

.footer__text {
  font-size: 0.85rem;
}

/* ========================================
   Responsive Breakpoints
   ======================================== */

/* Tablet (768px+) */
@media (min-width: 768px) {
  .section {
    padding: 80px 0;
  }

  .about {
    flex-direction: row;
    gap: 50px;
  }

  .about__text {
    flex: 1;
  }

  .about__image {
    flex: 1;
  }

  .values-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer__inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  .header__toggle {
    display: none;
  }

  .header__nav {
    position: static;
    width: auto;
    height: auto;
    background: transparent;
    padding: 0;
    overflow: visible;
  }

  .header__menu {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .header__link {
    padding: 8px 16px;
    border-bottom: none;
    font-size: 0.9rem;
    border-radius: var(--radius);
  }

  .header__link:hover,
  .header__link.active {
    padding-left: 16px;
    background: var(--color-bg-light);
    color: var(--color-accent);
  }

  .header__link--cta {
    margin-top: 0;
    margin-left: 8px;
  }

  .header__link--cta:hover {
    padding-left: 24px;
  }

  .header__link--lang {
    margin-top: 0;
    margin-left: 4px;
    padding: 6px 12px;
  }

  .header__link--lang:hover {
    padding-left: 12px;
  }

  .section {
    padding: 100px 0;
  }

  .hero__logo {
    max-width: 400px;
  }
}

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
  .container {
    padding: 0 40px;
  }
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 999;
  background: var(--color-accent);
  color: var(--color-white);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity var(--transition), visibility var(--transition),
              transform var(--transition), background var(--transition);
  box-shadow: var(--shadow-md);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-accent-light);
  transform: translateY(-3px);
}

/* --- Page Loader --- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.5s ease;
}

.loader.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Fallback: hide loader after 4s even if JS fails */
@keyframes loader-fallback {
  0%, 99% { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; pointer-events: none; }
}

.loader {
  animation: loader-fallback 4s ease forwards;
}

.loader__logo {
  max-width: 180px;
  animation: pulse 1.5s ease-in-out infinite;
}

.loader__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-accent-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* --- Parallax (desktop only) --- */
@media (min-width: 768px) {
  .section--dark {
    background-attachment: fixed;
  }
}

/* --- Animations --- */
/* Only hide elements when JS is available (html.js-ready class added by main.js) */
@media (prefers-reduced-motion: no-preference) {
  .js-ready .fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }

  .js-ready .fade-in.visible {
    opacity: 1;
    transform: translateY(0);
  }

  .js-ready .fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }

  .js-ready .fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }

  .js-ready .fade-in-left.visible,
  .js-ready .fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
  }

  .js-ready .fade-in-delay-1 { transition-delay: 0.15s; }
  .js-ready .fade-in-delay-2 { transition-delay: 0.3s; }
  .js-ready .fade-in-delay-3 { transition-delay: 0.45s; }
}

/* --- Cookie Consent Banner --- */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9998;
  width: 480px;
  max-width: calc(100% - 40px);
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.cookie-banner--visible {
  transform: translateY(0);
  opacity: 1;
}

.cookie-banner__inner {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cookie-banner__title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}

.cookie-banner__text {
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.7;
  opacity: 0.8;
}

.cookie-banner__actions {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  margin-top: 4px;
}

.cookie-banner__btn {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  background: transparent;
  color: var(--color-white);
}

.cookie-banner__btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.5);
}

.cookie-banner__btn--accept {
  background: none;
  border-color: transparent;
  color: var(--color-accent-light);
}

.cookie-banner__btn--accept:hover {
  background: rgba(13, 124, 143, 0.15);
  border-color: transparent;
}

/* Customize panel */
.cookie-banner__customize {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
}

.cookie-banner__customize--visible {
  display: flex;
}

.cookie-banner__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.cookie-banner__always-on {
  font-size: 0.75rem;
  opacity: 0.5;
  font-style: italic;
}

.cookie-banner__toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.cookie-banner__toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-banner__toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 22px;
  transition: background var(--transition);
}

.cookie-banner__toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--color-white);
  border-radius: 50%;
  transition: transform var(--transition);
}

.cookie-banner__toggle input:checked + .cookie-banner__toggle-slider {
  background: var(--color-accent);
}

.cookie-banner__toggle input:checked + .cookie-banner__toggle-slider::before {
  transform: translateX(18px);
}

.cookie-banner__btn--save {
  margin-top: 4px;
  background: var(--color-accent);
  color: var(--color-white);
  border-color: transparent;
}

.cookie-banner__btn--save:hover {
  background: var(--color-accent-light);
  border-color: transparent;
}

/* Map placeholder */
.cookie-banner__map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 300px;
  background: var(--color-bg-light);
  border-radius: var(--radius);
  color: var(--color-text-light);
  font-size: 0.95rem;
  text-align: center;
  padding: 20px;
  font-family: var(--font-body);
}

.cookie-banner__map-placeholder svg {
  opacity: 0.4;
}

.cookie-banner__map-placeholder button {
  background: var(--color-accent);
  color: var(--color-white);
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.cookie-banner__map-placeholder button:hover {
  background: var(--color-accent-light);
}

/* Footer cookie link */
.footer__cookie-link {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  transition: color var(--transition);
}

.footer__cookie-link:hover {
  color: var(--color-white);
}

/* Back-to-top adjustment when banner is active */
body.cookie-banner-active .back-to-top.visible {
  bottom: 120px;
  transition: bottom var(--transition);
}

/* Mobile cookie banner */
@media (max-width: 480px) {
  .cookie-banner {
    left: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
    max-width: none;
  }

  .cookie-banner__inner {
    padding: 22px 18px;
  }

  .cookie-banner__actions {
    flex-wrap: wrap;
  }

  .cookie-banner__btn {
    flex: 1 1 100%;
    text-align: center;
  }
}
