/* ==========================================================================
   Projects page (projects.html). Builds on css/home.css (header, footer,
   sparkles, buttons) and the theme tokens in css/theme.css.
   ========================================================================== */

.home-header .nav-links a.is-current { color: var(--t-accent); font-weight: 700; box-shadow: inset 0 -2px 0 var(--t-accent); }

.p-hero { position: relative; padding: clamp(44px, 6vw, 80px) 0 clamp(20px, 3vw, 32px); text-align: center; }
.p-hero-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 820px; }
.p-hero h1 { margin: 0; font-family: var(--t-font-head); font-weight: 700; font-size: clamp(34px, 4.6vw, 54px); line-height: 1.12; color: var(--t-heading); }

/* — role quick picks — */
.p-roles-wrap { padding-bottom: 26px; }
.p-roles { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.p-roles-label { font-size: 14px; font-weight: 700; color: var(--t-muted); padding-right: 4px; }
.p-roles-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.p-role {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: var(--t-radius-btn); border: 1px solid var(--t-line);
  background: var(--t-card); color: var(--t-text); font: 700 15px/1 var(--t-font-body); cursor: pointer;
}
.p-role:hover { border-color: var(--t-accent); }
.p-role[aria-pressed="true"] { background: var(--t-btn); color: var(--t-btn-text); border-color: var(--t-btn); }
.p-role-count { min-width: 22px; padding: 0 6px; border-radius: 999px; font-size: 12px; line-height: 20px; text-align: center; background: var(--t-tint); color: var(--t-muted); }
.p-role[aria-pressed="true"] .p-role-count { background: rgba(255, 255, 255, 0.55); color: var(--t-btn-text); }
.p-role-hint { margin: 10px 0 0; text-align: center; font-size: 14px; color: var(--t-muted); }

/* — layout: sidebar + results — */
.p-layout {
  position: relative; max-width: 1320px; margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px) clamp(64px, 8vw, 104px);
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 28px;
}
.p-filters {
  flex: 1 1 270px; max-width: 100%; min-width: 0; box-sizing: border-box;
  position: relative; overflow: hidden;
  background: var(--t-glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--t-card-border); border-radius: var(--t-radius-card);
  padding: 24px 20px; display: flex; flex-direction: column; gap: 16px;
}
.p-filters::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--t-bar); }
.p-filters-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.p-filters-head h2 { margin: 0; font-family: var(--t-font-head); font-weight: 700; font-size: 20px; color: var(--t-card-title); }
.p-filters-head span { font-size: 13px; color: var(--t-muted); }
.p-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.p-field label, .p-field legend { padding: 0; font-size: 13px; font-weight: 700; color: var(--t-muted); }
.p-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.p-two label { font-weight: 500; font-size: 12px; }
.p-filters input, .p-filters select, .p-toolbar select {
  min-height: 44px; width: 100%; min-width: 0; box-sizing: border-box; padding: 0 10px;
  border-radius: var(--t-radius-btn); border: 1px solid var(--t-line);
  background: var(--t-card); color: var(--t-text); font: 400 14px var(--t-font-body);
}
.p-filters input { padding: 0 14px; }
.p-filters input:focus-visible, .p-filters select:focus-visible, .p-toolbar select:focus-visible,
.p-btn:focus-visible, .p-role:focus-visible, .p-chip:focus-visible, .p-clear:focus-visible, .p-quick-link:focus-visible, .p-icon-btn:focus-visible {
  outline: 2px solid var(--t-accent); outline-offset: 2px;
}
.p-clear {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 4px;
  border-radius: var(--t-radius-btn); border: 1px solid var(--t-line); background: transparent;
  color: var(--t-muted); font: 700 15px var(--t-font-body); cursor: pointer;
}
.p-clear svg { width: 15px; height: 15px; }
.p-clear.is-active { background: var(--t-cta); color: var(--t-cta-text); border-color: var(--t-cta); }

.p-results { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.p-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; }
.p-toolbar p { margin: 0; font-size: 15px; color: var(--t-muted); }
.p-toolbar p strong { color: var(--t-text); }
.p-toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.p-toolbar-right label { font-size: 13px; font-weight: 700; color: var(--t-muted); padding-left: 6px; }
.p-toolbar select { width: auto; }
.p-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.p-chips[hidden] { display: none; }
.p-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
  border-radius: var(--t-radius-tag); border: 1px solid var(--t-line);
  background: var(--t-tint); color: var(--t-text); font: 700 13px var(--t-font-body); cursor: pointer;
}
.p-chip-static { cursor: default; min-height: 28px; }

/* — buttons used across the page and pop-up — */
.p-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: var(--t-radius-btn);
  font: 700 14px var(--t-font-body); text-decoration: none; cursor: pointer; border: 1px solid transparent;
}
.p-btn svg { width: 16px; height: 16px; }
.p-btn-cta { background: var(--t-cta); color: var(--t-cta-text); border-color: var(--t-cta); font-family: var(--t-font-cta); letter-spacing: var(--t-cta-spacing); }
.p-btn-cta:hover { color: var(--t-cta-text); filter: brightness(0.97); }
.p-btn-ghost { background: var(--t-card); color: var(--t-text); border-color: var(--t-line); }
.p-btn-ghost:hover { border-color: var(--t-accent); color: var(--t-accent); }
.p-btn-dashed { background: transparent; color: var(--t-text); border: 1px dashed var(--t-line); }

/* — cards — */
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.p-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--t-card); border: 1px solid var(--t-card-border); border-radius: var(--t-radius-card);
  box-shadow: var(--t-shadow-card); transition: transform 0.2s ease, border-color 0.2s ease;
}
.p-card:hover { transform: translateY(-3px); border-color: var(--t-accent); }
.p-card-bar { height: 6px; background: var(--t-bar); }
.p-card-media { position: relative; aspect-ratio: 16 / 9; background: var(--t-tint); border-bottom: 1px solid var(--t-pink-line); overflow: hidden; }
.p-card-media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.p-badge {
  display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px;
  border-radius: var(--t-radius-tag); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
}
.p-card-media .p-badge { position: absolute; top: 10px; left: 10px; box-shadow: 0 4px 12px rgba(38, 33, 48, 0.12); }
.p-badge-real { background: var(--t-btn); color: var(--t-btn-text); border: 1px solid var(--t-btn); }
.p-badge-synthetic, .p-badge-prototype, .p-badge-unknown { background: rgba(255, 255, 255, 0.94); color: var(--t-text); border: 1px dashed var(--t-line); }
.p-card-metric { padding: 18px 22px 16px; background: var(--t-metric-band); border-bottom: 1px solid var(--t-pink-line); display: flex; flex-direction: column; gap: 4px; }
.p-card-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--t-muted); }
.p-card-metric strong { font-family: var(--t-font-head); font-weight: 700; font-size: 36px; line-height: 1.05; color: var(--t-accent-big); }
.p-card-metric-label { font-size: 14px; color: var(--t-muted); }
.p-card-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex-grow: 1; }
.p-card-type { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--t-accent); }
.p-card-body h2 { margin: 0; font-family: var(--t-font-head); font-weight: 700; font-size: 20px; line-height: 1.3; color: var(--t-card-title); }
.p-card-body h2 a { color: inherit; text-decoration: none; }
.p-card-body h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.p-card-desc { margin: 0; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.p-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 0; padding: 4px 0 0; list-style: none; }
.p-tags li { background: var(--t-tag-bg); color: var(--t-tag-text); border: 1px solid var(--t-tag-border); padding: 2px 10px; font-size: 13px; font-weight: 600; border-radius: var(--t-radius-tag); }
.p-card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
.p-quick { display: flex; gap: 6px; }
.p-quick-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 12px;
  border-radius: var(--t-radius-btn); border: 1px solid var(--t-line); background: var(--t-card);
  color: var(--t-text); font-size: 13px; font-weight: 700; text-decoration: none;
}
.p-quick-link:hover { border-color: var(--t-accent); color: var(--t-accent); }
.p-quick-link svg { width: 18px; height: 18px; }

.p-empty { margin: 0; padding: 56px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--t-muted); }
.p-empty[hidden] { display: none; }
.p-empty p { margin: 0; font-family: var(--t-font-accent); font-style: italic; font-size: 22px; color: var(--t-plum-text); }

/* — case-study pop-up — */
.dialog-backdrop { background: rgba(38, 33, 48, 0.5); padding: clamp(8px, 3vw, 40px) 12px; place-items: start center; overflow-y: auto; }
.dialog.dialog-wide {
  position: relative; width: min(960px, 100%); max-height: none; overflow: visible;
  padding: clamp(22px, 4vw, 40px) clamp(18px, 4vw, 44px); gap: 16px;
  background: var(--t-bg); border: 1px solid var(--t-card-border); border-radius: var(--t-radius-card);
  box-shadow: 0 30px 80px rgba(38, 33, 48, 0.3);
}
.dialog.dialog-wide::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; border-radius: var(--t-radius-card) var(--t-radius-card) 0 0; background: var(--t-bar); }
.dialog-head .card-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--t-accent); }
.dialog-title { margin: 6px 0 0; font-family: var(--t-font-head); font-weight: 700; font-size: clamp(24px, 3.2vw, 34px); line-height: 1.2; color: var(--t-heading); }
.p-modal-lede { margin: 8px 0 0; font-family: var(--t-font-accent); font-style: italic; font-size: clamp(17px, 1.8vw, 20px); color: var(--t-plum-text); }
.p-modal-lede[hidden] { display: none; }
.p-modal-actions { display: flex; gap: 8px; flex-shrink: 0; }
.p-icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--t-radius-btn); border: 1px solid var(--t-line); background: var(--t-card); color: var(--t-text); cursor: pointer; }
.p-modal-intro { display: flex; flex-direction: column; gap: 16px; margin-bottom: 8px; }
.p-modal-badges, .p-modal-links { display: flex; flex-wrap: wrap; gap: 8px; }
.p-modal-image { display: block; width: 100%; max-height: 380px; object-fit: cover; object-position: top center; border-radius: var(--t-radius-card); border: 1px solid var(--t-pink-line); background: var(--t-tint); }
.p-modal-metric { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 20px 22px; background: var(--t-metric-band); border: 1px solid var(--t-pink-line); border-radius: var(--t-radius-card); }
.p-modal-metric strong { font-family: var(--t-font-head); font-weight: 700; font-size: clamp(34px, 5vw, 50px); line-height: 1; color: var(--t-accent-big); }
.p-modal-metric p { flex: 1 1 280px; margin: 0; font-size: 16px; }

/* Restyle the existing case-study sections to match the theme. */
#proj-body { display: flex; flex-direction: column; gap: 12px; }
#proj-body .section-label.dialog-section-heading { margin-top: 28px; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; color: var(--t-accent); }
#proj-body .dialog-section-headline { font-family: var(--t-font-head); font-size: clamp(21px, 2.4vw, 26px); color: var(--t-heading); }
#proj-body .viz-card, #proj-body .stakeholder-card, #proj-body .viz-callout, #proj-body .recommendation-row, #proj-body .method-grid > * {
  background: var(--t-card); border: 1px solid var(--t-pink-line); border-radius: var(--t-radius-card);
}
#proj-body .viz-stats-grid { gap: 10px; background: none; border: 0; }
#proj-body .viz-stat { background: var(--t-card); border: 1px solid var(--t-pink-line); border-radius: var(--t-radius-card); }
#proj-body .viz-stat-value { font-family: var(--t-font-head); font-weight: 700; }
#proj-body .viz-stat-value.highlight { color: var(--t-accent-big); }
#proj-body .stakeholder-role { color: var(--t-card-title); }
#proj-body .viz-highlight-heading { font-family: var(--t-font-head); color: var(--t-heading); }
#proj-body > div:last-child .btn { border-radius: var(--t-radius-btn); }

@media (prefers-reduced-motion: reduce) {
  .p-card { transition: none; }
  .p-card:hover { transform: none; }
}
