/* ============================================================
   Human School — certificate console + certificate artwork
   Follows design.md: monochrome editorial, Montserrat, hard
   edges, alternating ground, inversion on hover.
   ============================================================ */

:root {
  /* Metal accents. Muted rather than bright — a saturated gold on paper
     reads as clip-art, and the rest of the system has no colour at all,
     so these have to sit quietly next to it. */
  --gold: #b0892b;
  --silver: #878d93;
  --bronze: #a1682f;
  --cert-accent: var(--gray-dark);
}

/* A class that sets `display` outranks the UA's `[hidden] { display: none }`,
   which silently un-hides .lock and .modal. Make the attribute win. */
[hidden] { display: none !important; }

/* ---------- console chrome ---------- */

.console {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--black);
  color: var(--white);
  padding: 40px 0 90px;
}

.console-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-dark);
  margin-bottom: 30px;
}

.console-title h1 { font-size: 1.7rem; font-weight: 800; text-transform: uppercase; }
.console-sub {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: var(--gray-dark);
  margin-top: 8px;
}

.console-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- lock screen ---------- */

.lock {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  padding: 24px;
}

.lock-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.lock-mark { height: 54px; width: auto; margin: 0 auto 26px; }
.lock-card h1 {
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}
.lock-card p { color: var(--gray); font-size: 0.95rem; margin-bottom: 28px; }

.pin-row { display: flex; gap: 10px; }
.pin-row .field { flex: 1; }

/* ---------- forms ---------- */

.field { display: block; text-align: left; }

.field-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: var(--gray-dark);
  margin-bottom: 9px;
}

.input,
.select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--white);
  background: var(--black-soft);
  border: 1px solid var(--line-dark);
  padding: 13px 15px;
  transition: border-color 0.18s ease, background 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
.input:focus,
.select:focus {
  outline: none;
  border-color: var(--white);
  background: #191919;
}
.input::placeholder { color: #5c5c5c; }

.select {
  /* chevron drawn inline so the control needs no image request */
  background-image: linear-gradient(45deg, transparent 50%, var(--gray) 50%),
                    linear-gradient(135deg, var(--gray) 50%, transparent 50%);
  background-position: right 18px center, right 12px center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}
.select option { background: var(--black-soft); color: var(--white); }

.pin-input {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  padding: 16px 15px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.form-grid .field--wide { grid-column: 1 / -1; }
.field-hint { font-size: 0.8rem; color: var(--gray-dark); margin-top: 8px; }

/* ---------- buttons (console variants of the site's .btn) ---------- */

.cbtn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 11px 22px;
  border: 1px solid var(--line-dark);
  background: transparent;
  color: var(--white);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  border-radius: 0;
}
.cbtn:hover { border-color: var(--white); }
.cbtn:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
.cbtn[disabled] { opacity: 0.4; cursor: not-allowed; }

.cbtn--solid { background: var(--white); border-color: var(--white); color: var(--black); }
.cbtn--solid:hover { background: transparent; color: var(--white); }

.cbtn--danger:hover { border-color: #c0554b; color: #e88b82; }

.cbtn--sm { font-size: 0.72rem; padding: 7px 13px; letter-spacing: 0.06em; }

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 22px;
}
.toolbar .input,
.toolbar .select { padding: 10px 14px; font-size: 0.9rem; }
.toolbar .search { flex: 1; min-width: 200px; }
.toolbar .filter { width: auto; min-width: 170px; }

/* ---------- result bar ---------- */

.resultbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 6px;
}
.resultbar-count {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gray-dark);
}
.resultbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- import ---------- */

.import-lead { color: var(--gray); font-size: 0.92rem; line-height: 1.65; margin-bottom: 22px; }
.import-lead code {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--white);
}

.import-drop {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px dashed var(--line-dark);
  padding: 22px;
  margin-bottom: 20px;
}
.import-drop.is-over { border-color: var(--white); background: var(--black-soft); }
.import-filename { color: var(--gray); font-size: 0.88rem; }

.import-summary {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gray);
  margin-bottom: 14px;
}
.import-table-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--line-dark); }
.import-table th { padding: 12px 14px; background: var(--black); position: sticky; top: 0; }
.import-table td { font-size: 0.86rem; }
.import-table .ok { color: #8fbf74; }
.import-table .bad { color: #e88b82; }
tr.row-bad { background: rgba(192, 85, 75, 0.07); }

/* ---------- selection ---------- */

.col-pick { width: 34px; }
.records input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #f2f2f2;
  cursor: pointer;
  vertical-align: middle;
}
tr.is-picked { background: #151515; }

.progress {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gray);
}

/* ---------- records table ---------- */

.records { width: 100%; border-collapse: collapse; }

.records th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--gray-dark);
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--line-dark);
  white-space: nowrap;
}

.records td {
  padding: 15px 14px;
  border-bottom: 1px solid #171717;
  font-size: 0.92rem;
  vertical-align: middle;
}
.records tbody tr { transition: background 0.15s ease; }
.records tbody tr:hover { background: var(--black-soft); }

.rec-id {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gray);
  white-space: nowrap;
}
.rec-name { font-weight: 600; }
.rec-company { color: var(--gray); font-size: 0.86rem; }
.rec-date { color: var(--gray-dark); font-size: 0.82rem; white-space: nowrap; }
.rec-actions { text-align: right; white-space: nowrap; }
.rec-actions .cbtn { margin-left: 6px; }
tr.is-revoked .rec-name,
tr.is-revoked .rec-id { text-decoration: line-through; opacity: 0.55; }

.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 5px 10px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge--first { color: var(--gold); }
.badge--second { color: var(--silver); }
.badge--third { color: var(--bronze); }
.badge--completion { color: var(--gray); }
.badge--revoked { color: #c0554b; margin-left: 8px; }

.empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--gray-dark);
  border: 1px dashed var(--line-dark);
}
.empty strong { display: block; color: var(--gray); margin-bottom: 8px; font-size: 1.05rem; }

/* ---------- notices ---------- */

.notice {
  border: 1px solid var(--line-dark);
  border-left: 3px solid var(--gray);
  padding: 14px 18px;
  margin-bottom: 22px;
  font-size: 0.9rem;
  color: var(--gray);
}
.notice--error { border-left-color: #c0554b; color: #e8a49d; }
.notice--ok { border-left-color: #6f8f5f; color: #a9c79a; }
.notice[hidden] { display: none; }

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  background: rgba(5, 5, 5, 0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }

.modal-panel {
  width: 100%;
  max-width: 620px;
  background: var(--black);
  border: 1px solid var(--line-dark);
  padding: 32px;
}
.modal-panel--wide { max-width: min(1180px, 100%); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.modal-head h2 { font-size: 1.2rem; font-weight: 800; text-transform: uppercase; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line-dark);
  flex-wrap: wrap;
}

/* ============================================================
   THE CERTIFICATE
   Authored at true A4 landscape in millimetres, so the screen
   preview is this same object under transform: scale() rather
   than a second design kept in sync by hand.

   Hierarchy rule, taken from how Skillshare, Kajabi and Podia
   set theirs: the recipient's name is the largest thing on the
   sheet. The award ("First Place") is a label above it, not a
   headline competing with it.
   ============================================================ */

.cert-stage { overflow: hidden; }
/* the sheet is SVG now, so it scales itself; nothing to transform */
.cert-scaler { width: 100%; }
.cert-scaler svg { display: block; width: 100%; height: auto; box-shadow: 0 18px 50px rgba(0,0,0,0.45); }

.cert {
  position: relative;
  width: 297mm;
  height: 210mm;
  padding: 16mm 18mm 14mm;
  background: var(--paper);
  color: var(--black);
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line-light);
}

.cert--first { --cert-accent: var(--gold); }
.cert--second { --cert-accent: var(--silver); }
.cert--third { --cert-accent: var(--bronze); }
.cert--completion { --cert-accent: var(--gray-dark); }

/* accent rule across the very top */
.cert::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.6mm;
  background: var(--cert-accent);
}

.cert-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ---- header ---- */

.cert-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10mm;
  padding-bottom: 5mm;
  border-bottom: 1px solid var(--line-light);
}

.cert-brand { display: flex; align-items: center; gap: 3.6mm; }
.cert-logo { height: 12mm; width: auto; }
.cert-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 4.2mm;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1;
}
.cert-wordmark span { color: var(--gray); font-weight: 500; }

.cert-credential { text-align: right; }
.cert-credential dt {
  font-family: var(--font-display);
  font-size: 2.3mm;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: #a5a196;
  margin-bottom: 1.2mm;
}
.cert-credential dd {
  font-family: var(--font-display);
  font-size: 3.6mm;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.cert-credential .cert-verifyline {
  font-size: 2.6mm;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gray);
  margin-top: 1.4mm;
}

/* ---- main: copy on the left, seal on the right ---- */

.cert-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 6mm 0;
}

/* held clear of the bled mark in the bottom right */
.cert-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 178mm;
}

.cert-bar {
  width: 13mm;
  height: 2.8mm;
  background: var(--cert-accent);
  margin-bottom: 5mm;
}

.cert-eyebrow {
  font-family: var(--font-display);
  font-size: 2.8mm;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.34em;
  color: var(--gray-dark);
  margin-bottom: 3.4mm;
}

/* the award is a label in the accent, deliberately smaller than the name */
.cert-award {
  font-family: var(--font-display);
  font-size: 5.4mm;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--cert-accent);
  margin-bottom: 6mm;
}

.cert-awarded {
  font-family: var(--font-display);
  font-size: 2.6mm;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: #a5a196;
  margin-bottom: 2.6mm;
}

/* the hero */
.cert-name {
  font-family: var(--font-display);
  font-size: 19mm;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.02em;
  max-width: 100%;
  margin-bottom: 3.4mm;
  overflow-wrap: anywhere;
}
.cert-name--long { font-size: 14mm; }
.cert-name--xlong { font-size: 11mm; }

.cert-company {
  font-family: var(--font-display);
  font-size: 3.6mm;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray-dark);
  padding-top: 3mm;
  border-top: 1px solid var(--cert-accent);
  margin-bottom: 5mm;
}

.cert-citation {
  font-size: 3.5mm;
  line-height: 1.65;
  color: #4a4a4a;
  max-width: 148mm;
}
.cert-citation strong { color: var(--black); font-weight: 600; }

/* ---- the bled wireframe mark ----
   Same treatment as .sp-num in the method stack on the homepage: a giant
   outlined glyph cropped by the edge of its frame. Ranked sheets carry
   their numeral, completion carries the Human School mark. */

.cert-mark {
  position: absolute;
  right: -0.06em;
  bottom: -0.17em;
  z-index: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 168mm;
  line-height: 0.78;
  letter-spacing: -0.05em;
  color: transparent;
  -webkit-text-stroke: 1.1mm var(--cert-accent);
  opacity: 0.17;
  pointer-events: none;
  user-select: none;
}

.cert-mark--logo {
  right: -30mm;
  bottom: -40mm;
  width: 132mm;
  height: auto;
  color: var(--cert-accent);
  -webkit-text-stroke: 0;
}
.cert-mark--logo path,
.cert-mark--logo rect,
.cert-mark--logo circle {
  fill: none;
  stroke: currentColor;
  /* viewBox is 560 wide at 132mm, so 1 unit = 0.236mm; 4.6 matches the
     1.1mm hairline the numerals are stroked at */
  stroke-width: 4.6;
}

/* ---- footer ---- */

.cert-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12mm;
  padding-top: 5mm;
  border-top: 1px solid var(--line-light);
}

.cert-signs { display: flex; gap: 14mm; }
.cert-sign { min-width: 50mm; }
.cert-sign-rule { height: 1px; background: var(--black); margin-bottom: 2mm; }
.cert-sign-name {
  font-family: var(--font-display);
  font-size: 3.3mm;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.cert-sign-role {
  font-family: var(--font-display);
  font-size: 2.3mm;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--gray);
  margin-top: 1mm;
}

/* labelled metadata columns, the pattern Skillshare uses along the foot */
.cert-facts { display: flex; gap: 9mm; text-align: right; }
.cert-fact { white-space: nowrap; }
.cert-fact dt {
  font-family: var(--font-display);
  font-size: 2.2mm;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: #a5a196;
  margin-bottom: 1.2mm;
}
.cert-fact dd {
  font-family: var(--font-display);
  font-size: 2.9mm;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gray-dark);
}

.cert-void {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 40mm;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: rgba(192, 85, 75, 0.2);
  transform: rotate(-18deg);
  pointer-events: none;
}

/* ---------- preview toolbar ---------- */

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.preview-meta {
  display: flex;
  align-items: baseline;
  gap: 8px 16px;
  flex-wrap: wrap;
  min-width: 0;
}
.preview-id {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gray);
}

/* A download started from this toolbar reports here. The console notice line
   sits behind the preview, so it cannot be the only place progress is shown. */
.preview-note {
  font-size: 0.82rem;
  color: var(--gray);
  word-break: break-all;
}

/* ============================================================
   PRINT — the sheet only, at true size
   ============================================================ */

@page { size: 297mm 210mm; margin: 0; }

@media print {
  html, body { background: #fff; margin: 0; padding: 0; }

  /* visibility:hidden hides ink but keeps the boxes in layout, which printed
     two extra blank sheets after the certificate. The console has to leave
     layout altogether. */
  body > *:not(#view-modal) { display: none !important; }

  #view-modal:not([hidden]) {
    display: block !important;
    position: static;
    padding: 0;
    overflow: visible;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  #view-modal .modal-panel {
    max-width: none;
    width: auto;
    padding: 0;
    border: none;
    background: none;
  }
  .preview-bar { display: none !important; }

  .cert-stage,
  .cert-scaler { overflow: visible; height: auto !important; }
  .cert-scaler { transform: none !important; }

  .cert {
    margin: 0;
    break-inside: avoid;
    page-break-inside: avoid;
    /* without this the accent bar, the outlined mark and the metal tints all
       drop out of the PDF */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .form-grid { grid-template-columns: 1fr; }
  .console-head { align-items: flex-start; }
  .records thead { display: none; }
  .records tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 16px 0;
    border-bottom: 1px solid #171717;
  }
  .records td { border: none; padding: 0 2px; }
  .records .rec-actions { grid-column: 1 / -1; text-align: left; margin-top: 12px; }
  .records .rec-actions .cbtn { margin: 0 6px 6px 0; }
  .modal { padding: 16px 12px; }
  .modal-panel { padding: 22px 18px; }
}
