/* Attendance calculator look. Uses the locked Night Owl School palette (same tokens as shared/tool-theme.css);
   shared layout pieces still come from ../../shared/*.css. Functionality lives in app.js / calc.js. */
:root {
  --t-bg: var(--background); --t-card: var(--card); --t-ink: var(--foreground); --t-muted: var(--muted-foreground);
  --t-line: var(--border); --t-input: var(--input); --t-soft: var(--sand);
  --t-indigo: var(--cobalt-text); --t-violet: var(--cobalt); --t-blue: var(--cobalt); --t-teal: var(--acid-lime);
  --t-ok-bg: var(--acid-lime); --t-ok-fg: var(--ink); --t-warn-bg: var(--sun); --t-warn-fg: var(--ink); --t-bad-bg: var(--coral); --t-bad-fg: var(--ink);
  --t-shadow: none;
}

body.att { background: var(--t-bg); color: var(--t-ink); position: relative; }
.att .site-bar, .att .page { position: relative; z-index: 1; }
.att .site-bar a.brand { color: var(--t-ink); }
.att .site-bar a.brand span { color: var(--t-indigo); }
.att .theme-btn { color: var(--t-ink); border-color: var(--t-input); background: var(--t-card); }
.att a { color: var(--t-indigo); }

/* decorative blobs (clipped so they never cause sideways scrolling) */
.blobs { position: absolute; top: 0; left: 0; right: 0; height: 320px; overflow: hidden; pointer-events: none; z-index: 0; }
.blob { position: absolute; pointer-events: none; z-index: 0; }
.blobs { display: none; }

:root[data-theme="dark"] .blob { opacity: .55; }

/* hero */
.hero { text-align: center; padding: 8px 0 24px; }
.free-pill { display: inline-block; padding: 8px 28px; border-radius: 999px; color: var(--ink); font-weight: 800; font-size: .8rem; letter-spacing: 0.18em; text-transform: uppercase; background: var(--acid-lime); }
.att h1 { font-family: var(--font-sans); font-weight: 900; letter-spacing: -0.03em; line-height: 1.02; font-size: clamp(2.6rem, 11vw, 4.6rem); margin: 18px 0 12px; }
.h1-a, .h1-b { display: block; }
.h1-a { color: var(--t-ink); }
.h1-b { color: var(--cobalt-text); }

.hero-sub { max-width: 44ch; margin: 0 auto; color: var(--t-muted); font-size: 1.05rem; }
.hero-sub b { color: var(--t-teal); }
.hero-sub b { color: var(--t-ink); }

/* cards */
.att .card { background: var(--t-card); border: 1px solid var(--t-line); border-radius: 28px; padding: 22px 18px; box-shadow: var(--t-shadow); }
.att h2 { font-family: var(--font-sans); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; margin: 0; color: var(--t-ink); }
.card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.card-sub { margin: 2px 0 0; font-size: 0.88rem; color: var(--t-muted); }
.ico { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: #fff; }
.ico-indigo { background: var(--periwinkle); }
.ico-teal { background: var(--acid-lime); }
.center { text-align: center; }

/* form */
.att label { color: var(--t-muted); font-weight: 600; }
.att input[type="number"], .att input[type="text"] { background: var(--t-card); color: var(--t-ink); border: 1.5px solid var(--t-input); border-radius: 14px; }
.att :focus-visible { outline: 3px solid var(--t-violet); outline-offset: 2px; }
.req { max-width: 240px; margin-bottom: 16px; }
.err { margin: 8px 0 0; font-size: 0.9rem; color: var(--destructive-text); font-weight: 600; }
.hint { margin: 16px 0 0; font-size: 0.85rem; color: var(--t-muted); }

/* table */
.table-wrap { overflow-x: auto; border: 1px solid var(--t-line); border-radius: 18px; }
table { border-collapse: collapse; width: 100%; min-width: 720px; }
th, td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--t-line); font-weight: 400; }
thead th { font-size: 0.78rem; font-weight: 700; color: var(--t-muted); white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { text-align: left; font-size: 0.85rem; font-weight: 700; color: var(--t-ink); min-width: 118px; position: sticky; left: 0; background: var(--t-card); z-index: 1; }
td input { width: 64px; padding: 8px 6px; text-align: center; }
td input[aria-invalid="true"] { border-color: var(--destructive-text); border-width: 2px; }
.total { font-weight: 800; font-size: 1.15rem; background: var(--t-soft); color: var(--t-indigo); }
thead th.total-h { background: var(--t-soft); color: var(--t-indigo); }

/* button */
.actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.att .btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 34px; border-radius: 999px; border: 0; color: var(--background); font-weight: 800; font-size: 1.05rem; cursor: pointer; background: var(--ink);  }
.att .btn:hover { filter: brightness(1.06); }
.att .linkbtn { color: var(--t-indigo); }

/* gauge */
.gauge { position: relative; width: min(260px, 72vw); margin: 16px auto 8px; }
.gauge svg { display: block; width: 100%; height: auto; }
.g-track { stroke: var(--t-soft); }
.g-fill { transition: stroke-dashoffset .6s ease; }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 0 22%; }
.att .big { font-family: var(--font-sans); font-weight: 900; letter-spacing: -0.03em; font-size: clamp(1.9rem, 9vw, 2.7rem); line-height: 1; color: var(--t-ink); }
.att .badge { font-size: 0.72rem; line-height: 1.2; padding: 4px 10px; background: var(--t-ok-bg); color: var(--t-ok-fg); }
.att .badge.borderline { background: var(--t-warn-bg); color: var(--t-warn-fg); }
.att .badge.short { background: var(--t-bad-bg); color: var(--t-bad-fg); }

/* message panels (overall result + future) */
.note { margin-top: 16px; padding: 14px 16px; border-radius: 18px; background: var(--t-soft); color: var(--t-ink); }
.result[data-state="ok"] .note, #future[data-state="ok"] { background: var(--t-ok-bg); color: var(--t-ok-fg); }
.result[data-state="short"] .note, #future[data-state="short"] { background: var(--t-bad-bg); color: var(--t-bad-fg); }
.note .msg { margin: 8px 0 0; }
.note .msg:first-child { margin-top: 0; }
.strong { font-size: 1.1rem; font-weight: 800; }
.muted { opacity: 0.85; font-size: 0.9rem; }

/* feature tiles */
.features { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.features li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 12px; background: var(--t-card); border: 1px solid var(--t-line); border-radius: 22px; box-shadow: var(--t-shadow); }
.features b { font-size: 0.95rem; color: var(--t-ink); }
.features li > span:last-child { font-size: 0.8rem; color: var(--t-muted); }
.fi { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; margin-bottom: 4px; }
.fi-teal { background: var(--acid-lime); } .fi-indigo { background: var(--periwinkle); } .fi-orange { background: var(--coral); } .fi-green { background: var(--khaki); }
@media (min-width: 720px) { .features { grid-template-columns: repeat(4, 1fr); } }

/* footer band */
.band { display: none; }

@media (max-width: 480px) { .att .card { padding: 20px 14px; } .req { max-width: 100%; } }

/* wider page so all 8 subjects and the Total column fit on desktop */
.att .page { max-width: 900px; }
/* keep the Total column visible while the table scrolls sideways on small screens */
th.total-h, td.total { position: sticky; right: 0; z-index: 1; box-shadow: -8px 0 10px -8px rgba(25, 26, 23, 0.2); }
thead th.total-h { z-index: 2; }
@media (max-width: 480px) {
  tbody th { min-width: 92px; font-size: 0.8rem; }
  td input { width: 58px; }
}

/* ---- Finish-line mascot (owl in a bubble) ---- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mascot { padding-bottom: 18px; overflow: hidden; }
.scene { position: relative; height: 140px; margin: 6px 2px 0; }
.lane { position: absolute; left: 0; right: 0; bottom: 14px; height: 10px; border-radius: 999px; background: var(--t-soft); }
.lane::after { content: ""; position: absolute; left: 8px; right: 8px; top: 4px; border-top: 2px dashed var(--t-input); opacity: .45; }
.finish { position: absolute; right: 90px; bottom: 14px; width: 18px; height: 96px; z-index: 2; border: 1.5px solid var(--ink); border-radius: 4px;
  background: conic-gradient(var(--ink) 25%, var(--card) 0 50%, var(--ink) 0 75%, var(--card) 0) 0 0 / 18px 18px; }
.flabel { position: absolute; left: 50%; top: -26px; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800; color: var(--background); background: var(--ink); white-space: nowrap; }
:root[data-theme="dark"] .flabel { background: var(--acid-lime); color: var(--ink); }

.runner { position: absolute; z-index: 3; bottom: 20px; width: 76px; height: 76px; border-radius: 50%; padding: 4px;
  left: calc((100% - 208px) * var(--run, 0)); transition: left 1.6s cubic-bezier(.2, .8, .2, 1);
  background: var(--t-soft); border: 3px solid var(--t-card); box-shadow: 0 8px 18px rgba(25, 26, 23, .2); }
.runner svg { display: block; width: 100%; height: 100%; }
.mascot[data-state="ok"] .runner { left: calc(100% - 82px); background: var(--t-ok-bg); animation: hop .7s ease-in-out infinite; }
.mascot[data-state="short"] .runner { background: var(--t-bad-bg); animation: sulk 2.2s ease-in-out infinite; transform-origin: 50% 100%; }

.f-sad, .w-up { display: none; }
.mascot[data-state="ok"] .w-up, .mascot[data-state="short"] .f-sad { display: inline; }
.mascot[data-state="ok"] .w-down, .mascot[data-state="short"] .f-happy { display: none; }
.tear { transform-box: fill-box; animation: tear 1.3s ease-in infinite; }
.tear.t2 { animation-delay: .5s; }

.confetti { display: none; position: absolute; right: 0; top: 0; width: 120px; height: 110px; z-index: 4; }
.mascot[data-state="ok"] .confetti { display: block; }
.confetti i { position: absolute; top: 4px; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.9s linear infinite; }
.confetti i:nth-child(1) { left: 6px;  background: var(--sun); animation-delay: 0s; }
.confetti i:nth-child(2) { left: 22px; background: var(--coral); animation-delay: .3s; }
.confetti i:nth-child(3) { left: 38px; background: var(--acid-lime); animation-delay: .6s; }
.confetti i:nth-child(4) { left: 54px; background: var(--periwinkle); animation-delay: .1s; }
.confetti i:nth-child(5) { left: 70px; background: var(--sun); animation-delay: .9s; }
.confetti i:nth-child(6) { left: 86px; background: var(--coral); animation-delay: .4s; }
.confetti i:nth-child(7) { left: 102px; background: var(--acid-lime); animation-delay: .7s; }
.confetti i:nth-child(8) { left: 14px; background: var(--cobalt); animation-delay: 1.1s; }

.mascot-msg { margin: 10px 0 0; text-align: center; font-weight: 800; font-size: 1.1rem; }
.mascot[data-state="ok"] .mascot-msg { color: var(--t-ok-fg); }
.mascot[data-state="short"] .mascot-msg { color: var(--t-bad-fg); }

@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes sulk { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(2px); } }
@keyframes tear { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(12px); opacity: 0; } }
@keyframes fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(110px) rotate(360deg); opacity: 0; } }
@media (max-width: 480px) { .runner { left: calc((100% - 196px) * var(--run, 0)); } .finish { right: 84px; } .mascot[data-state="ok"] .runner { left: calc(100% - 78px); } .confetti { width: 100px; } }
