/* hanneszetterblom.com - single stylesheet. No inline styles anywhere (CSP). */

/* 1. Tokens. Light only (DL-017). */
:root {
  color-scheme: light;
  --bg: #FBFBF9;
  --ink: #16191D;
  --ink-2: #55606B;
  --ink-3: #66707A; /* DL-007 */
  --rule: #D6D9D4;
  --accent: #8A5209; /* DL-009 */
  --serif: "Literata", Georgia, "Times New Roman", serif; /* prose (DL-020) */
  --sans: "Familjen Grotesk", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; /* headings, era years, timestamp, heatmap labels, footer (DL-020 as amended) */
  --measure: 42rem;
  --measure-note: 65ch;
}

/* 2. Type. Root stays 16px so rem sizes hold; prose is Literata 18px, 17px under 560px (DL-016, DL-020). */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0 1rem;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
  overflow-wrap: break-word;
}

@media (max-width: 559.98px) {
  body {
    font-size: 1.0625rem;
  }
}

h1 {
  margin: 0;
  font-family: var(--sans);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
}

h2 {
  margin: 3.5rem 0 1rem;
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

p {
  margin: 0 0 1rem;
}

/* Labels sit in the grotesk; numbers inside sentences stay in the serif (DL-020 as amended). */
.meta,
.hm-legend {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}

/* 3. Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Links: 1px underline in ink, offset 3px, hover in the accent (R5). */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink);
}

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

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  top: -5rem;
  left: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--ink);
  font-family: var(--sans);
}

.skip:focus {
  top: 0.5rem;
}

/* 4. One centered column, left-aligned text (DL-012). */
.site-header,
main,
.site-footer {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}

/* 5. Header: the photo left of the name, the sentence under both (R7). */
.site-header {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  column-gap: 1.25rem;
  align-items: center;
  padding-top: 3rem;
}

.photo {
  display: block;
  width: 88px;
  height: 88px;
  object-fit: cover;
}

.lede {
  grid-column: 1 / -1;
  margin: 1.5rem 0 0;
  font-size: 1.1875rem;
}

.site-name {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
}

/* 6. Eras: the year range in the grotesk, the sentence in the serif; a 7rem year column, stacking under 560px. */
.eras {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  row-gap: 0.75rem;
  margin: 0;
}

.eras > div {
  display: contents;
}

.eras dt {
  padding-top: 0.3rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.eras dd {
  margin: 0;
}

@media (max-width: 559.98px) {
  .eras {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0;
  }

  .eras dt {
    padding-top: 0;
  }

  .eras dd {
    margin-bottom: 0.875rem;
  }
}

/* 7. Prose helpers */
.aside {
  color: var(--ink-2);
}

.meta {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-3);
}

/* 8. Heatmap: drawn by script.js from daily_hours at 15px cells and a 3px gap; it shrinks with the column, never grows. */
figure {
  margin: 1.25rem 0;
}

.heatmap {
  display: block;
  max-width: 100%;
  height: auto;
  font-family: var(--sans);
}

.hm-cell {
  fill: var(--accent);
}

.hm-label {
  fill: var(--ink-3);
  font-size: 12px;
}

.hm-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-3);
}

.hm-legend[hidden] {
  display: none;
}

.hm-sw {
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--accent);
}

.hm-sw-1 { opacity: 0.12; }
.hm-sw-2 { opacity: 0.3; }
.hm-sw-3 { opacity: 0.5; }
.hm-sw-4 { opacity: 0.75; }
.hm-sw-5 { opacity: 1; }

/* 9. Lists. The empty-string marker hides bullets and, unlike "none", keeps list semantics in Safari. */
.plain,
.beliefs {
  margin: 0;
  padding: 0;
  list-style: none;
  list-style-type: "";
}

.plain li {
  margin-bottom: 0.625rem;
}

.beliefs li {
  margin-bottom: 1rem;
}

.beliefs p {
  margin: 0;
}

.beliefs .sub {
  padding-left: 1.25rem;
  color: var(--ink-2);
}

/* 10. The call to action: the accent, at body size so it keeps its underline (R5). */
.cta {
  font-family: var(--sans);
  font-weight: 500;
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* 11. Footer: the one rule on the page sits above it. */
.site-footer {
  margin-top: 3.5rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-2);
}

.site-footer p {
  margin: 0;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.links a {
  display: inline-block;
  padding: 0.25rem 0;
}

/* 12. Notes and 404 */
main > h1,
.note {
  margin-top: 2.5rem;
}

.note > h1,
.note > .meta {
  max-width: var(--measure);
}

.note-body {
  max-width: var(--measure-note);
}

.note-body h2 {
  margin-top: 2rem;
}

.code-scroll {
  max-width: 100%;
  margin: 1.25rem 0;
  overflow-x: auto;
  border: 1px solid var(--rule);
}

.code-scroll pre {
  margin: 0;
  padding: 0.875rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.note-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1rem;
}

.note-list time {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--ink-3);
}
