/*
 * Обучение (templates/obuchenie.html): the team planner (#team-plan, static/js/team-plan.js).
 * A course's page (templates/service_detail.html): the certificate (.cert, static/js/certificate.js).
 * Levels in shades of red: l1 Начинаещ → l4 Експерт.
 */
.tp-lv, .tp-seg-c { --lv: #a3a3a3; }
.l1 { --lv: #f87171; } .l2 { --lv: #dc2626; } .l3 { --lv: #991b1b; } .l4 { --lv: #171717; }

/* the form */
.tp-range { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px; cursor: pointer;
  background: linear-gradient(90deg, #d42a2a var(--p, 15%), #e5e5e5 var(--p, 15%)); }
.tp-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 5px solid #d42a2a; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.tp-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 5px solid #d42a2a; }
.tp-c { transition: border-color .2s, background .2s, box-shadow .2s; }
.tp-c:hover { border-color: #a3a3a3; }
.tp-c.on { border-color: #d42a2a; background: #fff7f7; box-shadow: 0 0 0 1px #d42a2a inset; }
.tp-chk { width: 18px; height: 18px; accent-color: #d42a2a; flex: none; }
.tp-lv { width: 10px; height: 10px; border-radius: 3px; background: var(--lv); flex: none; }
.tp-seg { border: 1px solid #e5e5e5; border-radius: 12px; overflow: hidden; }
.tp-seg label { position: relative; cursor: pointer; }
.tp-seg label + label { border-left: 1px solid #e5e5e5; }
.tp-seg input { position: absolute; opacity: 0; }
.tp-seg span { display: block; padding: 11px 8px; text-align: center; font-size: 14px; font-weight: 600; color: #404040; transition: background .2s, color .2s; }
.tp-seg input:checked + span { background: #171717; color: #fff; }
.tp-seg input:focus-visible + span { outline: 2px solid #d42a2a; outline-offset: -2px; }

/* the dark panel */
.tp-panel { background: radial-gradient(90% 70% at 100% 0%, rgba(212, 42, 42, .22), transparent 60%), #111417; }
.tp-stat { border-left: 2px solid #d42a2a; padding-left: 14px; }
.tp-stat b { display: block; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.05; font-weight: 800; font-variant-numeric: tabular-nums; }
.tp-stat span { display: block; margin-top: 4px; font-size: 13px; color: #a3a3a3; line-height: 1.3; }
.tp-path { display: flex; gap: 6px; min-height: 92px; }
.tp-seg-c { flex: var(--w) 1 0; min-width: 0; position: relative; border-radius: 12px; padding: 12px 12px 12px; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--lv) 85%, #fff 0%), color-mix(in srgb, var(--lv) 55%, #000)); animation: tp-in .45s cubic-bezier(.3, 1.3, .5, 1) both; }
.tp-seg-c.l4 { background: linear-gradient(160deg, #2a2a2a, #000); box-shadow: inset 0 0 0 1px #3f3f46; }
.tp-seg-c i { font-style: normal; font: 700 11px ui-monospace, monospace; opacity: .7; }
.tp-seg-c b { display: block; margin-top: 4px; font-size: 13px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tp-seg-c span { display: block; margin-top: 6px; font-size: 11.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-seg-c + .tp-seg-c::before { content: ""; position: absolute; left: -1px; top: 50%; width: 8px; height: 8px; margin-top: -4px; background: #111417; transform: translateX(-50%) rotate(45deg); }
@keyframes tp-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.tp-plan { white-space: pre-wrap; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; color: #d4d4d4;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; padding: 16px 18px; }
@media (max-width: 640px) {
  .tp-path { flex-direction: column; }
  .tp-seg-c { flex: none; }
  .tp-seg span { font-size: 13px; padding: 11px 2px; }
  .tp-seg-c + .tp-seg-c::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { .tp-seg-c { animation: none; } }

/* ===== the certificate (templates/partials/certificate.html) ===== */
.cert-in input { width: 100%; border: 1px solid #d4d4d4; border-radius: 12px; padding: 13px 16px; font-size: 15px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.cert-in input:focus { outline: none; border-color: #d42a2a; box-shadow: 0 0 0 3px rgba(212, 42, 42, .15); }
.cert-stage { perspective: 1400px; }
.cert { --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 30%; position: relative; display: grid; grid-template-columns: 22% 1fr; aspect-ratio: 1.414; overflow: hidden;
  border-radius: 10px; color: #1c1917; background: #fbf8f1; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .5s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 30px 60px -20px rgba(17, 20, 23, .35), 0 12px 24px -12px rgba(17, 20, 23, .25); container-type: inline-size; }
.cert.tilt { transition: transform .08s linear; }
.cert::after { content: ""; position: absolute; inset: 2.2cqw 2.2cqw 2.2cqw calc(22% + 2.2cqw); border: 1px solid rgba(160, 120, 60, .35); outline: 1px solid rgba(160, 120, 60, .2); outline-offset: .5cqw; pointer-events: none; }
.cert-guil { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cert-guil path { fill: none; stroke-width: .6; }
.cert-band { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 3.2cqw 1.6cqw;
  color: #fff; background: radial-gradient(120% 60% at 0% 100%, rgba(212, 42, 42, .55), transparent 60%), linear-gradient(180deg, #1a1d21, #0c0e10); }
.cert-band::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: .45cqw; background: linear-gradient(180deg, #f87171, #d42a2a 40%, #7f1d1d); }
.cert-logo { width: 15cqw; max-width: none; height: auto; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.cert-vert { writing-mode: vertical-rl; transform: rotate(180deg); font: 700 1.25cqw/1 ui-monospace, monospace; letter-spacing: .5em; color: rgba(255, 255, 255, .45); }
.cert-lvl { display: flex; flex-direction: column; align-items: center; gap: .9cqw; font-size: 1.3cqw; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.cert-pips { display: flex; gap: .5cqw; }
.cert-pips i { width: 1.5cqw; height: .45cqw; border-radius: 1cqw; background: rgba(255, 255, 255, .22); }
.cert-pips i.on { background: #f87171; }
.cert-main { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 5cqw 6cqw 4cqw; }
.cert-top { width: 100%; display: flex; justify-content: center; position: relative; }
.cert-kicker { font: 700 1.35cqw/1 ui-monospace, monospace; letter-spacing: .38em; text-transform: uppercase; color: #a3392e; }
.cert-kicker::before, .cert-kicker::after { content: ""; display: inline-block; width: 4cqw; height: 1px; margin: 0 1.4cqw; vertical-align: middle; background: currentColor; opacity: .5; }
.cert-sample { position: absolute; right: -1cqw; top: -1.2cqw; font: 700 1.05cqw/1 ui-monospace, monospace; letter-spacing: .2em; text-transform: uppercase;
  color: #a3392e; border: 1px solid currentColor; border-radius: .6cqw; padding: .6cqw 1cqw; transform: rotate(6deg); opacity: .7; }
.cert-small { margin-top: 3.2cqw; font-size: 1.6cqw; color: #78716c; font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.cert-name { position: relative; margin-top: 1.2cqw; min-width: 46%; padding: 0 2cqw .8cqw; font: italic 400 var(--fs, 5.4cqw)/1.15 Georgia, "Times New Roman", serif; color: #111;
  white-space: nowrap; transition: color .3s; }
.cert-name.ph { color: #c9c2b6; }
.cert-name::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, transparent, #d42a2a 20%, #d42a2a 80%, transparent);
  transform: scaleX(.35); transition: transform .6s cubic-bezier(.3, 1.2, .5, 1); }
.cert-name:not(.ph)::after { transform: none; }
.cert-name.pop { animation: cert-pop .25s ease-out; }
@keyframes cert-pop { 40% { color: #d42a2a; } }
.cert-course { margin-top: .8cqw; font-size: 2.5cqw; line-height: 1.25; font-weight: 800; letter-spacing: -.01em; max-width: 90%; }
.cert-facts { margin-top: 1.6cqw; display: flex; flex-wrap: wrap; justify-content: center; gap: .8cqw; }
.cert-facts span { font-size: 1.25cqw; font-weight: 600; color: #57534e; border: 1px solid #e7e0d2; background: rgba(255, 255, 255, .6); border-radius: 2cqw; padding: .5cqw 1.3cqw; }
.cert-top + .cert-small { margin-top: auto; }
.cert-foot { margin-top: auto; width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 3cqw; }
.cert-sign { display: block; border-top: 1px solid #a8a29e; padding-top: .8cqw; font-size: 1.45cqw; font-weight: 600; color: #292524; }
.cert-sign small { display: block; margin-top: .3cqw; font-size: 1.1cqw; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: #a8a29e; }
.cert-seal { display: block; width: 12cqw; margin-bottom: -1cqw; border-radius: 50%; position: relative; filter: drop-shadow(0 .6cqw 1cqw rgba(127, 29, 29, .35)); }
.cert-seal::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from var(--sa, 0deg), #b91c1c, #f87171, #fde2e2, #dc2626, #7f1d1d, #ef4444, #fecaca, #b91c1c); animation: cert-foil 8s linear infinite; }
.cert-seal svg { position: relative; display: block; width: 100%; height: auto; }
.cert-seal .s1 { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 1; }
.cert-seal .s2 { fill: none; stroke: rgba(255, 255, 255, .7); stroke-width: .8; stroke-dasharray: 1.5 2; }
.cert-seal .s3 { fill: #fff; font: 700 8.4px ui-monospace, monospace; letter-spacing: .12em; }
.cert-seal .s4 { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.cert-seal .s5 { fill: #7f1d1d; stroke: #fff; stroke-width: 1.5; }
@property --sa { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes cert-foil { to { --sa: 360deg; } }
.cert-glare { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .4s; mix-blend-mode: soft-light;
  background: radial-gradient(40% 50% at var(--gx) var(--gy), rgba(255, 255, 255, .9), transparent 70%); }
.cert.tilt .cert-glare { opacity: 1; }
@media (max-width: 640px) {
  .cert { grid-template-columns: 16% 1fr; }
  .cert::after { left: calc(16% + 2.2cqw); }
  .cert-vert, .cert-lvl { display: none; }
}
@media (prefers-reduced-motion: reduce) { .cert-seal::before { animation: none; } .cert { transition: none; } }
html.dark .cert-in input { background: #171717; border-color: #404040; color: #f5f5f5; }
html.dark .tp-c.on { background: rgba(212, 42, 42, .1); }
html.dark .tp-seg, html.dark .tp-seg label + label { border-color: var(--d-line, #333); }
html.dark .tp-seg span { color: var(--d-text-2, #d4d4d4); }
html.dark .tp-seg input:checked + span { background: #f5f5f5; color: #111; }
html.dark .tp-range { background: linear-gradient(90deg, #d42a2a var(--p, 15%), #3f3f46 var(--p, 15%)); }
