/* Certificate archive and document viewer. Scoped to keep the existing site stable. */
.cert-section {
  padding: 88px 24px 96px;
  scroll-margin-top: 100px;
  border-top: 1px solid #E1D7C7;
  border-bottom: 1px solid #E1D7C7;
  background: #F7F1E6;
  color: #304963;
}
.cert-container { width: 100%; max-width: 1280px; margin-inline: auto; }
.cert-header { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 56px; align-items: center; margin-bottom: 32px; }
.cert-kicker { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 13px; color: #B34C3B; font-size: 11px; font-weight: 800; line-height: 1.5; letter-spacing: .14em; text-transform: uppercase; }
.cert-kicker::before { content: ""; width: 24px; height: 3px; background: #B34C3B; border-radius: 2px; }
.cert-heading, .cert-heading h2 { margin: 0; color: #142B45; font-family: 'Sora', 'Inter', sans-serif; font-size: clamp(28px, 3vw, 38px); font-weight: 800; letter-spacing: -.04em; line-height: 1.2; }
.cert-lead { max-width: 680px; margin-top: 16px; color: #5E6B76; font-size: 14px; line-height: 1.85; }
.cert-archive-note { border-left: 3px solid #D7C8B2; padding: 16px 20px; border-radius: 0 10px 10px 0; background: #FFFCF5; }
.cert-archive-note h3 { margin: 0 0 6px; color: #304963; font-size: 12px; font-weight: 700; line-height: 1.5; }
.cert-archive-note p { margin: 0; color: #5E6B76; font-size: 11px; line-height: 1.8; }
.cert-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 22px; }
.cert-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.cert-filter { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; border: 1px solid #E1D7C7; border-radius: 7px; padding: 8px 16px; background: #FFFCF5; color: #405369; font: inherit; font-size: 12px; font-weight: 700; line-height: 1.5; cursor: pointer; }
.cert-filter:hover { border-color: #B6B8B6; color: #142B45; }
.cert-filter[aria-pressed="true"] { border-color: #142B45; background: #142B45; color: #FFFCF5; }
.cert-total { flex-shrink: 0; color: #5E6B76; font-size: 11px; font-weight: 600; }
.cert-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: stretch; }
.cert-card { display: flex; min-width: 0; overflow: hidden; border: 1px solid #E1D7C7; border-radius: 12px; background: #FFFCF5; box-shadow: 0 3px 10px rgb(20 43 69 / 3%); }
.cert-open { display: flex; flex: 1; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; }
.cert-open:hover .cert-action { color: #B34C3B; }
.cert-card:has(.cert-open:hover) { border-color: #D7C8B2; box-shadow: 0 8px 22px rgb(20 43 69 / 7%); }
.cert-preview { position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0; height: 258px; overflow: hidden; padding: 25px 40px 18px; border-bottom: 1px solid #E6DCCB; background: #EEE5D7; }
.cert-preview img { display: block; width: auto; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 4px 12px rgb(20 43 69 / 14%); }
.cert-preview-label { position: absolute; top: 13px; left: 13px; display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border: 1px solid #E1D7C7; border-radius: 5px; background: rgb(255 252 245 / 96%); color: #405369; font-size: 9px; font-weight: 800; line-height: 1.4; letter-spacing: .045em; text-transform: uppercase; }
.cert-page-count { position: absolute; right: 13px; bottom: 13px; padding: 4px 8px; border: 1px solid #E1D7C7; border-radius: 5px; background: rgb(255 252 245 / 96%); color: #405369; font-size: 10px; font-weight: 700; line-height: 1.4; }
.cert-body { display: flex; flex: 1; flex-direction: column; padding: 23px 24px 0; }
.cert-type { margin-bottom: 7px; color: #B34C3B; font-size: 9px; font-weight: 800; line-height: 1.6; letter-spacing: .1em; text-transform: uppercase; }
.cert-model, .cert-model h3 { margin: 0; color: #142B45; font-family: 'Sora', 'Inter', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: -.025em; line-height: 1.45; }
.cert-number { display: inline-block; margin-top: 8px; color: #5E6B76; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.cert-description { margin-top: 12px; color: #5E6B76; font-size: 12px; line-height: 1.8; }
.cert-date { margin-top: 12px; padding-bottom: 20px; color: #5E6B76; font-size: 10px; line-height: 1.65; }
.cert-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding: 15px 0 17px; border-top: 1px solid #E6DCCB; }
.cert-variants { color: #5E6B76; font-size: 10px; font-weight: 600; line-height: 1.5; }
.cert-action { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; padding: 8px 11px; border: 1px solid #142B45; border-radius: 6px; background: #142B45; color: #FFFCF5; font-size: 11px; font-weight: 800; line-height: 1.5; }
.cert-open:hover .cert-action { border-color: #B34C3B; background: #B34C3B; color: #FFFCF5; }
.cert-preview::after { content: "\2315"; position: absolute; right: 13px; top: 13px; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #D7C8B2; border-radius: 50%; background: #FFFCF5; color: #142B45; font-size: 26px; line-height: 1; pointer-events: none; }
.cert-open:hover .cert-preview::after, .cert-open:focus-visible .cert-preview::after { border-color: #B34C3B; color: #B34C3B; }
.cert-action svg { width: 14px; height: 14px; }
.cert-card--tse .cert-type { color: #B34C3B; }
.cert-section [hidden], .cert-viewer [hidden] { display: none !important; }
.cert-section :is(a, button):focus-visible, .cert-viewer :is(a, button, select, [tabindex]):focus-visible { outline: 3px solid #B34C3B; outline-offset: 3px; }
.cert-open:focus-visible { outline-offset: -4px !important; border-radius: 11px; }

.cert-viewer { position: fixed; inset: 0; width: calc(100% - 48px); max-width: 1180px; height: min(900px, 92dvh); max-height: 92dvh; margin: auto; padding: 0; overflow: hidden; border: 0; border-radius: 14px; background: #FFFCF5; color: #304963; box-shadow: 0 24px 90px rgb(16 35 57 / 28%); }
.cert-viewer[open] { display: flex; flex-direction: column; }
.cert-viewer:not([open]) { display: none; }
.cert-viewer::backdrop { background: rgb(20 43 69 / 76%); backdrop-filter: blur(4px); }
.cert-viewer-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 20px; padding: 20px 24px; border-bottom: 1px solid #E1D7C7; background: #FFFCF5; }
.cert-viewer-header h2, .cert-viewer-title { margin: 0; color: #142B45; font-family: 'Sora', 'Inter', sans-serif; font-size: 17px; font-weight: 700; line-height: 1.5; letter-spacing: -.02em; overflow-wrap: anywhere; }
.cert-close { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; padding: 0; border: 1px solid #E1D7C7; border-radius: 8px; background: #F7F1E6; color: #304963; font: inherit; font-size: 25px; line-height: 1; cursor: pointer; }
.cert-close:hover { border-color: #D7C8B2; background: #EFE6D8; color: #142B45; }
.cert-close svg { width: 19px; height: 19px; }
.cert-viewer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 285px; flex: 1; min-height: 0; overflow: hidden; }
.cert-viewer-layout > div { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.cert-zoom-toolbar { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 12px; padding: 10px 24px; border-bottom: 1px solid #E1D7C7; background: #F7F1E6; }
.cert-zoom-controls { display: flex; align-items: center; gap: 5px; }
.cert-zoom-controls button { display: inline-flex; justify-content: center; align-items: center; min-width: 40px; min-height: 40px; padding: 7px 11px; border: 1px solid #D7C8B2; border-radius: 6px; background: #FFFCF5; color: #142B45; font: inherit; font-size: 22px; font-weight: 700; line-height: 1; cursor: pointer; user-select: none; }
.cert-zoom-controls [data-cert-zoom="fit"] { margin-left: 5px; font-size: 11px; line-height: 1.4; }
.cert-zoom-controls button:hover:not(:disabled) { border-color: #B34C3B; background: #EFE6D8; }
.cert-zoom-controls button:disabled { opacity: .45; cursor: default; }
.cert-zoom-level { min-width: 51px; color: #142B45; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.cert-zoom-hint { margin: 0; color: #5E6B76; font-size: 11px; line-height: 1.6; }
.cert-view-stage { display: block; flex: 1; min-width: 0; min-height: 0; padding: 24px; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; background: #EEE5D7; }
.cert-image-canvas { display: grid; place-items: center; }
.cert-full-image { display: block; width: auto; height: auto; max-width: none; max-height: none; object-fit: contain; box-shadow: 0 5px 20px rgb(20 43 69 / 16%); user-select: none; -webkit-user-drag: none; }
.cert-view-stage.is-zoomed { cursor: grab; }
.cert-view-stage.is-panning { cursor: grabbing; }
.cert-viewer-sidebar { min-height: 0; overflow-y: auto; padding: 25px 23px; border-left: 1px solid #E1D7C7; background: #FFFCF5; }
.cert-viewer-sidebar h3 { margin: 0 0 12px; color: #142B45; font-size: 12px; font-weight: 700; line-height: 1.5; }
.cert-viewer-kind { margin-bottom: 5px; color: #B34C3B; font-size: 10px; font-weight: 800; line-height: 1.6; letter-spacing: .06em; text-transform: uppercase; }
.cert-viewer-code { margin-bottom: 22px; color: #5E6B76; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.cert-document-buttons { display: grid; gap: 7px; margin: 0 0 24px; padding: 0; list-style: none; }
.cert-document-button { display: block; width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid #E1D7C7; border-radius: 7px; background: #FFFCF5; color: #405369; font: inherit; font-size: 11px; font-weight: 600; line-height: 1.6; text-align: left; cursor: pointer; }
.cert-document-button:hover { border-color: #B6B8B6; color: #142B45; }
.cert-document-button[aria-pressed="true"] { border-color: #142B45; background: #EFE6D8; color: #142B45; box-shadow: inset 3px 0 #142B45; }
.cert-viewer-facts { display: grid; gap: 11px; margin: 0 0 20px; padding: 18px 0; border-top: 1px solid #E1D7C7; border-bottom: 1px solid #E1D7C7; }
.cert-viewer-facts dt { margin-bottom: 2px; color: #5E6B76; font-size: 9px; font-weight: 700; line-height: 1.6; letter-spacing: .035em; text-transform: uppercase; }
.cert-viewer-facts dd { margin: 0; color: #304963; font-size: 11px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.cert-viewer-note { margin: 0; color: #5E6B76; font-size: 10px; line-height: 1.8; }
.cert-viewer-bottom { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 16px; padding: 14px 22px; border-top: 1px solid #E1D7C7; background: #FFFCF5; }
.cert-viewer-pager, .cert-viewer-navigation { display: flex; align-items: center; gap: 10px; }
.cert-viewer-step { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; padding: 6px 10px; border: 1px solid #E1D7C7; border-radius: 6px; background: #FFFCF5; color: #304963; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.cert-viewer-step:hover:not(:disabled) { border-color: #B6B8B6; background: #F7F1E6; }
.cert-viewer-step:disabled { opacity: .4; cursor: default; }
.cert-position { display: inline-block; min-width: 35px; color: #5E6B76; font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.cert-viewer-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.cert-viewer-sidebar .cert-viewer-actions { margin-bottom: 18px; }
.cert-download, .cert-original, .cert-zoom { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 8px 12px; border: 1px solid #E1D7C7; border-radius: 6px; background: #FFFCF5; color: #304963; font: inherit; font-size: 11px; font-weight: 700; line-height: 1.5; text-decoration: none; cursor: pointer; }
.cert-download { border-color: #142B45; background: #142B45; color: #FFFCF5; }
.cert-download:hover { border-color: #203B57; background: #203B57; }
.cert-original:hover, .cert-zoom:hover { border-color: #B6B8B6; background: #F7F1E6; color: #142B45; }
.cert-zoom[aria-pressed="true"] { border-color: #142B45; background: #EFE6D8; color: #142B45; }
.cert-viewer-actions svg, .cert-viewer-step svg { width: 14px; height: 14px; }
.cert-archive-footnote { margin-top: 28px; color: #5E6B76; font-size: 11px; line-height: 1.9; }
.cert-document-help { margin-bottom: 10px; color: #5E6B76; font-size: 10px; line-height: 1.7; }
.cert-document-note { margin-bottom: 18px; padding: 12px; border-left: 3px solid #E47763; background: #F7F1E6; color: #405369; font-size: 10px; line-height: 1.9; }
.cert-document-note[hidden] { display: none; }
.cert-page-controls { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 5px 10px; }
.cert-page-label { display: flex; align-items: center; gap: 6px; color: #5E6B76; font-size: 10px; }
.cert-page-select { max-width: 90px; min-height: 36px; border: 1px solid #E1D7C7; border-radius: 6px; padding: 4px 6px; background: #FFFCF5; color: #142B45; font-size: 11px; }
.cert-pdf-open, .cert-pdf-download { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 12px; border: 1px solid #142B45; border-radius: 6px; background: #142B45; color: #FFFCF5; font-size: 11px; font-weight: 700; line-height: 1.5; }
.cert-pdf-download { background: #FFFCF5; color: #142B45; }
.cert-pdf-open[hidden], .cert-pdf-download[hidden] { display: none; }
.cert-pdf-open:hover { background: #203B57; }
.cert-pdf-download:hover { background: #EFE6D8; }

@media (min-width: 1280px) and (max-width: 1399px) {
  .home-desktop-nav { gap: 8px; font-size: 11px; }
}
@media (max-width: 1000px) {
  .cert-section { padding-top: 68px; padding-bottom: 72px; }
  .cert-header { grid-template-columns: minmax(0, 1fr) 280px; gap: 30px; }
  .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .cert-viewer-layout { grid-template-columns: minmax(0, 1fr) 250px; }
  .cert-viewer-sidebar { padding: 20px 18px; }
  .cert-view-stage { padding: 20px; }
}
@media (max-width: 760px) {
  .cert-header { grid-template-columns: 1fr; gap: 23px; }
  .cert-archive-note { max-width: 600px; }
  .cert-viewer { width: calc(100% - 24px); height: 92dvh; overflow: hidden; border-radius: 10px; }
  .cert-viewer-header { padding: 12px 16px; gap: 14px; }
  .cert-viewer-header h2, .cert-viewer-title { font-size: 14px; }
  .cert-close { width: 38px; height: 38px; }
  .cert-zoom-toolbar { gap: 6px; flex-wrap: wrap; padding: 9px 12px; }
  .cert-zoom-controls { gap: 4px; }
  .cert-zoom-controls button { min-width: 40px; min-height: 40px; padding: 7px 9px; }
  .cert-zoom-hint { font-size: 10px; }
  .cert-viewer-layout { display: block; flex: 1; overflow-y: auto; overscroll-behavior-y: contain; }
  .cert-viewer-layout > div { display: block; overflow: visible; }
  .cert-view-stage { height: 44dvh; min-height: 190px; padding: 16px; }
  .cert-viewer-sidebar { padding: 21px 20px; overflow: visible; border-top: 1px solid #E1D7C7; border-left: 0; }
  .cert-viewer-code { margin-bottom: 16px; }
  .cert-document-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; }
  .cert-viewer-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
  .cert-viewer-bottom { flex-wrap: wrap; padding: 12px 16px; }
  .cert-viewer-actions { gap: 6px; }
  .cert-download, .cert-original, .cert-zoom { padding-inline: 10px; }
}
@media (max-width: 600px) {
  .cert-section { padding: 52px 18px 56px; scroll-margin-top: 92px; }
  .cert-header { margin-bottom: 23px; }
  .cert-kicker { margin-bottom: 11px; font-size: 10px; }
  .cert-heading, .cert-heading h2 { font-size: 28px; }
  .cert-lead { margin-top: 13px; font-size: 13px; }
  .cert-archive-note { padding: 13px 16px; }
  .cert-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; padding-bottom: 18px; }
  .cert-filter { min-height: 39px; padding: 8px 13px; font-size: 11px; }
  .cert-total { font-size: 10px; }
  .cert-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .cert-preview { height: 230px; padding-top: 20px; padding-bottom: 16px; }
  .cert-body { padding: 21px 21px 0; }
  .cert-model, .cert-model h3 { font-size: 17px; }
  .cert-card-footer { padding-bottom: 16px; }
  .cert-viewer-bottom { gap: 12px; }
  .cert-viewer-bottom { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; padding: 10px 8px; }
  .cert-viewer-step { min-height: 40px; padding: 6px; font-size: 10px; }
  .cert-page-controls { gap: 4px; }
  .cert-page-label { font-size: 9px; }
  .cert-page-select { max-width: 68px; }
  .cert-viewer-actions { width: 100%; }
  .cert-viewer-actions > * { flex: 1; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .cert-section *, .cert-viewer * { scroll-behavior: auto; }
}
