/* Tokens */
:root {
  --bg: #f4f4f4;
  --text: #222222;
  --surface: #ffffff;

  --header-bg: #121212;
  --footer-bg: #121212;

  --brand: #0077B6;
  --brand-600: #005f8a;

  --h1-accent: #4CAF50;   /* h1 in light */
  --dt-accent: #005f8a;   /* dt in light */

  --link: #0056b3;
  --link-hover: #003d80;

  --gold: #FFD700;
  --gold-600: #FFC300;

  --border-light: rgba(0, 0, 0, 0.08);
  --border-dark: rgba(255, 255, 255, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0c;
    --text: #f2f2f2;
    --surface: #1a1a1a;

    --header-bg: #0f0f0f;
    --footer-bg: #0f0f0f;

    /* Keep brand bar consistent in dark */
    --brand: #0077B6;
    --brand-600: #005f8a;

    --h1-accent: #FFD700;  /* h1 in dark switches to gold for clarity */
    --dt-accent: #FFD700;  /* dt in dark switches to gold for clarity */

    --link: #9bd1ff;
    --link-hover: #bfe3ff;

    --border-light: rgba(255, 255, 255, 0.14);
    --border-dark: rgba(255, 255, 255, 0.18);
  }
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: monospace, sans-serif;   /* match requested scheme */
  line-height: 1.2;                     /* match requested hierarchy */
  color: var(--text);
  background: var(--bg);
}

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

a:focus,
button:focus,
input:focus,
label:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Optional helper if you replace input[hidden] with this class */
.visually-hidden {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  padding: 10px;
  background-color: var(--header-bg);
  color: #ffffff;
}

.site-header a {
  color: var(--gold);
  text-decoration: none;
}

.left-section,
.center-section,
.right-section {
  flex: 1;
  text-align: center;
  padding: 5px;
}

@media (min-width: 48em) {
  .left-section { text-align: left; }
  .right-section { text-align: right; }
}

#taijitu { width: 44px; height: 44px; }

.right-section a:first-child {
  display: inline-block;
  padding: 0.5rem;
  margin: 0 0.5rem;
}

.accessibility-link {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
  transition: color 0.25s ease, background-color 0.25s ease;
  background-color: transparent;
  border-radius: 4px;
}

.accessibility-link:hover,
.accessibility-link:focus {
  color: var(--gold-600);
  text-decoration: underline;
}

/* Navigation */
nav {
  background-color: #0077B6;
  padding: 0.625em 1.25em;
}

.hamburger {
  display: block;
  font-size: 1.875em;
  cursor: pointer;
  text-align: center;
  padding: 0.625em; /* adjusted to match reference */
  background: #333333;
  color: #ffffff;
  border-radius: 6px;
  user-select: none;
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #333333; /* match reference */
  text-align: center;
  display: none;
}

/* Support both explicit id and generic checkbox structure */
#menu-toggle:checked + .hamburger + .menu,
input[type="checkbox"]:checked + .hamburger + .menu {
  display: block;
}

/* match original visual style: circular buttons */
.menu li a {
  display: inline-block;
  padding: 0.625em 1.25em;
  color: #ffffff;
  text-decoration: none;
  transition: background-color 0.5s ease, color 0.5s ease, border 0.5s ease; /* adjusted to 0.5s */
  border-radius: 50%;
  border: 2px solid transparent;
}

.menu li a:hover,
.menu li a:focus {
  background-color: #005f8a; /* use hex to match reference */
  color: #FFD700;
  border: 2px solid #FFD700;
  outline: none;
}

@media (min-width: 48em) {
  .hamburger { display: none; }
  .menu {
    display: flex;
    background: #333333; /* keep consistent with reference */
    justify-content: center;
    gap: 0.25rem 0.5rem;
    flex-wrap: wrap;
  }
  .menu li { display: inline-block; }
  .menu li a { margin: 0.25rem 0.5rem; }
}

/* Main */
main {
  max-width: 70ch;
  margin: 0 auto;
  padding: 1rem;
}

h1 {
  font-size: 1.875rem;
  color: var(--h1-accent);
  margin: 1.25rem 0 0.5rem 0;
  text-align: center;
}

/* optional h2 to align hierarchy with your scheme */
main h2 {
  font-size: 1.75rem;
  color: var(--dt-accent);
  margin: 1.25rem 0 0.5rem 0;
  text-align: center;
}

/* Intro block with left accent */
.about-general {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-left: 6px solid var(--dt-accent);
  border-radius: 8px;
  padding: 1rem;
  margin: 0.75rem 0 1.5rem 0;
}
@media (prefers-color-scheme: dark) {
  .about-general { border-color: var(--border-dark); }
}

.about-general p { margin: 0.25rem 0 0 0; }

/* Definition list with left-side guides */
main dl {
  max-width: 70ch;
  margin: 2rem auto;
  padding: 0 0.5rem;
  border-left: 6px solid var(--dt-accent);
}

/* Section headers within the DL */
main dt {
  font-weight: 700;
  font-size: 1.125rem;
  margin: 1.25rem 0 0.35rem 0.75rem;  /* indent past the left guide */
  color: var(--dt-accent);
}

/* Items under each section */
main dd {
  margin: 0 0 0 0.75rem;               /* align with dt text edge */
  padding: 0.5rem 0 0.5rem 0.75rem;    /* inner padding for readability */
  border-left: 3px solid var(--border-light);
  border-bottom: 1px dashed var(--border-light);
  background: transparent;
  border-radius: 0 6px 6px 0;
}

@media (prefers-color-scheme: dark) {
  main dd {
    border-left: 3px solid var(--border-dark);
    border-bottom: 1px dashed var(--border-dark);
  }
}

/* Links in main */
main a {
  color: var(--link);
  text-decoration: none;
  font-weight: 700;
}
main a:hover { text-decoration: underline; color: var(--link-hover); }

/* Blockquote and citation to match scheme */
blockquote {
  font-style: italic;
  background: #F9F9F9;
  border-left: 5px solid var(--dt-accent);
  margin: 20px;
  padding: 10px 20px;
  color: #4D4D4D;
}
cite {
  display: block;
  text-align: right;
  color: var(--dt-accent);
  font-style: normal;
  margin-top: 10px;
}

@media (prefers-color-scheme: dark) {
  blockquote {
    background-color: #222222;
    color: #CCCCCC;
    border-left: 5px solid var(--dt-accent);
  }
  cite { color: var(--dt-accent); }
}

/* Footer */
.site-footer {
  background-color: var(--footer-bg);
  color: #ffffff;
  padding: 1.5rem;
  text-align: center;
}

.site-footer a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.25s ease;
}

.site-footer a:hover,
.site-footer a:focus { color: var(--gold-600); }

/* Motion and print preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body {
    font-size: 12pt;
    color: black;
    background: none;
  }
  nav, .site-header, .site-footer { display: none; }
  main { max-width: none; }
  /* keep left guides in print for navigation */
  main dl { border-left-color: #000; }
  main dd { border-left-color: #000; border-bottom-color: #000; }
}

/* Light scheme explicit focus parity with prior sheets */
@media (prefers-color-scheme: light) {
  body {
    background-color: #ffffff;
    color: #000000;
  }
  button, a { border-color: #000000; }
  button:focus, a:focus { outline: 2px dashed #000000; }
}

/* Resolution strategy to match prior layout. Keep granular steps. */
@media (max-width: 2em) {
  body {
    font-size: .625rem;
    max-width: 2rem;
    padding: 0 .5rem;
  }
}

@media (min-width: 2.063em) and (max-width: 5.25em) {
  body {
    font-size: .75rem;
    max-width: 4rem;
    padding: 0 .5rem;
  }
}

@media (min-width: 5.313em) and (max-width: 15em) {
  body {
    font-size: .8125rem;
    max-width: 14rem;
    padding: 0 .75rem;
  }
}

@media (min-width: 15.063em) and (max-width: 20em) {
  body {
    font-size: .9375rem;
    max-width: 16rem;
    padding: 0 1rem;
  }
}

@media (min-width: 20.063em) and (max-width: 23.438em) {
  body {
    font-size: .9375rem;
    max-width: 18rem;
    padding: 0 1rem;
  }
}

@media (min-width: 23.5em) and (max-width: 30em) {
  body {
    font-size: 1.0625rem;
    max-width: 24rem;
    padding: 0 1rem;
  }
}

@media (min-width: 30.063em) and (max-width: 37.5em) {
  body {
    font-size: 1.0625rem;
    max-width: 30rem;
    padding: 0 1.125rem;
  }
}

@media (min-width: 37.563em) and (max-width: 48em) {
  body {
    font-size: 1.0625rem;
    max-width: 46rem;
    padding: 0 1.125rem;
  }
}

/* At and above this range, align nav presentation with prior sheet */
@media (min-width: 48.063em) and (max-width: 64em) {
  body {
    font-size: 1.125rem;
    max-width: 58rem;
    padding: 0 1.125rem;
  }

  .hamburger, #menu-toggle { display: none; }
  .menu {
    display: block;
    background: #333333; /* enforce consistency */
  }
  .menu li { display: inline-block; }
  .menu li a {
    padding: 15px;
    border-radius: 50%;
    border: 2px solid transparent;
  }
}

@media (min-width: 64.063em) and (max-width: 80em) {
  body {
    font-size: 1.25rem;
    max-width: 74rem;
    padding: 0 1.125rem;
  }

  .hamburger, #menu-toggle { display: none; }
  .menu { display: block; background: #333333; }
  .menu li { display: inline-block; }
  .menu li a {
    padding: 15px;
    border-radius: 50%;
    border: 2px solid transparent;
  }
}

@media (min-width: 80.063em) and (max-width: 90em) {
  body {
    font-size: 1.375rem;
    max-width: 82rem;
    padding: 0 1.125rem;
  }

  .hamburger, #menu-toggle { display: none; }
  .menu { display: block; background: #333333; } /* was none */
  .menu li { display: inline-block; }
  .menu li a {
    padding: 15px;
    border-radius: 50%;
    border: 2px solid transparent;
  }
}

@media (min-width: 90.063em) and (max-width: 120em) {
  body {
    font-size: 1.5rem;
    max-width: 106rem;
    padding: 0 1.125rem;
  }

  .hamburger, #menu-toggle { display: none; }
  .menu { display: block; background: #333333; } /* was none */
  .menu li { display: inline-block; }
  .menu li a {
    padding: 15px;
    border-radius: 50%;
    border: 2px solid transparent;
  }
}

@media (min-width: 120.063em) and (max-width: 160em) {
  body {
    font-size: 1.5rem;
    max-width: 110rem;
    padding: 0 1.125rem;
  }

  .hamburger, #menu-toggle { display: none; }
  .menu { display: block; background: #333333; } /* was none */
  .menu li { display: inline-block; }
  .menu li a {
    padding: 15px;
    border-radius: 50%;
    border: 2px solid transparent;
  }
}

@media (min-width: 160.063em) {
  body {
    font-size: 1.5rem;
    max-width: 110rem;
    padding: 0 1.125rem;
  }

  .hamburger, #menu-toggle { display: none; }
  .menu { display: block; background: #333333; } /* was none */
  .menu li { display: inline-block; }
  .menu li a {
    padding: 15px;
    border-radius: 50%;
    border: 2px solid transparent;
  }
}

/* Force nav bar and menu interior to the same blue at all sizes */
nav { background-color: #0077B6; }
.menu { background-color: #0077B6; }

/* Ensure desktop breakpoints do not reintroduce another background */
@media (min-width: 48.063em) { .menu { background-color: #0077B6; } }
@media (min-width: 64.063em) { .menu { background-color: #0077B6; } }
@media (min-width: 80.063em) { .menu { background-color: #0077B6; } }
@media (min-width: 90.063em) { .menu { background-color: #0077B6; } }
@media (min-width: 120.063em) { .menu { background-color: #0077B6; } }
@media (min-width: 160.063em) { .menu { background-color: #0077B6; } }
