/* Catppuccin Macchiato (default) */
:root {
  color-scheme: dark;
  --base: #24273a;
  --text: #cad3f5;
  --muted: #b8c0e0;
  --accent: #c6a0f6;
  --border: #5b6078;
}

/* Catppuccin Latte */
:root[data-theme="light"] {
  color-scheme: light;
  --base: #eff1f5;
  --text: #4c4f69;
  --muted: #5c5f77;
  --accent: #8839ef;
  --border: #bcc0cc;
}

* { box-sizing: border-box; }
/* Keep the native scrollbar's space so the page doesn't move when it's revealed */
@media (hover: hover) and (pointer: fine) {
  :root.scrollbar-auto-hide {
    --scrollbar-thumb: transparent;
    scrollbar-color: var(--scrollbar-thumb) var(--base);
  }
  :root.scrollbar-auto-hide.scrollbar-visible { --scrollbar-thumb: var(--border); }
  :root.scrollbar-auto-hide::-webkit-scrollbar { width: 12px; }
  :root.scrollbar-auto-hide::-webkit-scrollbar-track { background: var(--base); }
  :root.scrollbar-auto-hide::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 3px solid var(--base);
    border-radius: 12px;
  }
}
body {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
  background: var(--base);
  color: var(--text);
  font: 18px/1.7 Courier, "Courier New", monospace;
  text-align: center;
  /* Keep the layout width; text wraps only at explicit breaks such as <br>. */
  /* white-space: nowrap; */
}
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
header {
  /* Stay at the top while retaining space in the layout for the content below. */
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.site-name { font-weight: 600; }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; }
nav a { color: var(--muted); text-decoration: none; }
nav a[aria-current="page"] { color: var(--accent); text-decoration-line: underline; }
nav a:hover { text-decoration-line: underline; }
#theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.theme-icon {
  display: block;
  width: 20px;
  height: 20px;
  margin: auto;
}
.theme-icon-moon { display: none; }
:root[data-theme="light"] .theme-icon-sun { display: none; }
:root[data-theme="light"] .theme-icon-moon { display: block; }
/* Main text starts at the left boundary; only introductions and headings center. */
main { padding: 32px 0; text-align: left; }
.intro { text-align: center; }
main > :first-child, .intro > :first-child { margin-top: 0; }
main > :last-child { margin-bottom: 0; }
:is(h1, h2, h3, h4, h5, h6) { text-align: center; }
h2 { font-size: 25px; line-height: 1.3; font-weight: 400; }
p { margin: 12px 0; }
.eyebrow { color: var(--muted); font-size: 13px; }
section > :last-child { margin-bottom: 0; }
.article-list { list-style: none; padding: 0; margin: 32px 0 0; }
.article-list li { display: flex; align-items: baseline; justify-content: center; gap: 12px; padding: 8px 0; }
/* Let article rows extend past the column without shrinking or truncating text. */
.article-list li > * { flex-shrink: 0; }
.image-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.image-grid img { display: block; width: 100%; height: auto; }
@media (max-width: 480px) {
  .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
footer { padding: 24px 0 32px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* The fish button is 60px wide.
   theme.js uses twice its width for the hover/tap distance (120px).
   Fixed positioning keeps it independent of the website's margins. */
.fish-link {
  position: fixed;
  /* Leave room for a phone's home indicator and landscape screen cutout. */
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 1;
  width: 60px;
  height: 60px;
  text-decoration: none;
  opacity: var(--fish-opacity, 0);
  pointer-events: none;
}
.fish-link img { display: block; width: 100%; height: 100%; object-fit: contain; }
.fish-link.is-near { pointer-events: auto; }
/* Keyboard focus reveals the link too, so it remains accessible without a mouse. */
.fish-link:focus-visible { opacity: 1; pointer-events: auto; }

/* Animate colors only; rapid toggles retarget the current transition. */
@media (prefers-reduced-motion: no-preference) {
  .theme-ready :is(body, header, footer, a, button, .eyebrow) {
    transition: background-color 200ms ease, color 200ms ease,
      border-color 200ms ease, outline-color 200ms ease;
  }
}
