/* Ping My Lab · My courses (my.html only). Loaded after css/site.css and built on its tokens and components.
   Sign-in card, course materials, class recordings and the file viewer. */

/* Accent per file kind (new names; the site's own tokens are untouched). */
.k-video { --k: var(--teal); --kb: rgba(5, 208, 200, .10); --kl: rgba(5, 208, 200, .28); }
.k-pdf { --k: #FF8FA6; --kb: rgba(255, 91, 127, .10); --kl: rgba(255, 91, 127, .30); }
.k-doc { --k: #86B4FF; --kb: rgba(110, 160, 255, .10); --kl: rgba(110, 160, 255, .30); }
.k-sheet { --k: var(--ok); --kb: rgba(52, 211, 153, .10); --kl: rgba(52, 211, 153, .30); }
.k-slides { --k: var(--amber-2); --kb: rgba(245, 160, 32, .10); --kl: rgba(245, 160, 32, .32); }
.k-image { --k: #C7AEFF; --kb: rgba(170, 135, 255, .11); --kl: rgba(170, 135, 255, .32); }
.k-file { --k: var(--ink-2); --kb: rgba(255, 255, 255, .05); --kl: var(--line-2); }

/* ---------- sign-in ---------- */
.signin .lead { margin-bottom: 22px; }
.signin #login-note { margin: 0 0 18px; }
.signin-card {
  position: relative;
  background: linear-gradient(180deg, #0E141F, var(--card-2));
  border: 1px solid var(--line-2);
  border-radius: var(--r-l);
  padding: clamp(20px, 4.5vw, 32px);
  box-shadow: 0 34px 80px -44px rgba(5, 208, 200, .42), 0 1px 0 rgba(255, 255, 255, .04) inset;
}
.signin-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(5, 208, 200, .8), transparent);
  pointer-events: none;
}
.signin-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.signin-kicker { margin: 0; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; color: var(--teal); }
.signin-bar { display: flex; gap: 6px; flex: none; }
.signin-bar i { display: block; width: 28px; height: 3px; border-radius: 3px; background: var(--line-2); }
.signin-bar i.is-on { background: var(--teal); }
.signin-title { font-size: clamp(1.25rem, 1.15rem + .5vw, 1.45rem); line-height: 1.25; letter-spacing: -0.015em; margin: 0 0 20px; }
.signin-step .field { margin-bottom: 18px; }
.signin-step .field .hint { margin-bottom: 0; }
.signin-step .btn-block { margin-top: 0; }

.code-field label { font-weight: 500; color: var(--ink-2); line-height: 1.5; }
.code-to { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.field .code-input {
  min-height: 66px;
  margin-top: 4px;
  padding: 8px 10px;
  font-family: var(--f-mono);
  font-size: clamp(1.6rem, 1.3rem + 1.4vw, 1.95rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: .5em;
  text-indent: .5em;   /* balances the letter spacing after the last digit, so the code sits in the middle */
  text-align: center;
  caret-color: var(--teal);
  background: #070B13;
  border-radius: 12px;
}
.field .code-input:focus { box-shadow: 0 0 0 3px rgba(5, 208, 200, .22), 0 12px 30px -18px rgba(5, 208, 200, .5); }

.signin-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 20px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: .93rem;
}
.signin-links .linklike { min-height: 36px; padding: 6px 0; text-align: left; }
.signin-links .linklike:disabled { color: var(--ink-3); text-decoration: none; cursor: default; }
#resend-btn { font-variant-numeric: tabular-nums; }

/* ---------- class recordings (schedule) ---------- */
.cr-rec { margin-top: 9px; }
.rec-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 14px 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(5, 208, 200, .42);
  background: rgba(5, 208, 200, .07);
  color: var(--teal);
  font-family: var(--f-body);
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.rec-btn:hover { background: rgba(5, 208, 200, .14); border-color: var(--teal); color: #5FF0E8; }
.rec-btn .ico { width: 15px; height: 15px; flex: none; }
.rec-btn .ico-external { width: 14px; height: 14px; opacity: .85; }

/* ---------- course materials ---------- */
.mat-col > h3 { margin-bottom: 14px; }
.mat-section + .mat-section { margin-top: 24px; }
.mat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--f-mono);
  font-size: .74rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.mat-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.mat-name { min-width: 0; overflow-wrap: anywhere; }
.mat-count { flex: none; font-size: .7rem; letter-spacing: .02em; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px; }
.mat-list { list-style: none; display: grid; gap: 8px; }
/* Tablets: the materials sit under the schedule at full width, so two columns of files. */
@media (min-width: 600px) and (max-width: 860px) {
  .mat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mat-item { height: 100%; }
}
.mat-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 10px 12px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .02);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.mat-item:hover { border-color: rgba(5, 208, 200, .45); background: rgba(5, 208, 200, .05); }
.mat-item:hover .mat-go { color: var(--teal); transform: translateX(2px); }
.mat-item:active { transform: translateY(1px); }
.mat-item:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 12px; }
.mat-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px; color: var(--k, var(--ink-2)); background: var(--kb, rgba(255, 255, 255, .05)); border: 1px solid var(--kl, var(--line-2)); }
.mat-ico .ico { width: 21px; height: 21px; }
.mat-text { min-width: 0; }
.mat-title { display: block; color: var(--ink); font-weight: 500; line-height: 1.38; overflow-wrap: anywhere; }
.mat-meta { display: block; margin-top: 3px; font-family: var(--f-mono); font-size: .74rem; line-height: 1.3; color: var(--ink-3); }
.mat-go { display: grid; place-items: center; color: var(--ink-3); transition: color .15s ease, transform .15s ease; }
.mat-go .ico { width: 18px; height: 18px; }
.mat-empty { margin: 0; padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--ink-3); font-size: .9rem; }

/* ---------- viewer ---------- */
body.viewer-lock { overflow: hidden; }
.viewer {
  width: min(1080px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-l);
  background: var(--bg-2);
  color: var(--ink-2);
  box-shadow: 0 50px 120px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(5, 208, 200, .07);
  overflow: hidden;
  overscroll-behavior: contain;
}
.viewer[open] { display: flex; flex-direction: column; animation: viewer-in .2s cubic-bezier(.2, .8, .2, 1); }
.viewer::backdrop { background: rgba(2, 6, 14, .8); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.viewer.is-doc { width: min(1000px, calc(100vw - 48px)); height: calc(100vh - 48px); height: calc(100dvh - 48px); }
.viewer.is-video { width: min(1120px, calc(100vw - 48px), calc((100vh - 120px) * 16 / 9)); width: min(1120px, calc(100vw - 48px), calc((100dvh - 120px) * 16 / 9)); }
.viewer.is-fallback[open] { position: fixed; inset: 0; z-index: 100; box-shadow: 0 0 0 100vmax rgba(2, 6, 14, .85); }
.viewer-box { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.viewer-head { display: flex; align-items: center; gap: 12px; flex: none; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.viewer-ico { width: 38px; height: 38px; }
.viewer-ico .ico { width: 20px; height: 20px; }
.viewer-heading { flex: 1 1 auto; min-width: 0; }
.viewer-heading h2 { font-size: 1.02rem; line-height: 1.3; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-meta { margin: 2px 0 0; font-family: var(--f-mono); font-size: .74rem; line-height: 1.3; color: var(--ink-3); }
.viewer-meta:empty { display: none; }
.viewer-dl { flex: none; min-height: 44px; padding: 8px 16px 8px 13px; gap: 8px; font-size: .92rem; }
.viewer-dl svg { width: 18px; height: 18px; flex: none; }
.viewer-x { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--ink); cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.viewer-x:hover { border-color: var(--teal); background: rgba(5, 208, 200, .07); }
.viewer-x svg { width: 20px; height: 20px; }
.viewer-stage { position: relative; flex: 1 1 auto; min-height: 0; background: #070B13; }
.viewer.is-video .viewer-stage { flex: none; aspect-ratio: 16 / 9; background: #000; }
.viewer-frame { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; border: 0; background: transparent; }
.viewer-loading { position: absolute; inset: 0; z-index: 2; display: none; place-content: center; justify-items: center; gap: 14px; padding: 20px; background: inherit; color: var(--ink-2); font-size: .95rem; text-align: center; }
.viewer-stage.is-loading .viewer-loading { display: grid; }
.viewer-spin { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid rgba(5, 208, 200, .22); border-top-color: var(--teal); animation: spin .8s linear infinite; }
.viewer-none { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; color: var(--ink-2); }
.viewer-none .mat-ico { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 4px; }
.viewer-none .mat-ico .ico { width: 28px; height: 28px; }
.viewer-none p { margin: 0; }
.viewer-guard { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
@keyframes viewer-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

/* Phones: a full-screen sheet. */
@media (max-width: 640px) {
  .viewer, .viewer.is-doc, .viewer.is-video {
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .viewer[open] { animation-name: viewer-sheet; animation-duration: .24s; }
  .viewer-head { gap: 10px; padding: 8px 8px 8px 12px; }
  .viewer-ico { width: 34px; height: 34px; border-radius: 10px; }
  .viewer-ico .ico { width: 18px; height: 18px; }
  .viewer-heading h2 { font-size: .98rem; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
  .viewer-dl { width: 44px; padding: 0; gap: 0; }
  .viewer-dl .dl-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .viewer.is-video .viewer-stage { flex: 1 1 auto; aspect-ratio: auto; display: flex; align-items: center; }
  .viewer.is-video .viewer-frame { position: relative; inset: auto; height: auto; aspect-ratio: 16 / 9; }
}
@keyframes viewer-sheet { from { opacity: .4; transform: translateY(32px); } to { opacity: 1; transform: none; } }

@media (max-width: 400px) {
  .mat-item { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; padding: 9px 10px 9px 9px; }
  .mat-ico { width: 36px; height: 36px; border-radius: 10px; }
  .mat-ico .ico { width: 19px; height: 19px; }
  .signin-bar i { width: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .viewer[open] { animation: none; }
  .mat-item, .mat-go, .rec-btn, .viewer-x { transition: none; }
  .mat-item:hover .mat-go, .mat-item:active { transform: none; }
  .viewer-spin { animation: none; border-color: var(--teal); }
}
