/*
 * obs/islands.css — Observatory restyle of the JS islands (Phase 3e).
 *
 * Loads AFTER app.css (and the other obs/*.css files), so plain class
 * selectors here override the legacy island rules without touching app.css.
 * CLASS NAMES ARE A CONTRACT: timeline.js / span-utils.js / the templ track
 * markup reference every .tl-* name below — this file restyles, never renames.
 *
 * New (Observatory-only) classes introduced by timeline.js renderNowMarker():
 *   .tl-now-line / .tl-now-dot / .tl-now-label — the glowing "now" marker;
 *   .tl-future                                 — the dimmed not-yet shade;
 *   .tl-track--gridshift                       — half-period grid phase shift
 *                                                for fit windows starting :30.
 * The track gridlines are painted with the mockup's repeating-linear-gradients;
 * --tl-grid-hour / --tl-grid-quarter / --tl-ruler are set per-window by
 * renderNowMarker() and default to the 06:00–20:00 day-window stops.
 */

/* ── hour scale ──────────────────────────────────────────────────────────── */

.tl-scale {
  height: 18px;
  margin-bottom: 0;
}
.tl-scale__hour {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: #8b92a3;
}
/* Alternating label brightness (mockup: 06 bright, 07 dim, …). The x-for
 * <template> is child 1, so generated labels start at child 2. The dim step
 * stays readable (#6c7689 ≥ 3:1) — the ruler is essential editor chrome. */
.tl-scale__hour:nth-child(odd) { color: #6c7689; }
/* Edge labels pin inside the track (mockup): the first label is left-pinned,
 * the last right-pinned, so neither overhangs the rounded track corners. The
 * classes are bound by the templ hour-scale when a label sits at 0% / 100%. */
.tl-scale__hour--first { transform: none; }
.tl-scale__hour--last { transform: translateX(-100%); }

/* ── the track ───────────────────────────────────────────────────────────── */

.tl-track {
  height: 84px;
  border: none;
  border-radius: 12px;
  /* Own stacking context: the negative-z layers below (.tl-future, ::after)
   * must paint ABOVE this element's background — without isolation they would
   * escape to the page stacking context and vanish behind the track. */
  isolation: isolate;
  background-color: rgba(255, 255, 255, 0.03);
  /* Hourly gridlines (mockup stops; the var tracks the active window). */
  background-image: repeating-linear-gradient(
    to right,
    rgba(233, 237, 244, 0.05) 0,
    rgba(233, 237, 244, 0.05) 1px,
    transparent 1px,
    transparent var(--tl-grid-hour, 7.1428%)
  );
}
/* Fit windows can start on a half hour — shift the pattern half a period so
 * lines stay on true hour boundaries (class toggled by renderNowMarker). */
.tl-track--gridshift {
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(var(--tl-grid-hour, 7.1428%) / 2),
    rgba(233, 237, 244, 0.05) calc(var(--tl-grid-hour, 7.1428%) / 2),
    rgba(233, 237, 244, 0.05) calc(var(--tl-grid-hour, 7.1428%) / 2 + 1px),
    transparent calc(var(--tl-grid-hour, 7.1428%) / 2 + 1px),
    transparent var(--tl-grid-hour, 7.1428%)
  );
}
/* Bottom quarter-tick ruler (mockup's 6px strip; hidden on > 14h windows via
 * --tl-ruler). z-index -2 keeps it under the .tl-future shade (-1). */
.tl-track::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  z-index: -2;
  border-radius: 0 0 12px 12px;
  background-image: repeating-linear-gradient(
    to right,
    rgba(233, 237, 244, 0.09) 0,
    rgba(233, 237, 244, 0.09) 1px,
    transparent 1px,
    transparent var(--tl-grid-quarter, 1.7857%)
  );
  pointer-events: none;
  display: var(--tl-ruler, block);
}
.tl-track--compact { height: 38px; }

/* The gradient grid + ruler replace the element ticks entirely. */
.tl-tick { display: none; }

/* ── lunch window band ───────────────────────────────────────────────────── */

.tl-lunch {
  background: rgba(232, 196, 107, 0.05);
  border-left: 1px dashed rgba(232, 196, 107, 0.25);
  border-right: 1px dashed rgba(232, 196, 107, 0.25);
}

/* ── span blocks ─────────────────────────────────────────────────────────── */

.tl-span {
  top: 12px;
  bottom: 12px;
  border-radius: 9px;
  box-shadow: none;
  overflow: hidden; /* small spans hide their text gracefully */
  /* Mockup chip anatomy: name+range column left, duration right. */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
}
.tl-track--compact .tl-span {
  top: 5px;
  bottom: 5px;
  border-radius: 7px;
  padding: 0 8px;
}
/* Re-assert the state shadows the box-shadow:none above would otherwise
 * clobber (same specificity, later file). */
.tl-span--split { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 80%, transparent); }
.tl-span--open { box-shadow: 0 0 0 2px var(--color-accent); }
.tl-span--drop-target {
  box-shadow:
    0 0 0 2px var(--color-accent),
    0 0 0 5px color-mix(in srgb, var(--color-accent) 18%, transparent);
}

/* Dark-on-color chip text (mockup: name 12px/600 over the solid span color),
 * stacked as a name + local-range column (the chip itself owns the padding). */
.tl-span__label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  height: 100%;
  min-width: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: rgba(8, 14, 24, 0.9);
}
.tl-span__name {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-track--compact .tl-span__label {
  padding: 0;
  font-size: 10px;
}
/* Range / duration sub-labels (mockup): mono 9px local range under the name,
 * mono 10px duration right-aligned in the chip. */
.tl-span__range {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  color: rgba(8, 14, 24, 0.65);
  white-space: nowrap;
}
.tl-span__duration {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  color: rgba(8, 14, 24, 0.75);
  white-space: nowrap;
  flex: none;
}
/* Compact week rows (38px) have no vertical room for the sub-labels. */
.tl-track--compact .tl-span__range,
.tl-track--compact .tl-span__duration { display: none; }
.tl-span__scissor { color: rgba(8, 14, 24, 0.9); }

/* Unclassified ("worked") spans: dashed outline, transparent fill, muted mono
 * text. #94a3b8 is the engine's defaultSpanColor (month_builder.go, FT2
 * parity) — only category-less spans carry it, so the inline
 * style="…background:#94a3b8" the island binds is the unclassified signal.
 * !important outranks that inline background. .tl-span--unclassified is
 * pre-styled for a future class-based hook. */
.tl-span--unclassified,
.tl-span[style*="#94a3b8"] {
  background: rgba(233, 237, 244, 0.05) !important;
  border: 1px dashed rgba(233, 237, 244, 0.25);
}
.tl-span--unclassified .tl-span__label,
.tl-span[style*="#94a3b8"] .tl-span__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  color: #6c7689;
}
.tl-span--unclassified .tl-span__scissor,
.tl-span[style*="#94a3b8"] .tl-span__scissor { color: #8b92a3; }
/* The dashed chip has a near-transparent fill — its range/duration must use
 * the muted light ink, not the dark-on-color text of solid chips. */
.tl-span--unclassified .tl-span__range,
.tl-span[style*="#94a3b8"] .tl-span__range,
.tl-span--unclassified .tl-span__duration,
.tl-span[style*="#94a3b8"] .tl-span__duration { color: #6c7689; }

/* ── now marker + future shade (rendered by timeline.js) ─────────────────── */

.tl-future {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  /* Paints over the track's background + gridlines but under every span/lunch
   * layer. Negative z-index only works because .tl-track isolates its own
   * stacking context (isolation: isolate above). */
  z-index: -1;
  background: rgba(4, 6, 10, 0.4);
  border-radius: 0 12px 12px 0;
  pointer-events: none;
}
.tl-now-line {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 0;
  z-index: 30;
  border-left: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
.tl-now-dot {
  position: absolute;
  top: -10px;
  width: 7px;
  height: 7px;
  z-index: 30;
  border-radius: 50%;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
  animation: glowpulse 4s ease-in-out infinite;
  pointer-events: none;
}
.tl-now-label {
  position: absolute;
  top: -24px;
  z-index: 30;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  color: #b9c2d1;
  white-space: nowrap;
  pointer-events: none;
}
/* Compact week rows keep the line + shade but skip the floating chrome. */
.tl-track--compact .tl-now-dot,
.tl-track--compact .tl-now-label { display: none; }
.tl-track--compact .tl-now-line { top: -3px; bottom: -3px; }
@media (prefers-reduced-motion: reduce) {
  .tl-now-dot { animation: none; }
}

/* ── drag-create preview ─────────────────────────────────────────────────── */

.tl-preview {
  top: 12px;
  bottom: 12px;
  border-radius: 9px;
  border: 1px dashed rgba(94, 230, 200, 0.8);
  background: rgba(94, 230, 200, 0.12);
}
.tl-preview__label {
  top: -24px;
  border-radius: 6px;
  background: #5ee6c8;
  color: #07211b;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
}

/* ── split marker ────────────────────────────────────────────────────────── */

.tl-split-marker {
  top: -6px;
  bottom: -6px;
  border-left: 1px solid var(--color-accent);
  filter: drop-shadow(0 0 6px rgba(94, 230, 200, 0.55));
}
.tl-split-marker__label {
  top: -24px;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 10px;
  color: #07211b;
}

/* ── context menu (action popover) ───────────────────────────────────────── */

.tl-menu {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: #0d1018;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  padding: 8px;
}
.tl-menu__head {
  padding: 4px 6px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
}
.tl-menu__range {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #8b92a3;
}
.tl-menu__row {
  border-radius: 8px;
  font-size: 13px;
}
.tl-menu__row:hover { background: rgba(255, 255, 255, 0.05); }
.tl-menu__hint {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b92a3; /* carries real info (current project / split point) */
}
.tl-menu__back { font-size: 11px; }
.tl-menu__back:hover { background: rgba(255, 255, 255, 0.05); }

/* ── undo bar ────────────────────────────────────────────────────────────── */

.tl-undo {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  padding: 9px 14px;
  font-size: 12px;
}
.tl-undo__msg { color: #8b92a3; }
.tl-undo__btn {
  border: none;
  border-radius: 8px;
  background: #5ee6c8;
  color: #07211b;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
}
.tl-undo__btn:hover { background: #7eeed5; }

/* ── tool palette (entry-type chips) ─────────────────────────────────────── */

.tl-palette__hint {
  font-size: 13px;
  color: #6c7689;
}
.tl-tool {
  gap: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
}
.tl-tool:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: color-mix(in srgb, var(--tl-tool-color, var(--color-accent)) 60%, transparent);
  color: var(--color-text);
}
.tl-tool__dot {
  width: 7px;
  height: 7px;
  box-shadow: none;
}
.tl-tool__mins {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #8b92a3;
}
/* Armed chip = the mockup's glowing DRS chip: tinted fill, colored border,
 * soft outer glow (the pulse animates the glow; static under reduced motion
 * via app.css's existing guard). */
.tl-tool--armed {
  background: color-mix(in srgb, var(--tl-tool-color, var(--color-accent)) 12%, transparent);
  border-color: color-mix(in srgb, var(--tl-tool-color, var(--color-accent)) 55%, transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--tl-tool-color, var(--color-accent)) 20%, transparent);
}
@keyframes tlArmedPulse {
  0%, 100% { box-shadow: 0 0 10px color-mix(in srgb, var(--tl-tool-color, var(--color-accent)) 16%, transparent); }
  50% { box-shadow: 0 0 18px color-mix(in srgb, var(--tl-tool-color, var(--color-accent)) 30%, transparent); }
}

/* ── undo / redo history buttons (30px squares) ──────────────────────────── */

.tl-history { gap: 5px; }
.tl-history__btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: #8b92a3;
  font-size: 13px;
}
.tl-history__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--color-text);
}
.tl-history__btn:disabled { color: #3c4250; opacity: 1; }

/* ── armed hint pill ─────────────────────────────────────────────────────── */

.tl-armed {
  border: 1px solid rgba(94, 230, 200, 0.35);
  background: rgba(94, 230, 200, 0.1);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
}
.tl-armed__esc {
  border: 1px solid rgba(94, 230, 200, 0.3);
  border-radius: 5px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── day / fit / full segmented toggle ───────────────────────────────────── */

.tl-modes {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.tl-mode {
  border: none;
  background: transparent;
  border-radius: 999px;
  color: #8b92a3;
  padding: 5px 13px;
  font-size: 11px;
}
.tl-mode:hover { color: var(--color-text); }
.tl-mode--active {
  background: #e9edf4;
  border: none;
  color: #0b0d12;
  font-weight: 600;
}

/* ── timeline misc ───────────────────────────────────────────────────────── */

.timeline-error { font-size: 12px; }

/* ════════════════════════════════════════════════════════════════════════
 * Command composer (Ctrl/Cmd+K island) — Observatory chrome over the
 * .composer-* rules in app.css. Markup + Alpine bindings untouched.
 * (.composer-trigger lives in the header toolbar and is styled by
 * obs/header.css — not duplicated here.)
 * ════════════════════════════════════════════════════════════════════════ */

.composer-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8b92a3;
}
.composer-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  font-size: 9px;
  letter-spacing: 0;
  color: #8b92a3;
}
.composer-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--color-text);
}
.composer-input::placeholder { color: #6c7689; }
.composer-input:focus {
  outline: none;
  border-color: rgba(94, 230, 200, 0.5);
}
.composer-submit {
  border: none;
  border-radius: 8px;
  background: #5ee6c8;
  color: #07211b;
  font-size: 11px;
  font-weight: 600;
  padding: 8px 16px;
  box-shadow: none;
}
.composer-submit:hover:not(:disabled) {
  background: #7eeed5;
  border: none;
}
.composer-evidence,
.composer-proposal {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 11px 13px;
}
.composer-evidence-head {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #8b92a3;
}
.composer-stage {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8b92a3;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 2px 9px;
  background: transparent;
}
.composer-stage--on {
  color: #5ee6c8;
  border-color: rgba(94, 230, 200, 0.45);
  background: rgba(94, 230, 200, 0.1);
}
.composer-textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--color-text);
}
.composer-textarea:focus {
  outline: none;
  border-color: rgba(94, 230, 200, 0.5);
}
.composer-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #8b92a3;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 1px 7px;
  background: transparent;
}
.composer-entry { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.composer-warnings,
.composer-validation { color: #ff8d7e; font-size: 12px; }
.composer-success { color: #5ee6c8; font-size: 12px; }

/* ════════════════════════════════════════════════════════════════════════
 * Login — wordmark + Observatory panel card (markup in login.templ; base
 * .login-* rules in app.css, overridden here).
 * ════════════════════════════════════════════════════════════════════════ */

.login-page {
  max-width: 420px;
  margin: 0 auto;
  padding-top: 10vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.login-page .page__title {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.login-page .page__dot { color: #5ee6c8; }
.login-page .page__tagline {
  font-style: italic;
  font-size: 14px;
  color: #8b92a3;
  margin: 4px 0 0;
}
.login-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 20px;
  padding: 26px 30px;
  box-shadow: var(--shadow-card);
}
.login-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}
.login-sub {
  font-size: 12px;
  color: #8b92a3;
}
.login-error {
  border: 1px solid rgba(255, 141, 126, 0.4);
  background: rgba(255, 141, 126, 0.08);
  border-radius: 10px;
  padding: 9px 13px;
  color: #ff8d7e;
  font-size: 12px;
}
.login-card .field-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8b92a3;
}
.login-card input[type="text"],
.login-card input[type="url"],
.login-card input[type="password"] {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  padding: 8px 12px;
  color: var(--color-text);
  font-size: 13px;
}
.login-card input[type="text"]:focus,
.login-card input[type="url"]:focus,
.login-card input[type="password"]:focus {
  outline: none;
  border-color: rgba(94, 230, 200, 0.5);
}
.login-fixed-url {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  color: #8b92a3;
}
.remember-row { font-size: 12px; color: #8b92a3; }
.remember-row__hint { color: var(--color-text-faint); }
.login-submit {
  border: none;
  border-radius: 8px;
  background: #5ee6c8;
  color: #07211b;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 18px;
  box-shadow: none;
}
.login-submit:hover {
  background: #7eeed5;
  border: none;
}
