/* Ryan Kost — site styles
 *
 * Style guide
 * -----------
 * Three typefaces, each with one job:
 *   Display  Playfair Display   page titles, Selected Work headlines (700); the home lede (400)
 *   Label    Libre Franklin     nav, kickers, section labels, meta — always small caps-style:
 *                               uppercase, 0.6875–0.75rem, weight 600–700, tracking 0.12em
 *   Text     Newsreader         everything you read: bio, notes, related links, and
 *                               headlines in the Writing/Audio lists (500) for easy scanning
 *
 * Color: black ink on warm paper. One accent (deep blue) for kickers, the current page,
 * links and publication names in running text, and interactive states — never for large fills.
 *
 * Rules: 1px ink rule above each section label; 1px soft rule between list items.
 */

:root {
  --paper: #fcf2e6;
  --ink: #121212;
  --ink-soft: #363636;
  --muted: #6b6b6b;
  --rule: #121212;
  --rule-soft: #e2d6c6;
  --accent: #1f4f99;
  --accent-soft: rgba(31, 79, 153, 0.3);

  --display: "Playfair Display", Georgia, "Times New Roman", serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;
  --label: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;

  --measure: 42rem;
  --contact-h: 2.75rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.1875rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--contact-h);
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--rule-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 6vw, 4.5rem);
}

/* ---------- Type roles ---------- */

.label,
.kicker,
.section-label,
.nav,
.more,
.toc,
.contactbar,
.footer {
  font-family: var(--label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kicker {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.35rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  border-top: 1px solid var(--rule);
  padding-top: 0.6rem;
  margin: 0 0 1.5rem;
}

.hed {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.24;
  margin: 0;
}
.hed a { text-decoration: none; }
.hed a:hover { text-decoration: underline; text-decoration-color: var(--accent); }

.page-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  line-height: 1.1;
  margin: 3rem 0 0.75rem;
}
.page-title + .toc { margin-top: 2.25rem; }

.dek {
  font-size: 1.25rem;
  font-style: italic;
  color: var(--ink-soft);
  max-width: var(--measure);
  margin: 0 0 3rem;
}

main { padding-bottom: 4rem; }

/* Highlighted words in running text: links and publication names */
.prose a,
.prose cite {
  color: var(--accent);
  font-style: inherit;
}
.prose cite { font-style: italic; }
.prose a { text-decoration-color: var(--accent-soft); }
.prose a:hover { text-decoration-color: var(--accent); }

/* ---------- Header ---------- */

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.75rem;
  padding: 2rem 0 1rem;
}

.header__name {
  font-family: var(--label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.2rem 0;
}
.header__name:hover { text-decoration: underline; text-decoration-color: var(--accent); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.nav a { text-decoration: none; color: var(--ink-soft); padding: 0.2rem 0; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- Home ---------- */

.intro {
  max-width: 62rem;
  padding: clamp(3rem, 12vh, 7rem) 0 1rem;
}

.lede {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.25rem, 5.5vw, 3.75rem);
  line-height: 1.12;
  margin: 0 0 2.25rem;
}

.header__name,
.footer__name { color: var(--accent); }

/* Hand-drawn blue underline under the name in the home lede */
.lede__name {
  font-weight: 400;
  padding-bottom: 0.08em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M3 8.5 C 45 5.5, 110 4, 197 6.5 C 150 6, 120 6.8, 96 8' fill='none' stroke='%231f4f99' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: -0.08em 100%;
  background-size: calc(100% + 0.16em) 0.26em;
}

.bio p {
  font-size: clamp(1.1875rem, 2vw, 1.375rem);
  line-height: 1.6;
  margin: 0 0 1.5rem;
  max-width: 54rem;
}

.featured { margin-top: 5rem; }

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 46rem) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
  .card + .card { border-left: 1px solid var(--rule-soft); padding-left: 2rem; }
}
@media (max-width: 45.99rem) {
  .card + .card { border-top: 1px solid var(--rule-soft); padding-top: 1.25rem; }
}

.card { padding: 0.25rem 0 1.5rem; }
.card .hed { font-size: 1.3125rem; margin-bottom: 0.6rem; }
.card .kicker { font-size: 1rem; margin: 0; }
.card p:not(.kicker) { margin: 0; font-size: 1rem; color: var(--ink-soft); line-height: 1.5; }

.more {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.more:hover { text-decoration: underline; }

/* ---------- Writing ---------- */

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0;
  margin: 0 0 3rem;
  padding: 0;
  list-style: none;
  font-size: clamp(0.6875rem, 1.05vw, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.toc li + li::before { content: "|"; color: var(--rule-soft); margin: 0 0.6rem; }
.toc a { text-decoration: none; color: var(--accent); }
.toc a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.3em; }
.clip-section.is-summoned { animation: summon 0.35s ease; }
@keyframes summon { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .clip-section.is-summoned { animation: none; } }
.toc a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.3em; }

.clip-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 3.5rem;
  scroll-margin-top: 1.5rem;
}
@media (min-width: 52rem) {
  .clip-section { grid-template-columns: 13.25rem minmax(0, 1fr); gap: 1.25rem; border-top: 1px solid var(--rule); padding-top: 0.75rem; }
  .clip-section > .section-label { border-top: 0; padding-top: 0.1rem; white-space: nowrap; }
}

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

.clip {
  padding: 1rem 0 1.05rem;
  border-bottom: 1px solid var(--rule-soft);
}
.clip:first-child { padding-top: 0; }
.clip .hed,
.track .hed {
  font-family: var(--text);
  font-weight: 500;
  font-size: 1.3125rem;
  line-height: 1.3;
}

.related {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0 0 0 0.9rem;
  border-left: 1px solid var(--rule-soft);
}
.related li { font-size: 1.125rem; line-height: 1.4; margin: 0.35rem 0; color: var(--ink-soft); }
.related li::before {
  content: "Related";
  font-family: var(--label);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0.5rem;
}

/* ---------- Audio ---------- */

.audio-section .prose:first-child { max-width: 54rem; margin: 0 0 1.75rem; }

.track {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.track:first-of-type { border-top: 1px solid var(--rule-soft); }

.track__btn {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.track__btn:hover,
.track.is-playing .track__btn { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.track__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.track__btn svg { width: 0.9rem; height: 0.9rem; fill: currentColor; }
.track__btn .i-pause { display: none; }
.track.is-playing .i-play { display: none; }
.track.is-playing .i-pause { display: block; }

.track__note { font-size: 1rem; line-height: 1.5; color: var(--ink-soft); margin: 0.4rem 0 0; }

.track__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
  font-family: var(--label);
  font-size: 0.6875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.track__progress {
  flex: 1;
  height: 2px;
  background: var(--rule-soft);
  position: relative;
  cursor: pointer;
}
.track__progress::after { content: ""; position: absolute; inset: -8px 0; }
.track__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent);
}

.track__icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--rule-soft);
  display: grid;
  place-items: center;
  color: var(--muted);
}
.track__icon svg { width: 0.95rem; height: 0.95rem; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* Download arrow beside the Résumé link */
.dl-link { display: inline-flex; align-items: center; gap: 0.3rem; }
.dl-icon {
  width: 0.8em;
  height: 0.8em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--accent);
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--rule);
  padding: 1.25rem 0 2.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}
.footer ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ---------- Floating contact bar ---------- */

.contactbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  min-height: var(--contact-h);
  display: flex;
  align-items: center;
  background: rgba(252, 242, 230, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--rule-soft);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.contactbar__inner {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.3rem 2rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  list-style: none;
  margin: 0 auto;
}
.contactbar__label { color: var(--accent); font-weight: 700; margin-right: 0.45rem; }
.contactbar__value { text-transform: none; letter-spacing: 0.02em; font-size: 0.75rem; font-weight: 500; }
.contactbar a { text-decoration: none; }
.contactbar a:hover { color: var(--accent); }
.contactbar__social { display: flex; gap: 1.25rem; }
.contactbar__social a { color: var(--accent); }
.contactbar__social a:hover { text-decoration: underline; }
.contactbar__sep { width: 1px; height: 0.9rem; background: var(--rule-soft); }

@media (max-width: 40rem) {
  :root { --contact-h: 5.5rem; }
  .contactbar__inner { gap: 0.3rem 1.25rem; }
  .contactbar__sep { display: none; }
  .contactbar__social { width: 100%; justify-content: center; }
}

@media (max-width: 30rem) {
  body { font-size: 1.0625rem; }
  .header { gap: 0.6rem 1.5rem; }
  .nav { gap: 0.25rem 1.25rem; }
}
