/* Waterfront Day Shadow Prep Kit — Web App
   Mobile-first, iPad-optimised. Brand: cream / charcoal / violet. */

:root {
  --bg: #F5F2ED;
  --bg-elev: #FBF9F5;
  --text: #413b36;
  --text-muted: #7a716a;
  --accent: #7B2FF7;
  --accent-soft: #ede9fe;
  --rule: #C9B99A;
  --rule-soft: #e7dec9;
  --ok: #2f9e44;
  --danger: #c92a2a;
  --shadow: 0 1px 3px rgba(65, 59, 54, 0.08);
  --shadow-lg: 0 4px 16px rgba(65, 59, 54, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --font-head: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  padding-bottom: 96px; /* room for sticky footer */
}

/* ---------- Sticky top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 242, 237, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule-soft);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar img.logo { height: 40px; width: auto; display: block; }
.topbar-title {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.save-indicator {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-elev);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule-soft);
  transition: background 200ms, color 200ms, border-color 200ms;
  white-space: nowrap;
}
.save-indicator.flash {
  background: #d3f9d8;
  color: var(--ok);
  border-color: #b2f2bb;
}

/* ---------- Container ---------- */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 24px;
}

/* ---------- Hero / callout ---------- */
.hero {
  background: var(--bg-elev);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 18px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.hero h1 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 6px;
  color: var(--text);
}
.hero .meta {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 14px;
}
.callout {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 15px;
  color: var(--text);
}
.callout strong { color: var(--accent); }

/* ---------- Progress bar ---------- */
.progress {
  position: sticky;
  top: 60px;
  z-index: 40;
  background: rgba(245, 242, 237, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 13px;
  color: var(--text-muted);
}
.progress-track {
  height: 6px;
  background: var(--rule-soft);
  border-radius: 999px;
  margin-top: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 250ms ease;
}

/* ---------- TOC ---------- */
.toc {
  background: var(--bg-elev);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 14px 16px 8px;
  margin-bottom: 22px;
}
.toc h2 {
  font-family: var(--font-head);
  font-size: 16px;
  margin: 0 0 10px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
.toc li button {
  text-align: left;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.toc li button:hover { background: var(--accent-soft); }
.toc li button.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.toc .num {
  display: inline-block;
  min-width: 26px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 13px;
}
.toc li button.active .num { color: var(--accent); }
.toc .dot {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--rule);
}
.toc li button.filled .dot { background: var(--accent); border-color: var(--accent); }

/* ---------- Sections / accordion ---------- */
.section {
  margin-bottom: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.section-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-elev);
  cursor: pointer;
  user-select: none;
  border: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text);
  min-height: 64px;
}
.section-header:hover { background: #fff; }
.section-header .chev {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 6px;
  transition: transform 200ms ease;
  color: var(--accent);
}
.section.open .section-header .chev { transform: rotate(90deg); }
.section-header .title-wrap { flex: 1; min-width: 0; }
.section-header h2 {
  font-family: var(--font-head);
  font-size: 22px;
  margin: 0;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}
.section-header .num-label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}
.section-header .methodology {
  font-style: italic;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.section-header .filled-pill {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ok);
  background: #d3f9d8;
  border-radius: 999px;
  padding: 4px 8px;
  margin-top: 4px;
  display: none;
}
.section.has-answers .section-header .filled-pill { display: inline-block; }

.section-body {
  display: none;
  padding: 6px 18px 22px;
  border-top: 1px solid var(--rule-soft);
  background: var(--bg-elev);
}
.section.open .section-body { display: block; }

/* ---------- Form fields ---------- */
label.field {
  display: block;
  margin: 18px 0 8px;
  font-weight: 500;
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}
label.field .q-num {
  color: var(--accent);
  font-weight: 600;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
label.field .hint {
  display: block;
  font-weight: 400;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

input[type="text"], textarea, select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  font-size: 18px; /* iOS no-zoom */
  color: var(--text);
  min-height: 44px;
  transition: border-color 150ms, box-shadow 150ms;
}
textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(123, 47, 247, 0.15);
}

/* radio + checkbox groups */
.radio-group, .checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.radio-group label, .checkbox-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
  font-size: 16px;
  cursor: pointer;
  min-height: 44px;
  user-select: none;
}
.radio-group label:has(input:checked),
.checkbox-group label:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.radio-group input, .checkbox-group input {
  width: 20px; height: 20px;
  accent-color: var(--accent);
  margin: 0;
}

.scale-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  align-items: center;
}
.scale-row .scale-end {
  font-size: 13px;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.scale-row label {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
  min-width: 44px;
  min-height: 44px;
  font-size: 14px;
  cursor: pointer;
}
.scale-row label:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.scale-row label input { display: none; }

/* range slider */
.range-wrap { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.range-wrap input[type="range"] { flex: 1; accent-color: var(--accent); height: 44px; }
.range-wrap .range-val {
  min-width: 30px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
}
.range-ends {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* dropdown for ranking */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237B2FF7'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}

/* table-style worksheet rows */
.rows-wrap { margin-top: 8px; }
.row-card {
  background: #fff;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
  padding: 12px 12px 6px;
  margin-bottom: 10px;
  position: relative;
}
.row-card .row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.row-card .remove-row {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
}
.row-card .remove-row:hover { background: #ffe3e3; }
.row-card .row-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.row-card input[type="text"] { padding: 10px 12px; font-size: 16px; min-height: 40px; }
.add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--accent);
  border: 1.5px dashed var(--accent);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  margin-top: 4px;
  min-height: 44px;
}
.add-row-btn:hover { background: var(--accent-soft); }

/* divider between sub-blocks */
.sub-block {
  padding: 14px 0;
  border-top: 1px solid var(--rule-soft);
  margin-top: 8px;
}
.sub-block:first-of-type { border-top: none; margin-top: 0; }
.sub-block h3 {
  font-family: var(--font-head);
  font-size: 18px;
  margin: 0 0 6px;
  color: var(--text);
  font-weight: 600;
}
.sub-block .lead {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.info {
  font-size: 14px;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 10px 0;
  line-height: 1.5;
}
.info code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  min-height: 44px;
  transition: background 150ms, transform 80ms;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #6822d4; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  background: #fff;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-secondary:hover { background: var(--accent-soft); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--rule-soft);
}
.btn-ghost:hover { color: var(--text); border-color: var(--rule); }
.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: #ffe3e3; }

.export-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 8px;
}

/* ---------- Sticky bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(245, 242, 237, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--rule-soft);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.bottom-nav .btn { flex: 1; padding: 12px 10px; font-size: 15px; }

/* ---------- Footer ---------- */
footer {
  margin-top: 30px;
  padding: 24px 0 12px;
  border-top: 1px solid var(--rule-soft);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}
.reset-wrap { text-align: center; margin: 20px 0; }

/* ---------- Responsive ---------- */
@media (min-width: 820px) {
  .container { padding: 24px 24px 24px; max-width: 880px; }
  .toc ol { grid-template-columns: 1fr 1fr; }
  .row-card .row-fields { grid-template-columns: 1fr 1fr; }
  .row-card .row-fields .full { grid-column: 1 / -1; }
  .topbar-title { font-size: 19px; }
  .section-header h2 { font-size: 24px; }
}

@media (min-width: 1100px) {
  .container { max-width: 980px; }
}

/* Print mode (nice-to-have) */
@media print {
  .topbar, .progress, .bottom-nav, .add-row-btn, .reset-wrap, .export-row, .toc { display: none !important; }
  .section { break-inside: avoid; box-shadow: none; border-color: #ccc; }
  .section-body { display: block !important; }
  body { background: #fff; padding: 0; }
  .container { max-width: 100%; padding: 0 20px; }
}
