/* Andy Wright School of Leadership — site styles.
   Brand tokens match the Brand Kit Brief v1. Change a color here and the whole site follows. */

:root {
  --ink: #1D2B36;        /* Plat Ink: text, headings, primary buttons */
  --vellum: #ECEFEA;     /* Vellum: page background, cool drafting paper */
  --paper: #FFFFFF;      /* inputs and raised surfaces */
  --lamp: #C2801F;       /* Lamplight: the lit window, progress, focus */
  --lamp-deep: #8A5410;  /* Lamplight Deep: links and accents in text */
  --survey: #9AABB4;     /* Survey Line: plat lines, borders */
  --rule: #C7D0D4;       /* hairlines between sections */
  --sage: #56704F;       /* Desert Sage: finished */
  --night: #13212B;      /* Night Plat: the video stage */
  --muted: #5B6B75;      /* secondary text */
  --on-night: #ECEFEA;
  --error: #9B2C1F;

  --serif: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 36rem;
  --wide: 60rem;
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #E6EAE5;
    --vellum: #13212B;
    --paper: #1B2D39;
    --lamp: #D9963A;
    --lamp-deep: #E8B160;
    --survey: #4D6270;
    --rule: #2C3F4B;
    --sage: #8FB088;
    --night: #0B151C;
    --muted: #A9B6BD;
    --on-night: #E6EAE5;
    --error: #F08B7B;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #E6EAE5;
  --vellum: #13212B;
  --paper: #1B2D39;
  --lamp: #D9963A;
  --lamp-deep: #E8B160;
  --survey: #4D6270;
  --rule: #2C3F4B;
  --sage: #8FB088;
  --night: #0B151C;
  --muted: #A9B6BD;
  --on-night: #E6EAE5;
  --error: #F08B7B;
  color-scheme: dark;
}

/* Text size: three steps, chosen in the header and remembered on this device. */
html { font-size: 125%; -webkit-text-size-adjust: 100%; }
html[data-size="larger"] { font-size: 140%; }
html[data-size="largest"] { font-size: 160%; }
@media (max-width: 40rem) {
  html { font-size: 112.5%; }
  html[data-size="larger"] { font-size: 125%; }
  html[data-size="largest"] { font-size: 140%; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--vellum);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; display: block; }
a { color: var(--lamp-deep); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--lamp); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }
cite { font-style: italic; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 1rem; z-index: 10; }

/* ---------- masthead ---------- */
.masthead {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem;
  padding-block: 0.9rem;
  padding-left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--rule);
}
.lockup { display: flex; align-items: center; gap: 0.7rem; color: var(--ink); text-decoration: none; }
.lockup svg { width: 2.4rem; height: 2.4rem; flex: none; }
.lockup-name { display: flex; flex-direction: column; line-height: 1.1; }
.lockup-name b { font-family: var(--serif); font-weight: 400; font-size: 1.25rem; }
.lockup-name span { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.02em; }
.mast-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.2rem; }
.mast-nav a, .linklike {
  color: var(--ink); font: inherit; font-size: 0.9rem; background: none; border: 0; padding: 0.3rem 0;
  cursor: pointer; text-decoration: none; border-bottom: 2px solid transparent;
}
.mast-nav a[aria-current="page"] { border-bottom-color: var(--lamp); }
.mast-nav a:hover, .linklike:hover { border-bottom-color: var(--survey); }
.textsize { display: inline-flex; align-items: center; gap: 0.15rem; font-size: 0.85rem; color: var(--muted); }
.textsize button {
  font: inherit; color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: var(--radius);
  min-width: 2.4rem; min-height: 2.2rem; cursor: pointer; padding: 0 0.4rem;
}
.textsize button:nth-of-type(2) { font-size: 1.1em; }
.textsize button:nth-of-type(3) { font-size: 1.25em; }
.textsize button[aria-pressed="true"] { border-color: var(--ink); background: var(--paper); }
.textsize .label { margin-right: 0.35rem; }

main {
  display: block;
  padding-block: clamp(1.5rem, 5vw, 3.5rem) 4rem;
  padding-left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-right, 0px));
}
main:focus, [tabindex="-1"]:focus { outline: none; }
.loading { color: var(--muted); }

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; padding: 0.6rem 1.4rem; border-radius: var(--radius);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  background: var(--ink); color: var(--vellum); border: 2px solid var(--ink);
}
.btn:hover { background: var(--night); border-color: var(--night); color: var(--on-night); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--survey); }
.btn-quiet:hover { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.btn-lamp { background: var(--lamp); border-color: var(--lamp); color: #1D2B36; }
.btn-lamp:hover { background: #D9963A; border-color: #D9963A; color: #1D2B36; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.field { display: grid; gap: 0.35rem; margin-bottom: 1.1rem; }
.field label { font-weight: 600; }
.field .hint { font-size: 0.85rem; color: var(--muted); margin: 0; }
input[type="text"], input[type="tel"], input[type="email"], select, textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--survey); border-radius: var(--radius);
  padding: 0.65rem 0.8rem; width: 100%; min-height: 3rem;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: 3px solid var(--lamp); outline-offset: 0; }
.field.has-error input { border-color: var(--error); }
.field-error { color: var(--error); font-size: 0.9rem; margin: 0; }
.form-error { color: var(--error); font-weight: 600; }

/* ---------- sign in: the plat beside the door ---------- */
.signin {
  max-width: var(--wide); margin: 0 auto;
  display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: start;
}
@media (min-width: 52rem) { .signin { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); } }
.signin h1 {
  font-family: var(--serif); font-size: clamp(2.2rem, 5.5vw, 3.4rem); line-height: 1.08;
  letter-spacing: -0.01em; margin-bottom: 1.2rem;
}
.lede { font-size: 1.1rem; max-width: 30rem; margin-bottom: 2rem; }
.signin form { max-width: 26rem; }
.phone-row { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr); gap: 0.5rem; }
.phone-row select { min-width: 0; }
.signin .fine { font-size: 0.88rem; color: var(--muted); max-width: 26rem; margin-top: 1.2rem; }
.kicker {
  font-family: var(--serif); font-style: italic; font-size: 1.3rem; color: var(--sage);
  margin: 0 0 1.4rem; padding-top: 1.1rem; position: relative;
}
.kicker::before { content: ""; position: absolute; left: 0.1rem; top: 0; width: 7rem; height: 4px; background: var(--survey); }
.plat { margin: 0; }
/* The plat sits on a Night Plat card, like the video title cards: the drawing reads its colors from these. */
.plat-card {
  background: var(--night); border-radius: 10px; padding: clamp(0.75rem, 2.5vw, 1.4rem); max-width: 32rem;
  --ink: #ECEFEA; --vellum: var(--night); --survey: #4D6270; --muted: #9AABB4; --lamp-deep: #9AABB4; --lamp: #C2801F;
}
.plat-drawing { width: 100%; }
.plat-card .plat-house { fill: #26394A; }
.plat-card .plat-lot { fill-opacity: 0; }
.plat figcaption {
  font-family: var(--serif); font-style: italic; font-size: 0.95rem; color: var(--muted);
  max-width: 30rem; margin-top: 0.8rem; line-height: 1.5;
}

/* ---------- course: the lots ---------- */
.course { max-width: var(--wide); margin: 0 auto; }
.course > h1 { font-family: var(--serif); font-size: clamp(1.9rem, 4.5vw, 2.6rem); margin-bottom: 1.5rem; }
.resume {
  background: var(--night); color: var(--on-night); border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2rem); display: grid; gap: 0.6rem; margin-bottom: 2.2rem;
}
.resume p { margin: 0; color: #B8C4CA; }
.resume h2 { font-family: var(--serif); font-size: clamp(1.4rem, 3.5vw, 1.9rem); line-height: 1.2; }
.resume .btn { justify-self: start; margin-top: 0.6rem; }

.lots-wrap { margin-bottom: 2.2rem; }
.lots-wrap p { margin-bottom: 0.7rem; }
.lots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr)); gap: 0.35rem; max-width: 40rem; }
.lot {
  display: grid; place-items: center; aspect-ratio: 1; border: 1.5px solid var(--survey);
  border-radius: 2px; font-size: 0.8rem; color: var(--muted); text-decoration: none; position: relative;
}
a.lot:hover { border-color: var(--ink); color: var(--ink); }
.lot[data-status="started"] { border-color: var(--lamp-deep); border-width: 2.5px; color: var(--ink); }
.lot[data-status="finished"] { background: var(--ink); border-color: var(--ink); color: transparent; }
.lot[data-status="finished"]::after {
  content: ""; position: absolute; width: 34%; height: 34%; background: var(--lamp);
}
.lot-key { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.85rem; color: var(--muted); margin-top: 0.7rem; }
.lot-key span { display: inline-flex; align-items: center; gap: 0.4rem; }
.lot-key i { display: inline-block; width: 0.9rem; height: 0.9rem; border: 1.5px solid var(--survey); position: relative; }
.lot-key i.started { border: 2.5px solid var(--lamp-deep); }
.lot-key i.finished { background: var(--ink); border-color: var(--ink); }
.lot-key i.finished::after { content: ""; position: absolute; inset: 30%; background: var(--lamp); }

.jump { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-bottom: 2.6rem; max-width: 40rem; }
.jump .field { flex: 1 1 18rem; margin: 0; }

.section-title { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 0.8rem; }
.module-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.module-list li { border-bottom: 1px solid var(--rule); }
.module-list a {
  display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); column-gap: 1rem; row-gap: 0.15rem;
  padding: 1rem 0.25rem; color: var(--ink); text-decoration: none;
}
.module-list a:hover { background: color-mix(in srgb, var(--paper) 60%, transparent); }
.module-list .lot { grid-row: 1 / span 3; width: 2.6rem; }
.ml-title { font-family: var(--serif); font-size: 1.2rem; line-height: 1.3; }
.ml-meta { font-size: 0.88rem; color: var(--muted); }
.ml-epi { font-family: var(--serif); font-style: italic; font-size: 0.92rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- module page ---------- */
.module { max-width: var(--wide); margin: 0 auto; }
.module-bar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-bottom: 2rem; }
.module-bar .field { flex: 1 1 20rem; margin: 0; max-width: 34rem; }
.module-head { margin-bottom: 1.6rem; max-width: 46rem; }
.module-num { color: var(--muted); margin-bottom: 0.3rem; }
.module-head h1 { font-family: var(--serif); font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin-bottom: 1rem; }
.epigraph { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.05rem; line-height: 1.55; color: var(--ink); max-width: var(--measure); }
.epigraph cite { display: block; font-style: normal; font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; font-family: var(--sans); }

.stage { background: var(--night); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; position: relative; }
.stage video { width: 100%; height: 100%; display: block; background: var(--night); }
.stage-wait {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 0.8rem;
  text-align: center; color: var(--on-night); padding: 1.5rem;
}
.stage-wait svg { width: 3.4rem; height: 3.4rem; }
.stage-wait h2 { font-family: var(--serif); font-size: clamp(1.3rem, 3.4vw, 2rem); }
.stage-wait p { margin: 0; color: #B8C4CA; max-width: 28rem; }
.stage-wait .btn { margin-top: 0.4rem; }
.resume-note { font-size: 0.9rem; color: var(--muted); margin: 0.6rem 0 0; min-height: 1.4em; }
.video-credit { font-size: 0.85rem; color: var(--muted); margin: 0.2rem 0 0; }

.module-actions {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.8rem;
  margin: 1.2rem 0 3rem; padding-bottom: 1.6rem; border-bottom: 1px solid var(--rule);
}
.module-actions .middle { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.done-flag { color: var(--sage); font-weight: 600; }

.notes { max-width: 42rem; }
.notes section { margin-bottom: 2.6rem; }
.notes h2 { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 0.8rem; }
.notes ul, .notes ol { padding-left: 1.3rem; margin: 0; }
.notes li { margin-bottom: 0.55rem; padding-left: 0.2rem; }
.key-lines { display: grid; gap: 1rem; }
.key-lines blockquote {
  margin: 0; padding: 0.15rem 0 0.15rem 1.1rem; border-left: 3px solid var(--lamp);
  font-family: var(--serif); font-size: 1.12rem; line-height: 1.55;
}
.practice { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.2rem 1.4rem; }
.practice h2 { font-size: 1.25rem; }
.practice p { margin: 0; }
.my-note { margin-top: 1.4rem; }
.save-state { font-size: 0.85rem; color: var(--muted); margin: 0.35rem 0 0; min-height: 1.3em; }

details.chapter { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 2.4rem; }
details.chapter summary {
  cursor: pointer; padding: 1rem 0; font-family: var(--serif); font-size: 1.35rem; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
details.chapter summary::-webkit-details-marker { display: none; }
details.chapter summary::after { content: "+"; font-family: var(--sans); font-size: 1.4rem; color: var(--muted); }
details.chapter[open] summary::after { content: "−"; }
.chapter-text { font-family: var(--serif); font-size: 1.08rem; line-height: 1.75; padding-bottom: 1.6rem; max-width: var(--measure); }
.chapter-text p { margin-bottom: 0.9em; }
.chapter-text .emph { font-weight: 700; }
.chapter-text .scripture { font-style: italic; text-align: center; margin: 1.4em auto; max-width: 30rem; }
.chapter-text .divider { text-align: center; color: var(--survey); letter-spacing: 0.6em; margin: 1.6em 0; }
.chapter-text h3 { font-size: 1.15rem; font-weight: 700; margin: 1.6em 0 0.6em; }

/* ---------- talk to Andy ---------- */
.talk { max-width: 44rem; margin: 0 auto; }
.talk h1 { font-family: var(--serif); font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 0.8rem; }
.disclosure { border-left: 3px solid var(--survey); padding-left: 1rem; color: var(--muted); margin-bottom: 1.8rem; }
.starters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.starters button {
  font: inherit; font-size: 0.92rem; text-align: left; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.6rem 0.9rem; cursor: pointer; min-height: 2.75rem;
}
.starters button:hover { border-color: var(--ink); }
.thread { list-style: none; margin: 0 0 1.6rem; padding: 0; display: grid; gap: 1.2rem; }
.thread li { max-width: 38rem; }
.thread .from { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.2rem; }
.thread .me { justify-self: end; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.7rem 1rem; }
.thread .andy .body { font-family: var(--serif); font-size: 1.08rem; line-height: 1.7; }
.thread .andy .body p { margin-bottom: 0.8em; }
.thread .pending .body { color: var(--muted); font-family: var(--sans); font-style: italic; }
.ask { display: grid; gap: 0.6rem; padding: 1rem 0 0; border-top: 1px solid var(--rule); }
.ask .row { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.ask textarea { min-height: 5rem; }
.talk-off { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.2rem 1.4rem; }

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--rule); font-size: 0.85rem; color: var(--muted);
  padding-block: 1.5rem 2.5rem;
  padding-left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-right, 0px));
}
.foot p { margin: 0 0 0.3rem; max-width: 46rem; }

/* ---------- admin (server-rendered) ---------- */
.admin-main { max-width: 80rem; margin: 0 auto; }
.admin-main h1 { font-family: var(--serif); font-size: 2rem; margin-bottom: 1rem; }
.admin-main h2 { font-family: var(--serif); font-size: 1.4rem; margin: 2rem 0 0.8rem; }
.table-wrap { overflow-x: auto; }
.admin table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
.admin th, .admin td { text-align: left; vertical-align: top; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--rule); }
.admin th { font-weight: 700; }

@media (prefers-reduced-motion: no-preference) {
  .lot, .btn { transition: background-color 0.15s, border-color 0.15s; }
}
