/* Campus - a replacement for a portal nobody can read.
 *
 * The brief was "make me forget The Campus Web", and the reason that app won in the first
 * place is that Academia is unreadable, not that it is pretty. So the design goal here is
 * DENSITY WITHOUT NOISE: the number he needs is the biggest thing on screen, every status is
 * a word as well as a colour, and nothing animates that he did not touch.
 */

:root {
  --bg:        #0A0C0F;
  --surface:   #14181F;
  --surface-2: #1B212A;
  --line:      #252D3A;
  --text:      #E9EEF7;
  --muted:     #8B97AA;
  --accent:    #7C6BFF;
  --accent-dim:#7C6BFF26;

  /* Status. Never used alone - every one of these ships with a word next to it. */
  --ok:    #3DD68C;
  --tight: #F5A524;
  --edge:  #FF8A5C;
  --short: #FF5C6A;

  --r:   14px;
  --r-s: 9px;
  --pad: 16px;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs-h: 62px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  padding-bottom: calc(var(--tabs-h) + var(--safe-b));
  -webkit-font-smoothing: antialiased;
}

/* Every figure in this app is compared against another figure, so they all line up. */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.err { color: var(--short); min-height: 1.2em; font-size: 14px; }

/* ---------------------------------------------------------------- chrome */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px var(--pad);
}
.brand {
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: 9px;
}
.brand .mark { width: 22px; height: 22px; color: var(--accent); flex: none; }
.brand-lg { font-size: 26px; letter-spacing: -0.03em; }
.brand-lg .mark { width: 32px; height: 32px; }

/* Three lines, not a marketing wall. Someone deciding whether to hand over a password wants
   to know what it buys them, and then to stop reading. */
.feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.feats li {
  font-size: 14px; color: var(--muted); padding-left: 24px; position: relative; line-height: 1.45;
}
.feats li::before {
  content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px;
  border-radius: 3px; background: var(--accent); opacity: .8;
}

.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--r-s); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--surface); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.view { max-width: 760px; margin: 0 auto; padding: var(--pad); outline: none; }
.view > * + * { margin-top: 14px; }

/* Bottom nav: 4 items, icon + label. Icon-only nav is how Academia lost people. */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tab {
  min-height: var(--tabs-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--muted);
  font-size: 11px; font-weight: 550; letter-spacing: 0.01em; cursor: pointer;
}
.tab svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] svg { stroke: var(--accent); }

:where(button, a, textarea, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s);
}

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: var(--pad);
}
.card + .card { margin-top: 12px; }

.hero { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hero .date { font-size: 22px; font-weight: 680; letter-spacing: -0.02em; }
.hero .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

.do-badge {
  flex: none; text-align: center; padding: 7px 13px; border-radius: var(--r-s);
  background: var(--accent-dim); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.do-badge b { display: block; font-size: 21px; line-height: 1; color: var(--accent); }
.do-badge span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

/* A class. The live one gets the accent rail; everything else stays quiet. */
.klass {
  display: grid; grid-template-columns: 62px 1fr; gap: 13px;
  padding: 13px 0; border-top: 1px solid var(--line);
}
.klass:first-of-type { border-top: 0; }
.klass .time { font-size: 13px; color: var(--muted); line-height: 1.35; }
.klass .time b { display: block; color: var(--text); font-size: 15px; font-weight: 620; }
.klass .title { font-weight: 600; }
.klass .meta { font-size: 13px; color: var(--muted); margin-top: 3px;
  display: flex; flex-wrap: wrap; gap: 4px 10px; }
.klass.now { background: var(--accent-dim); margin: 0 calc(var(--pad) * -1); padding: 13px var(--pad);
  border-left: 3px solid var(--accent); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 640; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.pill.ok    { color: var(--ok);    border-color: color-mix(in srgb, var(--ok) 35%, transparent);
              background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.tight { color: var(--tight); border-color: color-mix(in srgb, var(--tight) 35%, transparent);
              background: color-mix(in srgb, var(--tight) 12%, transparent); }
.pill.edge  { color: var(--edge);  border-color: color-mix(in srgb, var(--edge) 38%, transparent);
              background: color-mix(in srgb, var(--edge) 12%, transparent); }
.pill.short { color: var(--short); border-color: color-mix(in srgb, var(--short) 42%, transparent);
              background: color-mix(in srgb, var(--short) 14%, transparent); }
.pill.lab   { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent);
              background: var(--accent-dim); }

/* ---------------------------------------------------------------- attendance */

.att-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.att-name { font-weight: 620; }
.att-code { font-size: 12px; color: var(--muted); margin-top: 2px; }
.att-pct  { font-size: 27px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }

.bar { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden;
  margin-top: 12px; position: relative; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.bar.tight i { background: var(--tight); }
.bar.edge  i { background: var(--edge); }
.bar.short i { background: var(--short); }
/* the 75% line, so the number has somewhere to be measured against */
.bar::after {
  content: ""; position: absolute; top: -2px; bottom: -2px; left: 75%;
  width: 2px; background: var(--text); opacity: .5;
}

.verdict { margin-top: 11px; font-size: 14px; }

/* The skip planner - the interaction no other SRM app has. */
.planner { margin-top: 13px; padding-top: 13px; border-top: 1px dashed var(--line); }
.planner-row { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s); }
.stepper button {
  width: 44px; height: 40px; background: none; border: 0; color: var(--text);
  font-size: 19px; cursor: pointer; border-radius: var(--r-s);
}
.stepper button:hover:not(:disabled) { background: var(--line); }
.stepper button:disabled { color: var(--muted); opacity: .45; cursor: default; }
.stepper output { min-width: 34px; text-align: center; font-weight: 660; }
.planner .result { font-size: 14px; }

/* ---------------------------------------------------------------- timetable */

.do-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; }
.do-tab {
  flex: none; min-height: 44px; padding: 0 16px; border-radius: var(--r-s); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  font-weight: 600; font-size: 14px;
}
.do-tab[aria-pressed="true"] { background: var(--accent-dim); color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------------------------------------------------------------- onboarding */

.onboard { position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: grid; place-items: center; padding: var(--pad); overflow: auto; }
/* A class with display:grid OUT-SPECIFIES the user agent's [hidden]{display:none}, so the
 * overlay stayed on screen while el.hidden was already true. Caught by rendering it, not by
 * reading it. Any element toggled via .hidden needs this guard next to its display rule. */
.onboard[hidden] { display: none; }
.onboard-card { width: 100%; max-width: 460px; }
.onboard-card > * + * { margin-top: 14px; }
.field { display: block; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
textarea, input[type="text"], input[type="password"], input[type="url"] {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-s); padding: 11px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical;
}
/* 16px on inputs specifically: anything smaller makes iOS Safari zoom the page on focus,
 * which then leaves the layout scrolled sideways. */
input[type="text"], input[type="password"], input[type="url"] { font-size: 16px; min-height: 44px; }
.btn:disabled { opacity: .55; cursor: default; }

/* The eye toggle sits inside the password field rather than beside it, so the touch target
   for "show password" lands exactly where a thumb already is. */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-eye {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--r-s); color: var(--muted); cursor: pointer;
}
.pw-eye:hover { color: var(--text); background: var(--surface-2); }
.pw-eye svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }
.pw-eye[aria-pressed="true"] { color: var(--accent); }
.row { display: flex; gap: 9px; flex-wrap: wrap; }
.btn {
  min-height: 44px; padding: 0 18px; border-radius: var(--r-s); cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  font-size: 15px; font-weight: 600;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0A0C0F; }
.btn.primary:hover { filter: brightness(1.08); }

.empty { text-align: center; padding: 34px 18px; color: var(--muted); }

.note { font-size: 13px; color: var(--muted); display: flex; gap: 9px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--r-s); padding: 12px 14px; }

@media (min-width: 620px) {
  .tabs { grid-template-columns: repeat(4, minmax(0, 150px)); justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
