/* ------------------------------------------------------------------
   jonahheim.com — two colours, one spine.

   The whole site is #5e6773 ground and #fffdeb ink. There is no third
   colour and no accent: hierarchy comes from opacity, optical size,
   and one inversion (ink becomes ground) reserved for the jump links.
   ------------------------------------------------------------------ */

:root {
  --ground: #5e6773;
  --ink: #fffdeb;

  /* Only these steps. Anything reading as prose stays at .85 or above
     so it clears 4.5:1 against the ground. */
  --ink-quiet: rgba(255, 253, 235, 0.85);
  --ink-mute: rgba(255, 253, 235, 0.55);
  --rule: rgba(255, 253, 235, 0.18);
  --rule-soft: rgba(255, 253, 235, 0.1);

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Newsreader", Georgia, "Times New Roman", serif;
  --utility: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --measure: 36rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --indent: 1.75rem;
  --label-col: 8rem;
  --label-gap: 3.5rem;
}

[data-theme="obsidian"] {
  --ground: #111317;
  --ink: #e6e8eb;
  --ink-quiet: rgba(230, 232, 235, 0.85);
  --ink-mute: rgba(230, 232, 235, 0.50);
  --rule: rgba(230, 232, 235, 0.16);
  --rule-soft: rgba(230, 232, 235, 0.08);
}

[data-theme="parchment"] {
  --ground: #1c1a17;
  --ink: #f4ebd9;
  --ink-quiet: rgba(244, 235, 217, 0.85);
  --ink-mute: rgba(244, 235, 217, 0.52);
  --rule: rgba(244, 235, 217, 0.18);
  --rule-soft: rgba(244, 235, 217, 0.1);
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-optical-sizing: auto;
  font-size: 1.0625rem;
  line-height: 1.75;
  font-weight: 380;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 300ms ease, color 300ms ease;
}

/* --- film grain texture overlay ---------------------------------- */
/* Subtle SVG noise layer providing an analog paper/film grain texture
   across the slate ground. Pointer-events are disabled. */

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

::selection {
  background: var(--ink);
  color: var(--ground);
}

/* --- the spine -------------------------------------------------- */
/* A single hairline runs the length of the document. Every section
   hangs off it by a tick. It is the only structural device on the
   site, which is why nothing else needs a border. */

.page {
  position: relative;
  max-width: 66rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.page::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--gutter);
  width: 1px;
  background: var(--rule);
  transform: scaleY(0);
  transform-origin: top;
  animation: spine 1100ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes spine {
  to {
    transform: scaleY(1);
  }
}

/* --- bands ------------------------------------------------------- */

.band {
  padding-left: var(--indent);
  padding-block: clamp(2.75rem, 7vw, 4.5rem);
}

.band > * {
  max-width: var(--measure);
}

.label {
  position: relative;
  margin: 0 0 1.5rem;
  font-family: var(--utility);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* the tick that joins a band to the spine */
.label::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: calc(var(--indent) * -1);
  width: 1rem;
  height: 1px;
  background: var(--rule);
}

@media (min-width: 62rem) {
  .band {
    display: grid;
    grid-template-columns: var(--label-col) minmax(0, var(--measure));
    gap: 0 var(--label-gap);
    padding-left: 2.5rem;
  }

  .band > * {
    grid-column: 2;
  }

  .label {
    grid-column: 1;
    grid-row: 1 / span 99;
    margin-bottom: 0;
  }

  .label::before {
    left: -2.5rem;
    width: 1.75rem;
  }
}

/* --- masthead ---------------------------------------------------- */

.masthead {
  padding-left: var(--indent);
  padding-top: clamp(4rem, 14vh, 8.5rem);
  padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

@media (min-width: 62rem) {
  .masthead {
    padding-left: calc(2.5rem + var(--label-col) + var(--label-gap));
  }
}

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 9.5vw, 5.5rem);
  font-variation-settings: "opsz" 96, "SOFT" 60, "WONK" 1;
  font-weight: 460;
  line-height: 0.95;
  letter-spacing: -0.025em;
}

.lede {
  max-width: 34rem;
  margin: 1.75rem 0 0;
  font-size: clamp(1.25rem, 2.6vw, 1.5rem);
  line-height: 1.5;
  font-weight: 350;
  color: var(--ink);
}

/* --- prose ------------------------------------------------------- */

p {
  margin: 0 0 1.15em;
  color: var(--ink-quiet);
  text-wrap: pretty;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: inherit;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 180ms ease;
}

a:hover {
  text-decoration-color: var(--ink);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 1px;
}

/* --- jump links -------------------------------------------------- */
/* The one place ink and ground trade places. */

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-left: var(--indent);
  padding-top: 0.5rem;
}

@media (min-width: 62rem) {
  .jump {
    padding-left: calc(2.5rem + var(--label-col) + var(--label-gap));
  }
}

.jump a,
.theme-toggle {
  padding: 0.45rem 1rem 0.5rem;
  border: 1px solid var(--rule);
  background: transparent;
  font-family: var(--utility);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-quiet);
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease,
    border-color 200ms ease;
}

.jump a:hover,
.jump a:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ground);
}

/* --- the index of writing ---------------------------------------- */

.index {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule-soft);
}

.entry {
  border-bottom: 1px solid var(--rule-soft);
}

.entry a {
  display: block;
  padding: 1.15rem 0;
  text-decoration: none;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.entry a:hover,
.entry a:focus-visible {
  transform: translateX(5px);
}

.entry-title {
  display: block;
  font-family: var(--display);
  font-variation-settings: "opsz" 36, "SOFT" 30, "WONK" 1;
  font-size: 1.3125rem;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.entry a:hover .entry-title,
.entry a:focus-visible .entry-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.entry-note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-quiet);
}

.entry-date {
  display: block;
  margin-top: 0.55rem;
  font-family: var(--utility);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

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

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

.contacts li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.55rem 0;
}

.contacts dt,
.contact-key {
  flex: 0 0 6.5rem;
  font-family: var(--utility);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.contacts a {
  font-size: 1.0625rem;
  overflow-wrap: anywhere;
}

/* Long values (an email address) have nowhere to go beside a fixed key
   column on a phone, so the key moves above the value. */
@media (max-width: 32rem) {
  .contacts li {
    display: block;
    padding: 0.4rem 0 0.75rem;
  }

  .contact-key {
    display: block;
    margin-bottom: 0.15rem;
  }
}

/* --- colophon ---------------------------------------------------- */

.colophon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 3rem 0 4rem var(--indent);
  font-family: var(--utility);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

@media (min-width: 62rem) {
  .colophon {
    padding-left: calc(2.5rem + var(--label-col) + var(--label-gap));
  }
}

/* --- entrance ---------------------------------------------------- */

.rise {
  opacity: 0;
  animation: rise 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.rise:nth-child(1) { animation-delay: 260ms; }
.rise:nth-child(2) { animation-delay: 380ms; }
.rise:nth-child(3) { animation-delay: 480ms; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .page::before {
    animation: none;
    transform: none;
  }

  .rise {
    opacity: 1;
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
