/* ===========================================================
   Dawn — Ring-inspired dashboard styling.
   Bright, friendly, rounded, soft shadows. Light theme so it
   reads well on an iPad outdoors at a construction site.
   =========================================================== */

:root {
  --fg:            #111827;
  --fg-muted:      #6b7280;
  --fg-subtle:     #9ca3af;
  --bg:            #ffffff;
  --bg-subtle:     #f5f8fc;
  --bg-sunken:     #eff4fa;
  --border:        #e5ebf2;
  --border-strong: #cbd5e1;

  --accent:         #1998ff;
  --accent-hover:   #0d84e8;
  --accent-soft:    #e7f3ff;
  --accent-shadow:  rgba(25, 152, 255, 0.25);

  --status-progress:    #f59e0b;
  --status-not-started: #94a3b8;
  --status-complete:    #22c55e;
  --delta:              #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.04),
               0 1px 2px rgba(17, 24, 39, 0.03);
  --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.06),
               0 1px 3px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 8px 24px rgba(17, 24, 39, 0.08),
               0 2px 4px rgba(17, 24, 39, 0.04);

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg-subtle);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* Keep the page pinned to viewport width on phones. Wide content
     (tables, Gantt) then scrolls within its own card rather than
     dragging the whole layout sideways. `clip` (not `hidden`) so we
     don't create a scroll container — that would break `position:
     sticky` on descendants like the phase-header rows. */
  overflow-x: clip;
}

a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { color: var(--accent-hover); }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-sunken);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  overflow-wrap: anywhere;   /* long task_ids can break across lines */
}

.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex; align-items: baseline; gap: 10px;
  font-weight: 700; font-size: 17px;
  letter-spacing: -0.01em;
}
.brand .proj {
  color: var(--fg-muted); font-weight: 400; font-size: 13px;
}
.topnav { display: flex; gap: 4px; }
.topnav a {
  color: var(--fg-muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}
.topnav a:hover { color: var(--accent); background: var(--accent-soft); }
.topnav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Gantt nav item — filled accent pill so it reads as a CTA from any page. */
.topnav a.gantt-link {
  color: white;
  background: var(--accent);
  box-shadow: 0 2px 6px var(--accent-shadow);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.topnav a.gantt-link:hover  { color: white; background: var(--accent-hover); }
.topnav a.gantt-link.active {
  /* On the Gantt page itself, calm it down a notch but keep it filled. */
  background: var(--accent-hover);
  color: white;
}

/* ---------- page ---------- */
main.page {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 56px;
}

.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-head .meta { color: var(--fg-muted); font-size: 14px; }

/* ---------- metric cards ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.metric {
  background: var(--bg);
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.metric:hover { box-shadow: var(--shadow-md); }
.metric-label {
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.metric-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.metric-value.accent-progress    { color: var(--status-progress); }
.metric-value.accent-not-started { color: var(--fg-subtle); }

/* ---------- dashboard AI handoff card ---------- */
.ai-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.ai-cta-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  color: #7c3aed;
  background: #f3f0ff;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.ai-cta-body {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1 1 240px; min-width: 0;
}
.ai-cta-body strong {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--fg);
}
.ai-cta-body span { font-size: 13px; color: var(--fg-muted); }

.ai-cta-actions {
  display: flex; gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.ai-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: white;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.15s;
}
.ai-btn:hover { color: white; transform: translateY(-1px); filter: brightness(1.05); }
.ai-btn:active { transform: translateY(0); }
.ai-btn-claude   { background: #d97757; box-shadow: 0 2px 8px rgba(217, 119, 87, 0.25); }
.ai-btn-chatgpt  { background: #10a37f; box-shadow: 0 2px 8px rgba(16, 163, 127, 0.25); }

/* ---------- filter bar ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.filters input[type="search"],
.filters select {
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filters input[type="search"]::placeholder { color: var(--fg-subtle); }
.filters input[type="search"] { flex: 1 1 220px; max-width: 420px; }
.filters select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 5l3 3 3-3' stroke='%236b7280' stroke-width='1.75' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.filters input:focus,
.filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.filters button, .filters .btn {
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.15s;
}
.filters button:active { transform: scale(0.97); }
.filters button.primary {
  background: var(--accent); color: white; border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-shadow);
}
.filters button.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px var(--accent-shadow);
}
.filters .btn.ghost {
  color: var(--fg-muted); border-color: transparent; background: transparent;
}
.filters .btn.ghost:hover { color: var(--fg); background: var(--bg-sunken); }

/* ---------- task list ---------- */
.task-table-wrap {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  /* no overflow:hidden — it makes a new containing block that breaks
     sticky positioning and causes the thead to float mid-card. */
}
.task-table {
  width: 100%;
  /* `separate` is required so `position: sticky` works on <td>
     (Firefox/Safari ignore sticky cells in collapsed tables). */
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.task-table thead th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.task-table thead th:first-child { border-top-left-radius: var(--radius-lg); }
.task-table thead th:last-child  { border-top-right-radius: var(--radius-lg); }
.task-table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }
.task-table tbody tr:last-child td:last-child  { border-bottom-right-radius: var(--radius-lg); }
.task-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.task-table tbody tr:last-child td { border-bottom: none; }
.task-table tbody tr:hover td { background: var(--bg-subtle); }

.task-table .col-row      { width: 48px; text-align: right; color: var(--fg-subtle); font-variant-numeric: tabular-nums; }
.task-table .col-deps     { width: 112px; }
.task-table .col-duration { width: 56px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.task-table .col-date     { width: 108px; font-variant-numeric: tabular-nums; color: var(--fg); }
.task-table .col-res      { width: 60px; color: var(--fg-muted); }
.task-table .col-status   { width: 120px; }

/* Date format swap — full "2026-06-15" on desktop, "06-15" on mobile. */
.date-short { display: none; }

.task-table tr.is-header td {
  background: var(--accent-soft);
  color: var(--accent);
  /* Make phase headers (WATERPROOFING, EXTERIORS, ...) stick just
     below the topbar while scrolling so the current phase is always
     visible. */
  position: sticky;
  top: 57px;
  z-index: 4;
}
.task-table tr.is-header td:hover { background: var(--accent-soft); }
.task-table tr.is-header td:nth-child(2) {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.task-table tr.is-header .col-date,
.task-table tr.is-header .col-duration,
.task-table tr.is-header .col-res { color: var(--fg-subtle); }

.task-table .indent-1 td:nth-child(2) { padding-left: 22px; }
.task-table .indent-2 td:nth-child(2) { padding-left: 36px; }
.task-table .indent-3 td:nth-child(2) { padding-left: 50px; }

.task-table a { color: var(--fg); }
.task-table a:hover { color: var(--accent); }

/* Deps cell — comfortable tap target on iPad. */
.deps-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  margin: -6px -12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.deps-cell:hover {
  background: var(--bg-sunken);
  color: var(--fg);
}
.deps-cell .dep-in  { color: #2563eb; font-weight: 600; }
.deps-cell .dep-out { color: #16a34a; font-weight: 600; }
.deps-cell .dep-sep { color: var(--fg-subtle); }
.deps-cell.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-shadow);
}

/* ---------- status pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  line-height: 1.4;
  background: #eef2f6;
  color: var(--fg-muted);
  white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge.status-progress    { background: #fef3c7; color: #b45309; }
.badge.status-not-started { background: #f1f5f9; color: #64748b; }
.badge.status-complete    { background: #dcfce7; color: #15803d; }
.badge.status-none        { display: none; }

/* ---------- focus bar ---------- */
.focus-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 18px;
  padding: 14px 18px;
  background: var(--accent-soft);
  border: 1px solid #bfdcff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}
.focus-bar[hidden] { display: none; }
.focus-bar-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.focus-bar-label { color: var(--fg-muted); font-size: 13px; }
.focus-bar-task  { font-weight: 700; color: var(--fg); flex: 1 1 auto; font-size: 15px; }
.focus-bar .btn {
  padding: 0 14px; height: 34px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
}
.focus-bar .btn:hover { background: var(--bg-subtle); }

.focus-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.legend-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.legend-chip strong { font-weight: 700; }
.legend-chip .chip-arrow { font-size: 14px; line-height: 1; }
.chip-before { background: #dbeafe; color: #1d4ed8; }
.chip-after  { background: #dcfce7; color: #15803d; }

/* ---------- focus-mode row states ---------- */
.task-table.focus-mode tbody tr {
  transition: opacity 0.15s ease, background-color 0.15s ease;
  opacity: 0.35;
}
.task-table.focus-mode tbody tr.focused,
.task-table.focus-mode tbody tr.ancestor,
.task-table.focus-mode tbody tr.descendant { opacity: 1; }

.task-table tbody tr.focused    td { background: var(--accent-soft) !important; }
.task-table tbody tr.ancestor   td { background: #eff6ff; }
.task-table tbody tr.descendant td { background: #f0fdf4; }

.task-table tbody tr.focused    td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.task-table tbody tr.ancestor   td:first-child { box-shadow: inset 4px 0 0 #2563eb; }
.task-table tbody tr.descendant td:first-child { box-shadow: inset 4px 0 0 #16a34a; }

.task-table tbody tr.ancestor   td:nth-child(2)::before,
.task-table tbody tr.descendant td:nth-child(2)::before {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.task-table tbody tr.ancestor   td:nth-child(2)::before {
  content: "Before"; background: #dbeafe; color: #1d4ed8;
}
.task-table tbody tr.descendant td:nth-child(2)::before {
  content: "After"; background: #dcfce7; color: #15803d;
}

/* ---------- task detail ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; color: var(--fg-muted); margin-bottom: 16px;
  font-weight: 500;
}
.back-link:hover { color: var(--accent); }

.detail-panel {
  padding: 22px 24px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.detail-panel h3 {
  margin: 0 0 14px 0; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--fg-muted); font-weight: 600;
}
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px 28px; margin: 0;
}
.kv-grid dt { font-size: 13px; color: var(--fg-muted); margin-bottom: 2px; }
.kv-grid dd { margin: 0; font-size: 15px; font-weight: 600; }

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px; margin-bottom: 24px;
}

.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li {
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.link-list li:last-child { border-bottom: none; }

.history-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.history-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.history-table th, .history-table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.history-table th {
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--fg-muted);
  font-weight: 600;
}
.delta {
  font-size: 10px; color: var(--delta); font-weight: 700;
  margin-left: 4px;
}

/* ---------- empty state / info notes ---------- */
.note {
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  font-size: 14px;
}

/* ---------- collapsible filter (gantt page) ---------- */
.filter-disclosure { margin-bottom: 14px; }
.filter-disclosure > .filter-toggle {
  /* strip default <summary> marker */
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
}
.filter-disclosure > .filter-toggle::-webkit-details-marker { display: none; }
.filter-disclosure > .filter-toggle:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}
.filter-disclosure[open] > .filter-toggle {
  background: var(--accent-soft);
  border-color: #bfdcff;
  color: var(--accent);
}
.filter-toggle-icon { display: inline-flex; }
.filter-disclosure[open] > .filter-toggle .filter-toggle-icon { color: var(--accent); }
.filter-disclosure strong { font-weight: 700; }
.filter-disclosure > .filters { margin-top: 10px; margin-bottom: 0; }
/* `.filters { display: flex }` beats the browser's default hiding of
   non-summary <details> children, so we re-assert it. */
.filter-disclosure:not([open]) > .filters { display: none; }

/* ---------- Gantt ---------- */
.gantt-toolbar {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.gantt-toolbar button {
  height: 38px; padding: 0 18px;
  background: transparent; border: none;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--fg-muted); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.gantt-toolbar button:hover { background: var(--bg-subtle); color: var(--fg); }
.gantt-toolbar button.active {
  background: var(--accent); color: white;
}

.gantt-wrap {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  /* Frappe Gantt wraps its own SVG in a .gantt-container which is the
     scrollable element. Adding overflow here creates a second scroll
     context that fights with Frappe's and causes scroll resets. */
  overflow: hidden;
}

/* Constrain the gantt's own scroller so vertical scrolling happens
   *inside* the chart instead of moving the whole chart down the page
   (which made Frappe's sticky week-header slide out of alignment). */
.gantt-container {
  max-height: calc(100vh - 220px);
  min-height: 320px;
}
.gantt-popup { padding: 12px 14px; font-size: 13px; }
.gantt-popup h5 { margin: 0 0 4px 0; font-size: 14px; font-weight: 600; }

.gantt .bar-wrapper.status-progress .bar    { fill: var(--status-progress); }
.gantt .bar-wrapper.status-not-started .bar { fill: var(--status-not-started); }
.gantt .bar-wrapper.status-complete .bar    { fill: var(--status-complete); }

/* ---------- footer ---------- */
.footer {
  max-width: 1240px; margin: 0 auto; padding: 18px 24px;
  font-size: 13px; color: var(--fg-subtle);
}

/* ---------- intro overlay (fires once per session) ---------- */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  background: radial-gradient(ellipse at center,
              #0a1728 0%, #040810 70%);
  overflow: hidden;
  animation: intro-overlay-out 0.8s ease 2.6s forwards;
}
.intro-overlay[hidden] { display: none !important; }

.intro-house {
  position: relative;
  max-width: min(82vw, 740px);
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: scale(0.94);
  animation: intro-image-in 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s forwards,
             intro-image-kenburns 3.4s ease-out 0.15s forwards,
             intro-image-out 0.8s ease 2.6s forwards;
}
.intro-house img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Vignette + shimmer sweep across the image. */
.intro-house::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
              transparent 55%, rgba(0,0,0,0.45) 100%);
  pointer-events: none;
}
.intro-house::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 50%;
  background: linear-gradient(120deg,
              transparent 0%,
              rgba(255, 255, 255, 0.0) 30%,
              rgba(255, 255, 255, 0.28) 50%,
              rgba(255, 255, 255, 0.0) 70%,
              transparent 100%);
  transform: skewX(-18deg);
  animation: intro-shimmer 1.6s ease-out 0.8s forwards;
  pointer-events: none;
}

.intro-title {
  margin: 0;
  font-size: clamp(34px, 7vw, 68px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: white;
  text-align: center;
  opacity: 0;
  transform: translateY(18px);
  animation: intro-title-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s forwards,
             intro-title-out 0.8s ease 2.6s forwards;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.5);
}
.intro-title .accent {
  background: linear-gradient(90deg, #1998ff 0%, #63c1ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-sub {
  margin: -20px 0 0 0;
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  opacity: 0;
  animation: intro-sub-in 0.8s ease 0.9s forwards,
             intro-title-out 0.8s ease 2.6s forwards;
}

@keyframes intro-image-in {
  to { opacity: 1; transform: scale(1); }
}
@keyframes intro-image-kenburns {
  0%   { transform: scale(1); }
  100% { transform: scale(1.06); }
}
@keyframes intro-image-out {
  to { opacity: 0; transform: scale(1.12); filter: blur(6px); }
}
@keyframes intro-shimmer {
  0%   { left: -60%; opacity: 0; }
  30%  { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}
@keyframes intro-title-in {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes intro-title-out {
  to { opacity: 0; transform: translateY(-8px); }
}
@keyframes intro-sub-in {
  to { opacity: 1; }
}
@keyframes intro-overlay-out {
  to { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .intro-overlay,
  .intro-house,
  .intro-title,
  .intro-sub { animation-duration: 0.01s !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; gap: 8px; }
  .brand { font-size: 15px; }
  .topnav { gap: 2px; }
  .topnav a { padding: 6px 10px; font-size: 13px; }
  main.page { padding: 20px 10px 40px; }
  .page-head h1 { font-size: 22px; }
  .metric-value { font-size: 28px; }

  /* Contain any residual overflow to the card instead of the page. */
  .task-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Sticky thead + overflow-x scroll don't play nice (sticky re-anchors
     to the wrap, not the viewport), so drop sticky on mobile. */
  .task-table thead th { position: static; }

  /* Hide noisy columns and shrink the rest so the row fits a ~375px
     viewport without horizontal page scroll. */
  .task-table .col-row,
  .task-table .col-duration,
  .task-table .col-res { display: none; }
  .task-table .col-deps   { width: 60px; }
  .task-table .col-date   { width: 52px; }
  .task-table .col-status { width: 82px; }
  .task-table thead th    { padding: 10px 8px; font-size: 11px; }
  .task-table tbody td    { padding: 10px 8px; font-size: 13px; }

  /* Swap date format. */
  .date-full  { display: none; }
  .date-short { display: inline; }

  /* Deps cell tighter but still tap-friendly. */
  .deps-cell { padding: 6px 8px; margin: -6px -8px; font-size: 12px; gap: 3px; }

  /* Status badge tightened so "Not Started" still fits the narrow cell. */
  .badge { padding: 3px 8px; font-size: 11px; }

  .task-table tbody tr.focused    td:first-child,
  .task-table tbody tr.ancestor   td:first-child,
  .task-table tbody tr.descendant td:first-child { box-shadow: none; }
  .task-table tbody tr.focused    td:nth-child(2) { box-shadow: inset 4px 0 0 var(--accent); }
  .task-table tbody tr.ancestor   td:nth-child(2) { box-shadow: inset 4px 0 0 #2563eb; }
  .task-table tbody tr.descendant td:nth-child(2) { box-shadow: inset 4px 0 0 #16a34a; }
}
