/* ============================================================
   project-1.css — Travel Agent case study + embedded map demo
   Builds on style.css tokens + project-detail.css components.
   Theme-aware: case-study chrome follows the site light/dark
   tokens; the map demo keeps its own fixed dark "app" palette
   in both themes (a framed data-viz surface, like code blocks).
   ============================================================ */

/* The base reset has no [hidden] rule, and several demo containers
   set their own display, so make the attribute authoritative. */
[hidden] { display: none !important; }

/* This page has no full-bleed hero band, so clear the fixed navbar. */
.project-article.is-caseflush { padding-top: 128px; }
@media (max-width: 768px) { .project-article.is-caseflush { padding-top: 104px; } }

/* ── Real project images ──────────────────────────────────── */
.project-img {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
  aspect-ratio: auto;
  overflow: visible;
  border-radius: var(--radius);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.28);
}

/* ── Project demo video ───────────────────────────────────── */
.project-video-wrap {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.38);
}
.project-video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

/* ── Reusable photo placeholders (theme-aware) ────────────── */
.photo-ph {
  position: relative;
  width: 100%;
  min-width: 0;
  border: 1.5px dashed rgba(var(--accent-rgb), 0.4);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.05), transparent 60%),
    var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  gap: 0.5rem;
  color: var(--text-muted);
  overflow: hidden;
}

.photo-ph::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(var(--accent-rgb), 0.035) 0 12px, transparent 12px 24px);
  pointer-events: none;
}

.photo-ph .ph-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.photo-ph .ph-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

.photo-ph .ph-desc {
  font-size: 0.9rem;
  max-width: min(46ch, 100%);
  line-height: 1.6;
  color: var(--text);
}

.photo-ph .ph-dims {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  max-width: 100%;
}

.photo-ph.ph-hero { aspect-ratio: 16 / 7; min-height: 240px; }
.photo-ph.ph-wide { aspect-ratio: 16 / 6; min-height: 200px; }
.photo-ph.ph-tile { aspect-ratio: 4 / 3;  min-height: 180px; }

.ph-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}
.ph-grid.ph-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Case-study chrome (theme-aware) ──────────────────────── */
.case-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.case-eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
}
:root[lang="ar"] .case-eyebrow { letter-spacing: normal; text-transform: none; }

.contrib-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.contrib-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.contrib-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
  color: var(--text);
}
.contrib-card h4 span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-inline-end: 0.5rem;
}
.contrib-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1.5rem;
}
.feature-list li {
  position: relative;
  padding-inline-start: 1.6rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.feature-list li::before {
  content: "\25B9";
  position: absolute;
  inset-inline-start: 0;
  color: var(--accent);
}
:root[dir="rtl"] .feature-list li::before { content: "\25C3"; }
.feature-list li b { color: var(--text); font-weight: 600; }

.tech-detail {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.25rem;
}
.tech-detail article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-inline-start: 3px solid rgba(var(--accent-rgb), 0.55);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
}
.tech-detail h4 {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.tech-detail p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
  max-width: none;
}
.tech-detail code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 5px;
  padding: 0.05rem 0.4rem;
  color: var(--accent);
  direction: ltr;
  unicode-bidi: isolate;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}
.impact-card {
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(var(--accent-rgb), 0.07), transparent 55%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
}
.impact-card .impact-k {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 0.35rem;
}
.impact-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* ============================================================
   Embedded map demo — self-contained dark "app" palette
   ============================================================ */
.tm-demo {
  --tm-bg: #0b0f16;
  --tm-surface: #131a23;
  --tm-elev: #1b2735;
  --tm-border: rgba(255, 255, 255, 0.09);
  --tm-text: #e8edf7;
  --tm-muted: #97a6c0;
  --tm-dim: #5f6f8c;

  margin: 1.75rem auto 0;
  max-width: 1000px;
}
:root[dir="rtl"] .tm-demo { direction: ltr; text-align: left; }

.tm-demo-caption {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 0.85rem;
  text-align: center;
}

/* Pre-launch poster */
.tm-poster {
  position: relative;
  border: 1px solid var(--tm-border);
  border-radius: 18px;
  background:
    radial-gradient(80% 120% at 50% 0%, rgba(var(--accent-rgb), 0.14), transparent 60%),
    var(--tm-surface);
  padding: 3.5rem 1.5rem;
  text-align: center;
  overflow: hidden;
}
.tm-poster::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  pointer-events: none;
}
.tm-poster h3 {
  position: relative;
  font-size: 1.25rem;
  color: var(--tm-text);
  margin-bottom: 0.5rem;
}
.tm-poster p {
  position: relative;
  font-size: 0.9rem;
  color: var(--tm-muted);
  max-width: 42ch;
  margin: 0 auto 1.5rem;
}

.tm-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: #06121a;
  background: #00d4ff;
  border: none;
  border-radius: 100px;
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.25);
}
.tm-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 38px rgba(0, 212, 255, 0.38); }
.tm-btn:disabled { opacity: 0.75; cursor: progress; transform: none; }

.tm-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: #06121a;
  border-radius: 50%;
  animation: tm-spin 0.7s linear infinite;
}
@keyframes tm-spin { to { transform: rotate(360deg); } }

/* Stage */
.tm-stage { display: block; }

.tm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 1rem 1.15rem;
  background: var(--tm-surface);
  border: 1px solid var(--tm-border);
  border-radius: 16px 16px 0 0;
  border-bottom: none;
}

.tm-field {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: var(--tm-muted);
}
.tm-field label { font-weight: 600; white-space: nowrap; }

.tm-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--tm-bg);
  color: var(--tm-text);
  border: 1px solid var(--tm-border);
  border-radius: 9px;
  padding: 0.5rem 2rem 0.5rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  min-width: 210px;
  background-image:
    linear-gradient(45deg, transparent 50%, #00d4ff 50%),
    linear-gradient(135deg, #00d4ff 50%, transparent 50%);
  background-position: right 1rem center, right 0.72rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.tm-select:focus { border-color: rgba(0, 212, 255, 0.5); }

.tm-ghost-btn {
  background: transparent;
  color: var(--tm-muted);
  border: 1px solid var(--tm-border);
  border-radius: 9px;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.tm-ghost-btn:hover { color: #00d4ff; border-color: rgba(0, 212, 255, 0.5); }

/* Legend — always visible */
.tm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-inline-start: auto;
}
.tm-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--tm-muted);
  white-space: nowrap;
}
.tm-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
.tm-swatch.free     { background: #22c55e; }
.tm-swatch.arrival  { background: #38bdf8; }
.tm-swatch.evisa    { background: #f5b301; }
.tm-swatch.required { background: #f43f5e; }
.tm-swatch.banned   { background: #a855f7; }
.tm-swatch.passport { background: #f8fafc; }
.tm-swatch.nodata   { background: #2f3b4c; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset; }

/* Map frame */
.tm-frame {
  position: relative;
  border: 1px solid var(--tm-border);
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(0, 212, 255, 0.06), transparent 60%),
    var(--tm-bg);
  min-height: 300px;
}
.tm-frame #map {
  width: 100%;
  cursor: crosshair;
}
.tm-frame #map svg { display: block; }

/* Hover tooltip */
.tm-tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  background: rgba(11, 15, 22, 0.95);
  border: 1px solid var(--tm-border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--tm-text);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.12s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.tm-tooltip.visible { opacity: 1; }
.tm-tt-badge {
  color: #06121a;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
}

/* Stats strip */
.tm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--tm-border);
  border: 1px solid var(--tm-border);
  border-top: none;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  margin-top: -1px;
}
.tm-stat {
  background: var(--tm-surface);
  padding: 0.85rem 1rem;
  text-align: center;
}
.tm-stat b {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: 0.2rem;
}
.tm-stat span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--tm-dim);
}
.tm-stat.free b     { color: #22c55e; }
.tm-stat.arrival b  { color: #38bdf8; }
.tm-stat.evisa b    { color: #f5b301; }
.tm-stat.required b { color: #f43f5e; }

.tm-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.9rem;
  line-height: 1.5;
}

/* Country panel */
.tm-panel {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  height: 100%;
  width: min(380px, 86%);
  background: var(--tm-surface);
  border-inline-start: 1px solid var(--tm-border);
  box-shadow: -24px 0 48px rgba(0, 0, 0, 0.45);
  transform: translateX(101%);
  transition: transform 0.4s var(--ease);
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.tm-panel.open { transform: none; }

.tm-panel-close {
  position: absolute;
  top: 0.6rem;
  inset-inline-end: 0.6rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--tm-border);
  background: var(--tm-elev);
  color: var(--tm-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  z-index: 2;
}
.tm-panel-close:hover { color: #f43f5e; border-color: rgba(244, 63, 94, 0.4); }

.tm-panel-loading {
  margin: auto;
  padding: 2rem;
  color: var(--tm-muted);
  font-size: 0.9rem;
}

.tm-panel-body { padding: 1.4rem; }

.tm-panel-head {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 1rem;
}
.tm-flag {
  width: 58px;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--tm-border);
  flex-shrink: 0;
}
.tm-panel-head h4 { font-size: 1.15rem; color: var(--tm-text); line-height: 1.2; }
.tm-panel-head p { font-size: 0.78rem; color: var(--tm-dim); margin: 0.2rem 0 0; }

.tm-verdict {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  background: color-mix(in srgb, var(--vc, #2f3b4c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--vc, #2f3b4c) 42%, transparent);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 1rem;
}
.tm-verdict--muted { --vc: #2f3b4c; }
.tm-verdict-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--vc, #2f3b4c);
  margin-top: 0.3rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--vc, #2f3b4c) 20%, transparent);
}
.tm-verdict b { display: block; font-size: 0.9rem; color: var(--tm-text); }
.tm-verdict small { display: block; font-size: 0.76rem; color: var(--tm-muted); margin-top: 0.15rem; line-height: 1.45; }
.tm-verdict i { font-size: 0.82rem; color: var(--tm-muted); }

.tm-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--tm-border);
  border: 1px solid var(--tm-border);
  border-radius: 10px;
  overflow: hidden;
}
.tm-fact {
  background: var(--tm-elev);
  padding: 0.7rem 0.8rem;
}
.tm-fact span {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--tm-dim);
  margin-bottom: 0.2rem;
}
.tm-fact b {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--tm-text);
  line-height: 1.35;
}

.tm-panel-note {
  font-size: 0.78rem;
  color: var(--tm-dim);
  line-height: 1.6;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--tm-border);
}

/* Error state */
.tm-error {
  border: 1px solid rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.06);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
}
.tm-error p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 820px) {
  .contrib-grid,
  .feature-list,
  .impact-grid,
  .ph-grid,
  .ph-grid.ph-grid-3 { grid-template-columns: 1fr; }

  .tm-toolbar { gap: 0.65rem 0.9rem; }
  .tm-field { width: 100%; }
  .tm-legend { margin-inline-start: 0; width: 100%; }
  .tm-select { min-width: 0; width: 100%; flex: 1 1 auto; }
  .tm-ghost-btn { width: 100%; }
  .tm-stats { grid-template-columns: repeat(2, 1fr); }

  /* True bottom sheet over the viewport — the framed map is short on phones. */
  .tm-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    inset-inline: 0;
    width: 100%;
    height: auto;
    max-height: 78vh;
    border-inline-start: none;
    border-top: 1px solid var(--tm-border);
    border-radius: 16px 16px 0 0;
    transform: translateY(101%);
    z-index: 1200;
  }
  .tm-panel.open {
    transform: none;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5), 0 0 0 100vmax rgba(0, 0, 0, 0.55);
  }
  .tm-frame { min-height: 180px; }
}

@media (max-width: 480px) {
  .tm-facts { grid-template-columns: 1fr; }
  .tm-toolbar { border-radius: 14px 14px 0 0; }
}
