/* Mazain Solution Certificate Portal — student portal + public verification.
   Ivory surfaces, plum brand colour, gold accents (matches the approved design). */
:root {
  --bg: #f7f4ef; --surface: #fff; --ink: #1c1226; --soft: #6f6680; --hair: #e7e1d8;
  --plum: #3b1466; --plum2: #5b21b6; --gold: #b8913f; --gold2: #e3c77d;
  --ok: #15803d; --ok-bg: #e9f6ee; --bad: #b42318; --bad-bg: #fdecea; --warn: #a15c07; --warn-bg: #fdf3e2;
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--plum2); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.muted { color: var(--soft); }
.small { font-size: .85rem; }
.eyebrow { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin: 0 0 .4rem; }
.eyebrow a { color: inherit; text-decoration: none; }
.staging-bar { background: #fde68a; color: #713f12; text-align: center; font-size: .8rem; font-weight: 600; padding: 4px 8px; }

.p-wrap { max-width: 1040px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.p-header { background: linear-gradient(160deg, #1a0b2e, #0f0619); }
.p-header-in { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 14px; }
.p-brand img { display: block; height: 46px; width: auto; background: #fff; border-radius: 10px; padding: 4px 10px; }
.p-back { color: #e6dcf5; text-decoration: none; font-size: .85rem; white-space: nowrap; }
.p-back:hover { color: #fff; }
.p-main { padding-block: 40px 64px; min-height: 60vh; }
.p-footer { border-top: 1px solid var(--hair); padding-block: 22px; font-size: .8rem; color: var(--soft); text-align: center; }
.p-footer a { color: var(--soft); }

.p-hero { text-align: center; margin: 0 auto 28px; max-width: 640px; position: relative; }
.p-hero-sm { margin-bottom: 22px; }
.p-title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.9rem, 4.6vw, 2.7rem); line-height: 1.1; margin: 0; text-wrap: balance; }
.p-title-sm { font-family: var(--serif); font-size: 1.8rem; margin: 0 0 .4rem; }
.p-sub { color: var(--soft); margin: .6rem 0 0; }
.p-signout { margin-top: 14px; }

.p-card { background: var(--surface); border: 1px solid var(--hair); border-radius: 18px; padding: 26px; box-shadow: 0 24px 48px -32px rgba(40, 15, 70, .45); }
.p-card-narrow { max-width: 420px; margin: 0 auto; }
.p-center { padding-block: 6vh; }
label { display: block; font-size: .78rem; font-weight: 700; color: #4a4058; margin: 14px 0 6px; letter-spacing: .01em; }
label:first-of-type { margin-top: 0; }
input, select, textarea { width: 100%; border: 1px solid #d9d0c4; border-radius: 10px; padding: .75rem .85rem; font: inherit; font-size: 1rem; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--plum2); box-shadow: 0 0 0 3px rgba(91, 33, 182, .14); }
.hint { font-size: .76rem; color: var(--soft); margin: 6px 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid transparent; border-radius: 10px; padding: .72rem 1.1rem; font: inherit; font-weight: 700; font-size: .9rem; text-decoration: none; cursor: pointer; transition: background .15s, transform .15s, box-shadow .15s; white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--plum), var(--plum2)); color: #fff; box-shadow: 0 10px 20px -12px rgba(59, 20, 102, .8); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: #fff; border-color: var(--hair); color: var(--ink); }
.btn-ghost:hover { border-color: #cdbfa9; }
.btn-sm { padding: .45rem .8rem; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; margin-top: 20px; }
.btn[disabled] { opacity: .65; cursor: wait; }

.notice { border-radius: 10px; padding: .7rem .9rem; font-size: .88rem; margin: 14px 0 0; }
.p-wrap > .notice { max-width: 560px; margin: 0 auto 18px; }
.notice-error { background: var(--bad-bg); color: #7a1a12; }
.notice-success { background: var(--ok-bg); color: #14532d; }
.notice-info { background: #efe9f8; color: #3b1466; }

.forgot { margin-top: 18px; font-size: .85rem; color: var(--soft); }
.forgot summary { cursor: pointer; color: var(--plum2); font-weight: 600; }
.forgot p { margin: .5rem 0 0; }

.p-trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 760px; margin: 40px auto 0; text-align: center; }
.p-trust strong { display: block; font-family: var(--serif); font-size: 1.25rem; color: var(--plum); }
.p-trust span { font-size: .82rem; color: var(--soft); }

.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 22px; }
.cert-card { background: var(--surface); border: 1px solid var(--hair); border-radius: 16px; overflow: hidden; min-width: 0; box-shadow: 0 20px 40px -34px rgba(40, 15, 70, .5); }
.cert-card.is-revoked { opacity: .7; }
.cert-thumb { position: relative; display: block; background: #efe9df; padding: 14px; aspect-ratio: 297 / 210; }
.cert-thumb canvas, .viewer canvas { width: 100%; height: auto; display: block; box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .45); background: #fff; }
.thumb-loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; color: var(--soft); pointer-events: none; }
.thumb-loading.is-done { display: none; }
.cert-meta { padding: 16px 18px 18px; }
.cert-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cert-head h2 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .66rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; border-radius: 999px; padding: .2rem .6rem; white-space: nowrap; }
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-bad { color: var(--bad); background: var(--bad-bg); }
.facts { margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.facts div { padding: .3rem 0; border-bottom: 1px dashed var(--hair); min-width: 0; }
.facts dt { font-size: .7rem; color: var(--soft); text-transform: uppercase; letter-spacing: .06em; }
.facts dd { margin: 0; font-size: .88rem; font-weight: 600; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions-center { justify-content: center; margin-top: 22px; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; background: #fff; border: 1px solid var(--hair); border-radius: 10px; padding: 6px; min-width: 210px; box-shadow: 0 16px 30px -18px rgba(0, 0, 0, .4); }
.menu-pop a { display: block; padding: .45rem .6rem; border-radius: 6px; font-size: .84rem; color: var(--ink); text-decoration: none; }
.menu-pop a:hover { background: #f4efe6; }
.empty { text-align: center; }
.empty h2 { font-family: var(--serif); margin: 0 0 .3rem; }

.viewer { position: relative; max-width: 900px; margin: 0 auto; background: #efe9df; border-radius: 16px; padding: clamp(10px, 3vw, 26px); min-height: 200px; }

.share-sheet { position: fixed; inset: 0; background: rgba(20, 10, 30, .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.share-box { background: #fff; border-radius: 18px; padding: 22px; width: min(420px, 100%); text-align: center; }
.share-box h2 { font-family: var(--serif); margin: 0 0 .3rem; font-size: 1.5rem; }
.share-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.share-links a, .share-links button { display: block; padding: .7rem; border-radius: 10px; border: 1px solid var(--hair); background: #faf8f4; color: var(--ink); font: inherit; font-weight: 700; font-size: .85rem; text-decoration: none; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 999px; font-size: .85rem; z-index: 60; }

/* Public verification page */
.verify-body { background: #f3f1ee; }
.v-main { padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
.v-card { max-width: 520px; margin: 4vh auto 0; background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 30px 60px -36px rgba(0, 0, 0, .4); }
.v-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--hair); }
.v-top img { height: 38px; width: auto; }
.v-top span { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); font-weight: 700; }
.v-status { text-align: center; padding: 28px 22px 10px; }
.v-icon { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; color: #fff; }
.v-icon svg { width: 32px; height: 32px; }
.v-status h1 { margin: 0; font-size: 1rem; letter-spacing: .12em; line-height: 1.4; }
.v-status p { margin: .5rem auto 0; color: var(--soft); font-size: .9rem; max-width: 40ch; }
.v-ok .v-icon { background: var(--ok); } .v-ok h1 { color: var(--ok); }
.v-bad .v-icon { background: var(--bad); } .v-bad h1 { color: var(--bad); }
.v-warn .v-icon { background: #c2780b; } .v-warn h1 { color: var(--warn); }
.v-none .v-icon { background: #6b7280; } .v-none h1 { color: #4b5563; }
.v-rows { margin: 0; padding: 14px 22px 8px; }
.v-rows div { display: flex; justify-content: space-between; gap: 16px; padding: .65rem 0; border-bottom: 1px solid #f0ece6; }
.v-rows dt { color: var(--soft); font-size: .86rem; }
.v-rows dd { margin: 0; font-weight: 700; font-size: .9rem; text-align: right; overflow-wrap: anywhere; }
.v-note { padding: 4px 22px 8px; font-size: .88rem; }
.v-foot { background: #faf8f4; padding: 14px 22px; font-size: .74rem; color: var(--soft); line-height: 1.5; }
.v-foot a { color: var(--soft); }

@media (max-width: 640px) {
  .p-main { padding-block: 26px 48px; }
  .p-card { padding: 20px; }
  .p-trust { grid-template-columns: 1fr; gap: 10px; }
  .p-back { font-size: .78rem; }
  .p-brand img { height: 40px; }
  .facts { grid-template-columns: 1fr; }
  .v-rows div { flex-direction: column; gap: 0; }
  .v-rows dd { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .p-header, .p-footer, .p-hero, .actions, .staging-bar, .share-sheet { display: none !important; }
  .viewer { background: none; padding: 0; }
  .viewer canvas { box-shadow: none; }
  body { background: #fff; }
  @page { size: A4 landscape; margin: 0; }
}
