/* ---------- Design tokens ---------- */
:root {
  --bg: #f2ede3;
  --fg: #17140f;
  --fg-muted: #6b6559;
  --line: rgba(23, 20, 15, 0.35);
  --line-soft: rgba(23, 20, 15, 0.15);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --tracking-label: 0.14em;
  --container-pad: clamp(24px, 5vw, 72px);

  --bulb-fill: #f2c14e;
  --bulb-glow: drop-shadow(0 0 5px rgba(242, 193, 78, 0.75));
}

:root[data-theme="dark"] {
  --bg: #100e0c;
  --fg: #f2ede3;
  --fg-muted: #8f897c;
  --line: rgba(242, 237, 227, 0.4);
  --line-soft: rgba(242, 237, 227, 0.18);

  --bulb-fill: none;
  --bulb-glow: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100e0c;
    --fg: #f2ede3;
    --fg-muted: #8f897c;
    --line: rgba(242, 237, 227, 0.4);
    --line-soft: rgba(242, 237, 227, 0.18);

    --bulb-fill: none;
    --bulb-glow: none;
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

hr {
  border: none;
  border-top: 1px solid var(--line-soft);
  margin: 20px 0;
}

a { color: inherit; }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px var(--container-pad) 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
}

.logo-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  column-gap: 6px;
  line-height: 1.3;
}

.logo-grid span:nth-child(1),
.logo-grid span:nth-child(2) {
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.main-nav {
  display: flex;
  gap: 32px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.main-nav a {
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.main-nav a:hover { opacity: 1; }

.main-nav a[aria-current="page"] {
  opacity: 1;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.mobile-nav a[aria-current="page"] {
  opacity: 0.6;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-utility {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
}

.theme-toggle:focus-visible {
  outline: 1px solid var(--line);
  outline-offset: 4px;
}

.bulb-icon {
  width: 26px;
  height: 26px;
  overflow: visible;
}

.bulb-glass,
.bulb-base {
  stroke: currentColor;
  fill: var(--bulb-fill);
  transition: fill 0.25s ease, filter 0.25s ease;
  filter: var(--bulb-glow);
}

.bulb-base {
  fill: none;
}

.menu-btn {
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
}

.menu-btn span {
  display: block;
  height: 1px;
  width: 100%;
  background: var(--fg);
}

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 24px var(--container-pad);
  font-family: var(--font-display);
  font-size: 20px;
}

.mobile-nav a { text-decoration: none; }

.mobile-nav.open { display: flex; }

@media (min-width: 981px) {
  .mobile-nav { display: none !important; }
  .menu-btn { display: none; }
}

@media (max-width: 980px) {
  .main-nav { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: clamp(32px, 9vw, 110px) var(--container-pad) clamp(32px, 8vw, 90px);
}

@media (min-width: 861px) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 620px) 1fr;
    gap: 40px;
    align-items: start;
  }
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(48px, 6.4vw, 92px);
  line-height: 1.02;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}

@media (max-width: 360px) {
  .hero-title {
    font-size: 11vw;
  }
}

.hero-subtitle {
  margin: 0 0 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg);
  line-height: 1.7;
}

/* ---------- Portada ---------- */
body.is-portada {
  margin: 0;
}

.portada-actions {
  position: fixed;
  top: 28px;
  right: var(--container-pad);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
}

.portada {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(88px, 22vw, 110px) var(--container-pad) clamp(28px, 6vw, 40px);
  text-decoration: none;
  color: var(--fg);
  position: relative;
}

@media (min-width: 861px) {
  .portada {
    justify-content: center;
    padding: clamp(48px, 9vw, 110px) var(--container-pad);
  }
}

.portada-mark {
  position: absolute;
  top: 28px;
  left: var(--container-pad);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
}

.portada .hero {
  padding: 0;
}

@media (max-width: 860px) {
  .portada .hero {
    flex: 1;
    justify-content: center;
    min-height: 0;
  }
}

.portada-enter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  align-self: center;
  margin-top: clamp(32px, 6vw, 64px);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-muted);
}

.portada-enter-arrow {
  font-size: 16px;
  animation: portada-bounce 2.2s ease-in-out infinite;
}

@keyframes portada-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------- Content pages ---------- */
.content-page {
  max-width: 640px;
  padding: clamp(48px, 9vw, 100px) var(--container-pad) clamp(64px, 10vw, 120px);
}

.content-page h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(40px, 5.5vw, 64px);
  line-height: 1.05;
  margin: 0 0 24px;
}

.page-lead {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.5;
  margin: 0;
}

.page-name {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.5;
  margin: 0;
}

.page-body {
  font-size: 16px;
  line-height: 1.75;
  margin: 0 0 20px;
  max-width: 58ch;
}

.page-body--muted {
  color: var(--fg-muted);
  font-style: italic;
}

.page-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  text-decoration: none;
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.page-link-arrow {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.page-link:hover .page-link-arrow {
  transform: translateX(6px);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  text-decoration: none;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--fg);
}

.back-link-arrow {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.back-link:hover .back-link-arrow {
  transform: translateX(-4px);
}

/* ---------- Contact links ---------- */
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 28px;
}

.contact-link {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  text-decoration: none;
  color: var(--fg);
  width: fit-content;
}

.contact-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-muted);
}

.contact-arrow {
  font-size: 16px;
  color: var(--fg-muted);
  transition: transform 0.2s ease;
}

.contact-value {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.8vw, 22px);
}

.contact-link:hover .contact-arrow {
  transform: translateX(6px);
}

.contact-link:hover .contact-value {
  opacity: 0.7;
}

/* ---------- Hero graphic ---------- */
.hero-graphic {
  display: flex;
  justify-content: center;
}

.hero-graphic-svg {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
}

@media (min-width: 861px) {
  .hero-graphic-svg {
    max-width: 320px;
  }
}

.hg-line {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.hg-circle {
  fill: none;
  stroke-width: 1;
}

.hg-circle--dashed {
  stroke: var(--line-soft);
  stroke-dasharray: 3 5;
}

.hg-circle--solid {
  stroke: url(#hg-fade-solid);
}

.hg-fade-stop-0 {
  stop-color: var(--line-soft);
  stop-opacity: 0;
}

.hg-fade-stop-1 {
  stop-color: var(--line-soft);
  stop-opacity: 1;
}

.hg-dot {
  fill: var(--fg);
}

.hg-quote {
  font-family: var(--font-display);
  font-size: 19px;
  fill: var(--fg);
}

.hg-quote-rule {
  stroke: var(--line-soft);
  stroke-width: 1;
}

/* ---------- Intro ---------- */
.intro {
  padding: clamp(40px, 8vw, 90px) var(--container-pad) 0;
}

/* ---------- Fit each page in one screen on desktop; scroll only if content needs it ---------- */
@media (min-width: 641px) {
  body:not(.is-portada) {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  body:not(.is-portada) main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
  }

  body.page-inicio .intro {
    padding: 0 var(--container-pad);
  }

  body.page-inicio .index-grid {
    margin-top: clamp(24px, 4vw, 40px);
    padding: clamp(24px, 4vw, 40px) var(--container-pad);
  }

  body.page-inicio .site-footer {
    padding-bottom: clamp(20px, 3vw, 40px);
  }
}

.intro-lead {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.5;
  margin: 0;
  max-width: 26ch;
}

/* ---------- Index / sections grid ---------- */
.index-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 32px;
  padding: 40px var(--container-pad) 100px;
  margin-top: 40px;
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 980px) {
  .index-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .index-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px var(--container-pad) 32px;
  }
}

.index-item {
  scroll-margin-top: 100px;
  display: block;
  text-decoration: none;
  color: inherit;
}

@media (max-width: 640px) {
  .index-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 14px;
    padding: 22px 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .index-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .index-item .index-number {
    order: 1;
    margin-bottom: 0;
  }

  .index-item h2 {
    order: 2;
    flex: 1;
    font-size: 22px;
  }

  .index-item hr {
    display: none;
  }

  .index-item::after {
    content: "\2192";
    order: 3;
    align-self: center;
    color: var(--fg-muted);
    font-size: 16px;
  }

  .index-desc {
    order: 4;
    flex-basis: 100%;
    margin-top: 6px;
  }
}

.index-item h2 {
  transition: opacity 0.2s ease;
}

.index-item:hover h2 {
  opacity: 0.65;
}

.index-number {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.index-item h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  margin: 0;
}

.index-desc {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-muted);
  line-height: 1.7;
  margin: 0;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 var(--container-pad) 40px;
  font-size: 11px;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-muted);
}

.footer-note {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0;
  line-height: 1.7;
}

.footer-rule {
  width: 24px;
  height: 1px;
  background: var(--line-soft);
  margin-top: 7px;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.lang-switch span,
.lang-switch a {
  font: inherit;
  color: var(--fg-muted);
  letter-spacing: inherit;
  text-transform: inherit;
  text-decoration: none;
}

.lang-switch a {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.lang-switch a:hover {
  opacity: 1;
}

.lang-switch .lang-current {
  color: var(--fg);
}
