/* Shared toolbar + wide-screen reading layout for Kautilyan resource guides */

body {
  padding-top: 52px;
  min-height: 100vh;
  background: #12121c;
}

/* Soft brand glow in the side margins (wide screens) */
body::before {
  content: '';
  position: fixed;
  inset: 52px 0 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 42% 36% at 8% 18%, rgba(91, 76, 245, 0.14), transparent 55%),
    radial-gradient(ellipse 38% 32% at 92% 72%, rgba(201, 168, 76, 0.1), transparent 55%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(44, 181, 168, 0.06), transparent 60%);
}

.doc-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(1080px, calc(100vw - 32px)) !important;
  margin: 16px auto 40px !important;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 20px 60px rgba(0, 0, 0, 0.42) !important;
}

/* Wider content area on large displays */
@media (min-width: 900px) {
  .doc-wrapper {
    max-width: min(1120px, calc(100vw - 48px)) !important;
    margin: 24px auto 48px !important;
  }

  .cover {
    padding-left: clamp(40px, 5vw, 72px) !important;
    padding-right: clamp(40px, 5vw, 72px) !important;
  }

  .body-content {
    padding-left: clamp(40px, 5vw, 72px) !important;
    padding-right: clamp(40px, 5vw, 72px) !important;
  }

  .doc-footer {
    padding-left: clamp(40px, 5vw, 72px) !important;
    padding-right: clamp(40px, 5vw, 72px) !important;
  }

  .cover-sub {
    max-width: 640px !important;
  }

  .cover h1 {
    font-size: clamp(36px, 4vw, 48px) !important;
  }
}

@media (min-width: 1280px) {
  .doc-wrapper {
    max-width: min(1160px, calc(100vw - 64px)) !important;
  }
}

/* ── Toolbar ── */
.doc-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(15, 15, 19, 0.96);
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
  backdrop-filter: blur(10px);
  font-family: 'Inter', -apple-system, sans-serif;
}

.doc-toolbar-back {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.doc-toolbar-back:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.doc-toolbar-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.doc-toolbar-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  display: none;
}

.doc-toolbar-pdf {
  font-size: 13px;
  font-weight: 600;
  color: #0f0f13;
  background: linear-gradient(135deg, #f0a030, #c9a84c);
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.doc-toolbar-pdf:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

@media (min-width: 720px) {
  .doc-toolbar-hint { display: inline; }
}

/* During programmatic PDF export */
body.is-pdf-exporting::before {
  display: none !important;
}

body.is-pdf-exporting .doc-wrapper {
  max-width: 1080px !important;
  margin: 0 auto !important;
  box-shadow: none !important;
}

@media (max-width: 599px) {
  .doc-wrapper {
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}

/* PDF / print - keep a tidy page width */
/* PDF email gate modal */
.pdf-gate-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.pdf-gate-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.pdf-gate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.pdf-gate-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 28px 26px 24px;
  border-radius: 14px;
  border: 1px solid rgba(201, 168, 76, 0.25);
  background: linear-gradient(165deg, #1a1a2e, #101018);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  font-family: 'Inter', -apple-system, sans-serif;
}

.pdf-gate-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.pdf-gate-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.pdf-gate-panel h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.pdf-gate-panel > p {
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.62);
  margin: 0 0 20px;
}

.pdf-gate-form label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
}

.pdf-gate-form label + input {
  margin-bottom: 14px;
}

.pdf-gate-form input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
}

.pdf-gate-form input:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}

.pdf-gate-error {
  font-size: 0.82rem;
  color: #f87171;
  margin: 0 0 12px;
  min-height: 0;
}

.pdf-gate-error:not(:empty) {
  min-height: 1.2em;
}

.pdf-gate-submit {
  width: 100%;
  margin-top: 4px;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #f0a030, #c9a84c);
  color: #0f0f13;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.pdf-gate-submit:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}

.pdf-gate-submit:disabled {
  opacity: 0.55;
  cursor: wait;
}

@media print {
  .pdf-gate-modal {
    display: none !important;
  }

  body {
    padding-top: 0 !important;
    background: white !important;
  }

  body::before {
    display: none !important;
  }

  .doc-toolbar {
    display: none !important;
  }

  .doc-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .cover,
  .body-content,
  .doc-footer {
    padding-left: 48px !important;
    padding-right: 48px !important;
  }
}
