/* ── LIGHT MODE ─────────────────────────────────────────────────── */
:root {
  --text:           darkslategrey;
  --border:         lightgrey;
  --accent:         teal;
  --bg:             #dce3e1;
  --gradientTop:    rgba(255,255,255,0.72);
  --gradientBottom: rgba(240,248,255,0.62);
  --panelBg:        rgba(230,238,236,0.68);
}
header {
  background: url('***light mode banner image***') center/cover no-repeat;
}

/* ── DARK MODE ──────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --text:           white;
    --border:         #5a7678;
    --accent:         #74C365;
    --bg:             rgba(0,60,60,0.70);
    --gradientTop:    rgba(47,79,79,0.72);
    --gradientBottom: rgba(0,50,60,0.62);
    --panelBg:        rgba(0,40,50,0.65);
  }
  a:link { color: lightblue; }
  header {
    background: url('***dark mode banner image***') center/cover no-repeat;
  }
}

/* ── RESET / BASE ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  padding: 10px;
  font-family: 'Michroma', sans-serif;
  color: var(--text);
  background-image: url("portland japanese garden dithered.png");
  background-attachment: fixed;
  background-size: cover;
  margin: 0;
  min-height: 100dvh;
}

img { max-width: 100%; height: auto; }
pre { overflow-x: auto; }
a:hover, a:focus { font-style: italic; }
a:visited { color: var(--accent); }

h1, h2, h3, h4, h5, h6, p {
  margin: 5px;
  line-height: 1.4;
  font-family: 'Michroma', sans-serif;
}
h1 {
  font-size: clamp(0.95rem, 2.5vw, 1.4rem);
  letter-spacing: 2px;
  font-weight: normal;
  text-align: center;
  border-bottom: 2px ridge var(--border);
  padding-bottom: 5px;
}
h2 { font-size: clamp(0.85rem, 2vw, 1.25rem); font-weight: normal; text-align: center; }
h3 { font-size: 1rem; text-align: center; }
h4 { font-size: 0.88rem; color: var(--accent); padding-left: 4px; line-height: 1.6; }

/* ── CONTAINER ──────────────────────────────────────────────────── */
.container {
  max-width: 55rem;
  margin: 5vw auto 12px auto;
  border: 6px ridge var(--border);
  outline: 3px solid var(--gradientTop);
  outline-offset: 4px;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  padding: 5px;
  gap: 5px;
  background-color: var(--panelBg);
  background-image:
    repeating-radial-gradient(circle at 0 0, transparent 0, var(--panelBg) 9px),
    repeating-linear-gradient(var(--bg), var(--bg));
  backdrop-filter: blur(3px);
}

/* ── GRID HELPERS (from cyanobacteria.css) ──────────────────────── */
.small { flex: 1 1 9%;  min-width: 120px; }
.large { flex: 1 1 82%; min-width: 0; }
.full  { flex: 1 1 100%; }
.half  { flex: 1 1 49%;  min-width: 260px; }

/* ── HEADER ─────────────────────────────────────────────────────── */
header {
  flex: 1 1 100%;
  min-height: 80px;
  border: 2px ridge var(--border);
  border-radius: 5px;
  background-color: var(--panelBg);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 14px;
  position: relative; /* for overlay z-index context */
}

/* Fira Sans Bold — site title only */
header > span {
  font-family: 'Fira Sans', sans-serif;
  font-weight: 700;
  font-size: clamp(1.2rem, 4vw, 1.75rem);
  color: var(--gradientTop);
  text-shadow:
     1px  1px var(--text),
    -1px  1px var(--text),
     1px -1px var(--accent),
    -1px -1px var(--accent);
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

/* Toggle button */
#navToggleBtn {
  background: var(--panelBg);
  border: 1px ridge var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: 'Michroma', sans-serif;
  font-size: 0.7rem;
  padding: 4px 10px;
  cursor: pointer;
  letter-spacing: 0.08em;
  backdrop-filter: blur(2px);
  white-space: nowrap;
}
#navToggleBtn::after                       { content: ' ▾'; }
#navToggleBtn[aria-expanded="true"]::after { content: ' ▴'; }

/* ── NAV OVERLAY DRAWER ─────────────────────────────────────────── */
/*
  On ALL screen sizes the nav is a fixed overlay that slides in from
  the left when toggled. On desktop it is open by default.
  On mobile it starts closed.
*/
#navDrawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 200px;
  z-index: 1000;
  background: var(--panelBg);
  backdrop-filter: blur(8px);
  border-right: 2px ridge var(--border);
  display: flex;
  flex-direction: column;
  padding: 12px 6px;
  gap: 5px;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
}
#navDrawer.open {
  transform: translateX(0);
}

/* Scrim behind the drawer on mobile */
#navScrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.45);
}
#navScrim.visible { display: block; }

/* Nav panels inside drawer */
#navDrawer nav {
  border: 2px ridge var(--border);
  border-radius: 5px;
  background: linear-gradient(var(--gradientTop), var(--gradientBottom));
  padding: 5px;
}
#navDrawer nav div {
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  margin: 4px 4px 8px 4px;
  border-bottom: 1px ridge var(--border);
  padding-bottom: 4px;
}
#navDrawer nav a {
  display: block;
  margin: 4px;
  background: linear-gradient(to right, var(--bg), var(--gradientBottom));
  border-radius: 5px;
  padding: 3px 7px;
  text-decoration: none;
  font-size: 0.75rem;
  color: var(--text);
}
#navDrawer nav a:visited { color: var(--text); }
#navDrawer nav a:hover,
#navDrawer nav a:focus {
  background: linear-gradient(to right, var(--bg), var(--gradientBottom), var(--gradientTop));
  font-style: italic;
}

/* ── SECTIONS ───────────────────────────────────────────────────── */
section {
  border: 2px ridge var(--border);
  border-radius: 5px;
  background: linear-gradient(var(--gradientTop), var(--gradientBottom));
  backdrop-filter: blur(1px);
  padding: 5px;
}

/* ── EMBED WRAPPER ──────────────────────────────────────────────── */
.embed-wrap {
  margin: 6px 5px;
  border: 2px ridge var(--border);
  border-radius: 5px;
  overflow: hidden;
  max-width: 100%;
}
.embed-wrap iframe {
  display: block;
  width: 100%;
  border: none;
}

/* ── FOOTER ─────────────────────────────────────────────────────── */
footer {
  flex: 1 1 100%;
  text-align: center;
  margin-bottom: 5vw;
  font-size: 0.8rem;
  padding: 5px;
}
footer a { text-decoration: none; }

/* ── MOBILE ≤600px ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  body { padding: 6px; }
  .container { gap: 6px; padding: 6px; margin-top: 10px; }

  /* All columns go full width and stack */
  .small, .large, .half { flex: 1 1 100%; min-width: 0; }

  /* On mobile: push the .small sidebar (nav+links in-page) BELOW main content */
  .container > .small  { order: 3; }
  .container > .half,
  .container > .large,
  .container > .full,
  .container > section { order: 2; }
  .container > header  { order: 1; }
  footer               { order: 4; }

  header { min-height: 55px; padding: 8px 10px; }
}
