/* ═══════════════════════════════════════════════════════════════════════
   Rafael Iñigo E. Herrera
   A flat, typographic portfolio. The page is one ink field; hierarchy comes
   from type scale, hairline rules, and a single accent colour.

   Palette is deliberately cold: deep blue and violet, never warm. The
   reference site this was briefed against lives in warm brown and amber,
   so nothing here goes near it.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces */
  --ink:        #05060E;
  --ink-2:      #0B0E1F;
  --ink-3:      #12152B;

  /* Accents */
  --violet:     #7C5CFF;
  --violet-bright: #9B85FF;  /* small text: 6.6:1 on ink */
  --violet-dim: #5B41C9;
  --magenta:    #FF4D9D;

  /* Text */
  --text:       #E8E9F5;
  --text-soft:  #C3C7DE;
  --muted:      #9AA0C0;

  /* Lines */
  --line:       rgba(232, 233, 245, 0.10);
  --line-2:     rgba(232, 233, 245, 0.20);

  /* Type */
  --font-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 160ms ease;

  /* Layout */
  --gutter: clamp(1.15rem, 4vw, 4rem);
  --measure: 62ch;
  --topbar-h: 64px;
}

/* ── Reset ─────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 1rem);
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  font-weight: 350;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* The page is a flat ink field. No wash, no glow, no grain. The type and
   the hairline rules carry the whole surface. */
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 800; margin: 0; }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--violet);
  color: #fff;
  padding: 0.7rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ── Grain ─────────────────────────────────────────────────────────── */

/* ── Top bar ───────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--gutter);
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  gap: clamp(0.7rem, 2vw, 1.6rem);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.01em;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
  transition: color var(--fast), border-color var(--fast);
}
.nav a:hover { color: var(--text); border-bottom-color: var(--violet); }

.ambience {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  transition: border-color var(--fast), color var(--fast);
  white-space: nowrap;
}
.ambience:hover { border-color: var(--violet); color: var(--text); }

.ambience__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line-2);
  transition: background var(--fast);
}
.ambience[aria-pressed="true"] { color: var(--text); border-color: var(--violet); }
.ambience[aria-pressed="true"] .ambience__dot {
  background: var(--magenta);
}

/* ── Cover ─────────────────────────────────────────────────────────── */

.cover {
  position: relative;
  padding: clamp(3.5rem, 10vh, 7rem) var(--gutter) clamp(2.5rem, 6vh, 4rem);
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  /* Tall enough to fill the first screen on a laptop, capped so a very tall
     display doesn't leave the cover rattling around in dead space. */
  min-height: min(calc(100svh - var(--topbar-h)), 860px);
}

.cover__text { min-width: 0; }

/* Type-only cover: the client site is mentioned in one segment further down
   rather than shown here, so the sleeve carries itself on type and light.
   A narrow measure keeps the headline from stretching across a wide screen. */
.cover--solo {
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
}
.cover--solo .cover__text { max-width: 46rem; }
.cover--solo .cover__title { font-size: clamp(2.75rem, 7.6vw, 6rem); }

.eyebrow, .side-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--violet-bright);
  margin: 0 0 1.5rem;
}

.eyebrow .dot { color: var(--line-2); margin: 0 0.35rem; }

.cover__title {
  font-size: clamp(2.5rem, 6.4vw, 5.1rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
  margin: 0 0 1.4rem;
}
.cover__title em {
  font-style: normal;
  color: var(--violet);
}


.cover__lead {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  color: var(--text-soft);
  max-width: 46ch;
  margin: 0 0 2rem;
}

.cover__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: clamp(2.25rem, 5vw, 3.5rem);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.78rem 1.25rem;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform var(--fast), background var(--fast), border-color var(--fast);
  will-change: transform;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { transform: translateY(-2px); }

/* Flat fill, one step darker than the accent. White on the accent #7C5CFF
   measures 4.35:1, under the 4.5:1 threshold. The old gradient hid that from
   every contrast checker. The accent stays bright where it is decoration only;
   the button fill is what has to carry text. */
.btn--solid {
  background: var(--violet-dim);
  color: #fff;
}

.btn--solid:hover { background: #6A4FD6; }


.btn--ghost {
  border-color: var(--line-2);
  color: var(--text-soft);
}
.btn--ghost:hover { border-color: var(--violet); color: var(--text); }

/* ── Sections ──────────────────────────────────────────────────────── */

.section {
  padding: clamp(4rem, 11vh, 8rem) var(--gutter);
  border-top: 1px solid var(--line);
  max-width: 1400px;
  margin: 0 auto;
}

.section__head { margin-bottom: clamp(2rem, 5vw, 3.25rem); }

.section__title {
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.section__note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 1rem 0 0;
}

/* About: the bio */
.notes { max-width: var(--measure); }
.notes p { margin: 0 0 1.5rem; color: var(--text-soft); }
.notes__lead {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.6vw, 1.95rem);
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: var(--text) !important;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem 2rem;
  margin: 2.5rem 0 0;
  padding: 1.75rem 0 0;
  border-top: 1px solid var(--line);
}
.facts dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--violet-bright);
  margin-bottom: 0.3rem;
}
.facts dd { margin: 0; font-size: 0.95rem; color: var(--text-soft); }

/* An outbound link inside the facts list (Letterboxd). Underlined so it reads
   as a link rather than as part of the value text. */
.facts__link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 1px;
  transition: border-color var(--fast), color var(--fast);
}
.facts__link:hover { border-bottom-color: var(--violet); color: #fff; }

/* Available to screen readers, removed from the visual layout. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Track panels ──────────────────────────────────────────────────── */

.track-panel {
  padding: clamp(3.5rem, 10vh, 7rem) var(--gutter);
  border-top: 1px solid var(--line);
  max-width: 1400px;
  margin: 0 auto;
}

.track-panel__head { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.track-panel__title {
  font-size: clamp(1.9rem, 5vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.035em;
  margin-bottom: 0.75rem;
}
.track-panel__meta {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0;
}

.shot {
  margin: 0 0 clamp(2rem, 5vw, 3rem);
  border: 1px solid var(--line-2);
  border-radius: 0;
  overflow: hidden;
  background: var(--ink-2);
}
.shot img { width: 100%; }
.shot figcaption {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--line);
}

.shot--wide { max-width: 100%; }

.shot-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
}

.phones {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
}

.shot--phone {
  border-radius: 0;
  border-color: var(--line-2);
  margin-bottom: 0;
}

.shot-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin: 1.25rem 0 0;
}

.panel { max-width: var(--measure); }
.panel p { margin: 0 0 1.4rem; color: var(--text-soft); }
.panel__lead {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  line-height: 1.45;
  color: var(--text) !important;
  letter-spacing: -0.01em;
}

.receipts {
  list-style: none;
  margin: 2.25rem 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.receipts li {
  position: relative;
  padding: 1rem 0 1rem 1.6rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}
.receipts li::before {
  content: "";
  position: absolute;
  left: 0; top: 1.55rem;
  width: 0.8rem; height: 1px;
  background: var(--violet);
}
.receipts strong { color: var(--text); font-weight: 600; }

.panel__cta { margin: 2rem 0 0; }


/* ── Timeline: orgs and honors ─────────────────────────────────────
   Year down the left in mono, the event in the display face, and where it
   happened underneath. Newest first, the way a discography reads.        */

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline__row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.35rem 1.75rem;
  align-items: baseline;
  padding: 1.35rem 0.85rem 1.35rem 0.85rem;
  border-top: 1px solid var(--line);
  position: relative;
  transition: background var(--fast), padding-left var(--fast);
}
.timeline__row:last-child { border-bottom: 1px solid var(--line); }

/* Same left-edge marker the track rows use, so the page reads as one system. */
.timeline__row::before {
  content: "";
  position: absolute;
  left: 0; top: -1px; bottom: -1px;
  width: 2px;
  background: var(--violet);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 320ms var(--ease);
}
.timeline__row:hover { background: rgba(124, 92, 255, 0.06); padding-left: 1.35rem; }
.timeline__row:hover::before { transform: scaleY(1); }

.timeline__when {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--violet-bright);
  margin: 0;
  white-space: nowrap;
}

.timeline__what {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.3rem;
}

.timeline__where {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
}

/* Co-located rather than in the Responsive section at the foot of this file:
   the stack order is part of how this component fits together. */
@media (max-width: 760px) {
  .timeline__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.3rem;
    padding-left: 0;
    padding-block: 1.15rem;
  }
  .timeline__row:hover { padding-left: 0.5rem; }
  .timeline__row::before { left: -0.5rem; }
}

/* ── Contact ────────────────────────────────────────────────────────── */

.bside__lead {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2.75rem);
  line-height: 1.14;
  letter-spacing: -0.03em;
  max-width: 22ch;
  margin: 0 0 2.5rem;
}

.bside__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ── Footer ────────────────────────────────────────────────────────── */

.footer {
  padding: clamp(2.5rem, 6vh, 4rem) var(--gutter);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  align-items: baseline;
  max-width: 1400px;
  margin: 0 auto;
}

.footer__name {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.footer__colophon, .footer__back {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0;
}
.footer__colophon { max-width: 62ch; }
.footer__back a { text-decoration: none; border-bottom: 1px solid var(--line-2); }
.footer__back a:hover { border-bottom-color: var(--violet); color: var(--text); }

/* ── Tape counter ──────────────────────────────────────────────────── */

.counter {
  position: fixed;
  right: var(--gutter);
  bottom: 1.1rem;
  z-index: 9;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.32rem 0.75rem;
  pointer-events: none;
}
.counter__side { color: var(--violet-bright); }

/* ── Reveal & drift ────────────────────────────────────────────────────
   Both are CSS scroll-driven animations, not JavaScript. That matters for two
   reasons:

   1. Nothing is ever hidden by CSS alone. The `from` state only exists while
      the animation is driving it, and browsers without `animation-timeline`
      skip the whole block and render the content plainly. An earlier
      JavaScript version left every [data-reveal] at opacity 0 whenever the
      observer did not fire, which silently hid real content.
   2. Scroll position drives the animation directly, so the motion is correct
      even on a page restored mid-scroll, and it costs nothing on the main
      thread.                                                        */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* Transform only, with no opacity fade, on purpose. A fade leaves every
       not-yet-revealed element at low alpha, which is a genuine color-contrast
       failure for anyone reading the page mid-animation. axe flags it and it
       is right to: the text really is dimmed. The rise reads the same without
       it, so nothing is lost by dropping the fade. Do not add one back. */
    [data-reveal] {
      animation: reveal-in linear both;
      animation-timeline: view();
      animation-range: entry 5% cover 30%;
    }

    @keyframes reveal-in {
      from { transform: translateY(22px); }
      to   { transform: none; }
    }

    /* The dolly move: artwork slides a little against the page as it passes. */
    [data-drift] img {
      animation: drift linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 100%;
    }

    @keyframes drift {
      from { transform: translateY(14px); }
      to   { transform: translateY(-14px); }
    }
  }
}

/* ── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 1000px) {
  .cover {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    padding-top: clamp(2.5rem, 7vh, 4rem);
  }
  .cover__glow { inset: 4% 0 45% 0; height: 45%; }
  .shot-pair { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .nav { font-size: 0.68rem; gap: 0.75rem; }
  /* Visually hidden rather than display:none: the button collapses to a dot
     on small screens, and it still needs an accessible name. */
  .ambience__label {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  .ambience { padding: 0.5rem; position: relative; }

  .facts { grid-template-columns: minmax(0, 1fr); }



  .footer { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .counter { display: none; }
}

@media (max-width: 420px) {
  /* Nothing is hidden here. The three nav items are kept, just tightened. */
  .nav { gap: 0.6rem; font-size: 0.64rem; }
  .phones { grid-template-columns: minmax(0, 1fr); }
}

/* ── Reduced motion ────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  [data-drift] img { transform: none; }
  .btn:hover { transform: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ── Print ─────────────────────────────────────────────────────────── */

@media print {
  .topbar, .counter, .cover__actions { display: none; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
}

/* ── Multi-page chrome ─────────────────────────────────────────────────
   The site is three pages: Home, Projects, Records. The top bar and the
   footer are identical markup on each, so the nav takes its active state
   from aria-current rather than a class that can drift out of sync.     */

.nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--violet);
}

/* Sub-page header. The cover does this job on the home page. */
.page-head {
  padding: clamp(3rem, 9vh, 6rem) var(--gutter) clamp(1.75rem, 4vw, 2.75rem);
  max-width: 1400px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.page-head__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.25rem, 6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0 0 0.85rem;
}
.page-head__note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

/* The page header already draws the rule, so the first block beneath it
   must not draw a second one. */
.section--flush, .track-panel--page { border-top: 0; }
.section--flush { padding-top: clamp(2.5rem, 6vh, 4rem); }

/* Home: two cards pointing at the other pages. */
.jump {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 3vw, 1.75rem);
}
.jump__card {
  display: block;
  position: relative;
  padding: 1.75rem 1.5rem 2.5rem;
  border: 1px solid var(--line-2);
  border-radius: 0;
  background: var(--ink-2);
  text-decoration: none;
  transition: border-color var(--fast), transform var(--fast);
}
.jump__card:hover { border-color: var(--violet); transform: translateY(-3px); }

.jump__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--violet-bright);
  margin-bottom: 0.9rem;
}
.jump__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0 0 0.75rem;
}
.jump__line {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
  max-width: 42ch;
}
.jump__cue {
  position: absolute;
  right: 1.5rem;
  bottom: 1.4rem;
  font-family: var(--font-mono);
  color: var(--violet-bright);
  transition: transform var(--fast);
}
.jump__card:hover .jump__cue { transform: translateX(4px); }

@media (max-width: 760px) {
  .jump { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .jump__card:hover { transform: none; }
  .jump__card:hover .jump__cue { transform: none; }
}

/* Contact sits in the footer of every page, so it is never a page away,
   and so no page rewrite can quietly drop the only way to reach him. */
.footer__contact {
  grid-column: 1 / -1;
  padding-bottom: 1.75rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.footer__contact .bside__lead {
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  margin-bottom: 1.25rem;
  max-width: 30ch;
}
