/* Shared design for all N0rdicNerd sites.
   Each site sets its own accent color in its theme.css, which is loaded after this file and
   defines --accent twice: once for light mode and once inside prefers-color-scheme: dark.
   Everything else comes from here, so a change in this file changes every site. */

:root {
  --bg: #ffffff;
  --surface: #f5f6f8;
  --text: #1d2127;
  --muted: #5b6470;
  --border: #dfe3e8;
  --border-strong: #c3cad2;
  --accent: #1a5fb4;
  --accent-text: #ffffff;
  --radius: 10px;
  --max-width: 960px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --surface: #1d2127;
    --text: #e8eaed;
    --muted: #9aa3ae;
    --border: #2c333b;
    --border-strong: #3d4651;
    --accent: #6ea8fe;
    --accent-text: #0d1117;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--font);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }
main.container { padding-top: 2rem; padding-bottom: 3rem; } /* must be more specific than .container */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

a { color: var(--accent); }

h1 { font-size: 2.4rem; line-height: 1.2; margin: 0 0 0.5rem; }
h2 { font-size: 1.5rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.35rem; }

.skip-link {
  position: absolute;
  left: -999px;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
  background: var(--bg);
  padding: 8px 12px;
  z-index: 10;
}

/* Header and footer */
.site-header { border-bottom: 1px solid var(--border); }
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.brand-logo { height: 32px; width: auto; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; margin: 0; padding: 0; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); }

/* Page building blocks */
.hero { padding: 0 0 1rem; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 40em; margin: 0 0 1.5rem; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--accent);
}
.btn:hover { filter: brightness(1.08); }
.btn-secondary { background: transparent; color: var(--accent); }
.btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 1rem 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card p { margin: 0; color: var(--muted); }

figure { margin: 2rem 0; }
figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
figcaption { text-align: center; color: var(--muted); font-size: 0.9rem; margin-top: 8px; }

/* Screenshot gallery: one large image with small thumbnails to its right; see layouts/gallery.njk.
   The thumbnails column is as tall as the main image, and each thumbnail has its own border. */
.gallery {
  display: grid;
  grid-template-columns: minmax(0, 540px) 200px;
  grid-template-areas:
    "main thumbs"
    "caption .";
  justify-content: start;
  gap: 8px 16px;
  margin: 2rem 0;
}
.gallery button {
  font: inherit;
  color: inherit;
  cursor: zoom-in;
  padding: 0;
  background: none;
  border: 0;
}
.gallery button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.gallery-main { grid-area: main; display: block; width: 100%; }
.gallery-main img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
}
.gallery-caption { grid-area: caption; margin: 0; color: var(--muted); font-size: 0.9rem; }
.gallery-thumbs {
  grid-area: thumbs;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-auto-rows: 1fr;
  gap: 12px;
  contain: size; /* the images do not set the height; the column takes the height of the main image */
}
.gallery-thumbs li { min-height: 0; }
.gallery .gallery-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 64px;
  padding: 6px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.gallery .gallery-thumb:hover { border-color: var(--accent); }
.gallery-thumb img { max-width: 100%; max-height: 100%; width: auto; height: auto; }

@media (max-width: 700px) {
  .gallery {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "caption" "thumbs";
  }
  .gallery-thumbs {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    grid-auto-rows: 96px;
    contain: none;
    margin-top: 8px;
  }
}

/* The popup that shows a screenshot at full size */
.lightbox {
  max-width: 96vw;
  max-height: 96vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.7); }
.lightbox-body { position: relative; padding: 16px; text-align: center; }
.lightbox img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; }
.lightbox-caption { margin: 12px 0 0; color: var(--muted); font-size: 0.95rem; }
.lightbox-body form { margin: 0; }
.lightbox-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 36px;
  height: 36px;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
}

.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 1.5rem 0;
}
.note p { margin: 0; }

ol, ul { padding-left: 1.4rem; }

@media (max-width: 600px) {
  h1 { font-size: 1.9rem; }
  .lead { font-size: 1.1rem; }
}
