/* ============================================================
   WatchWorks Academy — shared stylesheet
   ============================================================ */
:root {
  --bg: #10141c;
  --bg-soft: #171d28;
  --panel: #1e2634;
  --panel-2: #242e3f;
  --line: #33405556;
  --text: #e8ecf3;
  --text-dim: #a4afc0;
  --brass: #d4a24e;
  --brass-soft: #e6c88a;
  --steel: #7fa8d9;
  --ruby: #e05a6d;
  --ok: #5fc98e;
  --radius: 14px;
  --maxw: 980px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}
img, video { max-width: 100%; display: block; border-radius: 10px; }
a { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: #10141cf0;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 14px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 1.15rem; color: var(--brass-soft);
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo svg { flex: 0 0 auto; }
.header-spacer { flex: 1; }
.progress-pill {
  font-size: .8rem; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; background: var(--bg-soft);
  white-space: nowrap;
}
.progress-pill b { color: var(--brass); }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 90px; }
.module-part {
  color: var(--brass); font-size: .8rem; letter-spacing: .12em;
  text-transform: uppercase; margin-bottom: 6px;
}
h1 { font-family: var(--serif); font-size: 2rem; line-height: 1.25; margin-bottom: 8px; }
.subtitle { color: var(--text-dim); font-size: 1.05rem; max-width: 46em; }
.meta-row { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--text-dim); }
.meta-row .chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; background: var(--bg-soft);
}

h2 {
  font-family: var(--serif); font-size: 1.45rem; margin: 44px 0 12px;
  padding-top: 10px; color: var(--brass-soft);
}
h3 { font-size: 1.08rem; margin: 24px 0 8px; }
p { margin: 10px 0; max-width: 52em; }
ul, ol { margin: 10px 0 10px 24px; max-width: 50em; }
li { margin: 5px 0; }
strong { color: #fff; }
em { color: var(--brass-soft); font-style: italic; }

/* ---------- Cards & boxes ---------- */
.card, .objectives, .keyterms, .bench-note, .step, .figure, .warn {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin: 18px 0;
}
.objectives { border-left: 4px solid var(--brass); }
.objectives h3 { margin-top: 0; color: var(--brass-soft); }
.keyterms { border-left: 4px solid var(--steel); }
.keyterms h3 { margin-top: 0; color: var(--steel); }
.keyterms dt { font-weight: 600; color: #fff; margin-top: 10px; }
.keyterms dd { color: var(--text-dim); margin-left: 0; }
.warn { border-left: 4px solid var(--ruby); }
.warn h3 { margin-top: 0; color: var(--ruby); }

/* Bench notes: paraphrased guidance from the classic repair manuals */
.bench-note { border-left: 4px solid var(--ok); background: #17211c; }
.bench-note .src { display: block; margin-top: 8px; font-size: .82rem; color: var(--ok); font-style: italic; }
.bench-note h3 { margin-top: 0; color: var(--ok); font-size: .95rem; letter-spacing: .06em; text-transform: uppercase; }

/* Steps */
.step { position: relative; padding-left: 64px; }
.step .n {
  position: absolute; left: 16px; top: 18px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brass); color: #10141c; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step h3 { margin-top: 0; }

/* Figures */
.figure { padding: 14px; }
.figure img, .figure video { margin: 0 auto; max-height: 460px; object-fit: contain; }
.figure figcaption { font-size: .85rem; color: var(--text-dim); margin-top: 10px; text-align: center; }
.figure figcaption a { color: var(--steel); }
.fig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .fig-row { grid-template-columns: 1fr; } }

/* Diagrams (inline SVG) */
.diagram { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 18px 0; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram .caption { font-size: .85rem; color: var(--text-dim); margin-top: 8px; text-align: center; }
.diagram .controls { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }

button, .btn {
  font: inherit; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px;
  transition: background .15s, transform .1s;
}
button:hover, .btn:hover { background: #2c3950; text-decoration: none; }
button:active { transform: scale(.97); }
.btn-primary { background: var(--brass); color: #10141c; font-weight: 600; border: none; }
.btn-primary:hover { background: var(--brass-soft); }

/* ---------- Quiz ---------- */
.quiz { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 30px 0; }
.quiz h2 { margin: 0 0 4px; padding: 0; }
.quiz .q { margin: 18px 0 8px; font-weight: 600; }
.quiz label {
  display: block; margin: 6px 0; padding: 10px 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer;
}
.quiz label:hover { border-color: var(--steel); }
.quiz label.correct { border-color: var(--ok); background: #17211c; }
.quiz label.wrong { border-color: var(--ruby); background: #241318; }
.quiz .why { font-size: .88rem; color: var(--text-dim); margin: 6px 0 0 4px; display: none; }
.quiz .why.show { display: block; }
.quiz-result { margin-top: 16px; font-weight: 600; }
.quiz-result.pass { color: var(--ok); }
.quiz-result.fail { color: var(--ruby); }

/* ---------- Module nav footer ---------- */
.module-nav {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 40px; border-top: 1px solid var(--line); padding-top: 22px;
}
.module-nav a {
  flex: 1; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px; color: var(--text);
}
.module-nav a:hover { border-color: var(--brass); text-decoration: none; }
.module-nav .dir { font-size: .75rem; color: var(--brass); letter-spacing: .1em; text-transform: uppercase; }
.module-nav .next { text-align: right; }

/* ---------- Index page ---------- */
.hero { text-align: center; padding: 46px 0 26px; }
.hero h1 { font-size: 2.5rem; }
.hero .subtitle { margin: 12px auto 0; }
.hero-stats { display: flex; gap: 22px; justify-content: center; margin-top: 22px; flex-wrap: wrap; color: var(--text-dim); font-size: .9rem; }
.hero-stats b { color: var(--brass); font-size: 1.3rem; display: block; font-family: var(--serif); }

.progress-bar-outer { max-width: 460px; margin: 26px auto 0; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; height: 14px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: linear-gradient(90deg, var(--brass), var(--brass-soft)); width: 0%; transition: width .6s; }
.progress-caption { text-align: center; color: var(--text-dim); font-size: .85rem; margin-top: 8px; }

.part-heading { margin-top: 40px; }
.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
@media (max-width: 760px) { .module-grid { grid-template-columns: 1fr; } }
.module-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; color: var(--text); display: block; position: relative;
}
.module-card:hover { border-color: var(--brass); text-decoration: none; transform: translateY(-2px); transition: transform .15s; }
.module-card .num { font-family: var(--serif); color: var(--brass); font-size: .85rem; }
.module-card h3 { margin: 4px 0 6px; font-size: 1.02rem; }
.module-card p { font-size: .86rem; color: var(--text-dim); margin: 0; }
.module-card .done-badge {
  position: absolute; top: 14px; right: 14px; color: var(--ok); font-size: 1.1rem;
}
.module-card .mins { font-size: .75rem; color: var(--text-dim); margin-top: 10px; display: block; }

/* ---------- Tutor agent ---------- */
.tutor-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--brass); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px #0009;
}
.tutor-fab:hover { background: var(--brass-soft); }
.tutor-panel {
  position: fixed; right: 22px; bottom: 94px; z-index: 60;
  width: min(380px, calc(100vw - 44px));
  height: min(520px, calc(100vh - 130px));
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 12px 40px #000c;
  display: none; flex-direction: column; overflow: hidden;
}
.tutor-panel.open { display: flex; }
.tutor-head {
  padding: 14px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.tutor-head .t { font-family: var(--serif); color: var(--brass-soft); }
.tutor-head .s { font-size: .75rem; color: var(--text-dim); }
.tutor-head button { margin-left: auto; padding: 2px 10px; }
.tutor-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tmsg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: .9rem; }
.tmsg.bot { background: var(--panel); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.tmsg.user { background: var(--brass); color: #10141c; align-self: flex-end; border-bottom-right-radius: 4px; }
.tmsg a { font-weight: 600; }
.tmsg .why-note { display: block; font-size: .8rem; color: var(--text-dim); margin-top: 6px; }
.tutor-chips { padding: 0 14px 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.tutor-chips button { font-size: .75rem; padding: 4px 10px; border-radius: 999px; }
.tutor-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--panel); }
.tutor-input input {
  flex: 1; font: inherit; font-size: .9rem; padding: 9px 13px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.tutor-input input:focus { border-color: var(--brass); }

/* ---------- Interaction map (capstone) ---------- */
.map-info {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-top: 12px; min-height: 110px;
}
.map-info h3 { margin-top: 0; color: var(--brass-soft); }
.map-hotspot { cursor: pointer; }
.map-hotspot:hover .hs-shape, .map-hotspot.active .hs-shape { stroke: var(--brass); stroke-width: 2.5; }
.map-hotspot text { pointer-events: none; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 60px;
  padding: 26px 20px 110px; color: var(--text-dim); font-size: .82rem;
}
.site-footer .inner { max-width: var(--maxw); margin: 0 auto; }
.site-footer p { margin: 6px 0; }

/* ---------- Misc ---------- */
.mark-complete-row { display: flex; align-items: center; gap: 14px; margin: 26px 0; flex-wrap: wrap; }
.complete-note { color: var(--ok); font-weight: 600; display: none; }
.complete-note.show { display: inline; }
.pathline { stroke-dasharray: 6 6; animation: dashflow 1.2s linear infinite; }
@keyframes dashflow { to { stroke-dashoffset: -12; } }
.small { font-size: .82rem; color: var(--text-dim); }
table { border-collapse: collapse; margin: 14px 0; width: 100%; max-width: 52em; font-size: .92rem; }
th, td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
th { background: var(--panel); color: var(--brass-soft); }
