/* anderslundgren.se
   One stylesheet, no framework, no webfonts, no build step. Typography does the
   work; the photographs supply all the colour the page needs. */

:root {
  --paper:  #fbfaf7;
  --ink:    #1c1b19;
  --muted:  #6d6862;
  --rule:   #ddd8cf;
  --accent: #8a3d2b;
  --measure: 34rem;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:  #17171a;
    --ink:    #e4e0d9;
    --muted:  #948d84;
    --rule:   #33323a;
    --accent: #d98e73;
  }
}

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

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

body {
  margin: 0;
  padding: 0 1.5rem 6rem;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.65 var(--serif);
  font-synthesis-weight: none;
}

/* ---- chrome ------------------------------------------------------------- */

.masthead {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3.5rem 0 0;
}

.wordmark {
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border: 0;
}

.masthead nav {
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.masthead nav a {
  color: var(--muted);
  margin-right: 1.1rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.masthead nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.masthead nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding-top: 3rem;
}

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

h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 2.75rem 0 0.6rem;
  letter-spacing: -0.005em;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 2rem 0 0.4rem;
}

p { margin: 0 0 1.15rem; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--rule); }
a:hover { border-bottom-color: var(--accent); }

.prose > :first-child { margin-top: 0; }

blockquote {
  margin: 1.75rem 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

blockquote p:last-child { margin-bottom: 0; }
blockquote cite { display: block; font-style: normal; font-family: var(--mono); font-size: 0.75rem; margin-top: 0.5rem; }

ul, ol { margin: 0 0 1.15rem; padding-left: 1.25rem; }
li { margin-bottom: 0.35rem; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: color-mix(in srgb, var(--rule) 45%, transparent);
  padding: 0.1em 0.3em;
  border-radius: 2px;
}

/* ---- metadata ----------------------------------------------------------- */

.meta, .note {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.meta { margin: 0 0 2rem; }

.note {
  margin: 0 0 2rem;
  padding: 0.6rem 0.8rem;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--rule) 30%, transparent);
  line-height: 1.5;
}

.sep { color: var(--rule); }

/* ---- figures ------------------------------------------------------------ */

figure { margin: 2rem 0; }

/* Photographs break the measure — they carry the evidence, so give them room. */
figure.lead, figure.wide {
  width: min(52rem, calc(100vw - 3rem));
  margin-left: calc(50% - min(26rem, calc(50vw - 1.5rem)));
}

img { max-width: 100%; height: auto; display: block; }

figcaption {
  font-family: var(--mono);
  font-size: 0.71875rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 0.55rem;
  max-width: var(--measure);
}

/* A portrait is context for the text, not the subject of the page: it stays
   inside the measure and small enough that the first paragraph still leads. */
figure.portrait {
  float: right;
  width: min(12rem, 38%);
  margin: 0.25rem 0 1.25rem 1.75rem;
}

figure.portrait figcaption { max-width: none; }

/* ---- gallery ------------------------------------------------------------ */

/* Two up on a wide screen, one up on a narrow one. Captions carry the dates,
   so they are part of the content and never truncated. */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2.25rem 1.5rem;
  width: min(52rem, calc(100vw - 3rem));
  margin: 2rem 0 2.5rem calc(50% - min(26rem, calc(50vw - 1.5rem)));
}

.gallery figure { margin: 0; }
.gallery figcaption { max-width: none; }
.gallery .full { grid-column: 1 / -1; }

/* ---- listings ----------------------------------------------------------- */

.listing { margin-top: 3.5rem; }

.listing h2 {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 400;
  margin: 0 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

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

.entries li {
  margin: 0;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}

.entries time {
  display: block;
  font-family: var(--mono);
  font-size: 0.71875rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.entries > li > a { border: 0; font-size: 1.0625rem; }
.entries > li > a:hover { border-bottom: 1px solid var(--accent); }

.dek { display: block; color: var(--muted); font-size: 0.9375rem; margin-top: 0.2rem; }

.sources { margin-top: 3rem; }
.sources h2 {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 0.75rem;
}
.sources ul { list-style: none; padding: 0; font-size: 0.875rem; }
.sources li { margin-bottom: 0.5rem; color: var(--muted); line-height: 1.5; }

/* ---- footer ------------------------------------------------------------- */

footer {
  max-width: var(--measure);
  margin: 5rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

footer p { margin: 0 0 0.4rem; }
footer a { color: var(--muted); border-bottom-color: transparent; }
footer a:hover { color: var(--ink); border-bottom-color: var(--rule); }

/* ---- small screens ------------------------------------------------------ */

@media (max-width: 34rem) {
  body { padding: 0 1.25rem 4rem; font-size: 1rem; }
  .masthead { padding-top: 2.25rem; }
  main { padding-top: 2rem; }
  h1 { font-size: 1.5rem; }
  figure.lead, figure.wide { width: 100%; margin-left: 0; }
  .gallery { width: 100%; margin-left: 0; grid-template-columns: 1fr; }
  figure.portrait { float: none; width: min(11rem, 50%); margin: 0 0 1.5rem; }
}
