/* ============================================
   MODAL SYSTEM — JASON HANLON PORTFOLIO
   ============================================ */

/* --- BACKDROP --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(6, 6, 6, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  pointer-events: none;
  transition:
    background 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    backdrop-filter 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.is-open {
  background: rgba(6, 6, 6, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: all;
}

/* --- MODAL PANEL --- */
.modal-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9001;
  width: min(760px, 92vw);
  background: #0f0f0f;
  border-left: 1px solid rgba(240, 237, 232, 0.08);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  overflow: hidden;
}

.modal-panel.is-open {
  transform: translateX(0);
  pointer-events: all;
}

/* --- MODAL HEADER --- */
.modal-header {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px;
  border-bottom: 1px solid rgba(240, 237, 232, 0.07);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
}

.modal-panel.is-open .modal-header {
  opacity: 1;
  transform: translateY(0);
}

.modal-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-project-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.75rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
}

.modal-client-label {
  font-size: 0.75rem; /* raised from 0.6rem (9.6px) → 12px for WCAG readability */
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- CLOSE BUTTON --- */
.modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(240, 237, 232, 0.12);
  background: none;
  color: var(--text-muted);
  cursor: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s, color 0.25s, transform 0.25s, background 0.25s;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(90deg);
  background: rgba(201, 185, 154, 0.06);
}

/* --- MODAL BODY (scrollable) --- */
.modal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;

  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 185, 154, 0.2) transparent;
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(201, 185, 154, 0.2);
  border-radius: 2px;
}

/* --- MODAL HERO IMAGE --- */
.modal-hero-img {
  width: 100%;
  aspect-ratio: 16 / 7;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
}

.modal-panel.is-open .modal-hero-img {
  opacity: 1;
  transform: scale(1);
}

.modal-hero-img svg {
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-hero-img:hover svg {
  transform: scale(1.06);
}

/* ── Modal hero photo (replaces SVG placeholder) ──────────────────────────
   To update a project image, change heroImg.src in js/modal.js.
   Image is set to cover the full hero area at 16/7 aspect ratio.
   Works on all screen sizes — no fixed dimensions needed.           */
.modal-hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-hero-img:hover .modal-hero-photo {
  transform: scale(1.04);
}

.modal-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(15, 15, 15, 0.9) 100%
  );
  pointer-events: none;
}

/* --- MODAL CONTENT AREA --- */
.modal-content {
  padding: 36px 36px 48px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease 0.35s, transform 0.5s ease 0.35s;
}

.modal-panel.is-open .modal-content {
  opacity: 1;
  transform: translateY(0);
}

/* --- MODAL TITLE --- */
.modal-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* --- MODAL META ROW --- */
.modal-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(240, 237, 232, 0.07);
}

.modal-tag {
  font-size: 0.75rem; /* raised from 0.6rem (9.6px) → 12px for WCAG readability */
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(201, 185, 154, 0.08);
  border: 1px solid rgba(201, 185, 154, 0.18);
  padding: 4px 10px;
  border-radius: 2px;
}

/* --- MODAL STAT STRIP --- */
.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(240, 237, 232, 0.07);
  border: 1px solid rgba(240, 237, 232, 0.07);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 32px;
}

.modal-stat {
  background: #0f0f0f;
  padding: 20px 16px;
  text-align: center;
}

.modal-stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 5px;
}

.modal-stat-label {
  font-size: 0.75rem; /* raised from 0.6rem (9.6px) → 12px for WCAG readability */
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --- MODAL SECTION BLOCKS --- */
.modal-section {
  margin-bottom: 28px;
}

.modal-section-label {
  font-size: 0.75rem; /* raised from 0.6rem (9.6px) → 12px for WCAG readability */
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(240, 237, 232, 0.07);
}

.modal-section p {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.modal-section p + p {
  margin-top: 12px;
}

/* --- MODAL TWO-COL GRID --- */
.modal-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.modal-col-item {
  padding: 16px;
  border: 1px solid rgba(240, 237, 232, 0.07);
  border-radius: 2px;
  transition: border-color 0.25s;
}

.modal-col-item:hover {
  border-color: rgba(201, 185, 154, 0.22);
}

.modal-col-label {
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.modal-col-value {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.3;
}

/* --- MODAL OUTCOME LIST --- */
.modal-outcomes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 28px;
}

.modal-outcome-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(201, 185, 154, 0.03);
  border: 1px solid rgba(240, 237, 232, 0.05);
  border-radius: 2px;
  transition: background 0.2s, border-color 0.2s;
}

.modal-outcome-item:hover {
  background: rgba(201, 185, 154, 0.06);
  border-color: rgba(201, 185, 154, 0.14);
}

.modal-outcome-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
}

.modal-outcome-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* --- MODAL FOOTER CTA --- */
.modal-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border: 1px solid rgba(201, 185, 154, 0.18);
  border-radius: 2px;
  background: rgba(201, 185, 154, 0.04);
  transition: background 0.25s, border-color 0.25s;
  cursor: none;
  margin-top: 32px;
}

.modal-cta:hover {
  background: rgba(201, 185, 154, 0.08);
  border-color: rgba(201, 185, 154, 0.35);
}

.modal-cta-text {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
}

.modal-cta-arrow {
  font-size: 1rem;
  color: var(--accent);
  transition: transform 0.25s;
}

.modal-cta:hover .modal-cta-arrow {
  transform: translate(3px, -3px);
}

/* --- MODAL NAV (prev / next) --- */
.modal-nav {
  flex-shrink: 0;
  display: flex;
  border-top: 1px solid rgba(240, 237, 232, 0.07);
  opacity: 0;
  transition: opacity 0.4s ease 0.4s;
}

.modal-panel.is-open .modal-nav {
  opacity: 1;
}

.modal-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  background: none;
  border: none;
  cursor: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem; /* raised from 0.65rem (10.4px) → 12px for WCAG readability */
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.25s, background 0.25s;
}

.modal-nav-btn:hover {
  color: var(--text-primary);
  background: rgba(240, 237, 232, 0.03);
}

.modal-nav-btn:first-child {
  border-right: 1px solid rgba(240, 237, 232, 0.07);
  justify-content: flex-start;
}

.modal-nav-btn:last-child {
  justify-content: flex-end;
}

.modal-nav-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* --- CARD TRIGGER STYLE --- */
.work-card {
  cursor: none;
}

/* Make the entire card clickable (not just the arrow) */
.work-card.modal-trigger {
  cursor: none;
}

/* --- FOCUS / A11Y --- */
.modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.modal-nav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
  /* Hero image on mobile: auto height so the image fills the
     full width and nothing is cropped. The container height
     follows the image's natural proportions.                */
  .modal-hero-img {
    aspect-ratio: unset;
    height: auto;
    min-height: 180px;
  }

  .modal-hero-photo {
    width: 100%;
    height: auto;
    min-height: 180px;
    object-fit: contain;
    object-position: center center;
    background: #0d0d0d;
  }

  .modal-panel {
    width: 100vw;
    border-left: none;
    border-top: 1px solid rgba(240, 237, 232, 0.08);
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    height: 92svh;
    transform: translateY(100%);
    border-radius: 12px 12px 0 0;
  }

  .modal-panel.is-open {
    transform: translateY(0);
  }

  .modal-header,
  .modal-content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .modal-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .modal-two-col {
    grid-template-columns: 1fr;
  }

  .modal-nav-btn {
    padding: 14px 16px;
  }

  .modal-nav-title {
    max-width: 120px;
  }
}

@media (max-width: 400px) {
  .modal-stats {
    grid-template-columns: 1fr 1fr;
  }
  .modal-stats .modal-stat:last-child {
    grid-column: span 2;
  }
}
