/* ============================================================
   Marc Rodriguez Limpangog — portfolio
   Plain CSS. Dark-first, tactile brutalism, one accent.
   ============================================================ */

:root {
  /* Follow the OS by default: light by day, dark by night. light-dark(light, dark)
     resolves from `color-scheme`; the manual toggle just flips color-scheme. */
  color-scheme: light dark;
  --bg:        light-dark(#f7f7f4, #12171f);   /* dark base ~L*8, not near-black */
  --bg-2:      light-dark(#ffffff, #1a212c);   /* cards */
  --bg-3:      light-dark(#f0f0ec, #232c39);   /* hover / elevated */
  --text:      light-dark(#14181f, #e9edf3);   /* off-white in dark, never pure */
  --text-dim:  light-dark(#4a5160, #aab4c5);
  --text-mut:  light-dark(#555d6b, #8a93a5);   /* AA on cards */
  --accent:    light-dark(#0f766e, #5eead4);   /* teal — single accent */
  --accent-ink:light-dark(#ffffff, #06241f);
  --line:      light-dark(rgba(0,0,0,.14), rgba(255,255,255,.10));
  --line-2:    light-dark(rgba(0,0,0,.08), rgba(255,255,255,.06));

  --font:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --step--1: clamp(.78rem, .76rem + .12vw, .85rem);
  --step-0:  clamp(1rem, .96rem + .2vw, 1.08rem);
  --step-1:  clamp(1.2rem, 1.1rem + .5vw, 1.45rem);
  --step-2:  clamp(1.6rem, 1.35rem + 1.1vw, 2.2rem);
  --step-3:  clamp(2rem, 1.5rem + 2.2vw, 3.1rem);
  --step-4:  clamp(2.4rem, 1.7rem + 3.2vw, 4rem);

  --maxw: 1240px;
  --pad: clamp(1.25rem, 4vw, 3rem);
  --r: 4px;             /* tight radii — not 2xl */
}

/* manual override beats the system preference */
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"]  { color-scheme: dark; }

* { box-sizing: border-box; margin: 0; }

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

body {
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration: none; }

.mono { font-family: var(--mono); font-feature-settings: "ss01"; }

/* grain overlay — green-UX, CSS not heavy images */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: .035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* scroll progress bar — CSS scroll-driven, no JS */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: var(--accent);
  transform: scaleX(0); transform-origin: 0 50%;
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .progress { animation: progress-grow linear both; animation-timeline: scroll(root); }
  }
}
@keyframes progress-grow { to { transform: scaleX(1); } }

/* skip link */
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: .7rem 1rem; border-radius: var(--r); font-weight: 600;
  transition: top .2s;
}
.skip-link:focus { top: 1rem; }

/* focus — brutal & visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ===================== LAYOUT ===================== */
.layout {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
  display: grid;
  gap: clamp(2rem, 5vw, 5rem);
}
@media (min-width: 920px) {
  .layout {
    grid-template-columns: minmax(300px, 37%) 1fr;
    /* no align-items:start — the sidebar column must stretch to the full
       row height so its sticky inner has room to stay pinned while scrolling */
  }
}

/* ===================== SIDEBAR ===================== */
.side__inner {
  padding-block: clamp(5.75rem, 18vw, 6.5rem) clamp(1.75rem, 4vw, 3rem);
  display: flex; flex-direction: column;
  gap: clamp(.9rem, 2vw, 1.25rem);
}
@media (min-width: 920px) {
  /* fill the full-height grid cell so the sticky nav below has runway */
  .side__inner { padding-top: clamp(1.75rem, 4vw, 3.25rem); height: 100%; }
  /* section nav + social pin to the top: the hero scrolls away, the menu
     stays reachable at the top of the viewport for the whole page */
  .side__pin {
    position: sticky; top: 1.1rem;
    display: flex; flex-direction: column;
    gap: clamp(.9rem, 2vw, 1.25rem);
  }
}
/* Tall enough to show the whole sidebar at once → pin it entirely, so the
   identity block stays put too (classic fixed sidebar). On shorter screens
   only the nav pins (rule above), and the page keeps a single scrollbar. */
@media (min-width: 920px) and (min-height: 900px) {
  .side__inner { position: sticky; top: 0; height: auto; }
}

/* controls — lang + theme.
   Mobile: anchored top-right in flow (scrolls away with the hero).
   Desktop: fixed top-right, always reachable. Liquid-glass capsule. */
.controls {
  position: absolute; top: .85rem; right: var(--pad); z-index: 70;
  display: flex; align-items: center; gap: .35rem;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow: 0 6px 22px -10px rgba(0,0,0,.5),
              inset 0 1px 0 color-mix(in srgb, #fff 12%, transparent);
}
@media (min-width: 920px) {
  .controls { position: fixed; top: 1.1rem; right: clamp(1rem, 3vw, 2rem); }
}

.side__social { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* availability status pill */
.status {
  display: inline-flex; align-items: center; gap: .55rem;
  width: fit-content;
  font-family: var(--mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-dim);
  padding: .4rem .8rem;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.kicker {
  font-family: var(--mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  display: flex; align-items: center; gap: .55rem;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  .dot { animation: ping 2.4s ease-out infinite; }
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70%,100% { box-shadow: 0 0 0 7px transparent; }
}

.name {
  font-size: var(--step-4);
  line-height: .98;
  font-weight: 800;
  letter-spacing: -.03em;
}
.name__last { display: block; color: var(--text-dim); }

.role {
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--text);
  text-wrap: balance;
}
.role__sub {
  display: block;
  margin-top: .2rem;
  font-weight: 500;
  font-size: var(--step-0);
  color: var(--text-dim);
}

.tagline { color: var(--text-dim); max-width: 42ch; }
.loc { color: var(--text-mut); font-size: var(--step--1); }

/* ===================== NAV ===================== */
/* Mobile: floating "liquid glass" tab bar (iOS-style, thumb-zone). Same <nav>
   as desktop, so the scroll-spy that toggles .is-active works on phones too. */
.nav {
  position: fixed; z-index: 60;
  left: max(.6rem, env(safe-area-inset-left));
  right: max(.6rem, env(safe-area-inset-right));
  bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  border-radius: 26px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  box-shadow: 0 10px 34px -10px rgba(0,0,0,.55),
              inset 0 1px 0 color-mix(in srgb, #fff 14%, transparent);
}
.nav ul { list-style: none; margin: 0; padding: 4px; display: flex; }
.nav li { flex: 1; }
.nav a {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .18rem; min-height: 52px; padding: .4rem .15rem;
  color: var(--text-mut); font-weight: 600; text-align: center;
  font-size: clamp(.56rem, 2.3vw, .66rem); line-height: 1.1; letter-spacing: 0;
  border-radius: 18px;
  transition: color .25s, transform .12s;
}
.nav__num { display: none; }                 /* editorial number — desktop only */
.nav__ico {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.nav a.is-active { color: var(--accent); }
.nav a:active { transform: scale(.92); }       /* tactile press */
.nav a:focus-visible { color: var(--text); }

/* sliding glass pill behind the active tab (positioned by JS) */
.nav__pill {
  position: absolute; top: 0; left: 0; z-index: 0;
  width: 0; height: 0; border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .nav__pill { transition: transform .42s cubic-bezier(.22,1,.36,1),
                           width .42s cubic-bezier(.22,1,.36,1), height .42s; }
}

@media (min-width: 920px) {
  /* Desktop: editorial vertical nav inside the sidebar */
  .nav {
    position: static; z-index: auto; border-radius: 0;
    background: none; -webkit-backdrop-filter: none; backdrop-filter: none;
    border: 0; box-shadow: none;
  }
  .nav__pill, .nav__ico { display: none; }
  .nav ul { display: grid; gap: .15rem; padding: 0; }
  .nav li { flex: 0; }
  .nav a {
    flex-direction: row; align-items: center; justify-content: flex-start;
    gap: 1rem; min-height: 0; padding: .5rem 0; text-align: left;
    border-radius: 0; font-weight: 500; font-size: inherit; line-height: 1.6;
    transition: color .25s, gap .25s;
  }
  .nav a:active { transform: none; }
  .nav__num {
    display: block;
    font-size: var(--step--1); letter-spacing: .1em;
    width: 2.4rem; border-bottom: 1px solid var(--line);
    transition: width .3s, border-color .3s, color .3s;
  }
  .nav a:hover, .nav a:focus-visible, .nav a.is-active { color: var(--text); }
  .nav a:hover .nav__num,
  .nav a.is-active .nav__num {
    width: 3.6rem; border-color: var(--accent); color: var(--accent);
  }
}
/* room so the footer clears the floating tab bar on phones */
@media (max-width: 919px) {
  body { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}

/* buttons */
.btn {
  --bw: 1px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: .6rem;
  min-height: 44px;
  padding: .7rem 1.2rem;
  font-weight: 600; font-size: var(--step-0);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  background: transparent; color: var(--text);
  cursor: pointer;
  transition: transform .2s, background .25s, border-color .25s, color .25s;
  will-change: transform;
}
.btn--primary {
  background: var(--accent); color: var(--accent-ink);
  border-color: var(--accent);
}
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--lg { padding: 1rem 1.6rem; font-size: var(--step-1); }
.btn .mono { font-size: var(--step--1); opacity: .8; }

.side__actions { display: flex; flex-wrap: wrap; gap: .7rem; }

.iconlink {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  font-family: var(--mono); font-size: var(--step--1);
  color: var(--text-mut);
  border: 1px solid var(--line-2); border-radius: var(--r);
  transition: color .2s, border-color .2s, transform .2s;
}
.iconlink:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.spacer { flex: 1; }

.lang { display: inline-flex; gap: 2px; }
.lang button {
  min-width: 44px; min-height: 44px; padding: 0 .7rem;
  font-family: var(--mono); font-size: var(--step--1); font-weight: 600;
  background: transparent; color: var(--text-mut);
  border: 0; border-radius: 999px; cursor: pointer;
  transition: background .2s, color .2s, transform .12s;
}
.lang button:active { transform: scale(.92); }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.lang button:hover[aria-pressed="false"] { color: var(--text); }

.theme {
  min-width: 44px; min-height: 44px;
  background: transparent; color: var(--text-mut);
  border: 1px solid var(--line-2); border-radius: 999px;
  cursor: pointer; font-size: 1.1rem;
  transition: color .2s, border-color .2s, rotate .4s, transform .12s;
}
.controls .theme { border: 0; }
.theme:active { transform: scale(.92); }
.theme:hover { color: var(--accent); border-color: var(--accent); rotate: 180deg; }

/* ===================== MAIN ===================== */
.main {
  padding-block: clamp(2rem, 6vw, 6rem);
  display: grid;
  gap: clamp(3.5rem, 9vw, 7rem);
  min-width: 0;
}
.section { scroll-margin-top: 2rem; }

.kicker.mono {
  color: var(--accent);
  margin-bottom: 1rem;
  display: flex; gap: .6rem;
}
.kicker__n { color: var(--text-mut); }

.section__h {
  font-size: var(--step-2);
  font-weight: 700; letter-spacing: -.02em; line-height: 1.12;
  max-width: 20ch;
  margin-bottom: 1.6rem;
}
.section__h--big { font-size: var(--step-3); max-width: 16ch; }

.prose { display: grid; gap: 1rem; color: var(--text-dim); max-width: 62ch; }
.prose strong { color: var(--text); font-weight: 600; }

/* enfoque */
.enfoque {
  list-style: none; padding: 0; margin-top: 1.8rem;
  display: grid; gap: .65rem;
  max-width: 60ch;
}
.enfoque li { display: flex; gap: .7rem; color: var(--text-dim); }
.enfoque__m { color: var(--accent); }

/* ===================== BENTO ===================== */
.bento {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}
@media (min-width: 620px) { .bento { grid-template-columns: repeat(4, 1fr); } }

.card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.3rem;
  transition: transform .25s, border-color .25s;
}
.card::before {           /* cursor spotlight — soft glow following the pointer */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(260px circle at var(--mx,50%) var(--my,50%),
              color-mix(in srgb, var(--accent) 18%, transparent), transparent 62%);
  opacity: 0; transition: opacity .35s; pointer-events: none;
}
.card::after {            /* spotlight on the border itself (premium edge light) */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  padding: 1px; pointer-events: none;
  background: radial-gradient(180px circle at var(--mx,50%) var(--my,50%),
              color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
@media (prefers-reduced-motion: no-preference) {
  .card:hover { transform: translateY(-4px); }
}
.card:hover::before, .card:hover::after { opacity: 1; }

.card--stat { display: flex; flex-direction: column; gap: .35rem; }
.stat__n {
  font-size: var(--step-3); font-weight: 800; line-height: 1;
  letter-spacing: -.02em; color: var(--accent);
}
.stat__u { font-size: var(--step-0); margin-left: .15rem; color: var(--text-dim); font-weight: 500; }
.stat__c { font-size: var(--step--1); color: var(--text-dim); }

.card--stack { grid-column: 1 / -1; }
.card__label {
  font-size: var(--step--1); text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-mut); margin-bottom: .9rem;
}

/* chips */
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li {
  font-family: var(--mono); font-size: var(--step--1);
  padding: .3rem .6rem;
  border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--text-dim);
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
/* chips are static labels, not interactive — no hover affordance */

/* ===================== TIMELINE ===================== */
.timeline { list-style: none; padding: 0; display: grid; gap: .5rem; }
.job {
  display: grid; gap: .4rem;
  padding: 1.5rem;
  border: 1px solid transparent; border-radius: var(--r);
  transition: background .3s, border-color .3s, opacity .3s;
}
@media (min-width: 720px) {
  .job { grid-template-columns: 9rem 1fr; gap: 1.5rem; }
}
.job:hover { background: var(--bg-2); border-color: var(--line); }
/* dim siblings on hover — "La Playa" effect */
@media (hover: hover) and (min-width: 720px) {
  .timeline:hover .job { opacity: .5; }
  .timeline:hover .job:hover { opacity: 1; }
}
.job__period { font-size: var(--step--1); color: var(--text-mut); padding-top: .2rem; }
.job__title { font-size: var(--step-1); font-weight: 700; letter-spacing: -.01em; }
.job__at { color: var(--accent); font-weight: 600; }
.job__meta { font-size: var(--step--1); color: var(--text-mut); margin-top: .1rem; }
.job__lead { color: var(--text-dim); margin: .7rem 0; max-width: 60ch; }
.job__list { list-style: none; padding: 0; display: grid; gap: .55rem; max-width: 64ch; }
.job__list li { position: relative; padding-left: 1.4rem; color: var(--text-dim); font-size: var(--step-0); }
.job__list li::before {
  content: "▹" / ""; position: absolute; left: 0; top: 0;
  color: var(--accent); font-family: var(--mono);
}

/* ===================== SKILLS ===================== */
.skills {
  display: grid; gap: .75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) { .skills { grid-template-columns: repeat(2, 1fr); } }
.skillgroup {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 1.3rem;
}
.skillgroup__h {
  font-size: var(--step--1); text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent); margin-bottom: .9rem; font-weight: 600;
}

/* education */
.edu { margin-top: 2.5rem; }
.edu__h {
  font-size: var(--step--1); text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-mut); margin-bottom: 1rem;
}
.edu__list { list-style: none; padding: 0; display: grid; gap: .1rem; }
.edu__list li {
  display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px solid var(--line-2);
  color: var(--text-dim);
}
.edu__y { color: var(--accent); font-size: var(--step--1); padding-top: .15rem; }

/* ===================== PROJECTS ===================== */
.projects { display: grid; gap: .75rem; }
@media (min-width: 700px) { .projects { grid-template-columns: repeat(2, 1fr); } }
.card--proj { display: grid; gap: .8rem; align-content: start; }
.proj__t { font-size: var(--step-1); font-weight: 700; }
.proj__d { color: var(--text-dim); font-size: var(--step-0); }

/* ===================== CONTACT ===================== */
.section--contact { padding-block: 2rem; }
.contact__lead { color: var(--text-dim); max-width: 48ch; margin-bottom: 2rem; }
.contact__actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 2.5rem; }
.langs {
  list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1.2rem;
  color: var(--text-mut); font-size: var(--step--1);
}

/* footer */
.foot {
  border-top: 1px solid var(--line-2);
  padding-top: 2rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem;
  color: var(--text-mut); font-size: var(--step--1);
}

/* visually-hidden (SR-only live region) */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ===================== SCROLL REVEAL ===================== */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 30%;
    }
  }
  @keyframes reveal {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: none; }
  }
}
