/* Floats above the page, so it uses the popover shadow rather than a flat
   card's. */
.signin-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 100;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  max-width: calc(100% - 64px);
  background: var(--color-surface);
  color: var(--color-text-primary);
  padding: 20px 32px;
  border-radius: 20px;
  box-shadow: 0 8px 24px var(--color-shadow-popover);
  font-size: 17px;
  text-align: center;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.signin-toast--visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast-link {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--color-accent);
  text-decoration: underline;
  cursor: pointer;
}

/* The toast ignores the pointer so it never blocks what's behind it; only a
   link in a showing toast takes clicks. */
.signin-toast--visible .toast-link {
  pointer-events: auto;
}

/* Bottom-left so it never competes with .signin-toast; low z-index since it's
   ambient and must never sit above a real modal. */
/* In the tab bar's top right, left of the profile picture: pushed there by
   its auto left margin, which the profile picture's own then gives up (see
   below). Flat, with no shadow. */
.class-countdown-pill {
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: var(--color-surface);
  border: none;
  box-sizing: border-box;
  border-radius: 999px;
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  /* The profile picture's own edge and hover ring (see .auth-avatar): a 1px
     gray edge at rest, and a soft ring, there all along at 0% opacity so
     only its opacity animates. */
  --pill-ring-opacity: 75%;
  --pill-hover-border: transparent;
  box-shadow:
    0 0 0 1px var(--color-gray-lighter),
    0 0 0 5px color-mix(in srgb, var(--color-gray-light) 0%, transparent);
  transition: box-shadow 0.125s ease;
}

:root[data-theme="dark"] .class-countdown-pill {
  --pill-ring-opacity: 45%;
  --pill-hover-border: var(--color-gray-lighter);
}

.class-countdown-pill:hover,
.class-countdown-pill--open {
  box-shadow:
    0 0 0 1px var(--pill-hover-border),
    0 0 0 5px color-mix(in srgb, var(--color-gray-light) var(--pill-ring-opacity), transparent);
}

/* 12px in all from the profile picture: the tab bar's 4px gap plus 8px,
   standing in for the picture's own 16px margin. */
.class-countdown-pill:not([hidden]) + .auth-container {
  margin-left: 0;
}

.class-countdown-pill:not([hidden]) + .auth-container .auth-avatar-btn {
  margin-left: 8px;
}

/* A page with no tab bar: floating at the bottom-left, as it used to. */
body > .class-countdown-pill {
  position: fixed;
  /* Lines up with a class card's left edge. */
  left: 48px;
  bottom: 32px;
  z-index: 40;
  max-width: calc(100% - 64px);
}

.class-countdown-pill[hidden] {
  display: none;
}

.class-countdown-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-accent);
}

.class-countdown-time {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--color-text-primary);
}

.class-countdown-sep {
  flex-shrink: 0;
  color: var(--color-gray-dark);
}

.class-countdown-label {
  overflow: hidden;
  color: var(--color-gray-dark);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Clear glass in the spirit of Apple's Liquid Glass: barely tinted, with only
   a light blur, so whatever is behind stays recognizable. saturate() and
   brightness() lift what shows through, the way a lens does, and keep
   anything colored behind it from going gray.
   Every edge effect is even all the way round (see ::before), and the box is
   sized to whole pixels in JS, so no side renders thinner or softer than the
   others. */
.hover-tooltip {
  --glass-tint: rgba(255, 255, 255, 0.12);
  --glass-lift: 1.03;
  --glass-edge-glow: rgba(255, 255, 255, 0.5);
  --glass-rim-bright: rgba(255, 255, 255, 0.95);
  --glass-rim-dim: rgba(255, 255, 255, 0.35);
  --glass-outline: rgba(0, 0, 0, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.12);
  --glass-text-halo: rgba(255, 255, 255, 0.7);
  position: fixed;
  z-index: 300;
  box-sizing: border-box;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(2.5px) saturate(180%) brightness(var(--glass-lift));
  backdrop-filter: blur(2.5px) saturate(180%) brightness(var(--glass-lift));
  /* A thin inner glow along every edge gives the glass some thickness without
     clouding the middle; the outer hairline keeps it defined against a white
     page, where a white rim alone disappears. */
  box-shadow:
    inset 0 0 3px var(--glass-edge-glow),
    0 0 0 1px var(--glass-outline),
    0 6px 16px var(--glass-shadow);
  color: #1c1c1c;
  /* A soft halo, so the text stays legible over whatever passes behind. */
  text-shadow: 0 0 4px var(--glass-text-halo);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* The specular rim: a 1px ring, the same width all round, catching light at
   the top-left and bottom-right like a curved glass edge. Drawn as a gradient
   masked down to its border area, since a border can't take a gradient and
   keep the rounded corners. */
.hover-tooltip::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    var(--glass-rim-bright),
    var(--glass-rim-dim) 30%,
    var(--glass-rim-dim) 70%,
    var(--glass-rim-bright)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* On a dark page the tint drops almost to nothing and the lift goes up, so the
   glass reads as clearer than its surroundings rather than as a dark box. */
:root[data-theme="dark"] .hover-tooltip {
  --glass-tint: rgba(255, 255, 255, 0.06);
  --glass-lift: 1.25;
  --glass-edge-glow: rgba(255, 255, 255, 0.12);
  --glass-rim-bright: rgba(255, 255, 255, 0.48);
  --glass-rim-dim: rgba(255, 255, 255, 0.14);
  --glass-outline: transparent;
  --glass-shadow: rgba(0, 0, 0, 0.35);
  --glass-text-halo: rgba(0, 0, 0, 0.55);
  color: #f5f5f5;
}

.hover-tooltip--visible {
  opacity: 1;
}

/* On the Domain tab every tooltip, the tour's included, takes a heavier tint,
   so it stays readable over the busy score lists. Other tabs keep the clear
   glass. */
.page-domain .hover-tooltip {
  --glass-tint: rgba(255, 255, 255, 0.65);
}

/* Dark glass in dark mode: a white tint (and the usual brightness lift) read
   as a light-mode tooltip on the dark cards. */
:root[data-theme="dark"] .page-domain .hover-tooltip {
  --glass-tint: rgba(0, 0, 0, 0.35);
  --glass-lift: 1;
}

/* A one-time tip pointing at a Formative a Summative just replaced (see
   showFormativeLinkTipOnce). The hover tooltip's glass (it carries
   .hover-tooltip too).
   The box and its pointer are one shape: the element runs down over the
   pointer's area and is cut to the outline with a clip-path set in JS, so
   there's one sheet of glass rather than two overlapping. The rim and outline
   are an SVG stroke of that same path (.formative-link-tip-edge), since
   box-shadow and ::before can only follow a rectangle. */
.formative-link-tip {
  --tip-outline: rgba(0, 0, 0, 0.14);
  /* Matches FORMATIVE_LINK_TIP_POINTER_PX in domain.js. */
  --tip-pointer: 6px;
  padding: 4px 8px calc(4px + var(--tip-pointer));
  border-radius: 0;
  box-shadow: none;
  font-size: 13px;
  line-height: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  translate: 0 4px;
  transition: opacity 0.2s ease, translate 0.2s ease;
}

.formative-link-tip::before {
  display: none;
}

:root[data-theme="dark"] .formative-link-tip {
  --tip-outline: rgba(255, 255, 255, 0.16);
}

/* Stroked twice as wide as it shows, since the clip-path cuts the outer half:
   a faint outline at the very edge, then the specular rim just inside. */
.formative-link-tip-edge {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.formative-link-tip-edge .rim {
  fill: none;
  stroke-width: 4px;
}

/* On the dark glass the rim reads as a second outline, so dark mode keeps
   only the outer one. */
:root[data-theme="dark"] .formative-link-tip-edge .rim {
  display: none;
}

.formative-link-tip-edge .outline {
  fill: none;
  stroke: var(--tip-outline);
  stroke-width: 2px;
}

.formative-link-tip-ok {
  padding: 1px 8px;
  border: none;
  border-radius: 999px;
  background: var(--color-accent);
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  cursor: pointer;
}

.formative-link-tip-ok:hover {
  background: color-mix(in srgb, var(--color-accent) 85%, #000);
}

.formative-link-tip--visible {
  opacity: 1;
  translate: 0 0;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .formative-link-tip {
    translate: none;
  }
}

/* A small dropdown of actions (the account menu, the Upcoming card's + menu).
   Appended to <body> and positioned in JS, so a clipping ancestor (like
   .tab-bar's overflow-y: hidden) can't cut it off. */
.popup-menu {
  position: fixed;
  z-index: 50;
  min-width: 160px;
  margin: 0;
  padding: 6px;
  background: var(--color-surface);
  border-radius: calc(12px * var(--squircle-scale));
  corner-shape: squircle;
  /* A faint 1px edge over the cards' own soft shadow. */
  box-shadow: 0 0 0 1px var(--color-popup-outline), var(--shadow-card);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.popup-menu--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.popup-menu-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--color-text-primary);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.popup-menu-item:hover {
  background: var(--color-gray-lighter);
}

.popup-menu-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--color-gray-lighter);
}

/* Today's schedule, opened from the time-left pill (see openTodaySchedule):
   each event with its time, the one on now in bold on a gray band. */
.today-schedule {
  width: 280px;
  padding: 14px 8px 8px;
  box-sizing: border-box;
}

.today-schedule-title {
  margin: 0 10px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-dark);
}

.today-schedule-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.today-schedule-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--color-text-primary);
}

/* A neutral light gray: the hover overlay is mixed from the blue-tinted
   --color-gray-light. Dark mode keeps the overlay. */
.today-schedule-row--now {
  background: var(--color-gray-lighter);
  font-weight: 600;
}

:root[data-theme="dark"] .today-schedule-row--now {
  background: var(--color-hover-overlay);
}

.today-schedule-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.today-schedule-time {
  flex-shrink: 0;
  color: var(--color-gray-dark);
}
