/* ===========================================================
   Ethan Pablo Vasquez — Portfolio
   Static HTML/CSS/JS. Single-page: title/name screen + contact.
   Swap tokens below to restyle.
   =========================================================== */

:root {
  --bg: #0b0f14;
  --bg-alt: #10161d;
  --surface: #151c24;
  --border: #232d38;
  --text: #e7edf3;
  --text-dim: #9aa8b6;
  --accent: #4fd1c5;
  --accent-2: #5b8def;
  --brand-red: #d1685f;
  --nav-line: #566371;
  --nav-line-lit: #9aa8b6;
  --radius: 14px;
  --max-width: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --name-font: "Space Grotesk", var(--mono);
}

[data-theme="light"] {
  --bg: #f7f9fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --border: #e3e8ee;
  --text: #10161d;
  --text-dim: #56636f;
  --accent: #0f9c8f;
  --accent-2: #3b6fd6;
  --brand-red: #b1524a;
  --nav-line: #aab5c0;
  --nav-line-lit: #56636f;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: var(--accent); text-decoration: none; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; }

p { margin: 0 0 1em; color: var(--text-dim); }

img { max-width: 100%; display: block; }

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Hero: name, then scroll cue ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero-band {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

/* ---------- Name reveal (band 1) ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.name-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(3.5rem, 10vw, 6rem);
  width: 100%;
}

/* ---------- Letter-nav: lines + labels floating above/below the name ----------
   Drawn by JS (drawNavLines in script.js) from each red EPABEZ letter's
   real position to its section label — 3 labels float above the name
   (Experience, About, Education), 3 below (Projects, Blog, Zenith).
   Purely decorative/progressive: the letters themselves are real <a>
   elements with hrefs, so navigation works even if this never draws. */
.nav-leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}
.nav-leaders path {
  fill: none;
  stroke: var(--nav-line);
  stroke-width: 1;
  stroke-opacity: 0.68;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-leaders circle {
  fill: var(--nav-line);
  fill-opacity: 0.68;
}
.nav-label {
  position: absolute;
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  z-index: 1;
}

/* ---------- Fullname: letters come apart / together, horizontally only ----------
   Each letter carries --i (its position, 0-18) and --dist (its distance
   from the center letter, 0-9), set inline in the HTML. --spread is the
   current horizontal "pull" in px, toggled between 0 and an active value
   by JS adding/removing .is-expanded on the container — because the letters'
   `transform` transition is what's animated, flipping --spread (even
   though it isn't itself an animated custom property) still transitions
   smoothly, since the browser sees the computed transform value change. */
.fullname-word {
  --spread: 0px;
  /* Direction-specific easing: squishing back to "EPABEZ" (the default/
     rest state, below) always uses the smooth, no-overshoot curve — this
     guarantees --spread only ever shrinks toward 0 and never dips past it,
     so the red letters can never cross/overlap on their way back together.
     The bouncy overshoot is reserved for expanding apart (.is-expanded,
     further down), where overshoot just means the letters briefly spread
     a touch further — never a collision risk. */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.29, 1.88, 0.4, 1);
  --dur: 1.1s;
  --dur-bounce: 1.3s;
  font-family: var(--name-font);
  font-weight: 700;
  letter-spacing: 0;
  font-size: clamp(1.7rem, 6vw, 4rem);
  color: var(--text);
  text-transform: uppercase;
  display: flex;
  max-width: 100%;
  will-change: transform;
}
.fullname-word .ltr {
  display: inline-block;
  overflow: hidden;
  max-width: 1.15em;
  opacity: 1;
  transform: translateX(calc((var(--i) - 9) * var(--spread)));
  transition: transform var(--dur) var(--ease),
              max-width var(--dur) var(--ease),
              margin-left var(--dur) var(--ease),
              opacity 0.65s ease;
  transition-delay: calc(var(--dist) * 22ms);
}
.fullname-word .ltr.space {
  max-width: 0.4em;
}
.fullname-word .seed {
  color: var(--brand-red);
  cursor: pointer;
  outline-offset: 3px;
}
.fullname-word .seed:hover,
.fullname-word .seed:focus-visible {
  filter: brightness(1.35);
}
.fullname-word .seed:focus-visible {
  outline: 2px solid var(--accent);
  border-radius: 2px;
}

/* Squished (default/rest): only the red EPABEZ letters are visible — the
   rest collapse to nothing. gap-before marks every seed letter after the
   first, so every visible letter gets the same small breathing room
   before it (the collapsed hidden letters in between are zero-width and
   carry no margin of their own, so the gap is even no matter how many
   hidden letters separate two given red letters) — reads as one tight,
   evenly-spaced wordmark rather than touching, only while squished. */
.js .fullname-word .ltr:not(.seed) {
  max-width: 0;
  opacity: 0;
}
.js .fullname-word .ltr.gap-before {
  margin-left: 0.14em;
}
.js .fullname-word.is-expanded .ltr.gap-before {
  margin-left: 0;
}

/* Expanded: the hidden letters grow back in and the whole name spreads
   apart horizontally, spongey overshoot — this is when the full name reads.
   The bounce transition lives here (rather than on the base .ltr rule)
   so it only ever applies when transitioning INTO this state — squishing
   back out of it falls through to the smooth, non-overshooting base
   transition above. */
.js .fullname-word.is-expanded .ltr:not(.seed) {
  max-width: 1.15em;
  opacity: 1;
}
.js .fullname-word.is-expanded .ltr.space:not(.seed) {
  max-width: 0.4em;
}
.js .fullname-word.is-expanded {
  /* em, not px, so the "come apart" distance always scales together with
     the font-size — a fixed px spread paired with em-sized letters is what
     caused the letters to visibly misalign/jumble at non-100% browser
     zoom, since the gap wouldn't scale but the letters would. */
  --spread: 0.22em;
}
.js .fullname-word.is-expanded .ltr {
  transition: transform var(--dur-bounce) var(--ease-bounce),
              max-width var(--dur-bounce) var(--ease-bounce),
              margin-left var(--dur-bounce) var(--ease-bounce),
              opacity 0.65s ease;
  transition-delay: calc(var(--dist) * 22ms);
}

/* A soft squash-and-stretch pulse layered on the whole word, independent
   of the per-letter transforms above (different element, so no conflict),
   toggled briefly by JS at the moment each phase starts. Pushed further
   (bigger scale swings) to read as more elastic/springy. */
.name-stage {
  animation: none;
}
.name-stage.is-popping {
  animation: jelly-pop 0.75s ease-out;
}
@keyframes jelly-pop {
  0%   { transform: scale(1, 1); }
  25%  { transform: scale(1.10, 0.89); }
  48%  { transform: scale(0.92, 1.10); }
  68%  { transform: scale(1.04, 0.97); }
  85%  { transform: scale(0.98, 1.02); }
  100% { transform: scale(1, 1); }
}

@media (prefers-reduced-motion: reduce) {
  .fullname-word .ltr {
    transition: none;
  }
  .name-stage.is-popping {
    animation: none;
  }
}

/* Smaller viewports get a smaller font — the resting name and the fully-
   spread-apart name both need to fit without horizontal overflow. --spread
   is em-based (above), so it scales down with the font automatically and
   doesn't need its own breakpoint overrides. */
@media (max-width: 900px) {
  .fullname-word { font-size: clamp(1.6rem, 5.2vw, 3.2rem); }
}

@media (max-width: 640px) {
  .fullname-word { font-size: clamp(1.4rem, 6vw, 2.4rem); }
}

@media (max-width: 400px) {
  .fullname-word { font-size: clamp(1.1rem, 6.2vw, 2rem); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--accent);
  color: #06201d;
}
.btn-primary:hover { background: var(--accent-2); color: #fff; }

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Simple header (secondary pages: blog.html, zenith.html) ----------
   No animated name here on purpose — that's a homepage-only showpiece, so
   these pages get a small static wordmark instead of duplicating the
   delicate expand/squish animation code across files. */
.simple-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 24px;
  border-bottom: 1px solid var(--border);
}
.simple-header .home-link {
  font-family: var(--name-font);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--brand-red);
}
.simple-header .home-link span {
  color: var(--text-dim);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.78rem;
  margin-left: 8px;
}
.simple-header .back-link {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}
.simple-header .back-link:hover { color: var(--accent); }

/* ---------- Sections ---------- */
.section {
  padding: 96px 0;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 40px;
}

/* ---------- About: photo orb + bio text ----------
   Orb is a blank placeholder until a real headshot is dropped in. */
.about-content {
  display: flex;
  align-items: flex-start;
  gap: 40px;
}
.about-photo-orb {
  flex: none;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--bg-alt);
  box-shadow: 0 0 0 1px var(--border);
}
.about-text {
  flex: 1 1 auto;
  min-width: 0;
}
.about-text p {
  max-width: 90ch;
}
.about-milestones-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 20px 0 10px;
}
.about-milestones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.about-milestones li {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}
@media (max-width: 560px) {
  .about-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
  .about-photo-orb {
    width: 150px;
    height: 150px;
  }
}

/* ---------- Experience / Education / Projects entry cards ----------
   A little more "poppy" than a plain list: each entry is a card with a
   colored numbered badge. The badge color is purely decorative EXCEPT in
   Experience, where the two internship entries (DSS, HCA) intentionally
   use the neutral/gray badge rather than a bright accent — a deliberate
   choice, not a missing color, so those two read a notch more understated
   than the leadership/project entries. */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.exp-item {
  display: flex;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.exp-item:hover {
  transform: rotate(-0.4deg) translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.exp-badge {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-family: var(--name-font);
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.exp-badge--neutral {
  background: var(--border);
  color: var(--text-dim);
}
/* Color accents off for now — .exp-badge--red/--teal/--blue all fall back
   to the same neutral look as .exp-badge--neutral below. The HTML still
   carries the distinct class names, so flipping the color back on later
   is just restoring the background/color values here, no markup changes
   needed. */
.exp-badge--red,
.exp-badge--teal,
.exp-badge--blue {
  background: var(--border);
  color: var(--text-dim);
}
.exp-body {
  flex: 1;
  min-width: 0;
}
.exp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}
.exp-role {
  font-size: 1.05rem;
  margin: 0;
}
.exp-dates {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  white-space: nowrap;
  max-width: 100%;
}
/* A short date range never needs to wrap, but this field also doubles as
   a tech-stack list on Projects entries — those can run long, so on
   narrow viewports let it wrap instead of forcing horizontal overflow. */
@media (max-width: 480px) {
  .exp-dates {
    white-space: normal;
  }
}
.exp-org {
  margin: 4px 0 0;
  font-size: 0.92rem;
}
.exp-org + .exp-org {
  margin-top: 2px;
}
.exp-bullets {
  margin: 10px 0 0;
  padding-left: 1.15em;
  color: var(--text-dim);
  font-size: 0.92rem;
}
.exp-bullets li {
  margin: 0 0 6px;
}
.exp-bullets li:last-child {
  margin-bottom: 0;
}

/* Narrow phones: badge + text side-by-side gets tight fast, so stack
   the badge above the body instead of fighting for horizontal space. */
@media (max-width: 480px) {
  .exp-item {
    flex-direction: column;
    gap: 10px;
  }
}

/* ---------- Education: horizontal roadmap ----------
   Deliberately a different shape from the Experience/Projects card lists —
   two stops (PHSC, then USF) connected by a line, left to right in
   chronological order. Only works cleanly with exactly two or three
   entries; if a third school/certification is ever added, this should
   probably become a vertical timeline instead. Collapses to a stacked
   list below 600px, where a horizontal line has nowhere good to go. */
.edu-orb {
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--bg-alt);
  box-shadow: 0 0 0 1px var(--border);
  flex: none;
}
.edu-road {
  position: relative;
  padding-top: 8px;
}
.edu-road-line {
  position: absolute;
  top: 40px;
  left: 60px;
  right: 60px;
  height: 2px;
  background: var(--border);
}
.edu-road-nodes {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
}
.edu-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 46%;
}
.edu-node .edu-orb {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.edu-node-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.edu-node-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.edu-node-dates {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.edu-node-role {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0 0 4px;
}
.edu-node-org {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin: 4px 0 0;
}
.edu-node-org:first-of-type {
  margin-top: 2px;
}

@media (max-width: 600px) {
  .edu-road-line {
    display: none;
  }
  .edu-road-nodes {
    flex-direction: column;
    align-items: center;
    gap: 36px;
  }
  .edu-node {
    width: 100%;
  }
}

/* ---------- Contact ---------- */
.contact-inner { text-align: center; }
.contact-email {
  display: inline-block;
  margin: 0 0 28px;
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}
.contact-email:hover { color: var(--accent); border-color: var(--accent); }
.contact-email.is-copied {
  color: var(--accent);
  border-color: var(--accent);
}
.contact-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}
.footer-inner {
  display: flex;
  justify-content: center;
  align-items: center;
}
.footer p { margin: 0; font-size: 0.85rem; color: var(--text-dim); }

/* Fixed in place (not inside the footer) so it's reachable at any scroll
   position, not just once a visitor reaches the bottom of the page. */
.theme-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* ---------- Reveal-on-scroll ----------
   Only hides content when JS has actually run (html.js, set by an
   inline script in <head>). Without JS, or before it loads, content
   is fully visible — no invisible sections. */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .section { padding: 64px 0; }
}
