.pdfv {
    max-width: 1200px;
    margin: 16px auto 40px;
    padding: 0 15px;
}

.pdfv-head {
    margin-bottom: 10px;
}

.pdfv-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary_color);
    text-decoration: none;
    margin-bottom: 6px;
    transition: gap 0.2s ease;
}

.pdfv-back:visited,
.pdfv-back:hover,
.pdfv-back:focus {
    color: var(--primary_color);
}

.pdfv-back:hover {
    gap: 12px;
}

.pdfv-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--title_color);
    line-height: 1.25;
    margin: 0;
}

.pdfv-sub {
    margin-top: 4px;
    font-size: 0.85rem;
    color: #6b7280;
}

.pdfv-sub span + span::before {
    content: "•";
    margin: 0 8px;
    color: #cbd5e1;
}

/* ---------- Toolbar ---------- */
.pdfv-toolbar {
    position: sticky;
    /* Parks below the site's own sticky header; set from JS, which measures
       it, because the header's height changes with the breakpoint. */
    top: var(--pdfv-sticky-top, 0px);
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin-top: 12px;
    background: var(--primary_color);
    border-radius: var(--round_md) var(--round_md) 0 0;
    box-shadow: 0 2px 10px rgba(26, 43, 86, 0.18);
}

.pdfv-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pdfv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

/* The global `a:visited { color: inherit }` in style.css outranks a single
   class, which would turn these white buttons dark once visited. */
.pdfv-btn:visited,
.pdfv-btn:hover,
.pdfv-btn:focus,
.pdfv-btn:active {
    color: #fff;
}

.pdfv-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.35);
}

.pdfv-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.pdfv-btn--accent {
    background: var(--yellow_color);
    border-color: var(--yellow_color);
}

.pdfv-btn--accent:hover:not(:disabled) {
    background: #d95f12;
    border-color: #d95f12;
}

.pdfv-pagebox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}

.pdfv-pageinput {
    width: 46px;
    height: 34px;
    padding: 0 6px;
    text-align: center;
    font-size: 0.85rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    -moz-appearance: textfield;
}

.pdfv-pageinput::-webkit-outer-spin-button,
.pdfv-pageinput::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pdfv-pageinput:focus {
    outline: none;
    border-color: var(--yellow_color);
}

.pdfv-zoomlabel {
    min-width: 46px;
    text-align: center;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- Stage ---------- */
/* A fixed reading window, so the document behaves like a real PDF reader
   instead of stretching the page down the site. */
.pdfv-stage {
    position: relative;
    height: clamp(460px, calc(100vh - 160px), 1200px);
    overflow: auto;
    padding: 22px 12px 30px;
    background: #eef1f6;
    border: 1px solid #dde3ec;
    border-top: none;
    border-radius: 0 0 var(--round_md) var(--round_md);
    -webkit-overflow-scrolling: touch;
}

.pdfv-page {
    position: relative;
    margin: 0 auto 18px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.14);
    overflow: hidden;
}

.pdfv-page:last-child {
    margin-bottom: 0;
}

.pdfv-page canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.pdfv-page__num {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 2px 8px;
    font-size: 0.72rem;
    color: #fff;
    background: rgba(26, 43, 86, 0.65);
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.pdfv-page:hover .pdfv-page__num {
    opacity: 1;
}

.pdfv-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 70px 20px;
    text-align: center;
    color: #64748b;
}

.pdfv-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #d7dfeb;
    border-top-color: var(--primary_color);
    border-radius: 50%;
    animation: pdfv-spin 0.8s linear infinite;
}

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

.pdfv-fallback {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 10px 18px;
    color: #fff;
    background: var(--primary_color);
    border-radius: 6px;
    text-decoration: none;
}

.pdfv-fallback:visited,
.pdfv-fallback:hover,
.pdfv-fallback:focus {
    color: #fff;
}

/* ---------- Fullscreen ----------
   Written as separate rule blocks on purpose: a browser that does not
   know one of these prefixes drops the entire selector list, so joining
   them with commas would silently kill fullscreen styling everywhere. */
.pdfv:fullscreen {
    max-width: none;
    margin: 0;
    padding: 0;
    background: #eef1f6;
    display: flex;
    flex-direction: column;
}

.pdfv:-webkit-full-screen {
    max-width: none;
    margin: 0;
    padding: 0;
    background: #eef1f6;
    display: flex;
    flex-direction: column;
}

.pdfv:fullscreen .pdfv-head { display: none; }
.pdfv:-webkit-full-screen .pdfv-head { display: none; }

.pdfv:fullscreen .pdfv-toolbar { margin-top: 0; border-radius: 0; }
.pdfv:-webkit-full-screen .pdfv-toolbar { margin-top: 0; border-radius: 0; }

.pdfv:fullscreen .pdfv-stage {
    flex: 1 1 auto;
    height: auto;
    border: none;
    border-radius: 0;
}

.pdfv:-webkit-full-screen .pdfv-stage {
    flex: 1 1 auto;
    height: auto;
    border: none;
    border-radius: 0;
}

@media (max-width: 768px) {
    .pdfv-title { font-size: 1.3rem; }
    .pdfv-toolbar { justify-content: center; }
    .pdfv-stage { height: clamp(380px, calc(100vh - 210px), 700px); padding: 14px 6px 20px; }
    .pdfv-btn__label { display: none; }
    .pdfv-btn { padding: 0 9px; }
}

@media print {
    .pdfv-toolbar, .pdfv-head, .pdfv-page__num { display: none !important; }
    .pdfv-stage { max-height: none; overflow: visible; border: none; background: #fff; padding: 0; }
}
