/* busysteve.com
   Edit colors here. Everything else picks these up.
   Page text lives in the HTML files. The menu lives in js/site.js.
*/

:root {
  --bg: #241416;
  --bg-2: #1a0e10;
  --surface: #342024;
  --surface-2: #432c30;
  --paper: #f6f0ea;
  --paper-ink: #2c1818;
  --line: rgba(232, 180, 174, 0.28);
  --text: #f7ece8;
  --muted: #d2b5ae;
  --accent: #c96b6b;
  --accent-2: #e7b2a8;
  --hot: #8d4048;
  --link: #f0c2ba;
  --link-hover: #ffe8e2;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, "Noto Serif", "DejaVu Serif", serif;
  --sans: "Avenir Next", "Segoe UI", "Nimbus Sans", "DejaVu Sans", sans-serif;
  --max: 42rem;
  --wide: 76rem;
  --pad: 1.15rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.65;
  background:
    radial-gradient(1100px 520px at 8% -10%, #4e282c 0%, transparent 58%),
    radial-gradient(800px 420px at 110% 0%, #3a1c24 0%, transparent 52%),
    var(--bg);
}

::selection { background: var(--hot); color: #fff; }

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

a { color: var(--link); text-underline-offset: 0.16em; }
a:hover { color: var(--link-hover); }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.wrap {
  width: min(calc(100% - 2 * var(--pad)), var(--max));
  margin: 0 auto;
  padding: 1.4rem 0 3.5rem;
}

.wrap.wide,
.wrap.tool {
  width: min(calc(100% - 1.5rem), var(--wide));
}

h1, h2, h3 {
  font-weight: 560;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h1 { font-size: clamp(1.9rem, 5vw, 2.7rem); margin: 0 0 0.8rem; }
h2 { font-size: 1.45rem; margin: 2rem 0 0.7rem; }
h3 { font-size: 1.15rem; margin: 1.4rem 0 0.4rem; }

p { margin: 0 0 1rem; }

.lead { font-size: 1.15rem; }
.muted { color: var(--muted); }
.by { color: var(--muted); font-style: italic; }
.hint { color: var(--muted); font-family: var(--sans); font-size: 0.95rem; }

.gk, .he, .orig {
  font-family: "Noto Serif", "Noto Serif Hebrew", "DejaVu Serif", "Times New Roman", Palatino, serif;
  font-size: 1.28rem;
  line-height: 1.45;
}

.verse {
  margin: 1.5rem 0 2rem;
  padding: 1rem 1.1rem 0.4rem;
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 14px 14px 0;
}

.verse .ref {
  margin: 0 0 0.35rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}

/* Header and menu. Markup is built in js/site.js. */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(26, 14, 16, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.bar {
  width: min(calc(100% - 1.5rem), var(--wide));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.4rem;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-size: 1.35rem;
  font-style: italic;
  letter-spacing: -0.02em;
}

.brand span { color: var(--accent-2); font-style: italic; }
.brand:hover { color: var(--text); }

.nav-toggle {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
}

#menu {
  width: min(calc(100% - 1.5rem), var(--wide));
  margin: 0 auto;
  display: none;
  padding: 0 0 0.9rem;
}

.nav-open #menu {
  display: block;
  flex: 1 0 100%;
  padding-bottom: 0.8rem;
}

#menu a,
.group-btn {
  font-family: var(--sans);
  font-size: 0.98rem;
  color: var(--text);
  text-decoration: none;
}

#menu > a,
.group-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.4rem;
  min-height: 44px;
  cursor: pointer;
}

#menu > a:hover,
.group-btn:hover,
#menu a[aria-current="page"] {
  color: var(--link-hover);
  background: rgba(255, 255, 255, 0.04);
}

.group-links {
  display: none;
  padding: 0 0 0.4rem 0.8rem;
}

.group.open .group-links { display: block; }

.group-links a {
  display: block;
  padding: 0.4rem 0.3rem;
  min-height: 40px;
  color: var(--muted);
}

.group-links a:hover,
.group-links a[aria-current="page"] { color: var(--link-hover); }

.site-foot {
  width: min(calc(100% - 2 * var(--pad)), var(--max));
  margin: 0 auto;
  padding: 0 0 2rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
}

@media (min-width: 960px) {
  .nav-toggle { display: none; }

  .bar {
    justify-content: flex-start;
    gap: 1rem;
  }

  #menu {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    width: auto;
    margin: 0 0 0 auto;
    padding: 0;
  }

  #menu > a,
  .group-btn {
    width: auto;
    min-height: 0;
    padding: 0.35rem 0.55rem;
    white-space: nowrap;
  }

  .group { position: relative; }

  .group-links {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    min-width: 16rem;
    max-height: 70vh;
    overflow: auto;
    padding: 0.4rem;
    background: #2c181c;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
  }

  .group:hover .group-links,
  .group:focus-within .group-links,
  .group.open .group-links { display: block; }
}

@media (max-width: 959px) {
  .group:hover .group-links { display: none; }
  .group.open .group-links { display: block; }
}

/* Home and index cards */

.link-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.link-cards a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 44px;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.link-cards a span {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.92rem;
}

.link-cards a:hover { border-color: var(--accent); color: var(--text); }

@media (min-width: 720px) {
  .link-cards { grid-template-columns: 1fr 1fr; }
}

/* Reading pages */

.link-list { padding-left: 1.15rem; }
.link-list li { margin: 0.4rem 0; }

.prose li { margin: 0.2rem 0; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.2rem; }

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.paradigm {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.paradigm th,
.paradigm td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.paradigm th {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent-2);
  background: #3c262a;
}

.paradigm td { background: #2e1c20; }
.paradigm tbody tr:nth-child(even) td { background: #382428; }
.paradigm .gk { font-size: 1.15rem; }

.note {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.88rem;
}

/* Poems */

.poem .stanza { margin: 0 0 1.15rem; }
.poem .line { margin: 0; }

/* About: photos and music */

.gallery {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.gallery figure { margin: 0; }

.gallery a {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

.gallery img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.gallery figcaption {
  margin-top: 0.35rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8rem;
  line-height: 1.35;
}

.tracks { list-style: none; padding: 0; margin: 0 0 1.2rem; }

.tracks li {
  margin: 0 0 0.9rem;
  padding: 0.8rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.tracks audio { width: 100%; margin-top: 0.45rem; }

/* Forms, buttons, tools */

button, input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
}

select option { background: var(--surface-2); color: var(--text); }
select option:checked { background: var(--hot); color: #fff8f6; }

button, .keybtn {
  cursor: pointer;
  min-height: 44px;
}

button:hover, .keybtn:hover { border-color: var(--accent-2); }

.tool h1 { margin-top: 0.2rem; }
.tool select, .tool input[type="text"], .tool textarea { max-width: 100%; }
.tool textarea { width: min(100%, 42rem); }
.tool canvas { max-width: 100%; height: auto; background: var(--paper); border-radius: 8px; }
.tool table { color: inherit; }

/* Slingshot fields are "input" then a plain-text label. Keep the label on its own line. */
.tool form input[type="text"] {
  display: block;
  width: min(100%, 12rem);
  margin: 0.9rem 0 0.15rem;
}
.tool form select { display: block; width: min(100%, 22rem); margin: 0.6rem 0; }
.tool form button { margin: 0.45rem 0.4rem 0.45rem 0; }

.rows { display: grid; gap: 0.4rem; margin: 0.6rem 0 1rem; }
.row-label {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.chord-row, .key-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.keybtn {
  padding: 0.55rem 0.15rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 1.05rem;
}

.keybtn.go {
  background: var(--hot);
  border-color: #b56a70;
  color: #fff8f6;
}

.fields label {
  display: block;
  margin: 0 0 0.7rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--muted);
}

.fields input, .fields select { width: min(100%, 28rem); display: block; margin-top: 0.25rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0 1rem; }

#fretboardBlock, #progdiv {
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 14px;
  padding: 0.6rem;
  margin: 0.8rem 0;
  overflow-x: auto;
}

.workout {
  margin: 0;
  padding-left: 1.2rem;
}

.workout li { margin: 0.35rem 0; font-size: 1.2rem; }

/* Flash cards. The quiz script still writes into #myTable. */

#myTable {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.4rem 0.7rem 0.9rem;
  border-collapse: separate;
}

#myTable,
#myTable > tbody,
#myTable > tr,
#myTable > tbody > tr { display: block; width: 100%; }

#myTable > tr > td,
#myTable > tbody > tr > td {
  display: block;
  width: auto !important;
  border: 0;
  background: transparent;
  padding: 0.35rem 0.2rem;
  color: var(--text);
}

#myTable img[src*="logo"] { display: none; }
a[href*="busysteve.com/site"] { display: none; }
#myTable td:empty { display: none; }

#myTable select { max-width: 100%; margin: 0.25rem 0.4rem 0.25rem 0; }
#myTable select[multiple] { min-height: 7.5rem; width: min(100%, 16rem); }

font.flashcard, .flashcard {
  font-family: var(--serif) !important;
  font-size: clamp(2rem, 7vw, 3.3rem) !important;
  line-height: 1.25;
  color: var(--text);
}

#myTable table { width: 100%; border-collapse: collapse; }
#myTable table tr { background: #342024 !important; color: var(--text) !important; }
#myTable table td { color: var(--text) !important; background: transparent !important; border: 0; }

#myTable u a {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--hot);
  color: #fff;
  text-decoration: none;
}

.study-links { font-family: var(--sans); font-size: 0.92rem; }

/* Legacy pages that still carry the old class names */

.outer, .inner, .innermost {
  background: transparent !important;
  border: 0 !important;
  color: inherit;
}

@media (max-width: 720px) {
  .tool table,
  .tool tbody,
  .tool tr,
  .tool td {
    display: block;
    width: 100% !important;
  }

  .tool select { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
