/* Student portal, admin and certificate pages. Loads after site.css and reuses its tokens. */

.portal main { pointer-events: auto; }
.portal-main { min-height: 70vh; }
.portal-main.is-wide .wrap { max-width: 1120px; }
.portal h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); font-stretch: 112%; line-height: 1.05; margin: 0 0 0.6rem; }
.portal h2 { font-size: 1.35rem; margin: 0 0 0.5rem; }
.portal h3 { font-size: 1.2rem; margin: 0 0 0.35rem; }
.portal h4 { font-size: 1.02rem; margin: 0 0 0.5rem; }
.portal .lead { margin-bottom: 1.6rem; }

.portal-nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.portal-nav a:not(.btn), .linklike { color: var(--ink); font-weight: 650; text-decoration: none; font-size: 0.98rem; }
.portal-nav a:not(.btn):hover, .linklike:hover { color: var(--blue); }
.portal-nav form { margin: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; }
.portal-nav .linklike { text-decoration: none; }

.card {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: clamp(18px, 3vw, 28px);
  margin: 0 0 18px;
}
.card > :last-child { margin-bottom: 0; }
.auth { max-width: 560px; }
.section-title { margin: 2.2rem 0 0.9rem !important; }
.crumb { margin: 0 0 0.4rem; font-weight: 650; font-size: 0.95rem; }
.crumb a { text-decoration: none; }
.crumb a::before { content: '\2190\00a0'; }

.portal form .btn { width: auto; }
.auth form .btn { width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row form { margin: 0; }

.field select, .field textarea {
  font: inherit; font-size: 1.02rem; color: var(--ink);
  padding: 0.7rem 0.9rem; min-height: 52px; width: 100%;
  background: #f7f9ff; border: 2px solid rgba(20, 32, 87, 0.3); border-radius: 12px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 91, 255, 0.2); background: #fff; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; color: var(--ink-2); margin: 4px 0 16px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--blue); flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.flash { padding: 12px 16px; border-radius: 12px; background: #e5f7ee; border: 2px solid var(--leaf); font-weight: 650; margin: 0 0 18px; }
.flash[data-kind='error'] { background: #fff0ed; border-color: var(--coral); }
.form-status[data-kind='error'] { color: #c2341f; font-weight: 650; }

.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--sun); border: 2px solid var(--ink); font-weight: 750; font-size: 0.9rem; margin: 0.2rem 0 0.6rem; }
.pill[data-kind='approved'] { background: #c9f0dc; }
.pill[data-kind='changes'] { background: #ffd9d2; }

.kit { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; background: var(--sun); }
.kit p { margin: 0; color: var(--ink); }
.kit > div { flex: 1 1 320px; }
.done-card { background: #c9f0dc; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.done-card h2 { margin: 0; }

.meter { height: 12px; border-radius: 999px; background: var(--sky-2); border: 2px solid var(--ink); overflow: hidden; margin: 10px 0 6px; }
.meter span { display: block; height: 100%; background: var(--leaf); }

.lessons { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 4px; }
.lessons li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--sky-3); }
.lessons li:first-child { border-top: 0; }
.lessons li > span:first-of-type, .lessons li > span:only-of-type { flex: 1; }
.lessons li.is-done > span { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.tick-form { margin: 0; display: contents; }
.tick { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid var(--ink); background: #fff; cursor: pointer; padding: 0; }
.tick[aria-pressed='true'] { background: var(--leaf) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat; }
.go { font-weight: 700; white-space: nowrap; }
.soon { font-size: 0.85rem; color: var(--ink-2); white-space: nowrap; }
.submit { margin-top: 1rem; padding: 16px; border-radius: 12px; background: var(--sky); }
.feedback { background: var(--sky); border-radius: 10px; padding: 10px 14px; }
.submit .feedback { background: #fff; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0.6rem 0 1.4rem; }
.tabs a { padding: 8px 14px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; }
.tabs a[aria-current='page'] { background: var(--ink); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 14px 16px; display: grid; }
.stat b { font-size: 2rem; font-stretch: 112%; line-height: 1.1; }
.stat span { color: var(--ink-2); font-size: 0.92rem; }
.checklist { list-style: none; padding: 0; display: grid; gap: 8px; }
.checklist li { padding-left: 34px; position: relative; }
.checklist li::before { content: ''; position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--ink); background: #fff; }
.checklist li[data-ok='1']::before { background: var(--leaf); }
.table-wrap { overflow-x: auto; background: #fff; border: 2px solid var(--ink); border-radius: 14px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.table-wrap th, .table-wrap td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--sky-3); vertical-align: top; }
.table-wrap th { background: var(--sky); font-weight: 750; }
.table-wrap tr[data-status='needs_review'] td { background: #fff0ed; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; word-break: break-all; }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; align-items: end; }
.inline-form h2, .inline-form p, .inline-form .check { grid-column: 1 / -1; }
.inline-form .btn { justify-self: start; margin-bottom: 14px; }
.row-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
details.card summary { font-weight: 750; cursor: pointer; }
details.card[open] summary { margin-bottom: 12px; }
.review[data-status='approved'] { border-color: var(--leaf); }
.result[data-kind='ok'] { border-color: var(--leaf); }
.result[data-kind='error'] { border-color: var(--coral); }
.result dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0.6rem 0 1rem; }
.result dt { font-weight: 750; }
.result dd { margin: 0; color: var(--ink-2); }
.verify-form { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: end; }
.verify-form .field { flex: 1 1 240px; }
.verify-form .btn { margin-bottom: 14px; width: auto !important; }

@media (max-width: 640px) {
  .portal-nav { gap: 12px; }
  .portal-nav a:not(.btn), .portal-nav .linklike { font-size: 0.9rem; }
  .portal .nav .brand span { display: none; }
}

/* ---------- certificate ---------- */
.cert-body, .cert-body * { box-sizing: border-box; }
.cert-body { margin: 0; background: #dfe7fb; font-family: 'Archivo', ui-sans-serif, system-ui, sans-serif; color: #142057; }
.cert-tools { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 18px; }
.cert-tools a, .cert-tools button { font: inherit; font-weight: 700; font-size: 0.95rem; color: #142057; background: #fff; border: 2px solid #142057; border-radius: 12px; padding: 8px 14px; text-decoration: none; cursor: pointer; }
.cert-tools button { background: #ffce3a; }
.cert { width: min(1056px, calc(100vw - 24px)); aspect-ratio: 11 / 8.5; margin: 0 auto 40px; background: #fff; border: 2px solid #142057; border-radius: 6px; padding: 2.4%; container-type: inline-size; }
.cert-inner {
  height: 100%; border: 0.4cqw solid #142057; border-radius: 4px; padding: 4.2cqw 6cqw 3cqw; display: flex; flex-direction: column; position: relative;
  background:
    linear-gradient(rgba(47, 91, 255, 0.06) 1px, transparent 1px) 0 0 / 2.4cqw 2.4cqw,
    linear-gradient(90deg, rgba(47, 91, 255, 0.06) 1px, transparent 1px) 0 0 / 2.4cqw 2.4cqw,
    #f7f9ff;
}
.cert-inner::after { content: ''; position: absolute; right: 0; top: 0; width: 18cqw; height: 18cqw; background: #ffce3a; clip-path: polygon(100% 0, 100% 100%, 0 0); }
.cert-brand { display: flex; align-items: center; gap: 1.2cqw; font-weight: 800; font-stretch: 112%; font-size: 1.9cqw; }
.cert-brand svg { width: 4.4cqw; height: 4.4cqw; }
.cert-kicker { margin: 4.6cqw 0 0; font-weight: 800; font-stretch: 118%; font-size: 4.8cqw; line-height: 1; letter-spacing: -0.01em; }
.cert-small { margin: 3cqw 0 0; font-size: 1.9cqw; color: #3a4677; }
.cert-name { margin: 0.8cqw 0 0; font-size: 7.4cqw; font-weight: 800; font-stretch: 108%; line-height: 1.05; letter-spacing: -0.02em; border-bottom: 0.5cqw solid #ffce3a; align-self: flex-start; padding-bottom: 0.4cqw; }
.cert-what { margin: 2.8cqw 0 0; font-size: 2.05cqw; line-height: 1.45; max-width: 74cqw; color: #3a4677; }
.cert-what b { color: #142057; }
.cert-projects { margin: 1.8cqw 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 0.9cqw 3cqw; font-size: 1.7cqw; max-width: 82cqw; }
.cert-projects li { padding-left: 2.2cqw; position: relative; }
.cert-projects li::before { content: ''; position: absolute; left: 0; top: 0.55cqw; width: 1.2cqw; height: 1.2cqw; border-radius: 0.3cqw; background: #19a866; }
.cert-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 4cqw; }
.cert-sign { display: grid; font-size: 1.55cqw; color: #3a4677; min-width: 26cqw; }
.cert-sign .sig { font-style: italic; font-weight: 300; font-stretch: 70%; font-size: 3.8cqw; color: #142057; line-height: 1; }
.cert-sign .line { height: 0.25cqw; background: #142057; margin: 0.6cqw 0; }
.cert-meta { display: grid; text-align: right; font-size: 1.45cqw; color: #3a4677; gap: 0.2cqw; }
.cert-note { margin: 1.6cqw 0 0; font-size: 1.05cqw; color: #3a4677; }

@media print {
  @page { size: letter landscape; margin: 0; }
  .cert-body { background: #fff; }
  .cert-tools { display: none; }
  html, body { margin: 0; }
  .cert { width: 11in; height: 8.5in; aspect-ratio: auto; margin: 0; border: 0; border-radius: 0; padding: 0.3in; overflow: hidden; break-after: avoid; }
  .cert-inner, .cert-inner::after, .cert-projects li::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
