/*
 * adamtrainer.me. The same paper and ink as the apps, with its own accent: a
 * deep pine, used for links and nothing else. A serif for everything read, the
 * system sans for the small apparatus around it (dates, nav, captions).
 * One column for reading; photographs are allowed out of it.
 */

:root {
  --paper: #f8f7f3;
  --ink: #1c1c1e;
  --ink-2: #48484d;
  --ink-3: #6b6b70; /* 4.9:1 on the paper */
  --rule: rgba(28, 28, 30, 0.1);
  --wash: rgba(28, 28, 30, 0.04);
  --accent: #2c5e4f;

  --serif: ui-serif, 'New York', Charter, 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Helvetica Neue', 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;

  --measure: 38rem;
  --wide: 64rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);

  color-scheme: light dark;
  accent-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141413;
    --ink: #ebe9e4;
    --ink-2: #bdbbb5;
    --ink-3: #8f8e89; /* 5.6:1 */
    --rule: rgba(235, 233, 228, 0.12);
    --wash: rgba(235, 233, 228, 0.05);
    --accent: #8cc2ae;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.1875rem/1.6 var(--serif);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 0.06em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.12em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* ---------------------------------------------------------------- frame */

.masthead, main, .foot {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin-inline: auto;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 2rem 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
}
.masthead .name { color: var(--ink); font-weight: 600; text-decoration: none; letter-spacing: -0.005em; }
.masthead nav { display: flex; gap: 1.25rem; }
.masthead nav a { color: var(--ink-3); text-decoration: none; }
.masthead nav a:hover, .masthead nav a[aria-current] { color: var(--ink); }

main { padding-block: clamp(3rem, 9vw, 5rem) 4rem; }

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--rule);
  font: 0.8125rem/1.5 var(--sans);
  color: var(--ink-3);
}
.foot span { margin-right: auto; }
.foot a { color: var(--ink-3); text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* ---------------------------------------------------------------- type */

h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h2 {
  margin: 0 0 1rem;
  font: 600 0.8125rem/1.4 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
h2 a { color: inherit; text-decoration: none; }
h2 a:hover { color: var(--ink); }

main > section + section, .intro + section { margin-top: 3.5rem; }

.lede { color: var(--ink-2); margin: -0.5rem 0 3rem; }
.empty { color: var(--ink-3); }
.meta { font: 0.875rem/1.5 var(--sans); color: var(--ink-3); }
.draft { color: #b4561f; font-weight: 600; }
i, em, cite { font-style: italic; }

.intro { font-size: 1.3125rem; line-height: 1.55; }
.intro h2, .intro h3 { font: 600 clamp(2rem, 5vw, 2.5rem)/1.15 var(--serif); letter-spacing: -0.015em; text-transform: none; color: var(--ink); margin: 0 0 1.25rem; }
.intro p { margin: 0 0 1rem; text-wrap: pretty; }
.intro p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- lists */

.list, .log, .trips { list-style: none; margin: 0; padding: 0; }

.list li { border-top: 1px solid var(--rule); }
.list li:last-child { border-bottom: 1px solid var(--rule); }
.list a, .list.plain li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.7rem;
  color: var(--ink);
  text-decoration: none;
}
.list a:hover .t { color: var(--accent); }
.list time { flex: none; font: 0.875rem var(--sans); color: var(--ink-3); font-variant-numeric: tabular-nums; }

.year { display: flex; gap: 0.5rem; }
.count { font-weight: 400; }

.log li {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1rem;
  padding-block: 0.65rem;
  border-top: 1px solid var(--rule);
}
.log li:last-child { border-bottom: 1px solid var(--rule); }
.log .t { grid-column: 1; }
.log time { grid-column: 2; grid-row: 1; font: 0.875rem var(--sans); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.log .meta { grid-column: 1 / -1; }
.log .meta:empty { display: none; }
.log .meta a { color: var(--ink-3); }
.by { font: 0.9375rem var(--sans); color: var(--ink-3); margin-left: 0.25rem; }
.rating { letter-spacing: 0.1em; }

/* ---------------------------------------------------------------- trips */

.trips { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 2rem 1.5rem; }
.trip-card a { display: block; color: var(--ink); text-decoration: none; }
.trip-card img, .no-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
  background: var(--wash);
  margin-bottom: 0.65rem;
}
.trip-card .t { display: block; font-size: 1.1875rem; line-height: 1.3; }
.trip-card a:hover .t { color: var(--accent); }
.trip-card .meta { display: block; margin-top: 0.15rem; }

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

.prose > header { margin-bottom: 2.5rem; }
.prose > header h1 { margin-bottom: 0.5rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin: 0 0 1.25rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.35rem; }
.prose h2 { margin-top: 2.75rem; font: 600 1.375rem/1.3 var(--serif); letter-spacing: -0.005em; text-transform: none; color: var(--ink); }
.prose h3, .prose h4 { margin: 2rem 0 0.75rem; font-size: 1.1875rem; }
.prose blockquote { padding-left: 1.25rem; border-left: 2px solid var(--rule); color: var(--ink-2); }
.prose hr { border: 0; text-align: center; margin: 2.5rem 0; }
.prose hr::before { content: '⁂'; color: var(--ink-3); }
code { font: 0.85em var(--mono); background: var(--wash); padding: 0.1em 0.3em; border-radius: 3px; }
pre { overflow-x: auto; padding: 1rem 1.25rem; background: var(--wash); border-radius: 4px; line-height: 1.45; }
pre code { background: none; padding: 0; }

/* Photographs leave the column, up to --wide, centred on it. */
figure { margin: 2.5rem 0; }
.prose figure {
  width: min(100vw - 2 * var(--gutter), var(--wide));
  margin-left: 50%;
  transform: translateX(-50%);
}
figure img { display: block; width: 100%; height: auto; border-radius: 3px; background: var(--wash); }
/* A portrait photo keeps to one screen's height, centred, rather than filling three. */
.prose figure img { width: auto; max-width: 100%; max-height: 88vh; margin-inline: auto; }
figcaption { margin-top: 0.6rem; font: 0.875rem/1.5 var(--sans); color: var(--ink-3); text-align: center; }
.missing { font: 0.875rem var(--sans); color: #b4561f; }

.gallery {
  width: min(100vw - 2 * var(--gutter), var(--wide));
  margin: 3rem 0 0 50%;
  transform: translateX(-50%);
  columns: 3 14rem;
  column-gap: 0.75rem;
}
.gallery a { display: block; margin-bottom: 0.75rem; break-inside: avoid; }
.gallery img { display: block; width: 100%; height: auto; border-radius: 3px; background: var(--wash); }

/* ---------------------------------------------------------------- quotes */

.quote { margin: 0 0 2.25rem; }
.quote blockquote { margin: 0; font-size: 1.25rem; line-height: 1.55; }
.quote blockquote p { margin: 0 0 0.75rem; }
.quote blockquote p:last-child { margin: 0; }
.quote figcaption { text-align: left; margin-top: 0.6rem; }
.quote figcaption > * + *::before { content: ' · '; }
.quote cite { font-family: var(--serif); font-size: 1rem; color: var(--ink-2); }
.quote .note { margin-top: 0.6rem; font: 0.9375rem/1.55 var(--sans); color: var(--ink-2); }
.quote .note p { margin: 0; }
.log .note { grid-column: 1 / -1; font: 0.9375rem/1.55 var(--sans); color: var(--ink-2); }
.log .note p { margin: 0.25rem 0 0; }

.work { margin-top: 3rem; scroll-margin-top: 1.5rem; }
.work h2 { font: 400 1.0625rem/1.4 var(--serif); text-transform: none; letter-spacing: 0; color: var(--ink); padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); margin-bottom: 1.5rem; }

@media print {
  .masthead nav, .foot { display: none; }
  a { color: inherit; }
}

/* ---------------------------------------------------------------- apparatus */

.skip { position: absolute; left: -999px; top: 0.75rem; padding: 0.4rem 0.75rem; background: var(--paper); font: 0.875rem var(--sans); }
.skip:focus { left: var(--gutter); z-index: 1; }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.pager a { color: var(--ink); text-decoration: none; line-height: 1.35; }
.pager a:hover { color: var(--accent); }
.pager span { display: block; margin-bottom: 0.2rem; font: 0.8125rem var(--sans); color: var(--ink-3); }
.pager .newer { text-align: right; }
.pager .older span::before { content: '← '; }
.pager .newer span::after { content: ' →'; }

/* Covers in the log: a narrow column to the left; a blank keeps the titles in line. */
.log .cover { display: none; }
.log.with-covers li { grid-template-columns: 2.75rem 1fr auto; }
.log.with-covers .cover {
  display: block;
  grid-column: 1;
  grid-row: 1 / span 3;
  align-self: start;
  width: 2.75rem;
  height: auto;
  margin-top: 0.2rem;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--rule);
}
.log.with-covers span.cover { aspect-ratio: 2 / 3; background: var(--wash); box-shadow: none; }
.log.with-covers .t { grid-column: 2; }
.log.with-covers time { grid-column: 3; }
.log.with-covers .meta, .log.with-covers .note { grid-column: 2 / -1; }
.log.with-covers li { min-height: 4.75rem; }
