/* =========================================================
   physicalmagnetism.html — style.css
   Reference aesthetic: jila.colorado.edu/~ajsh/insidebh/
   Document-web style. Earth palette. Browser-native structure.
   ========================================================= */

/* ---------- Reset (minimal — let browser do its thing) ---------- */
*, *::before, *::after { box-sizing: border-box; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }

/* ---------- Design Tokens ---------- */
:root {
  --bg:           #F2EBDC;
  --surface:      #EDE5CE;
  --text:         #262014;
  --muted:        #594E39;
  --faint:        #A69D85;
  --border:       #594E39;
  --link:         #594E39;
  --link-visited: #7A4030;
  --link-hover:   #7A8C51;
  --accent:       #7A8C51;
  --accent-2:     #D9BA5F;
  --accent-rust:  #BF6849;
}

/* ---------- Base ---------- */
body {
  background: var(--bg);
  color: var(--text);
  font-family: Times New Roman, Times, serif;
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

/* Links: underlined, colored — default web behavior */
a           { color: var(--link); text-decoration: underline; }
a:visited   { color: var(--link-visited); }
a:hover     { color: var(--link-hover); }

h1 { font-size: 24px; font-weight: bold; margin: 12px 0 6px; }
h2 { font-size: 20px; font-weight: bold; margin: 14px 0 4px; }
h3 { font-size: 16px; font-weight: bold; margin: 12px 0 4px; }

p  { margin: 0 0 10px; }
ul { margin: 4px 0 10px 24px; padding: 0; }
li { margin-bottom: 2px; }
hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

pre, code {
  font-family: Courier New, Courier, monospace;
  font-size: 13px;
  background: var(--surface);
  padding: 0 2px;
}
pre {
  display: block;
  padding: 8px 10px;
  margin: 8px 0;
  border-left: 3px solid var(--accent);
  white-space: pre-wrap;
}

table { border-collapse: collapse; }
td    { vertical-align: top; padding: 0; }

/* ---------- Page layout: sidebar + content (table-based feel, CSS impl) ---------- */
.page-wrap {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

/* ---------- Sidebar nav ---------- */
.navbar,
header {
  width: 160px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 10px 20px 12px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
}

/* The logo inside sidebar */
.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 8px;
  line-height: 1.3;
}
.logo img {
  height: 28px;
  width: auto;
  border: 1px solid var(--border);
}
.logo span { font-size: 12px; }

/* Nav label (site title above list) */
.navbar .nav-label,
header .nav-label {
  display: block;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

/* Nav list */
#primaryNav {
  list-style: disc;
  margin: 0 0 0 16px;
  padding: 0;
}
#primaryNav li   { font-size: 14px; margin-bottom: 3px; }
#primaryNav a    { color: var(--link); text-decoration: underline; }
#primaryNav a:hover { color: var(--link-hover); }

/* Subnav: flatten — no dropdowns, just more list items */
.subnav { display: contents; }
.subnavbtn { display: none; }
.subnav-content { display: contents; }

/* Hide mobile toggle */
#menuToggle { display: none; }

/* Back/forward links in sidebar */
.sidebar-nav-prev-next {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  list-style: none;
  margin-left: 0;
  padding: 0;
}
.sidebar-nav-prev-next li { margin-bottom: 2px; }

/* ---------- Main content area ---------- */
main {
  flex: 1;
  padding: 10px 18px 24px;
  min-width: 0;
}

/* Breadcrumb prev/next */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--muted); }

/* ---------- JILA-style infobox (bordered definition box) ---------- */
.infobox {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 12px;
  margin: 10px 0;
  display: table; /* shrink-wrap like inline-block but respects width */
  font-size: 15px;
}
.infobox ul { margin: 4px 0 0 20px; }
.infobox p  { margin: 0; }

/* ---------- Buttons: minimal, gold-tinted ---------- */
button,
.btn,
.btn.primary,
.btn.ghost {
  background: var(--accent-2);
  border: 1px solid var(--border);
  font-family: Times New Roman, Times, serif;
  font-size: 14px;
  padding: 3px 10px;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  display: inline;
  border-radius: 0;
  box-shadow: none;
  letter-spacing: normal;
  font-weight: normal;
}
button:hover,
.btn:hover,
.btn.primary:hover,
.btn.ghost:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- Inputs ---------- */
input[type="text"],
input[type="number"] {
  background: var(--bg);
  border: 1px solid var(--text);
  font-family: Times New Roman, Times, serif;
  font-size: 15px;
  padding: 2px 4px;
  color: var(--text);
}
input[type="text"]::placeholder { color: var(--faint); font-style: italic; }
input[type="range"] { accent-color: var(--accent); vertical-align: middle; }

/* ---------- Sequence/color preview ---------- */
#sequence {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin: 8px 0;
  /* override any grid from index.html */
  grid-template-columns: unset !important;
}

/* Individual swatch cells */
#sequence > div {
  width: 44px !important;
  height: 44px !important;
  border-radius: 0 !important;
  border: 1px solid var(--border) !important;
  display: flex;
  align-items: flex-end;
  padding: 2px;
}

/* Sequence number inside cell */
#sequence > div > div {
  font-size: 9px !important;
  color: rgba(255,255,255,0.75) !important;
  font-family: Courier New, monospace;
  mix-blend-mode: difference;
  text-shadow: none !important;
  text-align: left;
}

/* Log output */
#log {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border-left: 2px solid var(--faint);
  padding-left: 8px;
  line-height: 1.8;
}

.meta { font-size: 12px; color: var(--faint); font-style: italic; }

/* ---------- Controls layout (table-based in html is fine here) ---------- */
/* Let the index.html controls grid remain; just normalize font/appearance */
#controls {
  display: flex !important;
  flex-wrap: wrap;
  gap: 10px !important;
  grid-template-columns: unset !important;
}
#controls label {
  font-size: 14px;
  font-family: Times New Roman, Times, serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#controls span.meta {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Card (used for preview section) ---------- */
.card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.card:hover { transform: none; background: transparent; }
.card .icon { display: none; }
.card h2 { font-size: 20px; font-weight: bold; }
.card p   { font-size: 15px; color: var(--muted); }

/* grid around the preview section: remove card-grid styling */
.grid .container {
  display: block !important;
  grid-template-columns: unset !important;
}
.grid { padding: 0; }

/* ---------- CTA band ---------- */
.cta-band {
  padding: 14px 0;
  background: transparent;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.cta-band h2 {
  font-size: 17px;
  font-weight: normal;
  font-style: italic;
  letter-spacing: normal;
  text-align: left;
  display: inline;
}
.cta-band .actions {
  display: inline;
  margin-top: 0;
}
.cta-band a.btn {
  font-size: 14px;
  margin-left: 10px;
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 10px 0 24px;
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  display: block;
}

/* Repeated nav at footer — inline dot-separated list */
footer #primaryNav {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
footer #primaryNav li { display: inline; margin: 0; }
footer #primaryNav li::after { content: " · "; color: var(--faint); }
footer #primaryNav li:last-child::after { content: ""; }
footer #primaryNav a { font-size: 13px; color: var(--muted); text-decoration: underline; }
footer #primaryNav a:hover { color: var(--link-hover); }
footer .subnavbtn { display: none; }
footer .subnav-content { display: contents; }
footer .subnav-content a { font-size: 13px; color: var(--muted); }

.footer-meta { font-size: 12px; color: var(--faint); margin-top: 4px; }

/* ---------- Proof/bullets section ---------- */
.proof { padding: 0 0 14px; }
.proof .bullets { display: block; }
.proof .bullets li {
  list-style: disc;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Grid-score / table components ---------- */
.grid-score {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 120px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: center;
}
.cell.small  { font-size: 12px; }
.cell.title  { font-size: 18px; font-weight: bold; }
.cell.empty  { background: transparent; }

.table-thin { border-collapse: collapse; width: 100%; font-size: 14px; }
.table-thin th, .table-thin td {
  border: 1px solid var(--border);
  padding: 5px 8px;
  text-align: left;
  font-weight: normal;
}
.table-thin th { border-bottom-width: 2px; font-weight: bold; }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
hr.sep { border: 0; height: 1px; background: var(--border); margin: 12px 0; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .page-wrap { flex-direction: column; }
  .navbar, header {
    width: 100%;
    min-height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }
  #primaryNav {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    gap: 0;
  }
  #primaryNav li { display: inline; }
  #primaryNav li::after { content: " · "; color: var(--faint); }
  #primaryNav li:last-child::after { content: ""; }
  main { padding: 10px 12px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
