/* Aliyah Readiness Score - styles
   Palette: paper #FFFFFF, ground #F3F5F2, ink #1B2A3A, sea #21667F, sand #C79B3B, mist #6B7785, line #D9DEDA
   Type: Fraunces for display, Public Sans for everything else. */

:root {
  --paper: #FFFFFF;
  --ground: #F3F5F2;
  --ink: #1B2A3A;
  --sea: #21667F;
  --sea-deep: #174A5C;
  --sand: #C79B3B;
  --mist: #6B7785;
  --line: #D9DEDA;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --measure: 62ch;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
}
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); max-width: 18ch; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); max-width: 22ch; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; max-width: var(--measure); }
a { color: var(--sea); }

.masthead {
  padding: 1.25rem 1.5rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.5rem;
}
.brand {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.brand-line { color: var(--mist); font-size: 0.875rem; margin: 0; max-width: none; }

.app { padding: 2.5rem 1.5rem 3rem; max-width: 64rem; margin: 0 auto; }
.view[hidden] { display: none; }

/* Intro */
.view-intro .lede { font-size: 1.15rem; }
.view-intro .quiet { color: var(--mist); }
.fine { font-size: 0.875rem; color: var(--mist); }
.view-intro .fine { margin-top: 1.25rem; }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 6px;
  padding: 0.7rem 1.3rem;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
a.btn { text-decoration: none; display: inline-block; }
.btn:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }
.btn-primary { background: var(--sea); color: var(--paper); }
.btn-primary:hover { background: var(--sea-deep); }
.btn-primary:disabled { background: var(--line); color: var(--mist); cursor: not-allowed; }
.btn-quiet { background: transparent; color: var(--sea); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--sea); }
.btn-link { background: transparent; color: var(--sea); padding-left: 0; padding-right: 0; border: 0; text-decoration: underline; }

/* Quiz layout: rail on the left, stage on the right */
.view-quiz { display: grid; grid-template-columns: 15rem 1fr; gap: 3rem; }
.rail ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.rail li {
  position: relative;
  padding: 0.45rem 0 0.45rem 1.1rem;
  color: var(--mist);
  font-size: 0.95rem;
}
.rail li::before {
  content: "";
  position: absolute;
  left: -6px; top: 0.85rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
}
.rail li.done { color: var(--ink); }
.rail li.done::before { background: var(--sea); border-color: var(--sea); }
.rail li.current { color: var(--ink); font-weight: 600; }
.rail li.current::before { border-color: var(--sea); background: var(--paper); box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 5px var(--sea); }

.progress { color: var(--mist); font-size: 0.9rem; margin-bottom: 0.75rem; }
.question { border: 0; padding: 0; margin: 0 0 1.5rem; min-width: 0; }
.question legend {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  font-weight: 600;
  line-height: 1.25;
  max-width: 28ch;
  margin-bottom: 0.5rem;
  padding: 0;
}
.help { color: var(--mist); font-size: 0.95rem; }
.options { display: grid; gap: 0.6rem; max-width: min(40rem, 100%); margin-top: 1rem; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  background: var(--paper);
}
.option:hover { border-color: var(--sea); }
.option input { margin-top: 0.3rem; accent-color: var(--sea); flex: none; }
.option span { min-width: 0; overflow-wrap: anywhere; }
.option.selected { border-color: var(--sea); background: var(--ground); }
.option:focus-within { outline: 3px solid var(--sand); outline-offset: 2px; }
.stage { min-width: 0; }
.stage-actions { display: flex; gap: 0.75rem; align-items: center; }

/* Result */
.notice {
  border-left: 4px solid var(--sand);
  background: var(--ground);
  padding: 0.9rem 1rem;
  margin: 0 0 1.25rem;
  max-width: var(--measure);
}
.profile { display: grid; gap: 0.9rem; max-width: 44rem; margin: 1.5rem 0 1rem; }
.bar { display: grid; grid-template-columns: 12rem 1fr 3rem; align-items: center; gap: 0.75rem; }
.bar-name { font-size: 0.95rem; }
.bar-track { height: 12px; background: var(--ground); border-radius: 6px; overflow: hidden; }
.bar-fill {
  height: 100%;
  background: var(--sea);
  border-radius: 6px;
  width: 0;
  transition: width 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bar.weak .bar-fill { background: var(--sand); }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--mist); font-size: 0.9rem; }

.total { margin: 0.5rem 0 2rem; }
.total-num { font-family: var(--display); font-size: 3rem; font-weight: 600; color: var(--ink); line-height: 1; }
.total-label { color: var(--mist); }

.next ol { padding-left: 1.2rem; max-width: var(--measure); }
.next li { margin-bottom: 0.6rem; }
.ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 2rem; }
.share { border-top: 1px solid var(--line); padding-top: 1rem; margin-bottom: 1.5rem; max-width: var(--measure); }
.share summary { cursor: pointer; color: var(--sea); font-weight: 600; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; margin: 0.75rem 0; font-size: 0.95rem; }
.check input { margin-top: 0.3rem; accent-color: var(--sea); }

.foot { padding: 1.5rem; border-top: 1px solid var(--line); }
.foot p { font-size: 0.85rem; color: var(--mist); max-width: 80ch; margin: 0 auto; }

@media (max-width: 720px) {
  .app { padding: 1.75rem 1.1rem 2.5rem; }
  .view-quiz { grid-template-columns: 1fr; gap: 1.25rem; }
  .rail ol { border-left: 0; display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; }
  .rail li { padding: 0.25rem 0.55rem; font-size: 0.8rem; white-space: nowrap; border-radius: 999px; background: var(--ground); }
  .rail li::before { display: none; }
  .rail li.current { background: var(--sea); color: var(--paper); }
  .rail li.done { background: var(--line); }
  .bar { grid-template-columns: 1fr 3rem; }
  .bar-name { grid-column: 1 / -1; margin-bottom: -0.4rem; }
  .bar-track { grid-column: 1; }
  .bar-val { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill, .btn { transition: none; }
}
