/* Dendrite styles */
/* Default: light theme */
:root {
  --bg: #ffffff;
  --text: #0b0f14;
  --muted: #66707a;
  --link: #0b63ce;
  --link-hover: #2a7fe6;
  --border: #e5e7eb;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s6: 24px;
}

/* Respect system dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f13;
    --text: #e7e7e7;
    --muted: #9aa3ad;
    --link: #68c3ff;
    --link-hover: #a8dcff;
    --border: #1a222b;
  }
}

/* Let the UA expose both palettes; switch via media rule above */
html {
  color-scheme: light;
  font-size: clamp(16px, 2.4vw, 18px);
}
@media (prefers-color-scheme: dark) {
  html {
    color-scheme: dark;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Ubuntu,
    'Helvetica Neue',
    Arial,
    sans-serif;
  line-height: 1.35;
}

/* Header/nav */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: var(--s3) 0; /* vertical only */
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* Constrain header content to match main's width */
.header .nav {
  display: flex;
  align-items: center;
  gap: var(--s3);
  max-width: 72ch;
  margin: 0 auto;
  padding: 0 var(--s4); /* same horizontal padding as main */
}

.nav-links {
  display: flex;
  gap: var(--s3);
  align-items: center;
}

.menu-toggle {
  display: block;
  margin-left: auto;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

#signinButton,
#signoutWrap {
  display: none;
}

.nav.open #signinButton,
.nav.open #signoutWrap {
  display: block;
}

@media (max-width: 600px) {
  .nav-links {
    display: none;
    flex-direction: column;
    gap: var(--s3);
    width: 100%;
    margin: var(--s2) 0 0 0;
  }

  .nav.open .nav-links {
    display: flex;
  }
}

.header a:first-of-type {
  font-weight: 600;
}

/* Main container */
main {
  padding: var(--s4);
  max-width: 72ch;
  margin: 0 auto;
}

/* Headings */
h1 {
  margin: var(--s3) 0 var(--s2);
  line-height: 1.15;
  text-wrap: balance;
}

/* Contents list */
ol.contents {
  margin: 0;
  padding-left: 1.4rem;
}

ol.contents li {
  margin: 0;
}

ol.contents li::marker {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

ol.contents a {
  display: block;
  padding-block: 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 0.06em;
  text-decoration-skip-ink: auto;
  color: var(--link);
}

ol.contents a:hover,
ol.contents a:focus-visible {
  color: var(--link-hover);
  outline: none;
}

ol.contents li:nth-child(10n + 1) {
  margin-top: var(--s2);
}

/* Global link tone */
a {
  color: var(--link);
}

/* Compact mode */
[data-density='compact'] ol.contents a {
  padding-block: 4px;
}

[data-density='compact'] body {
  line-height: 1.3;
}

/* Legacy page wrapper */
.page {
  max-width: 70ch;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Form styles */
form {
  display: grid;
  gap: var(--s3);
  max-width: 40ch;
}

form > div {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

form input[type='text'],
form textarea {
  width: 100%;
  padding: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--s1);
  font: inherit;
  box-sizing: border-box;
}

form textarea {
  resize: vertical;
  min-height: 8em;
}

form button {
  padding: var(--s2) var(--s3);
  width: fit-content;
}

/* Neutralize background for Google sign-in button */
.g_id_signin,
.abcRioButton {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
