/* ========================================
   Fikua — fikua.com
   Estudio de producto digital
   Visual identity shared with oriolcanades.com + lab.fikua.com
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Light theme (default) — Joan Miró palette --- */
:root {
  --color-bg: #FCFCFC;              /* near-white paper */
  --color-bg-alt: #F3F4F6;          /* tinted grey inset — non-interactive fills */
  --color-surface: #FFFFFF;         /* raised interactive cards only */
  --color-border: #E1E4DC;          /* line */
  --color-text: #1A1A1A;            /* ink */
  --color-heading: #1A1A1A;
  --color-muted: #4A4A46;           /* muted ink */
  --color-accent: #1A4C9C;          /* cobalt — safe colored text/link */
  --color-accent-hover: #143b78;
  --color-highlight: #E1241A;       /* vermilion — large text / buttons only */
  --color-highlight-hover: #b81d14;
  --color-link: #1A4C9C;
  --color-link-hover: #1A1A1A;
  --color-on-accent: #ffffff;       /* text on cobalt/vermilion fills */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --max-width: 860px;
  --header-height: 76px;
}

/* --- Dark theme — Miró on black --- */
[data-theme="dark"] {
  --color-bg: #1A1A1A;              /* black surface */
  --color-bg-alt: #242424;          /* tinted dark inset */
  --color-surface: #2E2E2C;         /* raised interactive cards */
  --color-border: #3a3a37;
  --color-text: #FCFCFC;            /* paper on dark */
  --color-heading: #FCFCFC;
  --color-muted: #b8b1a0;
  --color-accent: #6FA0E8;          /* lifted cobalt for contrast on black */
  --color-accent-hover: #9cc0f3;
  --color-highlight: #F6C915;       /* yellow reads as the highlight on black */
  --color-highlight-hover: #f8d550;
  --color-link: #6FA0E8;
  --color-link-hover: #9cc0f3;
  --color-on-accent: #1A1A1A;       /* dark text on lifted-blue fills */
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* --- Brand hairline: the four palette colours, fixed at the very top --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 4px;
  background: linear-gradient(
    to right,
    #E1241A 0% 25%,    /* vermilion */
    #1A4C9C 25% 50%,   /* cobalt */
    #F6C915 50% 75%,   /* cadmium yellow */
    #1A1A1A 75% 100%   /* black */
  );
}

[data-theme="dark"] body::before {
  background: linear-gradient(
    to right,
    #F6C915 0% 25%,
    #6FA0E8 25% 50%,
    #E1241A 50% 75%,
    #FCFCFC 75% 100%
  );
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-link-hover);
}

em {
  font-style: italic;
  color: var(--color-highlight);
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 4px;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  height: var(--header-height);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.3s ease;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  line-height: 1.2;
}

.site-logo {
  height: 34px;
  width: auto;
  display: block;
}

/* swap logo per theme: light lockup on light, dark lockup on dark */
.site-logo-dark { display: none; }
[data-theme="dark"] .site-logo-light { display: none; }
[data-theme="dark"] .site-logo-dark { display: block; }

.site-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-heading);
  letter-spacing: -0.01em;
}

.site-brand:hover .site-name {
  color: var(--color-accent);
}

.site-tagline {
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--color-heading);
}

.nav-section-link {
  position: relative;
}

.nav-section-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width 0.2s ease;
}

.nav-section-link:hover::after {
  width: 100%;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* --- Language switcher --- */
.lang-switcher {
  position: relative;
}

.lang-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.lang-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  min-width: 8rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 100;
  overflow: hidden;
}

.lang-switcher:hover .lang-dropdown,
.lang-switcher:focus-within .lang-dropdown,
.lang-switcher.is-open .lang-dropdown {
  display: block;
}

.lang-dropdown a {
  display: block;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  color: var(--color-text);
}

.lang-dropdown a:hover {
  background: var(--color-bg-alt);
  color: var(--color-accent);
}

/* --- Main content --- */
.page-content {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* --- Hero (showpiece) --- */
/* Full-bleed: break out of the centered .page-content column to span the
   whole viewport, while the text stays aligned to the content width. */
.hero {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 5rem 0 4.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 3rem;
  overflow: hidden;
}

/* Inner wrapper keeps hero content aligned with the rest of the page */
.hero-body,
.hero > .hero-aurora,
.hero > .hero-star {
  /* aurora + star are absolute; body is constrained below */
}

/* Aurora — a slow-drifting palette wash behind the hero text */
.hero-aurora {
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 150%;
  z-index: 0;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.5;
  background:
    radial-gradient(38% 50% at 20% 30%, rgba(225, 36, 26, 0.55), transparent 70%),
    radial-gradient(40% 55% at 75% 25%, rgba(26, 76, 156, 0.55), transparent 70%),
    radial-gradient(45% 55% at 55% 75%, rgba(246, 201, 21, 0.45), transparent 70%);
  background-size: 200% 200%;
  animation: aurora-drift 18s ease-in-out infinite alternate;
}

[data-theme="dark"] .hero-aurora {
  opacity: 0.38;
}

@keyframes aurora-drift {
  0%   { background-position: 0% 0%, 100% 0%, 50% 100%; }
  50%  { background-position: 40% 30%, 60% 40%, 30% 60%; }
  100% { background-position: 100% 100%, 0% 60%, 70% 0%; }
}

/* Compass-star — draws itself in, then breathes */
.hero-star {
  position: absolute;
  top: 50%;
  right: clamp(2rem, 8vw, 9rem);
  width: clamp(160px, 22vw, 300px);
  height: clamp(160px, 22vw, 300px);
  transform: translateY(-50%);
  z-index: 0;
  opacity: 0.92;
  pointer-events: none;
  animation: star-breathe 7s ease-in-out 1.4s infinite alternate;
}

.hero-star svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  transition: transform 0.25s ease-out;
}

[data-theme="dark"] .hero-star svg line[stroke="#1A1A1A"] { stroke: #FCFCFC; }
[data-theme="dark"] .hero-star svg line[stroke="#1A4C9C"] { stroke: #6FA0E8; }

.hero-star .spoke {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: spoke-draw 0.7s ease-out forwards;
}
.hero-star .spoke:nth-child(1) { animation-delay: 0.15s; }
.hero-star .spoke:nth-child(2) { animation-delay: 0.27s; }
.hero-star .spoke:nth-child(3) { animation-delay: 0.39s; }
.hero-star .spoke:nth-child(4) { animation-delay: 0.51s; }
.hero-star .spoke:nth-child(5) { animation-delay: 0.63s; }
.hero-star .spoke:nth-child(6) { animation-delay: 0.75s; }

@keyframes spoke-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes star-breathe {
  from { transform: translateY(-50%) scale(1);    }
  to   { transform: translateY(-50%) scale(1.05); }
}

/* Hero text sits above the aurora/star, and rises in on load.
   Constrained to the content column + centered, with side padding to match. */
.hero-body {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.hero-lead,
.hero-eyebrow,
.hero-actions {
  max-width: 40rem;
}

.hero-body > * {
  opacity: 0;
  transform: translateY(14px);
  animation: hero-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.hero-eyebrow  { animation-delay: 0.05s; }
.hero-title    { animation-delay: 0.18s; }
.hero-lead     { animation-delay: 0.31s; }
.hero-actions  { animation-delay: 0.44s; }

@keyframes hero-rise {
  to { opacity: 1; transform: translateY(0); }
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  background: rgba(26, 76, 156, 0.08);
  border: 1px solid currentColor;
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
  margin-bottom: 1.25rem;
}

[data-theme="dark"] .hero-eyebrow {
  background: rgba(111, 160, 232, 0.12);
}

.hero h1 {
  font-size: clamp(2.4rem, 7vw + 0.5rem, 4.5rem);
  font-weight: 700;
  color: var(--color-heading);
  line-height: 1.08;
  margin-bottom: 1.5rem;
  letter-spacing: -0.035em;
}

.hero-lead {
  font-size: clamp(1.1rem, 1.2vw + 0.9rem, 1.3rem);
  color: var(--color-text);
  margin-bottom: 2rem;
  max-width: 38rem;
}

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

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

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

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

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

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* --- Sections --- */
.section {
  padding: 3.5rem 0;
  border-top: 1px solid var(--color-border);
  /* Offset anchor jumps so the sticky header doesn't cover the heading */
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.section h2 {
  font-size: clamp(1.35rem, 2.5vw + 0.5rem, 1.75rem);
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

/* Scroll reveal — sections rise into view as they enter the viewport.
   JS adds .is-visible via IntersectionObserver. Without JS, content is
   visible by default (the .reveal opacity only applies once JS marks the
   document .js-reveal-ready, so no-JS users see everything). */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}

.section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: 0.5rem;
  margin-top: 1.5rem;
}

.section p {
  margin-bottom: 1rem;
}

.section p:last-child {
  margin-bottom: 0;
}

/* --- Principles grid --- */
.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.principle {
  position: relative;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.principle:hover {
  border-color: var(--color-accent);
  box-shadow: 0 8px 24px rgba(26, 76, 156, 0.12);
  transform: translateY(-3px);
}

.principle h3 {
  margin-top: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-heading);
}

.principle p {
  margin-bottom: 0;
  color: var(--color-text);
}

/* --- Areas --- */
.area {
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
}

.area:first-of-type {
  border-top: none;
  padding-top: 0;
}

.area-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.area-header h3 {
  margin: 0;
}

.area h3 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--color-heading);
}

.area-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-highlight);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-highlight);
  border-radius: 999px;
}

.area-proof {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 6px 6px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.area-follow {
  margin-top: 1rem;
  font-size: 0.92rem;
  color: var(--color-muted);
}

.area-follow a {
  font-weight: 500;
}

.area-soon h3 {
  color: var(--color-muted);
}

.link-arrow {
  font-weight: 500;
  color: var(--color-accent);
}

.link-arrow:hover {
  color: var(--color-accent-hover);
}

/* --- Contact --- */
.section-contact {
  background: var(--color-bg-alt);
  margin: 0 -1.5rem 1rem;
  padding: 2.5rem 1.5rem;
  border-radius: 8px;
  border-top: none;
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.email-link {
  font-weight: 600;
  color: var(--color-highlight);
}

.email-link:hover {
  color: var(--color-highlight-hover);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 1.5rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.footer-meta {
  margin-bottom: 0.6rem;
}

.footer-meta p {
  margin-bottom: 0.1rem;
}

.footer-meta strong {
  color: var(--color-heading);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-muted);
}

.footer-links a:hover {
  color: var(--color-accent);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* --- Legal / privacy pages --- */
.legal-page {
  padding: 1rem 0 2rem;
}

.legal-page h1 {
  font-size: 2rem;
  color: var(--color-heading);
  margin-bottom: 2rem;
  letter-spacing: -0.01em;
}

.legal-page h2 {
  font-size: 1.25rem;
  color: var(--color-heading);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.legal-page p,
.legal-page ul {
  margin-bottom: 1rem;
}

.legal-page ul {
  padding-left: 1.5rem;
}

.legal-page li {
  margin-bottom: 0.35rem;
}

.legal-page strong {
  color: var(--color-heading);
}

/* --- 404 --- */
.not-found {
  text-align: center;
  padding: 4rem 0;
}

.not-found-code {
  font-size: 4rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 1rem;
  letter-spacing: -0.04em;
}

.not-found h1 {
  font-size: 1.75rem;
  color: var(--color-heading);
  margin-bottom: 1rem;
}

/* --- Responsive --- */

/* Principle cards: 3-up → 1-up below tablet (the cards need room to read) */
@media (max-width: 720px) {
  .principles {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 0 1rem;
  }

  .nav-links {
    gap: 0.75rem;
  }

  /* Hide section links on mobile — keep theme + language controls */
  .nav-section-link {
    display: none;
  }

  /* Star moves behind the text and fades back so copy stays readable */
  .hero-star {
    right: 50%;
    transform: translate(50%, -50%);
    width: clamp(220px, 70vw, 320px);
    height: clamp(220px, 70vw, 320px);
    opacity: 0.12;
    animation: none;
  }

  .hero-lead {
    font-size: 1.05rem;
  }

  .page-content {
    padding: 2rem 1rem;
  }

  .section-contact {
    margin: 0 -1rem 1rem;
    padding: 2rem 1rem;
  }
}

/* --- Accessibility --- */

/* Visible keyboard focus (WCAG 2.4.11) */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Skip link — hidden until focused via keyboard */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 6px 6px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  color: var(--color-on-accent);
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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

  /* Show everything statically — no entrance, no aurora drift, star drawn */
  .hero-body > *,
  .js-reveal .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .hero-aurora { animation: none; }
  .hero-star .spoke { stroke-dashoffset: 0 !important; }
}
