/* ===================== Tokens ===================== */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f4f6f8;
  --color-border: #dde2e7;
  --color-text: #182432;
  --color-text-muted: #55606c;
  --color-navy: #0f2942;
  --color-navy-dark: #0a1c2e;
  --color-accent: #0b6e77;
  --color-accent-dark: #085860;
  --color-accent-bg: #e8f2f2;
  --font-serif: Georgia, 'Times New Roman', Times, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius: 8px;
  --max-width: 1120px;
  --shadow-card: 0 1px 2px rgba(15, 41, 66, 0.06), 0 1px 8px rgba(15, 41, 66, 0.06);
  --color-status-good: #0ca30c;
  --color-status-critical: #d03b3b;
}

/* ===================== Reset ===================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  font-size: 1rem;
}
img { max-width: 100%; display: block; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { margin: 0; padding: 0; }
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--color-navy);
  line-height: 1.25;
  margin: 0 0 0.6em;
}
p { margin: 0 0 1em; }

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-navy);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}

/* ===================== Header / Nav ===================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: saturate(180%) blur(6px);
}
.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.nav-brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-navy);
  margin-right: auto;
}
.nav-brand:hover { text-decoration: none; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1.25rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  color: var(--color-navy);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}
.nav-links a {
  color: var(--color-text);
  font-weight: 500;
}
.nav-links a:hover { color: var(--color-accent); text-decoration: none; }

.nav-actions { display: flex; align-items: center; }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.lang-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}
.lang-opt.active {
  background: var(--color-navy);
  color: #fff;
}
.lang-opt .flag { font-size: 1rem; }

/* ===================== Buttons ===================== */
.btn {
  display: inline-block;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid transparent;
  cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover { background: var(--color-accent-dark); }
.btn-secondary {
  background: transparent;
  border-color: var(--color-navy);
  color: var(--color-navy);
}
.btn-secondary:hover { background: var(--color-navy); color: #fff; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-disabled {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  border-color: var(--color-border);
  cursor: not-allowed;
}

/* ===================== Hero ===================== */
.hero {
  padding: 4rem 0 3rem;
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
  border-bottom: 1px solid var(--color-border);
}
.hero-inner { max-width: 760px; }
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 0.35rem;
}
.hero-subtitle {
  display: block;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  line-height: 1.35;
  color: var(--color-accent-dark);
  margin: 0 0 1.5rem;
}
.hero .lede {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.hero-sources {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  display: inline-block;
}

/* ===================== Sections ===================== */
section { padding: 3.5rem 0; }
.section-title {
  font-size: 1.75rem;
  text-align: center;
}
.section-lede {
  text-align: center;
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 0 auto 2.5rem;
}
section:nth-of-type(even) { background: var(--color-bg-alt); }

/* ===================== Service cards ===================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.service-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  scroll-margin-top: 5rem;
}
.service-card .service-question {
  font-size: 1.2rem;
  color: var(--color-navy);
}
.service-card .service-name {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}
.service-card .service-for {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 0.75rem;
}
.service-card .service-what { margin-bottom: 0.75rem; }
.service-card .service-deliverable {
  background: var(--color-accent-bg);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  margin-bottom: 1.25rem;
}
.service-card .service-deliverable strong { color: var(--color-navy); }
.service-card-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-start;
}

/* ===================== How we work ===================== */
.howwework-list {
  list-style: none;
  max-width: 720px;
  margin: 0 auto;
  counter-reset: hww;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.howwework-list li {
  counter-increment: hww;
  position: relative;
  padding-left: 3rem;
}
.howwework-list li::before {
  content: counter(hww);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-navy);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
}

/* ===================== Contact ===================== */
#contacto .hero-actions { justify-content: center; }
#contacto .section-lede { margin-bottom: 2rem; }

/* ===================== Demos ===================== */
.demo-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  position: relative;
}
.demo-card .tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}
.demo-status {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
}
.demo-card .btn { margin-top: 0.5rem; }

/* ===================== Footer ===================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  background: var(--color-navy);
  color: #cfd9e2;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.site-footer a { color: #fff; }

/* ===================== CV page ===================== */
.cv-utility-bar {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.cv-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2.5rem;
}
.cv-header {
  grid-column: 1 / -1;
  border-bottom: 2px solid var(--color-navy);
  padding-bottom: 1.5rem;
  margin-bottom: 0.5rem;
}
.cv-header h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.cv-title-line { color: var(--color-accent); font-weight: 600; margin-bottom: 0.25rem; }
.cv-tagline { color: var(--color-text-muted); font-style: italic; margin-bottom: 1rem; }
.cv-contact { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 0.92rem; }
.cv-contact a { color: var(--color-text); }
.cv-contact a:hover { color: var(--color-accent); }

.cv-sidebar { display: flex; flex-direction: column; gap: 2rem; }
.cv-sidebar h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.85rem;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag-chip {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  color: var(--color-text);
}
.skill-group { margin-bottom: 1rem; }
.skill-group-label { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.4rem; }

.edu-entry { margin-bottom: 1rem; }
.edu-entry .edu-year { font-size: 0.8rem; color: var(--color-text-muted); }
.edu-entry .degree { font-weight: 600; }
.edu-entry .institution { font-size: 0.88rem; color: var(--color-text-muted); }

.lang-item { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.92rem; }
.lang-badge {
  background: var(--color-accent-bg);
  color: var(--color-accent-dark);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.cv-main section { padding: 0 0 2rem; }
.cv-main .section-heading {
  font-size: 1.15rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}
.cv-note {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.timeline .entry { display: grid; grid-template-columns: 110px 1fr; gap: 1rem; margin-bottom: 1.75rem; }
.entry-date .year-range { font-size: 0.85rem; color: var(--color-text-muted); font-weight: 600; }
.entry-title { font-weight: 700; color: var(--color-navy); }
.entry-subtitle { font-size: 0.88rem; color: var(--color-text-muted); margin-bottom: 0.4rem; }
.entry-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.entry-list li { font-size: 0.92rem; padding-left: 1rem; border-left: 2px solid var(--color-border); }

.pub-item, .award-item { display: grid; grid-template-columns: 80px 1fr; gap: 1rem; margin-bottom: 1rem; font-size: 0.92rem; }
.pub-year, .award-year { font-weight: 600; color: var(--color-text-muted); }
.pub-title { font-weight: 600; }
.pub-venue { font-size: 0.85rem; color: var(--color-text-muted); }

/* ===================== Responsive ===================== */
@media (max-width: 860px) {
  .cv-page { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-block; order: 2; }
  .nav-links {
    order: 4;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 0;
    overflow: hidden;
  }
  .nav-links.is-open { max-height: 400px; padding-top: 0.5rem; }
  .nav-links a { display: block; padding: 0.6rem 0; }
  .nav-actions { order: 3; }
  .timeline .entry { grid-template-columns: 1fr; }
  .pub-item, .award-item { grid-template-columns: 1fr; }
}

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