@font-face {
  font-family: 'AuthenticSans';
  src: url('../fonts/AUTHENTICSans-60.woff2') format('woff2'), url('../fonts/AUTHENTICSans-60.woff') format('woff');
  font-weight: 400;
}
@font-face {
  font-family: 'AuthenticSans';
  src: url('../fonts/AUTHENTICSans-90.woff2') format('woff2'), url('../fonts/AUTHENTICSans-90.woff') format('woff');
  font-weight: 500;
}
@font-face {
  font-family: 'AuthenticSans';
  src: url('../fonts/AUTHENTICSans-130.woff2') format('woff2'), url('../fonts/AUTHENTICSans-130.woff') format('woff');
  font-weight: 700;
}
@font-face {
  font-family: 'AuthenticSans';
  src: url('../fonts/AUTHENTICSans-150.woff2') format('woff2'), url('../fonts/AUTHENTICSans-150.woff') format('woff');
  font-weight: 900;
}
@font-face {
  font-family: 'AuthenticSansCondensed';
  src: url('../fonts/AUTHENTICSans-Condensed-60.woff2') format('woff2'), url('../fonts/AUTHENTICSans-Condensed-60.woff') format('woff');
  font-weight: 400;
}
@font-face {
  font-family: 'AuthenticSansCondensed';
  src: url('../fonts/AUTHENTICSans-Condensed-90.woff2') format('woff2'), url('../fonts/AUTHENTICSans-Condensed-90.woff') format('woff');
  font-weight: 500;
}
@font-face {
  font-family: 'AuthenticSansCondensed';
  src: url('../fonts/AUTHENTICSans-Condensed-130.woff2') format('woff2'), url('../fonts/AUTHENTICSans-Condensed-130.woff') format('woff');
  font-weight: 700;
}
@font-face {
  font-family: 'AuthenticSansCondensed';
  src: url('../fonts/AUTHENTICSans-Condensed-150.woff2') format('woff2'), url('../fonts/AUTHENTICSans-Condensed-150.woff') format('woff');
  font-weight: 900;
}
 @font-face {
  font-family: 'FlorDeRuina';
  src: url('../fonts/FlorDeRuina-Flor.woff2') format('woff2'), url('../fonts/FlorDeRuina-Flor.woff') format('woff');
  font-weight: 100;
}
 @font-face {
  font-family: 'FlorDeRuina';
  src: url('../fonts/FlorDeRuina-Fractura.woff2') format('woff2'), url('../fonts/FlorDeRuina-Fractura.woff') format('woff');
  font-weight: 200;
}
 @font-face {
  font-family: 'FlorDeRuina';
  src: url('../fonts/FlorDeRuina-Germen.woff2') format('woff2'), url('../fonts/FlorDeRuina-Germen.woff') format('woff');
  font-weight: 300;
}
 @font-face {
  font-family: 'FlorDeRuina';
  src: url('../fonts/FlorDeRuina-Ruina.woff2') format('woff2'), url('../fonts/FlorDeRuina-Ruina.woff') format('woff');
  font-weight: 400;
}
 @font-face {
  font-family: 'FlorDeRuina';
  src: url('../fonts/FlorDeRuina-Semilla.woff2') format('woff2'), url('../fonts/FlorDeRuina-Semilla.woff') format('woff');
  font-weight: 500;
}

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

:root {
  --bg: #f2f0eb;
  --ink: #111;
  --red: #e8220a;
  --muted: #6a6761;
  --rule: 1px solid #c8c4bd;
  --nav-h: 46px;
  --row-h: 3.5rem;      /* one height for section labels, the CV row and the "All writing" row */
}

html { font-size: 17px; }

/* Anchor jumps (#film, #music, #cv, #contact) land below the sticky nav */
[id] { scroll-margin-top: var(--nav-h); }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'AuthenticSans', sans-serif;
  font-weight: 400;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }

/* ─── TOP NAV ─── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: var(--rule);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.nav-name {
  font-family: 'AuthenticSans', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 24px;
}
.nav-links a {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.12s;
}
.nav-links a:hover { color: var(--red); }

/* Homepage only: the nav stays hidden until the big name has scrolled out of view.
   main.js adds .show; without JS the nav simply stays visible as usual. */
html.js body.home .top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}
html.js body.home .top-nav.show {
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}

/* ─── PAGE ─── */
.page { min-width: 0; min-height: calc(100vh - var(--nav-h)); display: flex; flex-direction: column; }

/* ─── HEADER ─── */
.page-header {
  display: grid;
  grid-template-columns: 1fr 340px;
  border-bottom: var(--rule);
}

.header-bio {
  padding: 30px 28px;
  border-right: var(--rule);
}

.header-name {
  font-family: 'FlorDeRuina', sans-serif;
  font-weight: 200;
  font-size: 5rem;
  line-height: 0.9;
  text-transform: uppercase;
  color: var(--red);
  letter-spacing: -0.01em;
  margin-bottom: 22px;
}

.bio-text {
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.65;
  color: #222;
  max-width: 600px;
}
.bio-link {
  display: inline;
  font-size: inherit;
  font-weight: 500;
  line-height: inherit;
  vertical-align: baseline;
  color: var(--red);
  opacity: 0.8;
}
.bio-link:hover { opacity: 1; color: var(--red); }
.bio-text p + p { margin-top: 0.8em; }

.header-photo { overflow: hidden; }
.header-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: grayscale(15%);
}

/* ─── SECTION LABEL ─── */
.section-label {
  min-height: var(--row-h);
  display: flex;
  align-items: center;
  padding: 0 28px;
  border-bottom: var(--rule);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
}

/* ─── FILM ─── */
.hit {
  display: grid;
  grid-template-columns: 1fr 240px 200px;
  border-bottom: var(--rule);
  transition: background 0.1s;
  cursor: default;
}
a.hit { text-decoration: none; color: inherit; cursor: pointer; }
a.hit:hover { color: var(--bg); }
.hit:hover { background: var(--red); color: var(--bg); }
.hit:hover .hit-dir,
.hit:hover .hit-role { color: rgba(242,240,235,0.8); }
.hit:hover .hit-name,
.hit:hover .hit-dir { border-color: transparent; }

.hit-name {
  padding: 15px 28px;
  font-size: 1.2rem;
  font-weight: 500;
  border-right: var(--rule);
  transition: border-color 0.1s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hit-dir {
  padding: 15px 18px;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--muted);
  border-right: var(--rule);
  display: flex;
  align-items: center;
  transition: border-color 0.1s;
}
.hit-role {
  padding: 15px 18px;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--muted);
  display: flex;
  align-items: center;
}
.hit-laurels {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}
.hit-laurels img {
  height: 38px;
  width: auto;
  display: block;
}
.hit-laurels img.invert {
  filter: invert(1) brightness(0);
}
.hit:hover .hit-laurels img.invert {
  filter: invert(1);
}

/* ─── CV ─── */
.cv-year {
  display: flex;
  align-items: center;
  min-height: var(--row-h);          /* same height as every other row */
  line-height: 1;                    /* the page's 1.6 made the big numerals sit in a tall box */
  padding: 0.12em 28px 0;            /* caps have no descenders, so nudge down to centre them optically */
  border-bottom: var(--rule);
  border-top: 2px solid var(--red);
  font-family: 'AuthenticSansCondensed', sans-serif;
  font-weight: 900;
  font-size: 2.3rem;
  text-transform: uppercase;
  color: var(--red);
  letter-spacing: 0.01em;
}

.cv-entry {
  display: grid;
  grid-template-columns: 1fr 160px;
  border-bottom: var(--rule);
  transition: background 0.1s;
}
.cv-entry:hover { background: rgba(192,57,43,0.04); }

.cv-left {
  padding: 13px 28px;
  border-right: var(--rule);
}

.cv-title {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 2px;
}

.cv-meta {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
}

.cv-awards {
  list-style: none;
  margin-top: 3px;
}
.cv-awards li {
  font-size: 0.82rem;
  color: #444;
  line-height: 1.55;
}
.cv-awards li::before { content: '↳ '; color: var(--red); opacity: 0.6; }

.cv-link {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--red);
  opacity: 0.8;
  margin-top: 4px;
}
.cv-link:hover { opacity: 1; color: var(--red); }

.cv-right {
  padding: 12px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.65;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── FOOTER ─── */
.page-footer {
  margin-top: auto;
  border-top: 2px solid var(--red);
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.footer-col {
  padding: 26px 28px;
  border-right: var(--rule);
}
.footer-col:last-child { border-right: none; }

.footer-col-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  display: block;
  margin-bottom: 10px;
}

.footer-col a {
  display: block;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.85;
}
.footer-col a:hover { color: var(--red); }

.footer-end { height: 16px; border-top: var(--rule); }

/* ─── RESPONSIVE ─── */
@media (max-width: 860px) {
  .page-header { grid-template-columns: 1fr; }
  .header-photo { height: 240px; border-right: none; border-top: var(--rule); }
  .hit { grid-template-columns: 1fr; }
  .hit-name, .hit-dir { border-right: none; }
  .cv-entry { grid-template-columns: 1fr; }
  .cv-left { border-right: none; }
  .cv-right { border-top: var(--rule); }
  .page-footer { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  html { font-size: 16px; }

  /* Nav: five short links, one line, no wrapping */
  .top-nav {
    height: auto;
    min-height: 0;
    padding: 10px 14px;
    flex-wrap: nowrap;
    gap: 10px;
  }
  .nav-name {
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    flex-shrink: 0;
  }
  .nav-links {
    gap: 11px;
    flex-wrap: nowrap;
  }
  .nav-links a {
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }

  /* Stack header photo below bio */
  .page-header {
    grid-template-columns: 1fr;
  }
  .header-bio {
    padding: 22px 18px;
    border-right: none;
  }
  .header-name {
    font-size: 3.8rem;
    margin-bottom: 16px;
  }
  .header-photo {
    height: 260px;
    border-top: var(--rule);
  }

  /* CV entries single column */
  .cv-left { padding: 10px 18px; border-right: none; }
  .cv-right { padding: 8px 18px; border-top: var(--rule); }
  .section-label { padding: 0 18px; }
  .cv-year { padding: 0.12em 18px 0; }

  /* Hits single column */
  .hit-name { padding: 12px 18px; border-right: none; }
  .hit-dir, .hit-role { padding: 4px 18px; }
  .hit-dir { border-right: none; }

  /* Footer single column */
  .page-footer { grid-template-columns: 1fr; }
  .footer-col { border-right: none; border-bottom: var(--rule); padding: 20px 18px; }
}
/* ─── POSTER PREVIEW ─── */
.hit-poster {
  display: none;
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  width: 175px;
  box-shadow: 4px 4px 24px rgba(0,0,0,0.18);
  border: var(--rule);
}
.hit-poster img {
  width: 100%;
  height: auto;
  display: block;
}
.hit:hover .hit-poster {
  display: block;
}

/* ─── EXTENDED CV ACCORDION ─── */
/* The CV row is a solid red bar with the text inverted */
.cv-head { padding: 0; background: var(--red); color: var(--bg); }
.cv-toggle {
  flex: 1;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  text-align: left;
}
.cv-toggle:hover { background: rgba(0,0,0,0.1); }
.cv-toggle:focus-visible { outline: 2px solid var(--bg); outline-offset: -4px; }
.cv-toggle-state { display: flex; align-items: center; gap: 6px; }
.cv-toggle-icon { transition: transform 0.3s ease; }
.cv-toggle[aria-expanded="true"] .cv-toggle-icon { transform: rotate(180deg); }

/* grid-template-rows 0fr → 1fr gives a smooth height animation without measuring in JS */
.cv-collapsible {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s ease;
}
.cv-collapsible.open { grid-template-rows: 1fr; }
.cv-collapsible-inner {
  min-height: 0;
  overflow: hidden;
  visibility: hidden;                      /* keeps hidden links out of tab order */
  transition: visibility 0s linear 0.45s;
}
.cv-collapsible.open .cv-collapsible-inner {
  visibility: visible;
  transition-delay: 0s;
}

/* ─── WRITING ─── */
.hit-more { min-height: var(--row-h); }
.hit-more .hit-name { color: var(--muted); font-weight: 400; font-size: 1rem; }
.hit-more:hover .hit-name { color: var(--bg); }   /* was staying grey on the red hover */
.hit-empty { padding: 18px 28px; font-size: 1rem; color: var(--muted); border-bottom: var(--rule); }

.page-title {
  padding: 30px 28px 24px;
  border-bottom: var(--rule);
}
.page-title h1 {
  font-family: 'FlorDeRuina', sans-serif;
  font-weight: 200;
  font-size: 4rem;
  line-height: 0.9;
  text-transform: uppercase;
  color: var(--red);
  letter-spacing: -0.01em;
}
.page-title p {
  margin-top: 14px;
  max-width: 600px;
  font-size: 1.05rem;
  line-height: 1.65;
  color: #222;
}

/* Entries on /writing/: notes in full, essays as title + excerpt */
.entry {
  display: grid;
  grid-template-columns: 1fr 210px;
  border-bottom: var(--rule);
}
.entry-main { padding: 20px 28px 24px; border-right: var(--rule); min-width: 0; }
.entry-side {
  padding: 22px 18px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
}
.entry-side .entry-type {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
}
.entry-title { font-size: 1.35rem; font-weight: 500; line-height: 1.3; }
.entry-excerpt { margin-top: 8px; font-size: 1.05rem; line-height: 1.65; color: #222; max-width: 640px; }
.entry-more { display: inline-block; margin-top: 10px; font-size: 0.88rem; font-weight: 500; color: var(--red); opacity: 0.85; }
.entry-more:hover { opacity: 1; }
.entry .prose { margin-top: 12px; }

/* Row highlight, same as .hit. The title link is stretched over the whole row so the row is clickable. */
.entry { position: relative; transition: background 0.1s; }
.entry-title a::after { content: ''; position: absolute; inset: 0; }
.entry .prose a, .entry-more { position: relative; z-index: 1; }
.entry:hover { background: var(--red); color: var(--bg); }
.entry:hover .entry-main { border-color: transparent; }
.entry:hover .entry-title,
.entry:hover .entry-excerpt,
.entry:hover .prose,
.entry:hover .prose blockquote { color: var(--bg); }
.entry:hover .entry-side { color: rgba(242,240,235,0.8); }
.entry:hover .entry-type,
.entry:hover a { color: var(--bg); opacity: 1; }
.entry:hover .prose a { text-decoration: underline; }
.entry:hover .prose code,
.entry:hover .prose pre { background: rgba(242,240,235,0.18); }
.entry:hover .prose blockquote { border-color: var(--bg); }

/* ─── POST PAGE + PROSE ─── */
.post-header { padding: 30px 28px 22px; border-bottom: var(--rule); }
.post-meta {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
}
.post-title { font-size: 2.4rem; font-weight: 500; line-height: 1.15; max-width: 700px; }
.post-body { padding: 26px 28px 34px; }

.prose { max-width: 680px; font-size: 1.05rem; font-weight: 400; line-height: 1.7; color: #222; }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: 1.4rem; font-weight: 500; line-height: 1.3; margin-top: 1.8em; }
.prose h3 { font-size: 1.15rem; font-weight: 500; margin-top: 1.5em; }
.prose a { color: var(--red); opacity: 0.8; }
.prose a:hover { opacity: 1; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.3em; }
.prose blockquote { border-left: 3px solid var(--red); padding-left: 16px; color: #444; }
.prose img, .prose video { max-width: 100%; height: auto; display: block; }
.prose .embed { margin: 1.6em 0; }
.prose .embed iframe { display: block; width: 100%; border: 0; }
.prose .embed-video iframe { aspect-ratio: 16 / 9; height: auto; }
.prose .embed-audio iframe { height: 166px; }

/* Wide screens: embeds with .embed-side sit in the right margin, level with the paragraph they precede.
   (Negative right margin pushes them out of the text column; narrower screens keep them inline.) */
@media (min-width: 1120px) {
  .prose .embed-side {
    --side-w: clamp(400px, 32vw, 640px);   /* grows with the window, 400px at the smallest */
    float: right; clear: right;
    width: var(--side-w);
    margin: 0.3em calc(-1 * (var(--side-w) + 40px)) 1em 0;
  }
}
.prose audio { width: 100%; display: block; }
.prose figure { margin: 1.4em 0; }
.prose figcaption { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.prose hr { border: none; border-top: var(--rule); margin: 2em 0; }
.prose code { font-size: 0.85em; background: rgba(0,0,0,0.05); padding: 1px 4px; }
.prose pre {
  overflow-x: auto;
  background: rgba(0,0,0,0.05);
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-top: var(--rule);
  border-bottom: var(--rule);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* On /writing/ the last row already has a bottom border, so don't double it */
.entry + .post-nav, .hit-empty + .post-nav { border-top: none; }

@media (max-width: 860px) {
  .entry { grid-template-columns: 1fr; }
  .entry-main { border-right: none; padding-bottom: 8px; }
  .entry-side { padding: 0 28px 16px; display: flex; gap: 10px; }
  .entry-side .entry-type { margin-top: 0; }
}
@media (max-width: 600px) {
  .cv-toggle { padding: 0 18px; }
  .hit-more { min-height: 0; }
  .page-title { padding: 22px 18px 18px; }
  .page-title h1 { font-size: 3rem; }
  .entry-main { padding: 16px 18px 8px; }
  .entry-side { padding: 0 18px 14px; }
  .post-header { padding: 22px 18px 18px; }
  .post-title { font-size: 1.5rem; }
  .post-body { padding: 20px 18px 28px; }
  .post-nav { padding: 12px 18px; }
  .hit-empty { padding: 14px 18px; }
}
