/* Bundled Helvetica clone (TeX Gyre Heros, GUST Font License — see /fonts/GUST-FONT-LICENSE.txt).
   Apple devices use their built-in Helvetica Neue; everything else gets this instead of Arial. */
@font-face {
  font-family: "Heros";
  src: url("/fonts/texgyreheros-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Heros";
  src: url("/fonts/texgyreheros-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Heros";
  src: url("/fonts/texgyreheros-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Heros";
  src: url("/fonts/texgyreheros-bolditalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* ------------------------------------------------------------------ */
/* Tokens                                                             */
/* ------------------------------------------------------------------ */

:root {
  --bg: #e8e6e4;
  --ink: #000;
  --line: 2px;
  --about: #d9785f;
  --experience: #2e6db4;
  --education: #c42b2e;
  --skills: #3f9150;
  --photo-bg: #3f9150;
  --focus: #2e6db4;
  --font: "Helvetica Neue", Helvetica, "Heros", sans-serif;
  --text: clamp(1rem, 0.55rem + 0.75vw, 1.35rem);
  --pad-y: clamp(0.6rem, min(3vw, 3.2vh), 3.25rem);
  --pad-x: clamp(1.25rem, 3.4vw, 3.5rem);
  --tab-w: max(3rem, 7vw);
  --reveal-ms: 250ms;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text);
  line-height: 1.22;
  -webkit-font-smoothing: antialiased;
}

p,
ul,
h1,
h2,
h3 {
  margin: 0;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--bg);
}

.skip-link:focus {
  top: 1rem;
}

.noscript {
  padding: 2rem;
}

/* ------------------------------------------------------------------ */
/* Poster grid — black "lines" are the 2px gaps over a black backdrop */
/* ------------------------------------------------------------------ */

.poster {
  display: grid;
  grid-template-columns: 68fr 32fr;
  gap: var(--line);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ink);
}

.sections {
  display: grid;
  /* fr tracks never shrink below their content, so long sections simply grow. */
  grid-template-rows: 15fr 45fr 25fr 15fr;
  gap: var(--line);
  background: var(--ink);
}

.row {
  display: grid;
  grid-template-columns: var(--tab-w) 1fr;
  gap: var(--line);
  background: var(--ink);
}

.row[data-section="about"] { --tab-color: var(--about); }
.row[data-section="experience"] { --tab-color: var(--experience); }
.row[data-section="education"] { --tab-color: var(--education); }
.row[data-section="skills"] { --tab-color: var(--skills); }

.tab {
  display: flex;
  background: var(--tab-color);
  font-size: clamp(1.1rem, 0.6rem + 1vw, 1.75rem);
  font-weight: 700;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

/* Black, inset from the grid lines, so it reads on every tab color (blue would vanish on Experience). */
.row:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -7px;
  position: relative;
  z-index: 1;
}

.tab-btn:focus-visible {
  outline-color: var(--ink);
  outline-offset: -6px;
}

.content {
  background: var(--bg);
  padding: var(--pad-y) var(--pad-x);
  min-width: 0;
}

/* Blur the text, not the cell, so the grey background and grid lines stay crisp. */
.content > * {
  max-width: 44em;
  transition: filter var(--reveal-ms) ease, opacity var(--reveal-ms) ease;
}

.entry + .entry {
  margin-top: 1.15em;
}

.entry .dates {
  font-weight: 700;
  margin-bottom: 0.45em;
}

.entry .title {
  font-style: italic;
  font-weight: 700;
  margin-bottom: 0.45em;
}

.entry .description,
.about-text {
  white-space: pre-line;
}

.skills-list {
  list-style: none;
  padding: 0;
}

.skills-list li + li {
  margin-top: 0.55em;
}

.empty-note {
  opacity: 0.6;
  font-style: italic;
}

/* Identity panel */

.identity {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--line);
  background: var(--ink);
  min-width: 0;
}

.cell {
  background: var(--bg);
  min-width: 0;
}

.photo-cell {
  padding: clamp(0.6rem, min(3vw, 3.2vh), 3rem);
}

.photo-frame {
  aspect-ratio: 1 / 1;
  background: var(--photo-bg);
  overflow: hidden;
}

.photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 3vw, 3rem) clamp(1rem, 2.5vw, 2.5rem);
  overflow: hidden;
}

.name {
  writing-mode: vertical-rl; /* first line sits on the right, like the poster */
  text-transform: uppercase;
  font-weight: 400;
  font-size: var(--name-size, clamp(3rem, min(8.5vw, 8vh), 10rem));
  line-height: 0.92;
  letter-spacing: -0.03em; /* tight tracking makes the big capitals read as one shape */
  white-space: nowrap;
}

.name span {
  display: block;
}

.contact-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: var(--pad-y) clamp(1.25rem, 3vw, 3rem);
}

.contact {
  font-style: normal;
  text-align: right;
  overflow-wrap: anywhere;
}

.contact > * {
  display: block;
}

/* ------------------------------------------------------------------ */
/* Wide screens: the whole poster fits the window                     */
/* ------------------------------------------------------------------ */

@media screen and (min-width: 900px) {
  /* app.js lowers --fit-text until the poster fits the window height. */
  body {
    font-size: var(--fit-text, var(--text));
  }

  /* An exact height lets crowded rows borrow space from roomy ones instead of
     stretching the whole poster. If it still can't fit, app.js adds .is-overflowing
     and the page scrolls. */
  .poster {
    height: 100vh;
    height: 100dvh;
    grid-template-rows: minmax(0, 1fr); /* columns take the window height, not their content's */
  }

  .poster.is-overflowing {
    height: auto;
    grid-template-rows: auto;
  }

  /* When scrolling anyway, size rows to their content so there's no empty space to scroll past. */
  .poster.is-overflowing .sections {
    grid-template-rows: auto;
  }

  /* Like the printed poster: the photo takes about a quarter of the height, leaving the
     name most of the column. On short windows it is limited by height, not column width. */
  .photo-frame {
    width: min(100%, 26vh);
    margin: 0 auto;
  }

  .name-cell {
    padding: clamp(0.6rem, 2.5vh, 3rem) clamp(1rem, 2.5vw, 2.5rem);
  }

  /* Leave room so the fixed "Reveal all" button never covers the contact lines. */
  .contact-cell {
    padding-bottom: max(var(--pad-y), 4.25rem);
  }
}

/* ------------------------------------------------------------------ */
/* Blur / reveal (wide screens)                                       */
/* ------------------------------------------------------------------ */

@media screen and (min-width: 900px) {
  /* Visual only: the text stays in the DOM and in the accessibility tree. */
  .is-blurred .row .content > * {
    filter: blur(6px);
    opacity: 0.6;
    user-select: none;
  }

  .is-blurred .row:focus-within .content > *,
  .is-blurred .row.is-revealed .content > * {
    filter: none;
    opacity: 1;
    user-select: auto;
  }
}

@media screen and (min-width: 900px) and (hover: hover) {
  .is-blurred .row:hover .content > * {
    filter: none;
    opacity: 1;
    user-select: auto;
  }
}

/* ------------------------------------------------------------------ */
/* Reveal-all toggle + hint                                           */
/* ------------------------------------------------------------------ */

.reveal-toggle {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.05rem 0.55rem 0.85rem;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: 700 0.95rem/1 var(--font);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.reveal-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--ink);
}

.reveal-toggle:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}

.reveal-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.reveal-toggle .icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reveal-toggle .icon-eye-slash,
.reveal-toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.reveal-toggle[aria-pressed="true"] .icon-eye-slash {
  display: block;
}

.reveal-hint {
  position: fixed;
  right: 1rem;
  bottom: 4.25rem;
  z-index: 10;
  max-width: calc(100vw - 2rem);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 700;
  transition: opacity 400ms ease, transform 400ms ease;
}

.reveal-hint.is-leaving {
  opacity: 0;
  transform: translateY(0.5rem);
}

/* ------------------------------------------------------------------ */
/* Narrow screens: single column, accordions                          */
/* ------------------------------------------------------------------ */

@media screen and (max-width: 899px) {
  :root {
    --pad-y: 1.25rem;
    --pad-x: 1.25rem;
  }

  body {
    padding-bottom: 5rem; /* room for the fixed toggle */
  }

  .poster {
    display: flex;
    flex-direction: column;
  }

  .sections,
  .identity {
    display: contents;
  }

  .photo-cell { order: 1; }
  .name-cell { order: 2; }
  .row { order: 3; }
  .contact-cell { order: 4; }

  .photo-cell {
    padding: 1.25rem;
  }

  .photo-frame {
    max-width: 26rem;
    margin: 0 auto;
  }

  .name-cell {
    display: block;
    padding: 1.25rem;
  }

  .name {
    writing-mode: horizontal-tb;
    font-size: clamp(2.5rem, 13vw, 5rem);
    line-height: 0.95;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .tab {
    font-size: 1.15rem;
  }

  .tab-btn {
    writing-mode: horizontal-tb;
    transform: none;
    justify-content: space-between;
    padding: 0.95rem 1.25rem;
    text-align: left;
  }

  .tab-btn::after {
    content: "+";
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 400;
  }

  .tab-btn[aria-expanded="true"]::after {
    content: "\2212";
  }

  /* Collapsed unless opened, or unless "Reveal all" is on. */
  .is-blurred .row:not(.is-revealed) .content {
    display: none;
  }

  .contact-cell {
    justify-content: flex-start;
    padding: 1.25rem;
  }

  .contact {
    text-align: left;
  }
}

/* ------------------------------------------------------------------ */
/* Motion                                                             */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  :root {
    --reveal-ms: 0ms;
  }

  .reveal-toggle,
  .reveal-hint {
    transition: none;
  }
}

/* ------------------------------------------------------------------ */
/* Print: one US Letter page, no blur, colors kept                    */
/* ------------------------------------------------------------------ */

@page {
  size: letter;
  margin: 0;
}

@media print {
  :root {
    --text: 9.5pt;
    --pad-y: 0.28in;
    --pad-x: 0.32in;
    --tab-w: 0.55in;
  }

  html,
  body {
    width: 8.5in;
    height: 11in;
    overflow: hidden;
    background: var(--bg);
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .poster {
    height: 11in;
    min-height: 0;
    overflow: hidden;
  }

  .tab {
    font-size: 12pt;
  }

  .content > * {
    filter: none !important;
    opacity: 1 !important;
    transition: none;
  }

  .photo-cell {
    padding: 0.3in;
  }

  .name-cell {
    padding: 0.25in 0.15in;
  }

  .name {
    /* Fits the longest name line into the ~6in-tall name cell; JS sets --name-len. */
    font-size: min(calc(6in / (var(--name-len, 8) * 0.72)), 1.05in);
  }

  .contact-cell {
    padding: 0.3in;
  }

  .reveal-toggle,
  .reveal-hint,
  .skip-link {
    display: none !important;
  }
}
