:root {
  --prolato-teal: #0D6A6E;
  --prolato-teal-light: #0E8387;
  --prolato-teal-lighter: #2A9D8F;
  --text-dark: #1a1a1a;
  --text-muted: #555555;
  --text-light: #888888;
  --bg-white: #FFFFFF;
  --bg-light: #FAFAFA;
  --paper: #F7F5F0;
  --teal-wash: rgba(13, 106, 110, 0.04);
  --border: rgba(13, 106, 110, 0.08);
  --border-hover: rgba(13, 106, 110, 0.15);
  --shadow-sm: 0 4px 24px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.02);
  --shadow-md: 0 12px 40px rgba(13,106,110,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 30px 60px rgba(13,106,110,0.1), 0 10px 30px rgba(0,0,0,0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --font: 'acumin-pro', 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  --accent: var(--prolato-teal);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-light);
  font-family: var(--font);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
}

.loading, .error {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

/* ---------- Masthead: the building watercolour, faded into the page ---------- */
.masthead {
  position: relative;
  isolation: isolate;
  margin-bottom: 44px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.masthead-art {
  position: absolute;
  inset: 0;
  z-index: -1;
}
.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 32%;
}
.masthead-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, #fff 0%, rgba(255,255,255,0.94) 38%, rgba(255,255,255,0.62) 62%, rgba(255,255,255,0.35) 100%),
    linear-gradient(to bottom, rgba(255,255,255,0.2) 60%, #FAFAFA 100%);
}
.masthead-inner {
  position: relative;
  padding-top: 74px;
  padding-bottom: 62px;
  max-width: 1080px;
}
.kicker {
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--prolato-teal-light);
}
.masthead h1 {
  margin: 0 0 14px;
  max-width: 15ch;
  font-size: 52px;
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--prolato-teal);
}
.subtitle {
  margin: 0;
  max-width: 46ch;
  font-size: 16.5px;
  color: var(--text-muted);
}
.masthead-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.issue-label {
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(13, 106, 110, 0.1);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--prolato-teal);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 13px 28px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--prolato-teal), var(--prolato-teal-light));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:focus-visible { outline: 3px solid var(--prolato-teal-lighter); outline-offset: 2px; }
.btn-secondary {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border-hover);
  color: var(--prolato-teal);
}
.btn-secondary:hover { background: #fff; border-color: var(--prolato-teal-lighter); }
.btn-secondary:focus-visible { outline: 3px solid var(--prolato-teal-lighter); outline-offset: 2px; }

/* ---------- Condition finder ---------- */
.finder {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 32px 34px 28px;
  margin-bottom: 40px;
}
.finder-head { margin-bottom: 26px; }
.finder-title {
  margin: 0 0 4px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--prolato-teal);
}
.finder-note {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-muted);
}
.finder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(218px, 1fr));
  gap: 26px 24px;
}
.practice { border-top: 3px solid var(--accent); padding-top: 14px; }
.practice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.practice-name {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}
.mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--border);
}
.mark-img { width: 100%; height: 100%; object-fit: cover; }
.mark-glyph { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, #fff); }
.mark-glyph svg { width: 22px; height: 22px; }

.finder-list { list-style: none; margin: 0; padding: 0; }
.finder-list li + li { margin-top: 2px; }
.condition {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--text-dark);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.condition:hover { background: color-mix(in srgb, var(--accent) 8%, #fff); color: var(--accent); }
.condition:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.condition.on-page { background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--accent); }
.condition.active { background: var(--accent); color: #fff; }
.condition-page {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
}
.condition:hover .condition-page, .condition.on-page .condition-page { color: var(--accent); }
.condition.active .condition-page { color: rgba(255, 255, 255, 0.78); }

.finder-more {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 14.5px;
  color: var(--text-muted);
}
.finder-more-link {
  color: var(--prolato-teal);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--border-hover);
}
.finder-more-link:hover, .finder-more-link:focus-visible { border-bottom-color: var(--prolato-teal); }

/* ---------- Issue viewer ---------- */
.viewer { scroll-margin-top: 16px; }
.page-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 16px;
}
.practice-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 4px 6px 4px 4px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, #fff);
  border-radius: 999px;
  background: var(--bg-white);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.practice-tab.active {
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  border-color: var(--accent);
}
.practice-tab-label {
  padding: 5px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.practice-tab-label:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.practice-tab-pages { display: flex; gap: 3px; }
.page-dot {
  width: 25px;
  height: 25px;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.page-dot:hover { background: color-mix(in srgb, var(--accent) 26%, #fff); }
.page-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.page-dot.active { background: var(--accent); color: #fff; }

.stage {
  position: relative;
  border-radius: var(--radius-md);
  background: var(--bg-white);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
}
.sheet {
  display: block;
  position: relative;
  /* Reserve the printed page's proportions so the layout never jumps while the page loads. */
  aspect-ratio: 8.5 / 11;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.sheet:focus-visible { outline: 3px solid var(--prolato-teal-lighter); outline-offset: 3px; }
.sheet-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sheet-open {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(13, 106, 110, 0.94);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.sheet:hover .sheet-open, .sheet:focus-visible .sheet-open { opacity: 1; transform: translateY(0); }
@media (hover: none) { .sheet-open { opacity: 1; transform: none; } }

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: 1px solid var(--border-hover);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: var(--prolato-teal);
  font-family: var(--font);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, color 0.15s ease;
}
.arrow:hover:not(:disabled) { background: var(--prolato-teal); color: #fff; }
.arrow:focus-visible { outline: 3px solid var(--prolato-teal-lighter); outline-offset: 2px; }
.arrow:disabled { opacity: 0.3; cursor: default; }
.arrow-prev { left: -20px; }
.arrow-next { right: -20px; }
.stage-caption {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
}

/* ---------- Legend ---------- */
.legend {
  margin-top: 40px;
  padding: 26px 30px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.legend-title {
  margin: 0 0 14px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--prolato-teal);
}
.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 2px 26px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 13.5px;
  color: var(--text-muted);
}
.legend-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* ---------- Archive ---------- */
.archive-bar {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin: 34px 0 8px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.archive-kicker {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-light);
}
.archive-links { display: flex; gap: 8px; flex-wrap: wrap; }
.archive-link {
  padding: 7px 16px;
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  background: var(--bg-white);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--prolato-teal);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.archive-link:hover, .archive-link:focus-visible {
  background: var(--prolato-teal);
  color: #fff;
  outline: none;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 48px;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 26px;
  padding-bottom: 34px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}
.footer-mark {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border);
}
.footer-line { margin: 0; }
.footer-inner a { color: var(--prolato-teal); font-weight: 500; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .wrap { padding: 0 18px; }
  .masthead { margin-bottom: 30px; }
  .masthead-inner { padding-top: 40px; padding-bottom: 34px; }
  .masthead h1 { font-size: 32px; max-width: none; }
  .subtitle { font-size: 15px; }
  .masthead-scrim {
    background:
      linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.93) 55%, #FAFAFA 100%);
  }
  .masthead-actions .btn { flex: 1 1 100%; text-align: center; }
  .finder { padding: 24px 20px 20px; }
  .finder-grid { gap: 22px 18px; }
  .legend { padding: 22px 20px 20px; }
  .page-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .page-strip::-webkit-scrollbar { display: none; }
  .arrow-prev { left: 8px; }
  .arrow-next { right: 8px; }
  .stage { box-shadow: var(--shadow-md), 0 0 0 1px var(--border); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
