/* ============================================================
   Jonathan Tellechea — portfolio
   Palette derived from the viridis colormap.
   ============================================================ */

:root {
  --paper:      #EEF1F3;
  --panel:      #F8FAFB;
  --ink:        #0E141B;
  --ink-2:      #55636F;
  --ink-3:      #7C8894;
  --rule:       #C6D0D8;
  --rule-soft:  #DBE2E7;

  --v-deep:     #3B0F70;
  --v-blue:     #3B528B;
  --v-teal:     #21918C;
  --v-teal-dk:  #146D68;
  --v-green:    #5EC962;
  --v-yellow:   #FDE725;

  --display: "IBM Plex Sans Condensed", "Helvetica Neue", sans-serif;
  --body:    "Source Serif 4", Georgia, serif;
  --mono:    "IBM Plex Mono", ui-monospace, monospace;

  --rail-w: 268px;
  --measure: 66ch;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* Faint graph-paper ground, so the page reads as plotting stock. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(59,82,139,.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(59,82,139,.055) 1px, transparent 1px);
  background-size: 26px 26px;
}

/* Subscripts and superscripts must not stretch the line box. */
sub, sup {
  font-size: .72em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sub { bottom: -.25em; }
sup { top: -.45em; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: .6rem 1rem;
  font-family: var(--mono);
  font-size: .8rem;
  z-index: 50;
}
.skip:focus { left: 0; }

a { color: var(--v-teal-dk); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--v-deep); }
:focus-visible { outline: 2px solid var(--v-deep); outline-offset: 3px; }

/* ---------- shell ---------- */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  gap: 0;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- left rail ---------- */

.rail { border-right: 1px solid var(--rule); }

.rail__inner {
  position: sticky;
  top: 0;
  padding: 56px 34px 56px 0;
  display: flex;
  flex-direction: column;
  gap: 34px;
  max-height: 100vh;
  overflow-y: auto;
}

.rail__name {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.94rem;
  line-height: .98;
  letter-spacing: -.015em;
}

.rail__role {
  margin: 0;
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.nav__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav__list a {
  display: block;
  padding: 3px 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .01em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.nav__list a:hover { color: var(--v-deep); border-bottom-color: var(--rule); }
.nav__num {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--ink-3);
  margin-right: 9px;
}
.nav__list a.is-active { color: var(--v-deep); }
.nav__list a.is-active .nav__num { color: var(--v-teal-dk); }

.rail__links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--mono);
  font-size: .76rem;
}
.rail__links a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.rail__links a:hover { border-bottom-color: var(--v-deep); }

/* ---------- main column ---------- */

.main { padding: 56px 0 96px 52px; min-width: 0; }

.eyebrow {
  margin: 0 0 22px;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.hero__title {
  margin: 0 0 24px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.15rem, 4.4vw, 3.35rem);
  line-height: 1.02;
  letter-spacing: -.02em;
  max-width: 19ch;
  text-wrap: balance;
}

.hero__lede {
  margin: 0 0 44px;
  max-width: var(--measure);
  font-size: 1.09rem;
  color: var(--ink-2);
}
.hero__lede em { color: var(--ink); font-style: italic; }

/* ---------- figures ---------- */

.figure { margin: 0 0 40px; max-width: var(--measure); }

.figure figcaption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: .73rem;
  line-height: 1.62;
  color: var(--ink-2);
}
.fignum {
  color: var(--v-deep);
  font-weight: 500;
  margin-right: 8px;
}

.figure__img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 10px;
}

.plot {
  display: block;
  width: 100%;
  height: auto;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 10px;
}
.plot .ax { stroke: var(--ink-3); stroke-width: 1; }
.plot .tick text {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--ink-2);
}
.plot .lbl {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--ink-2);
}
.plot .lbl--hi { fill: var(--v-deep); }
.plot .bar { fill: var(--v-blue); opacity: .55; }
.plot .bar--hi { fill: var(--v-teal); opacity: 1; }

/* ---------- sections ---------- */

.section {
  margin-top: 92px;
  padding-top: 30px;
  border-top: 1px solid var(--rule);
}

.section__head {
  margin: 0 0 40px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: -.01em;
}
.section__num {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 400;
  color: var(--v-deep);
  margin-right: 14px;
  vertical-align: .18em;
}

.entry { margin-bottom: 68px; max-width: var(--measure); }
.entry:last-of-type { margin-bottom: 40px; }

.entry__title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.32rem;
  line-height: 1.16;
  letter-spacing: -.005em;
}
.entry__meta {
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: .73rem;
  color: var(--v-teal-dk);
}
.entry p { margin: 0 0 18px; }
.entry code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--panel);
  border: 1px solid var(--rule-soft);
  padding: .05em .3em;
}
.entry__note {
  padding-left: 16px;
  border-left: 2px solid var(--v-green);
  color: var(--ink-2);
  font-size: .96rem;
}
.entry__links {
  margin: 0;
  font-family: var(--mono);
  font-size: .76rem;
}

/* ---------- also ---------- */

.also {
  max-width: var(--measure);
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 26px 28px 8px;
}
.also__head {
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--ink-2);
}
.also__list { margin: 0; }
.also__list dt {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.04rem;
  margin-bottom: 5px;
}
.also__list dd {
  margin: 0 0 20px;
  color: var(--ink-2);
  font-size: .97rem;
}

/* ---------- record rows ---------- */

.record { max-width: var(--measure); }
.record__row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 22px;
  padding: 20px 0;
  border-top: 1px solid var(--rule-soft);
}
.record__row:first-child { border-top: 0; padding-top: 0; }
.record__when {
  margin: 0;
  font-family: var(--mono);
  font-size: .73rem;
  color: var(--ink-3);
  padding-top: .3em;
}
.record__what h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.08rem;
}
.record__what p { margin: 0; color: var(--ink-2); font-size: .98rem; }
.record__what .entry__meta { margin: 0 0 8px; }

/* ---------- toolkit ---------- */

.kit {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 34px;
  max-width: var(--measure);
}
.kit__head {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--v-deep);
}
.kit__list { margin: 0; padding: 0; list-style: none; }
.kit__list li {
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 2.05;
  color: var(--ink-2);
}
.kit__bench {
  max-width: var(--measure);
  margin: 30px 0 0;
  font-family: var(--mono);
  font-size: .73rem;
  color: var(--ink-3);
}

/* ---------- contact ---------- */

.section--last { padding-bottom: 0; }
.contact__line { max-width: var(--measure); margin: 0 0 26px; }
.contact__mail { margin: 0 0 20px; }
.contact__mail a {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -.01em;
  text-decoration: none;
  border-bottom: 2px solid var(--v-teal);
}
.contact__mail a:hover { border-bottom-color: var(--v-deep); }
.contact__links {
  margin: 0 0 60px;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  font-size: .78rem;
}

/* ---------- scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */

@media (max-width: 940px) {
  .shell { grid-template-columns: 1fr; padding: 0 22px; }
  .rail { border-right: 0; border-bottom: 1px solid var(--rule); }
  .rail__inner {
    position: static;
    max-height: none;
    padding: 34px 0 26px;
    gap: 24px;
  }
  .nav__list { flex-direction: row; flex-wrap: wrap; gap: 6px 20px; }
  .rail__links { flex-direction: row; flex-wrap: wrap; gap: 6px 18px; }
  .main { padding: 40px 0 72px; }
  .section { margin-top: 68px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .kit { grid-template-columns: 1fr 1fr; gap: 26px; }
  .record__row { grid-template-columns: 1fr; gap: 6px; }
  .record__when { padding-top: 0; }
  .figure figcaption { font-size: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
