/* Caspar Milan Nielsen — site styles */

:root {
  --bg: #f9f9f9;
  --text: #111111;
  --muted: #5f5f5f;
  --rule: #e3dfd6;
  --link: #a8441f;
  --accent: #d8613c;
  --sand: #cfcabe;
  --sage: #b1c5a4;
  --leaf: #3f5f35;
  --forest: #1f3a2e;
  --forest-text: #f3efe6;
  --forest-accent: #b1c5a4;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --measure: 40rem;
  --radius: 10px;
  /* Side margins that let a block break out of the text column, up to 68rem wide */
  --breakout: calc(50% - min(34rem, 50vw - 1rem));
  --breakout-sm: calc(50% - min(26rem, 50vw - 1rem));

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --text: #ecebe8;
    --muted: #a39f97;
    --rule: #2e2b27;
    --link: #f0916a;
    --sand: #34302a;
    --sage: #27321f;
    --leaf: #9cb88c;
    --forest: #1b2b23;
  }
}

/* Base */

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

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.1875rem/1.7 var(--serif);
  overflow-wrap: break-word;
}

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

/* Keeps the footer at the bottom on short pages */
main { flex: 1; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { line-height: 1.2; font-weight: 700; text-wrap: balance; }

.wrap { width: min(100% - 2rem, var(--measure)); margin-inline: auto; }

/* Hidden on screen, still read by screen readers and search engines */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
  font-family: var(--sans);
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

.meta {
  margin: 0;
  font: 0.875rem/1.5 var(--sans);
  color: var(--muted);
}
.meta a { color: inherit; }

/* Header & footer */

.site-header { border-bottom: 1px solid var(--rule); }

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 1.25rem;
}

.site-id {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
}
.site-id img { width: 40px; height: 40px; border-radius: 50%; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 0.9375rem/1.5 var(--sans);
}
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); text-decoration: underline; }
.site-nav .site-nav__out { color: var(--link); font-weight: 600; }

/* Footer: The Hikers + copyright */
.site-footer {
  margin-top: 5rem;
  background: var(--forest);
  color: var(--forest-text);
}
.site-footer a { color: inherit; }
.site-footer .button { color: #111111; }

.site-footer__hikers { padding-block: 3.5rem 3rem; }
.site-footer__hikers p { margin: 0 0 1rem; }
.site-footer__eyebrow {
  font: 600 0.8125rem/1.5 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}
.site-footer .site-footer__name { margin: 0; font-size: 2.25rem; font-weight: 700; line-height: 1.2; }
.site-footer__tagline { font-style: italic; color: var(--forest-accent); }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.5rem 2rem;
  border-top: 1px solid rgb(255 255 255 / 0.15);
  font: 0.875rem/1.5 var(--sans);
  color: rgb(243 239 230 / 0.75);
}
.site-footer__bottom p { margin: 0; }

/* Home, category & 404 */

.intro { padding-block: 3rem 2.5rem; }
.intro h1 { margin: 0 0 0.75rem; font-size: clamp(2.25rem, 7vw, 3.25rem); letter-spacing: -0.01em; }
.intro p { margin: 0; font-size: 1.25rem; color: var(--muted); }

.page-header { padding-block: 3rem 1rem; }
.page-header h1 { margin: 0.5rem 0 0; font-size: clamp(2rem, 6vw, 2.75rem); }
.page-header p:not(.meta) { color: var(--muted); }

.section-label {
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  font: 600 0.8125rem/1.5 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-list { margin: 0; padding: 0; list-style: none; }
.post-card { padding-block: 1.75rem; border-bottom: 1px solid var(--rule); }
.post-card__title { margin: 0.35rem 0 0.5rem; font-size: 1.625rem; }
.post-card__title a { color: var(--text); text-decoration: none; }
.post-card__title a:hover { color: var(--link); text-decoration: underline; }
.post-card p:last-child { margin: 0; color: var(--muted); font-size: 1.0625rem; }

/* Button */

.button {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: #111111;
  font: 600 0.9375rem/1.4 var(--sans);
  text-decoration: none;
}
.button:hover { background: #e7774f; }

/* Post */

.post-header { padding-block: 3rem 2rem; }
.post-header h1 { margin: 0.75rem 0 0; font-size: clamp(2.125rem, 7vw, 3.25rem); letter-spacing: -0.01em; }

.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.25em; }
.prose li + li { margin-top: 0.4em; }
.prose h2 { margin: 2.25em 0 0.75em; font-size: 1.75rem; }
.prose h3 { margin: 1.75em 0 0.5em; font-size: 1.3rem; }
.prose [id] { scroll-margin-top: 1.5rem; }

.prose hr {
  height: 1px;
  margin: 3.5rem 0;
  border: 0;
  background: var(--rule);
}

/* Table of contents on a photo */
.toc {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 26rem;
  margin: 0 var(--breakout) 3rem;
  overflow: hidden;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: #2a2a2a;
  color: #ffffff;
}
.toc__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 52% 64%; }
.toc::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(0 0 0 / 0.8), rgb(0 0 0 / 0.5) 60%, rgb(0 0 0 / 0.2));
}
.toc__inner { position: relative; z-index: 1; padding: 2rem 2.25rem; text-shadow: 0 1px 3px rgb(0 0 0 / 0.6); }
.toc h2 { margin: 0 0 0.5rem; font: 600 0.8125rem/1.5 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; }
.prose .toc ul { margin: 0; padding-left: 1.1em; font: 1.0625rem/1.5 var(--sans); }
.prose .toc li + li { margin-top: 0.2em; }
.toc a { color: #ffffff; text-decoration-color: rgb(255 255 255 / 0.5); }
.toc a:hover { text-decoration-color: #ffffff; }

/* Pull quotes */
.quote {
  margin: 3rem var(--breakout-sm);
  padding: 2rem 2.5rem;
  border-radius: var(--radius);
  background: radial-gradient(circle at 20% 15%, var(--sand), var(--bg) 140%);
}
.quote blockquote { margin: 0; font-size: 1.25rem; line-height: 1.55; }
.quote blockquote p { margin: 0 0 0.9em; }
.quote blockquote p:last-child { margin: 0; }
.quote figcaption { margin-top: 1rem; font: 600 0.9375rem/1.5 var(--sans); }
.quote figcaption a { color: inherit; }

/* Photos */
.prose figure:not(.quote) { margin: 2.5rem 0; }
.prose figure img { width: 100%; border-radius: var(--radius); }
.prose figure .zoom { display: block; cursor: zoom-in; }
.prose figure:not(.quote) figcaption {
  margin-top: 0.75rem;
  text-align: center;
  font: 0.875rem/1.5 var(--sans);
  color: var(--muted);
}

/* "What I like" list */
.prose .highlights {
  margin: 2.5rem var(--breakout-sm);
  padding: 2rem 2.5rem 2rem 3.75rem;
  border-radius: var(--radius);
  background: radial-gradient(circle at 15% 10%, var(--sage), var(--bg) 150%);
}
.prose .highlights li { padding-left: 0.4em; }
.prose .highlights li + li { margin-top: 1em; }
.prose .highlights li::marker { color: var(--leaf); font-size: 1.15em; }

/* The three phases — wider than the text column, centred on the page */
.prose .phases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 2.5rem var(--breakout);
  padding: 0;
  list-style: none;
}
.prose .phases li {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--sand), var(--bg) 130%);
  font-size: 1rem;
  line-height: 1.55;
}
.phases h3 { margin: 0 0 0.5rem; font-size: 1.3rem; }
.phase__num { display: block; font: 600 0.75rem/1.5 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.prose .phases p { margin: 0 0 1rem; }
.prose .phases .phase__when { margin: auto 0 0; font-weight: 700; font-style: italic; }

.prose .tagline { margin: 2.5rem 0; text-align: center; font-size: 1.75rem; line-height: 1.35; }

.back { margin-top: 2.5rem; font-family: var(--sans); font-size: 0.9375rem; }

/* Reading progress (post pages) */
.progress {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 5;
}

/* Lightbox */
.lightbox {
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 1rem;
  border: 0;
  background: transparent;
  cursor: zoom-out;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.88); }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; border-radius: 6px; }
.lightbox button {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.15);
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 30rem) {
  body { font-size: 1.125rem; }
  .quote { padding: 1.25rem 1.25rem; }
  .prose .highlights { padding: 1.25rem 1.25rem 1.25rem 2.5rem; }
  .toc { min-height: 20rem; }
}
