/* Landing: header, hero, sections, carousel, contact, dock and responsive rules. */

header.site-header { position: sticky; top: 0; z-index: 10; background: var(--header-bg); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
header.site-header .inner { padding: 16px 32px; display: flex; justify-content: space-between; align-items: center; }
header.site-header .inner { gap: 24px; }
nav#nav-wrap { position: relative; display: flex; gap: 28px; align-items: center; }
.nav-links { display: flex; gap: 28px; align-items: center; }
nav#nav-wrap a { font-size: 13px; color: var(--text-muted); transition: color .2s; white-space: nowrap; }
nav#nav-wrap a:hover { color: var(--text); }
nav#nav-wrap a.active { color: var(--accent-ink); }
#nav-underline { position: absolute; bottom: -8px; left: 0; width: 0; height: 2px; background: var(--accent); transition: left .28s ease, width .28s ease; opacity: 0; }
#nav-underline.visible { opacity: 1; }

/* Header switches: a pill with an accent thumb that slides to the active side.
   The whole pill is one button, so clicking anywhere on it toggles. */
.theme-toggle, .lang-switch { position: relative; flex: none; height: 28px; padding: 0; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); cursor: pointer; transition: border-color .2s; }
.theme-toggle:hover, .lang-switch:hover { border-color: var(--accent); }
.theme-toggle:focus-visible, .lang-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.theme-toggle { width: 54px; }
.theme-toggle .track-ico { position: absolute; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--text-muted); opacity: .6; }
.theme-toggle .track-ico.sun { left: 6px; }
.theme-toggle .track-ico.moon { right: 6px; }
.theme-toggle .thumb { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-size: 14px; transform: translateX(26px); transition: transform .3s cubic-bezier(.2,.7,.2,1), background .2s; }
html[data-theme="light"] .theme-toggle .thumb { transform: translateX(0); }

.lang-switch { display: flex; font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 600; }
.lang-switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 28px; height: 22px; border-radius: 999px; background: var(--accent); transition: transform .3s cubic-bezier(.2,.7,.2,1); }
.lang-switch[data-active="en"]::before { transform: translateX(32px); }
.lang-switch span { position: relative; width: 32px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: color .25s; }
.lang-switch[data-active="es"] span[data-lang="es"], .lang-switch[data-active="en"] span[data-lang="en"] { color: var(--on-accent); }

.hero .btn-outline { background: var(--bg); }
.hero { position: relative; z-index: 1; padding-top: 120px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 26px; }
.hero .kicker { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); }
.hero h1 { font-size: clamp(52px, 9.5vw, 116px); line-height: 0.92; font-weight: 700; letter-spacing: -0.045em; }
.hero .tagline { font-family: "Space Grotesk", sans-serif; font-size: clamp(24px, 3.3vw, 40px); line-height: 1.12; font-weight: 600; letter-spacing: -0.025em; color: var(--text-body); max-width: 780px; margin: 0; }
.hero p.lead { font-size: 17px; line-height: 1.65; color: var(--text-body); max-width: 600px; margin: 0; }
.status-row { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--accent-glow); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
.status-row span.mono { font-size: 13px; color: var(--text-muted); }
.cta-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }

section.about { padding-top: 96px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 44px; }
.about-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 56px; }
.about-copy { grid-column: span 2; display: flex; flex-direction: column; gap: 18px; }
.about-copy p { margin: 0; font-size: 17px; line-height: 1.75; color: var(--text-body); }
.stats { display: flex; flex-direction: column; gap: 28px; }
.stat { border-left: 3px solid var(--accent); padding-left: 18px; }
.stat .num { font-size: 48px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; color: var(--text); font-family: "Space Grotesk", sans-serif; }
.stat .label { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

section.experience { padding-top: 96px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 44px; }
.timeline-row { position: relative; display: grid; grid-template-columns: 180px 1fr; gap: 24px; padding: 26px 0; border-top: 1px solid var(--border); transition: padding-left .25s; }
.timeline-row::before { content: ""; position: absolute; left: 0; top: -1px; height: 1px; width: 0; background: var(--accent); transition: width .4s ease; }
.timeline-row:hover::before { width: 100%; }
.timeline-row .years { font-size: 14px; color: var(--text-muted); padding-top: 3px; }
.timeline-row .role { font-size: 21px; font-weight: 600; letter-spacing: -0.015em; font-family: "Space Grotesk", sans-serif; color: var(--text); transition: color .2s; }
.timeline-row:hover .role { color: var(--accent-ink); }
.timeline-row .org { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

section.skills { padding-top: 96px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 44px; }
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 36px 56px; }
.skill-group .cat { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; color: var(--text); font-family: "Space Grotesk", sans-serif; margin-bottom: 12px; }
.skill-group .cat .icon { font-size: 20px; color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* Groups are <details>: on tablet/desktop they stay open and don't collapse (skills.js);
   on phones they become an accordion (see the 640px block below) */
.skill-group > summary { list-style: none; }
.skill-group > summary::-webkit-details-marker { display: none; }
.skill-group .count, .skill-group .toggle { display: none; }
@media (min-width: 641px) { .skill-group > summary { pointer-events: none; } }
.chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; background: var(--surface); border: 1px solid var(--border); color: var(--text-body); border-radius: 2px; padding: 6px 11px; transition: border-color .2s, color .2s; }
/* Concept icons (non-brand) use the accent color, like the group titles, so they don't look dimmed next to the brand logos */
.chip .icon { font-size: 18px; color: var(--accent-ink); transition: color .2s; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip:hover .icon { color: var(--accent); }

/* Brand logos keep their official color (also on hover). Values are tuned per theme:
   on the dark background, colors that are too dark use the brand's lighter tint. */
.chip .icon.brand, .chip:hover .icon.brand { color: var(--brand); }
.brand-csharp     { --brand: #A77BCA; }
.brand-vbnet      { --brand: #4A9BE0; }
.brand-dotnet     { --brand: #8C6BF2; }
.brand-react      { --brand: #61DAFB; }
.brand-javascript { --brand: #F7DF1E; }
.brand-html5      { --brand: #E34F26; }
.brand-jquery     { --brand: #3F8FD6; }
.brand-bootstrap  { --brand: #9E7BDB; }
.brand-sqlserver  { --brand: #E0443F; }
.brand-git        { --brand: #F05032; }
.brand-docker     { --brand: #2496ED; }
.brand-laravel    { --brand: #FF2D20; }
.brand-claude     { --brand: #D97757; }
.brand-openai     { --brand: var(--text); }  /* OpenAI's mark is monochrome: white on dark, black on light */
html[data-theme="light"] .brand-csharp     { --brand: #68217A; }
html[data-theme="light"] .brand-vbnet      { --brand: #004E8C; }
html[data-theme="light"] .brand-dotnet     { --brand: #512BD4; }
html[data-theme="light"] .brand-react      { --brand: #0A7EA4; }
html[data-theme="light"] .brand-javascript { --brand: #C9A900; }
html[data-theme="light"] .brand-jquery     { --brand: #0769AD; }
html[data-theme="light"] .brand-bootstrap  { --brand: #7952B3; }
html[data-theme="light"] .brand-sqlserver  { --brand: #CC2927; }

section.work { padding-top: 96px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 36px; }
.work-intro p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text-muted); max-width: 680px; }
.carousel-wrap { position: relative; }
#case-carousel { display: flex; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 0 12px; }
.case-card { position: relative; overflow: hidden; flex: 0 0 calc((100% - 48px)/3); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 26px 24px 24px; display: flex; flex-direction: column; gap: 12px; scroll-snap-align: start; transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.case-card::before { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 0; background: var(--accent); transition: width .35s ease; }
.case-card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: 0 8px 20px rgba(0,0,0,0.22); }
.case-card:hover::before { width: 100%; }
.case-card .top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.case-card .card-icon { width: 44px; height: 44px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: 23px; flex: none; transition: background .25s, color .25s; }
.case-card:hover .card-icon { background: var(--accent); color: var(--on-accent); }
.case-card .meta { display: flex; align-items: center; gap: 10px; }
.case-card .num { font-size: 13px; color: var(--accent-ink); }
.case-card .badge { font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: #6FCF97; border: 1px solid rgba(111,207,151,0.4); border-radius: 2px; padding: 3px 8px; white-space: nowrap; }
.case-card h3 { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--text); }
.case-card p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.case-card p b { color: var(--text); font-weight: 500; }
.case-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.case-card .tags span { font-size: 10.5px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 2px; padding: 3px 8px; }
.carousel-nav { display: flex; justify-content: center; align-items: center; gap: 20px; }
.carousel-arrow { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--accent); background: transparent; color: var(--accent-ink); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .2s, color .2s; }
.carousel-arrow:hover { background: var(--accent); color: var(--on-accent); }
.carousel-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.dots-row { display: flex; justify-content: center; }
/* The button is the 24x24 touch target; the visible dot is drawn with ::before */
.dot { display: flex; align-items: center; justify-content: center; height: 24px; width: 24px; padding: 0; border: none; border-radius: 999px; background: none; cursor: pointer; transition: width .2s; }
.dot::before { content: ""; height: 8px; width: 8px; border-radius: 999px; background: var(--dot-inactive); transition: width .2s, background .2s; }
.dot.active { width: 34px; }
.dot.active::before { width: 22px; background: var(--accent); }
.dot:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Phones: a "03 / 12" counter replaces the dots (12 dots don't fit next to the arrows) */
.carousel-counter { display: none; min-width: 64px; text-align: center; font-size: 13px; color: var(--text-muted); }

section.contact { padding-top: 110px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 26px; align-items: flex-start; }
/* Contact title styled as a two-line code snippet */
.contact-code { display: flex; flex-direction: column; gap: 10px; }
.contact-code .code-line { font-size: clamp(16px, 2vw, 22px); color: var(--text-muted); }
section.contact .contact-code h2 { font-family: "IBM Plex Mono", monospace; font-size: clamp(38px, 7vw, 88px); line-height: 1; font-weight: 600; letter-spacing: -0.04em; color: var(--text); }
.contact-code .kw { color: var(--accent-ink); }
.contact-code .pn { color: var(--text-muted); }
/* Caret sizes (the blinking .caret itself lives in base.css) */
.contact-code .caret { width: 0.5em; height: 0.85em; margin-left: 0.12em; vertical-align: -0.08em; }
.hero-caret { width: 0.26em; height: 0.72em; margin-left: 0.08em; vertical-align: -0.02em; }
section.contact p { margin: 0; font-size: 18px; line-height: 1.6; color: var(--text-muted); max-width: 520px; }
.contact-cta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
footer.site-footer { width: 100%; border-top: 1px solid var(--border); margin-top: 40px; padding-top: 24px; }
footer.site-footer span { font-size: 12px; color: var(--text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  nav#nav-wrap, .nav-links { gap: 18px; }
  .case-card { flex-basis: calc((100% - 24px)/2); }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .about-copy { grid-column: auto; }
  .stats { flex-direction: row; flex-wrap: wrap; gap: 24px 40px; }
}

/* Bottom dock (phones/tablets). Below 860px the top links + both switches
   don't fit in one row, so section navigation moves to a floating bar. */
.dock { display: none; }
@media (max-width: 860px) {
  nav#nav-wrap { gap: 10px; }
  .nav-links, #nav-underline { display: none; }
  body { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .dock { display: flex; position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
    bottom: calc(12px + env(safe-area-inset-bottom)); width: min(480px, calc(100% - 24px));
    padding: 6px; gap: 2px; border: 1px solid var(--border-strong); border-radius: 18px;
    background: var(--header-bg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
  .dock a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px;
    border-radius: 12px; font-size: 10px; line-height: 1.1; color: var(--text-muted); white-space: nowrap; transition: color .2s, background .2s; }
  .dock a .icon { font-size: 20px; }
  .dock a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .dock a.active { color: var(--accent-ink); background: var(--accent-soft); }
}

@media (max-width: 640px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  header.site-header .inner { padding: 12px 20px; }
  #about, #experience, #skills, #work, #contact { scroll-margin-top: 70px; }

  .hero { padding-top: 64px; padding-bottom: 64px; gap: 22px; }
  .hero h1 { font-size: clamp(44px, 13vw, 64px); }
  .hero p.lead { font-size: 16px; }
  .cta-row { gap: 12px; }

  section.about, section.experience, section.skills, section.work { padding-top: 64px; padding-bottom: 64px; gap: 32px; }
  .about-copy p { font-size: 16px; }
  .stat .num { font-size: 38px; }

  .timeline-row { grid-template-columns: 1fr; gap: 6px; padding: 20px 0; }
  .timeline-row .role { font-size: 18px; }

  .skills-grid { grid-template-columns: 1fr; gap: 28px; }

  /* Stack on phones (spec 002, phase 1): accordion, one row per group with its count and a +/− */
  .stack-accordion .cat { font-size: 14px; gap: 7px; }
  .stack-accordion .cat .icon { font-size: 17px; }
  .stack-accordion .chips { gap: 6px; padding-bottom: 16px; overflow: hidden; }
  .stack-accordion .chip { font-size: 12px; padding: 5px 9px; gap: 6px; }
  .stack-accordion .chip .icon { font-size: 15px; }
  .skills-grid.stack-accordion { gap: 0; border-top: 1px solid var(--border); }
  .stack-accordion .skill-group { border-bottom: 1px solid var(--border); }
  .stack-accordion .skill-group > summary { margin: 0; min-height: 52px; padding: 14px 2px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .stack-accordion .skill-group > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .stack-accordion .count { display: inline; margin-left: 4px; font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 400; color: var(--text-muted); }
  /* + made of two bars: opening shrinks the vertical one, so it turns into − smoothly */
  .stack-accordion .toggle { display: block; position: relative; flex: none; width: 14px; height: 14px; margin-left: auto; }
  .stack-accordion .toggle::before, .stack-accordion .toggle::after { content: ""; position: absolute; background: var(--accent-ink); border-radius: 1px; }
  .stack-accordion .toggle::before { left: 0; right: 0; top: 6px; height: 2px; }
  .stack-accordion .toggle::after { top: 0; bottom: 0; left: 6px; width: 2px; transition: transform .3s cubic-bezier(.2,.7,.2,1); }
  .stack-accordion .skill-group[open]:not(.is-closing) .toggle::after { transform: scaleY(0); }
  @media (prefers-reduced-motion: reduce) { .stack-accordion .toggle::after { transition: none; } }

  #case-carousel { gap: 16px; }
  .dots-row { display: none; }
  .carousel-counter { display: block; }
  .case-card { flex-basis: 86%; padding: 22px 20px 20px; }
  .case-card p { font-size: 13.5px; }

  section.contact { padding-top: 72px; }
  .contact-code .code-line { font-size: 14px; }
  section.contact .contact-code h2 { font-size: clamp(24px, 8vw, 40px); }
  section.contact p { font-size: 16px; }
}
