/* =========================================================
   DIY project site: shared styles
   Change the colours and fonts here; every page uses them.
   ========================================================= */

:root {
  /* Colours (light mode). --accent recolours links, step numbers and highlights. */
  --paper: #eef2e6;      /* page background: engineering-pad green */
  --grid: #dde6d3;       /* faint grid lines on the background */
  --surface: #f8faf4;    /* behind photos and the project facts box */
  --ink: #252a27;        /* main text: graphite */
  --ink-soft: #57605a;   /* dates, captions, labels */
  --rule: #9aa597;       /* thin lines and borders */
  --accent: #1d55c0;     /* chalk-line blue */

  /* Fonts already installed on visitors' devices; nothing is downloaded.
     Each list is tried left to right until the device has one. */
  --font-head: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --font-body: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-mono: Consolas, Menlo, "DejaVu Sans Mono", monospace;

  --page-width: 72rem;
  --text-width: 44rem;
  --grid-size: 24px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #18201c;
    --grid: #212b26;
    --surface: #1f2823;
    --ink: #e3e9e1;
    --ink-soft: #a3aea5;
    --rule: #4b574f;
    --accent: #8fb3ff;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
}

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

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

a:hover {
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3 {
  font-family: var(--font-head);
  line-height: 1.1;
  margin: 0;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 4.25rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.85rem;
  font-weight: 600;
  margin-top: 3.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.35rem;
  font-weight: 600;
}

p {
  margin: 0 0 1em;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--surface);
  padding: 0.5rem 1rem;
  z-index: 10;
}

/* ---------- Header and footer ---------- */

.site-header,
.site-footer {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.site-header {
  border-bottom: 1.5px solid var(--ink);
}

.site-name {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
}

/* Yellow splash text diagonally across GESODEMIETER, like the old Minecraft title screen */
.brand {
  position: relative;
}

.splash {
  position: absolute;
  z-index: 1;
  /* centred on GESODEMIETER: its middle sits about 6 of the 21 characters in */
  left: 28.5%;
  top: 50%;
  translate: -50% -50%;
  rotate: -20deg;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: #ffff00;
  /* dark outline keeps the yellow readable on the light background too */
  text-shadow:
    -1px -1px 0 #3f3f00,
    1px -1px 0 #3f3f00,
    -1px 1px 0 #3f3f00,
    1px 1px 0 #3f3f00,
    2px 2px 0 #3f3f00;
  pointer-events: none;
  animation: splash-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes splash-pulse {
  to {
    scale: 1.1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash {
    animation: none;
  }
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 500;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent);
}

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 5rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.site-footer p {
  margin: 0;
}

.view-counter {
  height: 20px;
  width: auto;
}

/* ---------- Home page ---------- */

main {
  display: block;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.intro {
  padding: 4rem 0 1rem;
  max-width: var(--text-width);
}

.intro p {
  font-size: 1.3rem;
  color: var(--ink-soft);
  margin-top: 1.25rem;
}

.intro p:first-child {
  margin-top: 0;
}

/* Project index (home page) and heading index (project pages): a plain list in monospace */
.project-index,
.page-index {
  margin: 1.5rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

.page-index {
  margin-bottom: 2rem;
}

.project-index h2,
.page-index h2 {
  margin: 0 0 0.4rem;
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
}

.project-index ol,
.page-index ol {
  margin: 0;
  padding-left: 2rem;
}

.project-index li::marker,
.page-index li::marker {
  color: var(--ink-soft);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 2.5rem 2rem;
}

/* Placeholder homepage: stands in for the project cards */
.wip {
  margin: 0;
  padding: 3rem 1rem;
  border: 2px dashed var(--rule);
  background: var(--surface);
  text-align: center;
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.card a {
  color: var(--ink);
  text-decoration: none;
}

.card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 1.5px solid var(--ink);
  background: var(--surface);
}

.card h3 {
  margin-top: 0.9rem;
}

.card a:hover h3 {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
}

.card-date {
  font-family: var(--font-head);
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0.25rem 0 0.4rem;
}

/* Temporary: marks finished write-ups on index_new.html. Remove before launch. */
.status-ready {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0 0.45em;
  border: 1.5px solid #2e7d32;
  border-radius: 3px;
  color: #2e7d32;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  text-transform: uppercase;
  vertical-align: middle;
}

@media (prefers-color-scheme: dark) {
  .status-ready {
    border-color: #81c784;
    color: #81c784;
  }
}

.card p:last-child {
  margin-bottom: 0;
}

.about {
  max-width: var(--text-width);
}

/* ---------- Project page ---------- */

.project {
  max-width: var(--text-width);
  margin: 0 auto;
  padding-top: 2.5rem;
}

.back-link {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 500;
}

.project h1 {
  margin-top: 1.5rem;
}

.lede {
  font-size: 1.3rem;
  color: var(--ink-soft);
  margin-top: 1.25rem;
}

/* Project facts, laid out like the title block on a technical drawing */
.facts {
  display: grid;
  /* one equal column per fact, however many there are */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  margin: 2rem 0;
  border: 1.5px solid var(--ink);
  background: var(--surface);
}

.facts div {
  padding: 0.6rem 0.9rem 0.7rem;
  border-left: 1px solid var(--rule);
}

.facts div:first-child {
  border-left: 0;
}

.facts dt {
  font-family: var(--font-head);
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.facts dd {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
}

figure {
  margin: 2rem 0;
}

figure img {
  width: 100%;
  border: 1.5px solid var(--ink);
  background: var(--surface);
}

figcaption {
  font-family: var(--font-head);
  font-size: 1rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
}

.cover {
  margin-top: 0;
}

.lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0 2.5rem;
}

.lists ul {
  padding-left: 1.2rem;
  margin: 0;
}

.lists li {
  margin-bottom: 0.35rem;
}

.lists li::marker {
  color: var(--accent);
}

/* Build steps: numbered like balloon callouts on a drawing, joined by a leader line */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
}

.step {
  counter-increment: step;
  position: relative;
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  column-gap: 1.25rem;
  padding-bottom: 2.5rem;
}

.step::before {
  content: counter(step);
  grid-row: 1 / span 10;
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--paper);
  color: var(--accent);
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.step::after {
  content: "";
  position: absolute;
  left: calc(1.625rem - 1px);
  top: 3.25rem;
  bottom: 0;
  border-left: 2px dashed var(--rule);
}

.step:last-child::after {
  display: none;
}

.step > * {
  grid-column: 2;
}

.step h3 {
  margin-top: 0.75rem;
  margin-bottom: 0.6rem;
}

.step figure {
  margin: 0.5rem 0 0;
}

.downloads {
  padding-left: 1.2rem;
}

/* ---------- Small screens ---------- */

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

  /* room for the splash text when the menu wraps under the site name */
  .site-header {
    row-gap: 1rem;
  }

  .intro {
    padding: 2.5rem 0 0.5rem;
  }

  .facts {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, 1fr);
  }

  .facts div:nth-child(3) {
    border-left: 0;
  }

  .facts div:nth-child(n + 3) {
    border-top: 1px solid var(--rule);
  }

  .step {
    grid-template-columns: 2.5rem 1fr;
    column-gap: 0.9rem;
  }

  .step::before {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.2rem;
  }

  .step::after {
    left: calc(1.25rem - 1px);
    top: 2.5rem;
  }
}

/* ---------- Printing a build guide ---------- */

@media print {
  body {
    background: none;
    color: #000;
  }

  .site-header nav,
  .site-footer,
  .back-link,
  .comments {
    display: none;
  }

  .step {
    break-inside: avoid;
  }
}
