/* Policies & Manuals — full-width read-only document reader */

.policies-page {
  padding: 0 0 0;
}

.policies-page__header {
  padding: clamp(2rem, 5vw, 3rem) 0 clamp(1.25rem, 3vw, 1.75rem);
}

.policies-page__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--heca-brand, #15803d);
  margin-bottom: 0.75rem;
}

.policies-page__title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
  color: #000;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.policies-page__intro {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--afosi-muted);
  max-width: 42rem;
  margin: 0;
}

.policies-page__empty {
  padding: 2rem;
  border-radius: var(--afosi-radius-sm);
  border: 1px dashed rgba(21, 128, 61, 0.25);
  color: var(--afosi-muted);
  background: var(--afosi-surface-2);
  margin: 0 0 3rem;
}

/* Full-width reader shell */
.policy-reader {
  display: grid;
  grid-template-columns: minmax(240px, 280px) 1fr;
  min-height: calc(100vh - var(--nav-scroll-offset, 5.75rem));
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8faf9;
}

.policy-reader__sidebar {
  background: #fff;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.25rem 1rem 1.5rem;
  position: sticky;
  top: var(--nav-scroll-offset, 5.75rem);
  align-self: start;
  max-height: calc(100vh - var(--nav-scroll-offset, 5.75rem));
  overflow-y: auto;
}

.policy-reader__sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--afosi-muted);
  margin: 0 0 0.85rem;
  padding: 0 0.35rem;
}

.policy-reader__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.policy-reader__tab {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.65rem;
  border: none;
  border-radius: 0.35rem;
  background: transparent;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.policy-reader__tab:hover {
  background: rgba(21, 128, 61, 0.06);
  color: #0f172a;
}

.policy-reader__tab.is-active {
  background: rgba(21, 128, 61, 0.1);
  color: var(--heca-brand, #15803d);
}

.policy-reader__tab-icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1.2;
  opacity: 0.85;
}

/* Reading stage — no card box */
.policy-reader__stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100vh - var(--nav-scroll-offset, 5.75rem));
}

.policy-reader__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.85rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  position: sticky;
  top: var(--nav-scroll-offset, 5.75rem);
  z-index: 2;
}

.policy-reader__doc-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.policy-reader__pager {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.policy-reader__pager-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 0.35rem;
  background: #fff;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.policy-reader__pager-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: rgba(21, 128, 61, 0.35);
  color: var(--heca-brand, #15803d);
}

.policy-reader__pager-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.policy-reader__page-info {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  min-width: 6.5rem;
  text-align: center;
  user-select: none;
}

.policy-reader__canvas-area {
  flex: 1;
  position: relative;
  padding: 0;
  background: #eef1ef;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.policy-reader__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #eef1ef;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 3;
}

.policy-reader__loading.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.policy-reader__spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(21, 128, 61, 0.15);
  border-top-color: var(--heca-brand, #15803d);
  border-radius: 50%;
  animation: policy-spin 0.7s linear infinite;
}

@keyframes policy-spin {
  to {
    transform: rotate(360deg);
  }
}

.policy-reader__page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100%;
  padding: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.policy-reader__page.is-ready {
  opacity: 1;
}

.policy-reader__canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
  user-select: none;
  -webkit-user-drag: none;
}

html.dark-mode .policies-page__title {
  color: var(--afosi-ink);
}

html.dark-mode .policy-reader {
  background: #0f172a;
}

html.dark-mode .policy-reader__sidebar,
html.dark-mode .policy-reader__toolbar {
  background: var(--afosi-white);
  border-color: rgba(148, 163, 184, 0.2);
}

html.dark-mode .policy-reader__tab {
  color: var(--afosi-muted);
}

html.dark-mode .policy-reader__tab.is-active {
  color: var(--heca-brand-light, #22c55e);
}

html.dark-mode .policy-reader__doc-title {
  color: var(--afosi-ink);
}

html.dark-mode .policy-reader__canvas-area,
html.dark-mode .policy-reader__loading {
  background: #1e293b;
}

@media (max-width: 991.98px) {
  .policy-reader {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .policy-reader__sidebar {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding: 1rem;
  }

  .policy-reader__list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 0.15rem;
  }

  .policy-reader__tab {
    flex: 0 0 auto;
    max-width: 240px;
    white-space: normal;
  }

  .policy-reader__stage {
    min-height: calc(100vh - var(--nav-scroll-offset, 5.75rem) - 120px);
  }

  .policy-reader__toolbar {
    top: var(--nav-scroll-offset, 5.75rem);
  }
}

@media print {
  body[data-page="policies"] .policy-reader,
  body[data-page="policies"] .policies-page__header {
    display: none !important;
  }
}
