/* Vaenell — site styles */
/* Layout: 12-column catalogue grid, max 1600px, wide margins; asymmetric placements, 1px warm-grey rules between sections. */
:root {
  --paper: #F4F1EA;
  --ink: #1A1A1A;
  --grey: #8C877D;
  --rule: #8C877D;
  --accent: #6B2E2A;

  --display: "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  --text: "Newsreader", "EB Garamond", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --margin: clamp(16px, 4.5vw, 80px);
  --gap: clamp(10px, 1.8vw, 32px);
  --section: clamp(88px, 11vw, 200px);
  --slow: .5s cubic-bezier(.25, .1, .25, 1);

  color-scheme: light;
}

/* Dark mode: follows the reader's device unless they pick Light or Dark in the menu (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #171614;
    --ink: #E9E4DA;
    --grey: #9A948A;
    --rule: #4A4640;
    --accent: #C27A70;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #171614;
  --ink: #E9E4DA;
  --grey: #9A948A;
  --rule: #4A4640;
  --accent: #C27A70;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  transition: background-color var(--slow), color var(--slow);
  font-family: var(--text);
  font-size: clamp(19px, 1rem + 0.35vw, 21px);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--paper); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-weight: 400; margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Frame ---------- */
.wrap {
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
  padding-left: max(var(--margin), env(safe-area-inset-left, 0px));
  padding-right: max(var(--margin), env(safe-area-inset-right, 0px));
}
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
}
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* ---------- Type roles ---------- */
.label {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.muted { color: var(--grey); }
.u {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size var(--slow), color var(--slow);
}
.u:hover, .u:focus-visible, .u.is-active { background-size: 100% 1px; }
.u.is-active { color: var(--accent); }
.more { display: inline-flex; gap: .6em; align-items: baseline; }
.more .arr { display: inline-block; transition: transform var(--slow); }
.more:hover .arr { transform: translateX(4px); }

/* ---------- Header ---------- */
.site-head .head-in {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px 32px;
  padding-block: clamp(22px, 2.6vw, 36px) clamp(18px, 2vw, 26px);
  border-bottom: 1px solid var(--rule);
}
.logo {
  font-family: var(--display);
  font-size: clamp(28px, 2.4vw, 38px);
  line-height: 1;
  letter-spacing: -.005em;
}
.nav { font-size: 14.5px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px clamp(16px, 2.2vw, 36px); }
.nav .sep { width: clamp(8px, 2vw, 32px); }
.theme-toggle {
  align-self: center;
  display: inline-flex;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  padding: 2px;
  color: var(--grey);
  cursor: pointer;
  transition: color var(--slow);
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: square;
  vector-effect: non-scaling-stroke;
}
.theme-toggle svg * { vector-effect: non-scaling-stroke; }
/* Show the moon in light mode and the sun in dark mode: the icon names where the click leads. */
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
}

/* ---------- Masthead line ---------- */
.masthead .mast-in {
  display: flex;
  justify-content: space-between;
  gap: 10px 24px;
  flex-wrap: wrap;
  padding-block: 14px;
  border-bottom: 1px solid var(--rule);
}

/* ---------- Featured essay ---------- */
.feature { padding-block: var(--section); }
.feature-img { grid-column: 1 / 7; margin-top: clamp(0px, 4vw, 80px); margin-inline: 0; }
.feature-img img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.feature-img figcaption { margin-top: 12px; }
.feature-text { grid-column: 8 / 13; display: flex; flex-direction: column; gap: clamp(22px, 2.4vw, 36px); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.feature-title {
  font-family: var(--display);
  font-size: clamp(56px, 8vw, 140px);
  line-height: .9;
  letter-spacing: -.02em;
}
.feature-title a { transition: color var(--slow); }
.feature-title a:hover { color: var(--accent); }
.excerpt {
  font-style: italic;
  font-size: clamp(21px, 1.3rem + .5vw, 28px);
  line-height: 1.38;
  max-width: 30ch;
}
.feature-text .excerpt { margin-left: clamp(0px, 8%, 120px); }
.feature-text .more { margin-left: clamp(0px, 8%, 120px); }

/* ---------- Section heads ---------- */
.sec-head { padding-block: 0 18px; align-items: baseline; }
.sec-head > :first-child { grid-column: 1 / 4; }
.sec-head > :nth-child(2) { grid-column: 4 / 10; }
.sec-head > :nth-child(3) { grid-column: 10 / 13; justify-self: end; }

/* ---------- Index ---------- */
.index { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--rule); }
.row { border-top: 1px solid var(--rule); transition: opacity var(--slow); }
.row a {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: baseline;
  padding-block: clamp(18px, 2vw, 30px);
}
.row-no { grid-column: 1 / 2; transition: color var(--slow); }
.row-title {
  grid-column: 3 / 10;
  font-family: var(--display);
  font-size: clamp(27px, 1.2rem + 1.5vw, 46px);
  line-height: 1.05;
  letter-spacing: -.01em;
  transition: transform var(--slow), color var(--slow);
}
.row-meta { grid-column: 10 / 13; justify-self: end; display: flex; gap: clamp(14px, 2vw, 32px); text-align: right; }
.row a:hover .row-title, .row a:focus-visible .row-title { transform: translateX(.45em); }
.row a:hover .row-no, .row a:focus-visible .row-no { color: var(--accent); }
.index-foot { display: flex; justify-content: flex-end; padding-top: 22px; }

.thumb {
  position: fixed; top: 0; left: 0; z-index: 20;
  width: clamp(180px, 15vw, 250px);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--slow), transform .4s cubic-bezier(.2, .7, .3, 1);
}
.thumb.on { opacity: 1; }
.thumb img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

/* ---------- Editor's note ---------- */
.note { padding-block: var(--section); }
.note-in { grid-column: 7 / 12; display: flex; flex-direction: column; gap: 26px; }
.note-in p + p { margin-top: -6px; }

/* ---------- Newsletter ---------- */
.nl .nl-in { border-top: 1px solid var(--rule); padding-block: clamp(56px, 7vw, 120px) var(--section); row-gap: 30px; }
.nl-label { grid-column: 1 / 4; }
.nl-line {
  grid-column: 4 / 12;
  font-family: var(--display);
  font-size: clamp(36px, 1.4rem + 3.4vw, 76px);
  line-height: 1;
  letter-spacing: -.015em;
}
.nl-form { grid-column: 4 / 10; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 32px; margin-top: 18px; }
.nl-form input {
  flex: 1 1 260px;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: italic clamp(19px, 1.1rem + .3vw, 23px)/1.3 var(--text);
  padding: 10px 0 9px;
  outline: none;
  transition: border-color var(--slow);
  -webkit-appearance: none;
  appearance: none;
}
.nl-form input::placeholder { color: var(--grey); opacity: 1; }
.nl-form input:focus { border-bottom-color: var(--accent); }
.nl-form button {
  border: 0; background: none; color: var(--ink); cursor: pointer;
  padding: 0 0 2px;
}
.nl-form button:hover { color: var(--accent); }
.nl-fine { grid-column: 4 / 10; }
.nl-msg { grid-column: 4 / 10; font-style: italic; transition: opacity var(--slow); }

/* ---------- Footer ---------- */
.site-foot .foot-in { border-top: 1px solid var(--rule); padding-block: 30px 44px; row-gap: 22px; align-items: baseline; }
.foot-in .logo { grid-column: 1 / 6; }
.foot-links { grid-column: 6 / 10; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.foot-copy { grid-column: 10 / 13; justify-self: end; }
.colophon { grid-column: 1 / 13; }

/* ---------- Page heads (category, all essays, about) ---------- */
.page-head { padding-block: clamp(56px, 8vw, 140px) clamp(44px, 6vw, 96px); row-gap: 26px; align-items: end; }
.page-head .label-row { grid-column: 1 / 13; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title {
  grid-column: 1 / 9;
  font-family: var(--display);
  font-size: clamp(76px, 15vw, 260px);
  line-height: .82;
  letter-spacing: -.03em;
}
.page-desc { grid-column: 9 / 13; padding-bottom: .6em; }
.page-desc.excerpt { max-width: none; }
.filters { grid-column: 1 / 13; display: flex; flex-wrap: wrap; gap: 10px clamp(18px, 2.4vw, 40px); margin-top: 8px; }
.filters button {
  border: 0; background: none; padding: 0 0 2px; cursor: pointer; color: var(--ink);
}
.filters sup { font-size: 10px; margin-left: 3px; color: var(--grey); vertical-align: super; letter-spacing: .06em; }
.list-block { padding-bottom: var(--section); }

/* ---------- Essay page ---------- */
.essay-head { padding-block: clamp(56px, 8vw, 140px) clamp(40px, 5vw, 80px); row-gap: clamp(22px, 2.6vw, 40px); }
.essay-head .meta { grid-column: 2 / 13; }
.essay-title {
  grid-column: 2 / 12;
  font-family: var(--display);
  font-size: clamp(56px, 10vw, 184px);
  line-height: .88;
  letter-spacing: -.025em;
}
.essay-head .excerpt { grid-column: 4 / 10; max-width: 34ch; }

.hero { margin-block: 0; }
.hero { padding-bottom: clamp(56px, 7vw, 120px); row-gap: 14px; }
.hero img { grid-column: 1 / 12; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.hero figcaption { grid-column: 9 / 12; }
.hero-portrait img { grid-column: 2 / 7; aspect-ratio: 3 / 4; }
.hero-portrait figcaption { grid-column: 8 / 11; align-self: end; }

.caption {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  letter-spacing: .03em;
  color: var(--grey);
  white-space: pre-line;
}
.caption b { display: block; font-weight: 500; color: var(--ink); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 2px; }

.prose { padding-bottom: clamp(48px, 6vw, 96px); }
.prose > * { grid-column: 4 / 11; max-width: 680px; }
.prose > p { margin-bottom: 1.05em; hyphens: auto; -webkit-hyphens: auto; }
.prose > p:first-of-type::first-letter {
  float: left;
  font-family: var(--display);
  font-size: 5.6em;
  line-height: .78;
  margin: .05em .1em 0 -.03em;
  color: var(--ink);
}
.prose > .pull {
  grid-column: 1 / 8;
  max-width: none;
  margin: 1.1em 0 1.5em;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(30px, 1.2rem + 2.2vw, 54px);
  line-height: 1.06;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.prose > .pull::before { content: "“"; color: var(--accent); }
.prose > .pull::after { content: "”"; color: var(--accent); }
.prose > .fig { grid-column: 4 / 13; max-width: none; margin: 1.6em 0 2em; display: grid; gap: 12px; }
.prose > .fig img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.prose > .fig figcaption { max-width: 420px; }
.prose em { font-style: italic; }

.byline { grid-column: 4 / 11; max-width: 680px; border-top: 1px solid var(--rule); padding-top: 22px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 14px 28px; }

.next a { border-top: 1px solid var(--rule); padding-block: clamp(40px, 5vw, 72px) var(--section); row-gap: 22px; align-items: baseline; }
.next .label:first-child { grid-column: 1 / 4; }
.next-body { grid-column: 4 / 13; display: flex; flex-direction: column; gap: 18px; }
.next-title {
  font-family: var(--display);
  font-size: clamp(44px, 1.5rem + 4.4vw, 110px);
  line-height: .92;
  letter-spacing: -.02em;
  transition: transform var(--slow), color var(--slow);
}
.next a:hover .next-title { transform: translateX(.25em); color: var(--accent); }

/* ---------- About ---------- */
.about-body { padding-bottom: var(--section); row-gap: 40px; }
.about-art { grid-column: 1 / 5; margin-inline: 0; align-self: start; display: grid; gap: 12px; margin-top: 8px; }
.about-art img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.about-text { grid-column: 6 / 12; max-width: 680px; display: flex; flex-direction: column; gap: 1.05em; }
.about-text .lead { font-family: var(--display); font-size: clamp(28px, 1.2rem + 1.4vw, 40px); line-height: 1.12; letter-spacing: -.01em; margin-bottom: .4em; }

/* ---------- Page fade ---------- */
main { animation: page-in .6s ease both; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Tablet ---------- */
@media (max-width: 1000px) {
  .feature-img { grid-column: 1 / 10; margin-top: 0; }
  .feature-text { grid-column: 3 / 13; margin-top: 52px; }
  .row-title { grid-column: 2 / 10; }
  .note-in { grid-column: 5 / 13; }
  .nl-label { grid-column: 1 / 13; }
  .nl-line, .nl-form, .nl-fine, .nl-msg { grid-column: 2 / 13; }
  .page-title { grid-column: 1 / 13; }
  .page-desc { grid-column: 5 / 13; padding-bottom: 0; }
  .essay-head .meta, .essay-title { grid-column: 1 / 13; }
  .essay-head .excerpt { grid-column: 3 / 13; }
  .hero img { grid-column: 1 / 13; }
  .hero figcaption { grid-column: 7 / 13; }
  .hero-portrait img { grid-column: 1 / 9; }
  .hero-portrait figcaption { grid-column: 9 / 13; }
  .prose > * { grid-column: 2 / 12; }
  .prose > .pull { grid-column: 1 / 11; }
  .prose > .fig { grid-column: 2 / 13; }
  .byline { grid-column: 2 / 12; }
  .about-art { grid-column: 1 / 7; }
  .about-text { grid-column: 2 / 13; }
  .foot-in .logo { grid-column: 1 / 13; }
  .foot-links { grid-column: 1 / 8; }
  .foot-copy { grid-column: 8 / 13; }
}

/* ---------- Phone ---------- */
@media (max-width: 680px) {
  .masthead .mast-in { display: grid; grid-template-columns: 1fr 1fr; }
  .masthead .mast-in > :nth-child(even) { text-align: right; }
  .nav .sep { display: none; }
  .feature-img { grid-column: 1 / 13; }
  .feature-text { grid-column: 1 / 13; margin-top: 40px; }
  .feature-text .excerpt, .feature-text .more { margin-left: 0; }
  .sec-head > :first-child { grid-column: 1 / 7; }
  .sec-head > :nth-child(2) { display: none; }
  .sec-head > :nth-child(3) { grid-column: 7 / 13; }
  .row a { row-gap: 10px; }
  .row-no { grid-column: 1 / 7; grid-row: 1; }
  .row-meta { grid-column: 7 / 13; grid-row: 1; }
  .row-title { grid-column: 1 / 13; grid-row: 2; }
  .note-in { grid-column: 2 / 13; }
  .nl-line, .nl-form, .nl-fine, .nl-msg { grid-column: 1 / 13; }
  .page-desc { grid-column: 2 / 13; }
  .essay-head .excerpt { grid-column: 1 / 13; }
  .hero figcaption { grid-column: 1 / 13; }
  .hero-portrait img { grid-column: 1 / 11; }
  .hero-portrait figcaption { grid-column: 1 / 13; }
  .prose > *, .prose > .pull, .prose > .fig, .byline { grid-column: 1 / 13; }
  .about-art { grid-column: 1 / 10; }
  .about-text { grid-column: 1 / 13; }
  .foot-links, .foot-copy { grid-column: 1 / 13; justify-self: start; }
  .next .label:first-child, .next-body { grid-column: 1 / 13; }
}

/* ---------- Selected essays (homepage) ---------- */
.selected { padding-bottom: var(--section); }
.selected .sec-head { border-bottom: 1px solid var(--rule); margin-bottom: clamp(36px, 4.5vw, 72px); }
.sel-grid { row-gap: clamp(56px, 7vw, 96px); align-items: start; }
.sel-1 { grid-column: 1 / 6; }
.sel-2 { grid-column: 8 / 12; margin-top: clamp(0px, 11vw, 200px); }
.sel-3 { grid-column: 3 / 7; }
.sel-4 { grid-column: 9 / 13; margin-top: clamp(0px, 8vw, 140px); }
.sel-link { display: flex; flex-direction: column; gap: 14px; }
.sel-link img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; margin-bottom: 8px; transition: opacity var(--slow); }
.sel-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.sel-title {
  font-family: var(--display);
  font-size: clamp(28px, 1.1rem + 1.4vw, 42px);
  line-height: 1.02;
  letter-spacing: -.01em;
  transition: transform var(--slow);
}
.sel-1 .sel-title { font-size: clamp(32px, 1.2rem + 1.9vw, 52px); }
.sel-excerpt { font-style: italic; font-size: clamp(17px, 1rem + .15vw, 19px); line-height: 1.45; max-width: 34ch; }
.sel-link .more { margin-top: 4px; }
.sel-link:hover img { opacity: .9; }
.sel-link:hover .sel-title { transform: translateX(.2em); }
.sel-link:hover .u, .sel-link:focus-visible .u { background-size: 100% 1px; }
.sel-link:hover .arr { transform: translateX(4px); }

@media (max-width: 1000px) {
  .sel-1 { grid-column: 1 / 7; }
  .sel-2 { grid-column: 8 / 13; margin-top: clamp(0px, 12vw, 120px); }
  .sel-3 { grid-column: 2 / 7; }
  .sel-4 { grid-column: 8 / 13; margin-top: clamp(0px, 8vw, 80px); }
}
@media (max-width: 680px) {
  .selected .sec-head > :nth-child(3) { grid-column: 7 / 13; }
  .sel-1 { grid-column: 1 / 13; }
  .sel-2, .sel-4 { grid-column: 3 / 13; margin-top: 0; }
  .sel-3 { grid-column: 1 / 11; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
}

/* Images shown uncropped at their own shape (imageNatural), e.g. a scanned Polaroid with its frame */
.feature-img img.natural, .hero img.natural, .sel-link img.natural { aspect-ratio: auto; object-fit: fill; }
