/* ===========================================================
   JAVIER CV — editorial / neo-brutalist style
   Dark mode first. Sharp, bold, opinionated.
   =========================================================== */

:root {
  --bg: #0a0a0a;
  --bg-raised: #141414;
  --bg-paper: #1a1a1a;
  --fg: #f4f4f0;
  --fg-muted: #9a9a92;
  --fg-dim: #5a5a55;
  --accent: #d4ff00;
  --accent-2: #ff4d00;
  --border: #2a2a28;
  --border-strong: #f4f4f0;

  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;

  --gutter: clamp(20px, 4vw, 48px);
  --max-w: 1400px;

  --t-fast: 150ms;
  --t-med: 320ms;
  --t-slow: 600ms;
}

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

/* Page fade-in: avoid FOUC while fonts + data are loading. */
html:not(.ready) body {
  opacity: 0;
}
body {
  opacity: 1;
  transition: opacity 380ms ease-out;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01", "ss02", "cv01";
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

::selection {
  background: var(--accent);
  color: #000;
}

/* --- typography --- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.display-xl {
  font-family: var(--font-display);
  font-size: clamp(4rem, 14vw, 12rem);
  font-weight: 400;
  line-height: 0.85;
  letter-spacing: -0.04em;
}
.display-xl em {
  font-style: italic;
  color: var(--accent);
}

.display-l {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 6rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
}

.display-m {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
}

p, li {
  max-width: 60ch;
}

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--fg-dim);
  transition: color var(--t-fast), border-color var(--t-fast);
}
a:hover { color: var(--accent); border-color: var(--accent); }

.mono {
  font-family: var(--font-mono);
  font-size: 0.78em;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.mark {
  background: var(--accent);
  color: #000;
  padding: 0 0.3em;
}

/* --- layout --- */

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

.row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gutter);
}

/* --- navigation --- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  border: none;
  letter-spacing: -0.02em;
}
.nav-logo em { color: var(--accent); font-style: italic; }

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-links a {
  border: none;
  position: relative;
  padding: 4px 0;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transition: right var(--t-med);
}
.nav-links a:hover::after,
.nav-links a.active::after { right: 0; }
.nav-links a.active { color: var(--accent); }

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 16px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
}
.lang-btn {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 4px 2px;
  transition: color var(--t-fast);
}
.lang-btn:hover { color: var(--fg); }
.lang-btn.active { color: var(--accent); }
.lang-sep { color: var(--fg-dim); font-family: var(--font-mono); font-size: 0.78rem; }

/* --- hero --- */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 140px var(--gutter) 80px;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(24px, 4vw, 72px);
  align-items: center;
}
.hero-text { min-width: 0; }

.hero-portrait {
  position: relative;
  width: clamp(180px, 22vw, 320px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--fg);
  box-shadow:
    0 0 0 10px var(--bg),
    0 0 0 12px var(--accent),
    12px 12px 0 rgba(212, 255, 0, 0.22),
    0 30px 60px -20px rgba(0, 0, 0, 0.6);
  background: var(--bg-paper);
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.04) saturate(0.92);
}
.hero-portrait:hover {
  transform: translateY(-4px) rotate(-1deg);
}
/* subtle editorial overlay: dark vignette + lime highlight on the edge */
.hero-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    120% 120% at 30% 20%,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(0, 0, 0, 0) 35%,
    rgba(0, 0, 0, 0.35) 100%
  );
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.hero-kicker::before {
  content: "";
  width: 40px;
  height: 1px;
  background: var(--accent);
}

.hero-title {
  margin-bottom: 24px;
}

.hero-sub {
  font-size: clamp(1rem, 1.4vw, 1.3rem);
  color: var(--fg-muted);
  max-width: 54ch;
  margin-top: 28px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 48px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}
.hero-meta > div { display: flex; flex-direction: column; gap: 4px; }
.hero-meta span:first-child { color: var(--fg-dim); }
.hero-meta span:last-child { color: var(--fg); }

.hero-scroll {
  position: absolute;
  left: var(--gutter);
  bottom: 32px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-scroll::after {
  content: "↓";
  animation: bounce 2s infinite;
  font-size: 1rem;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* --- section --- */

.section {
  padding: 100px 0;
  border-bottom: 1px solid var(--border);
}
.section-header {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 64px;
}
.section-num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-muted);
  letter-spacing: 0.1em;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: -0.02em;
}
.section-title em { color: var(--accent); font-style: italic; }

/* --- cards --- */

.card {
  border: 1px solid var(--border);
  background: var(--bg-raised);
  padding: 28px;
  transition: border-color var(--t-med), transform var(--t-med);
  position: relative;
}
.card:hover {
  border-color: var(--accent);
}
.card-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 10px;
  line-height: 1.05;
}
.card-body { color: var(--fg-muted); font-size: 0.95rem; }

/* --- tag chip --- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border: 1px solid var(--border);
  color: var(--fg);
  background: var(--bg-paper);
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
  border-radius: 0;
}
.tag.accent { border-color: var(--accent); color: var(--accent); }
.tag.tech { color: var(--fg-muted); }

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

/* --- skill tag (flies to backpack) --- */

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 14px;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  border: 2px solid var(--accent);
  will-change: transform, opacity;
  box-shadow: 3px 3px 0 rgba(212, 255, 0, 0.25);
}
.skill-tag.secondary {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #000;
  box-shadow: 3px 3px 0 rgba(255, 77, 0, 0.25);
}

/* --- footer --- */

.footer {
  padding: 80px var(--gutter) 40px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* --- utilities --- */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }

.text-muted { color: var(--fg-muted); }
.text-dim { color: var(--fg-dim); }
.text-accent { color: var(--accent); }

/* ---- index.html composed layouts ---- */

.summary-lead {
  font-size: 1.15rem;
  color: var(--fg);
  max-width: 62ch;
}

.cta-row { margin-top: 48px; }

/* Language card */
.lang-list {
  list-style: none;
  margin-top: 12px;
}
.lang-item {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.lang-name { flex: 0 0 auto; }
.lang-level {
  flex: 1 1 auto;
  text-align: right;
  min-width: 0;
}

/* Education rows */
.edu-row {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.edu-row-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 6px;
  line-height: 1.1;
}

/* Contact block */
.contact-intro {
  font-size: 1.3rem;
  margin-bottom: 24px;
  max-width: 50ch;
}
.contact-list { list-style: none; }
.contact-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.contact-label { flex: 0 0 auto; }
.contact-value {
  flex: 1 1 auto;
  text-align: right;
  min-width: 0;
  word-break: break-word;
}

@media (max-width: 760px) {
  .summary-lead { font-size: 1rem; }
  .cta-row { margin-top: 32px; }
  .lang-item { flex-direction: column; gap: 2px; align-items: flex-start; }
  .lang-level { text-align: left; }
  .contact-intro { font-size: 1.05rem; }
  .contact-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 12px 0;
  }
  .contact-value { text-align: left; }
}

/* Experience summary rows on the index page */
.exp-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.exp-row-date { color: var(--fg-muted); }
.exp-row-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 6px;
  line-height: 1;
}
.exp-row-meta { color: var(--fg-muted); margin-bottom: 12px; }
.exp-row-short { color: var(--fg-muted); }

@media (max-width: 760px) {
  .exp-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 18px 0;
  }
  .exp-row-title { font-size: 1.3rem; }
}

/* Helper classes for grids so they collapse cleanly on small screens. */
.col-span-12 { grid-column: span 12; }
.col-span-7  { grid-column: span 7; }
.col-span-6  { grid-column: span 6; }
.col-span-5  { grid-column: span 5; }
.col-span-4  { grid-column: span 4; }

/* --- tablet --- */
@media (max-width: 1024px) {
  .display-xl { font-size: clamp(3rem, 10vw, 6rem); }
  .display-l  { font-size: clamp(2rem, 6vw, 4rem); }
}

/* --- phone --- */
@media (max-width: 760px) {
  :root {
    --gutter: 18px;
  }

  body { font-size: 15px; }

  /* Collapse the 12-col grid so cards stack naturally */
  .row { grid-template-columns: 1fr; gap: 20px; }
  .row > [style*="grid-column"] { grid-column: 1 / -1 !important; }
  .col-span-12, .col-span-7, .col-span-6, .col-span-5, .col-span-4 {
    grid-column: 1 / -1;
  }

  /* Nav: hide the page links but KEEP the lang switcher visible */
  .nav { padding: 14px var(--gutter); }
  .nav-links {
    gap: 12px;
    flex-wrap: nowrap;
    overflow: visible;
  }
  .nav-links > li:not(.lang-switcher) { display: none; }
  .nav-logo { font-size: 1.15rem; }
  .lang-switcher {
    padding-left: 0;
    margin-left: 0;
    border-left: none;
  }

  /* Hero */
  .hero {
    min-height: auto;
    padding: 110px var(--gutter) 60px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    text-align: left;
  }
  .hero-portrait {
    width: 140px;
    order: -1;
    box-shadow:
      0 0 0 6px var(--bg),
      0 0 0 8px var(--accent),
      6px 6px 0 rgba(212, 255, 0, 0.22),
      0 18px 36px -14px rgba(0, 0, 0, 0.6);
  }
  .display-xl {
    font-size: clamp(2.8rem, 13vw, 4.6rem);
    line-height: 0.9;
  }
  .hero-kicker { font-size: 0.72rem; letter-spacing: 0.08em; }
  .hero-kicker::before { width: 22px; }
  .hero-sub { font-size: 1rem; margin-top: 20px; }
  .hero-meta { gap: 16px; margin-top: 28px; }
  .hero-meta > div { min-width: calc(50% - 8px); }
  .hero-meta span { font-size: 0.68rem; }
  .hero-scroll {
    position: static;
    margin-top: 32px;
    font-size: 0.65rem;
  }

  /* Sections */
  .section { padding: 56px 0; }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 32px;
  }
  .section-title { font-size: clamp(1.8rem, 7vw, 2.6rem); }
  .section-num { font-size: 0.7rem; }

  /* Cards */
  .card { padding: 20px; }
  .card-title { font-size: 1.3rem; }
  .card-body { font-size: 0.9rem; }

  /* Tag chips slightly smaller */
  .tag { font-size: 0.62rem; padding: 4px 8px; }

  /* Footer */
  .footer { padding: 40px var(--gutter) 28px; font-size: 0.68rem; }
}

/* Very small screens */
@media (max-width: 380px) {
  .display-xl { font-size: clamp(2.4rem, 12vw, 3.8rem); }
  .hero-meta > div { min-width: 100%; }
}
