/* ==========================================================================
   components.css — all section and component styles
   Depends on: main.css (tokens, reset, base typography, utilities, buttons)
   Mobile-first. All values via CSS custom properties — no hardcoded colors,
   spacing, or radii. Transitions use --dur-* and --ease tokens.
   Source of truth for visual intent: design/site/sections.jsx
   ========================================================================== */

/* ==========================================================================
   1. Site Header — transparent overlay, no logo/CTA
   Only the lang-toggle-card is visible. Body needs no top padding since the
   hero fills full viewport height and the toggle floats above it.
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  border: none;
  pointer-events: none; /* pass clicks through to page content */
}

.site-header.is-sticky {
  /* no visual change — toggle card has its own permanent background */
  box-shadow: none;
}

/* Language toggle — pill switch card floating in top-right */
.lang-toggle-card {
  pointer-events: all; /* re-enable clicks for the toggle */
  position: absolute;
  top: 16px;
  right: 24px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-radius: var(--radius-pill);
  box-shadow:
    0 4px 20px rgba(26, 26, 26, 0.08),
    0 1px 4px  rgba(26, 26, 26, 0.05);
  padding: 7px 14px;
}

/* Single-button pill — the whole row is one interactive element */
.lang-toggle-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  min-height: 30px;
}

.lang-toggle-pill:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: var(--radius-pill);
}

/* EN / ES text labels */
.lang-toggle-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: var(--w-bold);
  letter-spacing: 0.1em;
  color: var(--fg-3);
  line-height: 1;
  transition: color var(--dur-fast) var(--ease);
  user-select: none;
}

.lang-toggle-label.is-active {
  color: var(--ink);
}

/* Pill track — the sliding rail */
.lang-toggle-track {
  position: relative;
  width: 56px;
  height: 28px;
  background: var(--bg-3);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  display: block;
}

/* Knob — circular flag badge that slides along the track */
.lang-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow:
    0 2px 6px  rgba(26, 26, 26, 0.18),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  transition: transform var(--dur) var(--ease);
}

.lang-toggle-knob img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* EN active: knob at left end */
.lang-toggle-knob--en {
  transform: translateX(0);
}

/* ES active: knob at right end — track(56) - knob(24) - padding(4) = 28px */
.lang-toggle-knob--es {
  transform: translateX(28px);
}

/* Lucide icon spans (empty until main.js injects SVG) */
[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-icon] svg {
  display: block;
}


/* ==========================================================================
   2. Hero
   bg: --bg-1 | Section id="home"
   ========================================================================== */

.hero {
  position: relative; /* stacking context for absolutely-positioned blob */
  background: var(--bg-1);
  padding-block: var(--space-7) var(--space-7);
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

@supports not (min-height: 100svh) {
  .hero {
    min-height: 100vh;
  }
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  align-items: center;
  position: relative;
  z-index: 1; /* render above the blob */
}

@media (min-width: 768px) {
  .hero__grid {
    grid-template-columns: 1.08fr 0.92fr;
    gap: 72px;
  }
}

/* Left column */
.hero__content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hero__logo {
  height: 88px;
  width: 125px;
  display: block;
  margin-bottom: var(--space-4);
  margin-left: -4px; /* optical alignment per sections.jsx */
}

.hero__eyebrow {
  margin-bottom: var(--space-3);
}

.hero__eyebrow-name {
  font-size: 18px; /* --text-sm (14px) + 4px */
  color: var(--ink);
}

.hero__title {
  margin-bottom: var(--space-3);
}

.hero__intro {
  max-width: 520px;
  margin-bottom: var(--space-4);
}

.hero__cta {
  align-self: flex-start;
}

/* Right column — circular portrait with decorative ring */
.hero__visual {
  display: flex;
  justify-content: center;
}

/* Decorative semicircle image — fills hero, positioned top-right.
   Replicates the reference template's ::before background-image approach. */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../images/bg-semicircle-img.png');
  background-position: top right;
  background-repeat: no-repeat;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.hero__portrait-wrap {
  position: relative;
  width: min(420px, 80vw);
  aspect-ratio: 1 / 1;
}

.hero__ring {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  opacity: 0.5;
  pointer-events: none;
}

.hero__portrait-frame {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero__portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 95%;
  display: block;
}


/* ==========================================================================
   3. Intro Band
   bg: --bg-2 | Section id="intro"
   ========================================================================== */

.intro-band {
  background: var(--bg-2);
  padding-block: var(--space-7);
}

.intro-band__inner {
  max-width: 760px;
  margin-inline: auto;
  text-align: center;
}

.intro-band__inner .sj-eyebrow {
  margin-bottom: var(--space-3);
}

.intro-band__text {
  font-family: var(--font-display);
  font-weight: var(--w-light);
  font-size: clamp(24px, 3.2vw, 36px);
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
}

.intro-band__text strong {
  font-weight: var(--w-semibold);
}


/* ==========================================================================
   4. Companies
   bg: --bg-2 (follows Intro Band) | Section id="companies"
   ========================================================================== */

.companies {
  background: var(--bg-2);
  padding-bottom: var(--space-7);
}

.companies__eyebrow {
  text-align: center;
  margin-bottom: var(--space-4);
}

.companies__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .companies__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.companies__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 92px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: var(--w-semibold);
  font-size: var(--text-base);
  letter-spacing: 0.04em;
  color: var(--fg-3);
  text-align: center;
  padding: 0 var(--space-2);
}


/* ==========================================================================
   5. About
   bg: --bg-1 | Section id="about"
   ========================================================================== */

.about {
  background: var(--bg-1);
  padding-block: var(--space-7);
  padding-bottom: var(--space-7);
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  align-items: center;
}

@media (min-width: 768px) {
  .about__grid {
    grid-template-columns: 0.82fr 1.18fr;
    gap: 70px;
  }
}

/* Image with decorative offset border (--border-strong motif) */
.about__image-wrap {
  position: relative;
}

.about__image-frame {
  position: absolute;
  inset: -16px 16px 16px -16px;
  border: 1px solid var(--border-strong);
  opacity: 0.55;
  border-radius: var(--radius-md);
  pointer-events: none;
}

.about__image {
  position: relative; /* stacks above the frame */
  width: 100%;
  border-radius: var(--radius-md);
  display: block;
  box-shadow: var(--shadow-md);
}

/* Content */
.about__content .sj-eyebrow {
  margin-bottom: var(--space-2);
}

.about__heading {
  margin-block: 0 var(--space-4);
  font-size: clamp(28px, 3.4vw, 42px);
}

.about__content .sj-body + .sj-body {
  margin-top: var(--space-3);
}


/* ==========================================================================
   6. Skills & Experience
   bg: --bg-2 | Section id="skills"
   ========================================================================== */

.skills {
  background: var(--bg-2);
  padding-block: var(--space-7);
  padding-bottom: var(--space-7);
}

.skills__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  align-items: start;
}

@media (min-width: 768px) {
  .skills__grid {
    grid-template-columns: 1fr 1fr;
    gap: 80px;
  }
}

/* Skill bars */
.skills__bars .sj-eyebrow {
  margin-bottom: var(--space-2);
}

.skills__title {
  margin-block: 0 var(--space-5);
}

.skills__bar-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.skill-bar__meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: var(--w-medium);
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 10px;
}

.skill-bar__pct {
  font-weight: var(--w-semibold);
  /* color set inline in PHP via SKILL_COLORS */
}

.skill-bar__track {
  height: 16px;
  background: var(--bg-3);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.skill-bar__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  width: 0; /* animated to --target-width when is-visible is added */
  transition: width 1200ms var(--ease);
  /* background set inline in PHP */
}

/* Stagger delays matching sections.jsx i * 120ms */
.skills__bar-list .skill-bar:nth-child(2) .skill-bar__fill { transition-delay: 120ms; }
.skills__bar-list .skill-bar:nth-child(3) .skill-bar__fill { transition-delay: 240ms; }
.skills__bar-list .skill-bar:nth-child(4) .skill-bar__fill { transition-delay: 360ms; }

/* JS adds is-visible to .js-skills-section; CSS drives the animation */
.js-skills-section.is-visible .skill-bar__fill {
  width: var(--target-width);
}

/* -------------------------------------------------------------------------
   Scroll-reveal — fade-up entrance triggered by IntersectionObserver.
   Only opacity + transform are animated (compositor-thread, zero reflow).
   initRevealAnimations() in main.js adds .is-visible when element enters view.
   ------------------------------------------------------------------------- */
.js-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity   650ms var(--ease),
    transform 650ms var(--ease);
  will-change: opacity, transform;
}

.js-reveal.is-visible {
  opacity: 1;
  transform: none;
  will-change: auto; /* release GPU layer once animation completes */
}

/* Stagger delays — apply to siblings (cards, tiles, columns) */
.js-reveal--delay-1 { transition-delay: 120ms; }
.js-reveal--delay-2 { transition-delay: 240ms; }
.js-reveal--delay-3 { transition-delay: 360ms; }

/* Respect OS-level reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .js-reveal {
    opacity: 1;
    transform: none;
    transition: none;
    will-change: auto;
  }
}

.skills__resume {
  margin-top: var(--space-5);
  display: inline-flex;
}

/* Experience timeline */
.skills__timeline .sj-eyebrow {
  margin-bottom: var(--space-2);
}

.timeline {
  margin-top: var(--space-2);
  border-left: 1px solid var(--border);
  padding-left: var(--space-4);
}

.timeline__item {
  position: relative;
  padding-bottom: var(--space-4);
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__dot {
  position: absolute;
  left: calc(-1 * var(--space-4) - 6px); /* center on border: padding - half-dot-width */
  top: 4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--bg-2);
}

.timeline__years {
  font-size: 12px;
  margin-bottom: var(--space-1);
}

.timeline__co {
  font-family: var(--font-display);
  font-weight: var(--w-semibold);
  font-size: var(--text-md);
  color: var(--ink);
  margin: 0 0 3px;
}

.timeline__role {
  font-size: 15px;
  color: var(--fg-2);
}


/* ==========================================================================
   7. Services
   bg: --bg-1 | Section id="services"
   ========================================================================== */

.services {
  background: var(--bg-1);
}

.services__header {
  max-width: 640px;
  margin-bottom: var(--space-5);
}

.services__header .sj-eyebrow {
  margin-bottom: var(--space-2);
}

.services__header .sj-h2 {
  margin-block: 0 var(--space-3);
}

.services__lead {
  margin: 0;
}

/* Card grid — .three-col utility from main.css handles responsive columns */
.services__grid {
  gap: var(--space-4);
}

.service-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  padding: 40px 34px;
  box-shadow: none;
  transition:
    box-shadow var(--dur) var(--ease),
    transform  var(--dur) var(--ease);
}

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

.service-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.service-card__icon {
  color: var(--ink-secondary);
  width: 30px;
  height: 30px;
}

.service-card__num {
  font-family: var(--font-display);
  font-weight: var(--w-bold);
  font-size: 22px;
  color: var(--border); /* faint large index number per JSX */
}

.service-card__title {
  font-family: var(--font-display);
  font-weight: var(--w-semibold);
  font-size: 21px;
  color: var(--ink);
  margin-block: 0 var(--space-2);
}

.service-card__body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg-2);
  margin: 0;
}


/* ==========================================================================
   8. Projects / Portfolio
   bg: --bg-2 | Section id="portfolio"
   ========================================================================== */

.projects {
  background: var(--bg-2);
}

.projects__header {
  margin-bottom: var(--space-5);
}

.projects__header .sj-eyebrow {
  margin-bottom: var(--space-2);
}

.projects__header .sj-h2 {
  margin-block: 0 var(--space-3);
}

.projects__header .sj-body {
  margin: 0;
}

/* Card grid */
.projects__grid {
  gap: var(--space-4);
}

.project-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: var(--radius-md);
  box-shadow: none;
  transition: box-shadow var(--dur) var(--ease);
}

.project-card:hover {
  box-shadow: var(--shadow-md);
}

.project-card__thumb {
  aspect-ratio: 4 / 3;
  background: var(--card-tone, var(--fg-3)); /* --card-tone set inline in PHP */
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(1);
  transition: transform var(--dur-slow) var(--ease);
}

.project-card:hover .project-card__thumb {
  transform: scale(1.04);
}

.project-card__initials {
  font-family: var(--font-display);
  font-weight: var(--w-bold);
  font-size: 64px;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
}

.project-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(26,26,26,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.project-card:hover .project-card__overlay {
  opacity: 1;
}

.project-card__role {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--fg-on-dark-2);
}

.project-card__title {
  font-family: var(--font-display);
  font-weight: var(--w-semibold);
  font-size: var(--text-md);
  color: var(--fg-on-dark);
  text-align: center;
  padding: 0 var(--space-3);
}


/* ==========================================================================
   9. CTA Banner
   bg: --bg-dark | No nav anchor
   ========================================================================== */

.cta-banner {
  background: var(--bg-dark);
  color: var(--fg-on-dark);
  padding-block: 100px;
}

.cta-banner__inner {
  max-width: 820px;
  margin-inline: auto;
  text-align: center;
}

.cta-banner__title {
  font-family: var(--font-display);
  font-weight: var(--w-semibold);
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.18;
  color: var(--fg-on-dark);
  margin-block: 0 var(--space-3);
}

.cta-banner__text {
  color: var(--fg-on-dark-2);
  font-size: var(--text-base);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto var(--space-2);
}

.cta-banner__free {
  color: var(--fg-on-dark);
  margin-bottom: var(--space-5);
}

.cta-banner__cta {
  display: inline-flex;
}


/* ==========================================================================
   10. Contact
   bg: --bg-1 | Section id="contact"
   ========================================================================== */

.contact {
  background: var(--bg-1);
}

.contact__intro {
  margin-bottom: var(--space-5);
}

.contact__intro .sj-eyebrow {
  margin-bottom: var(--space-2);
}

.contact__intro .sj-h2 {
  margin: 0;
}

.contact__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  align-items: start;
}

@media (min-width: 768px) {
  .contact__grid {
    grid-template-columns: 0.85fr 1.15fr;
    gap: 70px;
  }
}

/* Contact info cards */
.contact__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.contact-card {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.contact-card__icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
}

.contact-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-card__label {
  font-size: 12px;
  margin-bottom: 4px;
}

.contact-card__value {
  font-size: var(--text-base);
  color: var(--ink);
  text-decoration: none;
}

a.contact-card__value:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Form area */
.contact__form-placeholder {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 56px var(--space-5);
  text-align: center;
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: var(--text-sm);
}

/* Contact Form 7 overrides — scoped to avoid conflicts */
.wpcf7 input:not([type="submit"]),
.wpcf7 textarea,
.wpcf7 select {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-1);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding: 13px 15px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.wpcf7 input:not([type="submit"]):focus,
.wpcf7 textarea:focus,
.wpcf7 select:focus {
  border-color: var(--ink-secondary);
  box-shadow: 0 0 0 3px rgba(26,26,26,0.1);
}

.wpcf7 form {
  display: grid;
  gap: var(--space-3);
}

.wpcf7 .name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.wpcf7 input[type="submit"],
.wpcf7-submit {
  width: 100%;
  padding: 14px var(--space-4);
  background: var(--ink-secondary);
  color: var(--fg-on-dark);
  border: 1px solid var(--ink-secondary);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--w-semibold);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.wpcf7 input[type="submit"]:hover,
.wpcf7-submit:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.wpcf7 .wpcf7-not-valid-tip {
  font-size: var(--text-xs);
  color: #b91c1c;
  margin-top: 4px;
  display: block;
}

.wpcf7 .wpcf7-response-output {
  border: 1px solid var(--ink-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  margin-top: var(--space-3);
}


/* ==========================================================================
   11. Site Footer
   bg: --bg-dark | role="contentinfo"
   ========================================================================== */

.site-footer {
  background: var(--bg-dark);
  color: var(--fg-on-dark-2);
  padding: 72px 0 36px;
}

/* Main row: brand (left) + social (right) */
.footer__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

@media (min-width: 640px) {
  .footer__main {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-5);
  }
}

.footer__brand {
  max-width: 420px;
}

.footer__logo-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: var(--space-3);
  margin-left: -4px; /* optical alignment */
}

.footer__logo {
  height: 64px;
  width: auto;
  display: block;
}

.footer__desc {
  color: var(--fg-on-dark-2);
  font-size: 15px;
  line-height: 1.7;
  margin: 0;
}

/* Social icon buttons: 46×46, border 1px rgba(255,255,255,0.22) */
.footer__social {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--radius-sm);
  color: var(--fg-on-dark);
  background: transparent;
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.social-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.4);
}

/* Bottom bar: copyright (left) + powered (right) */
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 26px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--fg-on-dark-2);
}

@media (min-width: 640px) {
  .footer__bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
  }
}
