/* ==========================================================================
   Portafolio · Sebastián Monje Pulecio
   Estructura: 1. Tokens  2. Base  3. Layout  4. Componentes  5. Secciones
   ========================================================================== */

/* 1. Tokens ------------------------------------------------------------- */
:root {
  --c-bg: #eef2f1;          /* gris mineral */
  --c-surface: #ffffff;
  --c-ink: #14262b;         /* tinta azul petróleo */
  --c-muted: #4d6166;
  --c-line: #c9d4d3;
  --c-accent: #1b6680;      /* petróleo */
  --c-accent-ink: #ffffff;
  --c-tag: #dde6e5;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, sans-serif;

  /* Escala tipográfica (razón ~1.25) */
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.25rem;
  --t-lg: 1.75rem;
  --t-xl: clamp(2.25rem, 5vw + 0.5rem, 4rem);
  --t-figure: clamp(2rem, 3vw + 1rem, 2.75rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  --wrap: 72rem;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #0f1c1f;
    --c-surface: #152629;
    --c-ink: #e3ecea;
    --c-muted: #9db0b2;
    --c-line: #2b4146;
    --c-accent: #6cc3df;
    --c-accent-ink: #0f1c1f;
    --c-tag: #1f3438;
  }
}

/* 2. Base --------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-body);
  font-size: var(--t-base);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 {
  font-family: var(--f-display);
  line-height: 1.15;
  margin: 0;
  font-weight: 700;
}

p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }

a { color: var(--c-accent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

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

[id] { scroll-margin-top: 5rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* 3. Layout ------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

main > section { padding-block: var(--space-5); }
main > section + section {
  /* Línea divisoria alineada con el contenido, no con el padding lateral */
  background: linear-gradient(var(--c-line), var(--c-line)) top center / calc(100% - 2 * var(--space-3)) 1px no-repeat;
}

.section-head {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  max-width: 40rem;
}
.section-head h2 { font-size: var(--t-lg); }
.section-head p { color: var(--c-muted); }

/* 4. Componentes -------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -3rem;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  padding: var(--space-1) var(--space-2);
  z-index: 100;
}
.skip-link:focus { top: var(--space-2); }

.button {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--c-accent);
}
.button--primary { background: var(--c-accent); color: var(--c-accent-ink); }
.button--primary:hover { filter: brightness(1.1); }
.button--ghost { color: var(--c-accent); }
.button--ghost:hover { background: var(--c-surface); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: var(--space-1);
}
.tags li {
  font-size: var(--t-sm);
  background: var(--c-tag);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--c-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 4rem;
}
.brand {
  font-family: var(--f-display);
  font-weight: 700;
  color: var(--c-ink);
  text-decoration: none;
  margin-right: auto;
}
.nav-list { display: flex; gap: var(--space-3); }
.nav-list a { color: var(--c-ink); text-decoration: none; }
.nav-list a:hover { color: var(--c-accent); text-decoration: underline; }

.lang-switch {
  display: flex;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.lang-switch button {
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  background: transparent;
  color: var(--c-muted);
  border: 0;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--c-ink);
  color: var(--c-bg);
}

/* 5. Secciones ---------------------------------------------------------- */

/* Intro */
.hero { padding-block: var(--space-6) var(--space-5); }
.hero__role { color: var(--c-muted); font-weight: 600; }
.hero__title {
  font-size: var(--t-xl);
  font-weight: 500;
  letter-spacing: -0.02em;
  max-width: 18ch;
  margin-top: var(--space-2);
}
.hero__lead {
  font-size: var(--t-md);
  max-width: 38rem;
  margin-top: var(--space-3);
  color: var(--c-muted);
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Proyectos: registro tipo tabla */
.ledger { border-top: 2px solid var(--c-ink); }

.ledger__head,
.row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1fr) 7.5rem;
  gap: var(--space-3);
}

.ledger__head {
  padding-block: var(--space-1);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-line);
}

.row {
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--c-line);
}
.row h3 { font-size: var(--t-md); }
.row__project p { color: var(--c-muted); margin-top: 0.375rem; }
.row__result p { font-weight: 600; }
.row__result .figure {
  font-family: var(--f-display);
  font-size: var(--t-figure);
  line-height: 1;
  color: var(--c-accent);
  margin-bottom: 0.375rem;
}
.row__links { display: grid; gap: 0.25rem; align-content: start; font-weight: 600; }

/* Experiencia */
.jobs { display: grid; gap: var(--space-4); }
.job {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: var(--space-3);
  max-width: 52rem;
}
.job__dates { color: var(--c-muted); font-weight: 600; font-size: var(--t-sm); padding-top: 0.3rem; }
.job h3 { font-size: var(--t-md); }
.job__org { color: var(--c-muted); }
.job__list { list-style: disc; padding-left: 1.25rem; margin-top: var(--space-1); display: grid; gap: 0.25rem; }

/* Habilidades */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-4) var(--space-3);
}
.skills__grid dt {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--t-md);
  margin-bottom: var(--space-1);
}
.skills__grid dd { color: var(--c-muted); }

/* Sobre mí */
.about__body { max-width: 40rem; display: grid; gap: var(--space-2); }
.about__body h3 { font-size: var(--t-md); margin-top: var(--space-2); }
.edu { list-style: disc; padding-left: 1.25rem; color: var(--c-muted); }

/* Contacto */
.contact h2 { font-size: var(--t-xl); font-weight: 500; letter-spacing: -0.02em; }
.contact > p { margin-top: var(--space-2); color: var(--c-muted); font-size: var(--t-md); }
.contact__links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-4);
  font-weight: 600;
}
.contact__mail { font-size: var(--t-lg); font-family: var(--f-display); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--c-line);
  padding-block: var(--space-3);
  color: var(--c-muted);
  font-size: var(--t-sm);
}

/* Responsive ------------------------------------------------------------ */
@media (max-width: 56rem) {
  .ledger__head { display: none; }
  .row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  .row__links { display: flex; gap: var(--space-3); }
}

@media (max-width: 40rem) {
  .site-header__inner { flex-wrap: wrap; gap: var(--space-1) var(--space-2); padding-block: var(--space-1); }
  nav { order: 3; width: 100%; overflow-x: auto; }
  .nav-list { flex-wrap: wrap; gap: 0.25rem var(--space-2); font-size: var(--t-sm); }
  .nav-list a { white-space: nowrap; }
  [id] { scroll-margin-top: 7rem; }
  .hero { padding-block: var(--space-5) var(--space-4); }
  .contact__mail { font-size: var(--t-md); }
  .job { grid-template-columns: 1fr; gap: var(--space-1); }
}
