/* ==========================================================================
   Zexaapp — portfolio page styles
   Depends on main.css for tokens (:root variables).
   ========================================================================== */

/* ── Page hero ───────────────────────────────────────────────────────── */
.page-hero {
  position: relative;
  padding-block: 150px 56px;
  overflow: hidden;
  border-block-end: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
}
.page-hero__glow {
  position: absolute; inset-block-start: -180px; inset-inline-start: 60%;
  width: 700px; height: 520px;
  background: radial-gradient(circle, rgba(30, 111, 217, .20), transparent 65%);
  pointer-events: none;
}
.page-hero > .container { position: relative; }

.crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
  margin-block-end: 18px;
}
.crumbs a:hover { color: var(--accent); }
.crumbs i { font-size: 13px; opacity: .6; }

/* Size/weight/colour come from main.css so this title matches every other
   section title on the site (no gradient, no second font). */
.page-hero__title { margin-block-end: 14px; }
.page-hero__lead { max-width: 660px; font-size: 16.5px; }

.page-hero__meta {
  display: flex; gap: 22px; flex-wrap: wrap;
  margin-block-start: 22px;
}
.page-hero__meta span {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 14px;
}
.page-hero__meta i { color: var(--accent); font-size: 18px; }

/* ── Filter bar ──────────────────────────────────────────────────────── */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-block-end: 34px;
  padding: 8px;
  background: var(--surface-60);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  width: fit-content;
  max-width: 100%;
}
.filter {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: color .28s var(--ease), background .28s var(--ease),
              border-color .28s var(--ease);
}
.filter em {
  font-style: normal; font-size: 11.5px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(232, 237, 242, .07);
  color: var(--text-muted);
}
.filter:hover { color: var(--text); background: var(--accent-08); }
.filter.is-active {
  color: var(--white);
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 8px 20px rgba(30, 111, 217, .28);
}
.filter.is-active em { background: rgba(255, 255, 255, .2); color: var(--white); }

/* ── Project grid ────────────────────────────────────────────────────── */
/* `align-items: stretch` (the default) is deliberate: every card in a row
   gets the same height, and the clamps further down keep the inner blocks
   the same size, so the grid reads as one tidy row instead of a ragged one. */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 24px;
  align-items: stretch;
}

.p-card {
  display: flex; flex-direction: column;
  height: 100%;
  background: linear-gradient(165deg, var(--surface-60), rgba(13, 27, 42, .6));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .4s var(--ease), border-color .4s var(--ease),
              box-shadow .4s var(--ease), opacity .35s var(--ease);
}
.p-card:hover {
  transform: translateY(-7px);
  border-color: var(--accent-30);
  box-shadow: 0 26px 60px rgba(0, 0, 0, .5), 0 0 0 1px var(--accent-15);
}
.p-card.is-hidden { display: none; }

/* 16/10 = the real aspect ratio of every file in static/images/portfolio/,
   so no cover is ever cropped. */
.p-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-2);
  border-block-end: 1px solid var(--border);
}
.p-card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .7s var(--ease);
}
.p-card:hover .p-card__media img { transform: scale(1.06); }
.p-card__media .placeholder { min-height: 0; height: 100%; }

.p-card__year {
  position: absolute; inset-block-start: 12px; inset-inline-end: 12px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--bg-80);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--text);
}

.p-card__body {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: 24px 22px 26px;
  flex: 1;
}
/* ── Uniform card blocks ─────────────────────────────────────────────────
   Each text block below is clamped to a fixed number of lines and given a
   matching min-height. A project with a long name, a long summary or long
   feature bullets therefore occupies exactly the same vertical space as a
   short one, which is what keeps the grid even. */
.p-card__title {
  font-size: 19.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.p-card__summary {
  font-size: 14.5px; line-height: 1.9;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(3 * 1.9em);
}

.p-card__features { display: grid; gap: 7px; width: 100%; }
.p-card__features li {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 13.8px; line-height: 1.8;
  min-width: 0;
}
.p-card__features li i { flex-shrink: 0; }
/* One line each — a long bullet is trimmed with an ellipsis instead of
   wrapping and pushing this card taller than its neighbours. The text has
   to live in its own element for text-overflow to apply inside a flex row. */
.p-card__features li span {
  min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.p-card__features i {
  color: var(--accent); font-size: 15px;
}

.p-card .chips--sm { min-height: 30px; }
.p-card__more { margin-block-start: auto; }

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  padding: 24px;
}
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 6, 10, .78);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: fadeIn .3s var(--ease) both;
}
.modal__dialog {
  position: relative;
  width: min(100%, 880px);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(165deg, #101b2e, var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .6);
  animation: modalIn .4s var(--ease) both;
}
@keyframes fadeIn { from { opacity: 0 } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(.97) }
}

.modal__close {
  position: absolute;
  inset-block-start: 14px; inset-inline-start: 14px;
  z-index: 5;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-80);
  border: 1px solid var(--border);
  color: var(--text); font-size: 19px;
  cursor: pointer;
  transition: color .25s, border-color .25s, transform .25s var(--ease);
}
.modal__close:hover { color: #FCA5A5; border-color: rgba(226, 86, 75, .4); transform: rotate(90deg); }

.modal__body { padding: 0 0 32px; }

.m-hero {
  position: relative;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  border-block-end: 1px solid var(--border);
  background: linear-gradient(140deg, var(--surface), var(--bg-2));
}
.m-hero img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
}
.m-hero__fallback {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background:
    radial-gradient(120% 100% at 70% 0%, var(--accent-15), transparent 60%),
    linear-gradient(140deg, var(--surface), var(--bg-2));
}
.m-hero__fallback i { font-size: 46px; color: var(--accent); opacity: .8; }
.m-hero__fallback em {
  font-style: normal; font-size: 15px; font-weight: 700; color: var(--text);
}
.m-hero:empty,
.m-hero--missing .m-hero__fallback { display: flex; }
.m-hero--missing img { display: none; }
/* No cover declared at all → the fallback is the only child. */
.m-hero > img:not([src]) + .m-hero__fallback,
.m-hero > .m-hero__fallback:first-child { display: flex; }

.m-content { padding: 26px 32px 0; }
.m-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-block-end: 12px; }
.m-content h2 { font-size: clamp(22px, 3vw, 30px); margin-block-end: 6px; width: 100%; }
.m-desc { font-size: 15.2px; line-height: 2; margin-block-end: 26px; }

.m-block { margin-block-end: 26px; }
.m-block h3 {
  display: flex; align-items: center; gap: 9px;
  font-size: 16.5px; margin-block-end: 14px;
}
.m-block h3 i { color: var(--accent); font-size: 20px; }

.m-features { display: grid; gap: 10px; }
.m-features li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 15px;
  background: rgba(10, 10, 15, .4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.4px; color: var(--text);
}
.m-features i { color: var(--accent); font-size: 17px; margin-block-start: 4px; flex-shrink: 0; }

/* ── Screenshot gallery ──────────────────────────────────────────────── */
.m-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.m-gallery__hint {
  margin-block-start: 10px;
  font-size: 12.5px; color: var(--text-muted);
}

.shot {
  position: relative;
  display: block; padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-2); cursor: pointer;
  aspect-ratio: 16 / 10;
  transition: border-color .3s var(--ease), transform .3s var(--ease),
              box-shadow .3s var(--ease);
}
.shot:hover {
  border-color: var(--accent-30);
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .45);
}
.shot img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
  transition: transform .6s var(--ease);
}
.shot:hover img { transform: scale(1.04); }

/* Styled fallback shown when the image file is missing. */
.shot__fallback {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; text-align: center;
  background:
    radial-gradient(120% 100% at 70% 0%, var(--accent-15), transparent 62%),
    linear-gradient(140deg, var(--surface), var(--bg-2));
}
.shot__fallback i { font-size: 30px; color: var(--accent); opacity: .8; }
.shot__fallback em {
  font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--text);
}
.shot--missing { cursor: default; }
.shot--missing:hover { transform: none; box-shadow: none; border-color: var(--border); }
.shot--missing img { display: none; }
.shot--missing .shot__fallback { display: flex; }

.m-meta {
  display: flex; flex-wrap: wrap; gap: 22px;
  padding: 18px 20px;
  background: rgba(10, 10, 15, .4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-block-end: 26px;
}
.m-meta div { display: grid; gap: 2px; }
.m-meta dt { font-size: 12.5px; color: var(--text-muted); }
.m-meta dd { font-size: 14.5px; font-weight: 600; color: var(--text); }

.m-cta {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding-block-start: 6px;
}

/* ── Lightbox ────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 400;
  display: grid; place-items: center;
  padding: 40px;
  background: rgba(3, 4, 8, .93);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fadeIn .25s var(--ease) both;
}
.lightbox img {
  max-width: min(1100px, 92vw);
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
}
.lightbox__close,
.lightbox__nav {
  position: absolute;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-80);
  border: 1px solid var(--border);
  color: var(--text); font-size: 22px;
  cursor: pointer;
  transition: border-color .25s, color .25s, transform .25s var(--ease);
}
.lightbox__close { inset-block-start: 26px; inset-inline-end: 26px; }
.lightbox__nav--prev { inset-inline-end: 26px; inset-block-start: 50%; transform: translateY(-50%); }
.lightbox__nav--next { inset-inline-start: 26px; inset-block-start: 50%; transform: translateY(-50%); }
.lightbox__close:hover,
.lightbox__nav:hover { color: var(--accent); border-color: var(--accent-30); }

.lightbox__counter {
  position: absolute; inset-block-end: 26px; inset-inline: 0;
  text-align: center;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-muted);
}

body.is-locked { overflow: hidden; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .page-hero { padding-block: 128px 44px; }
  .portfolio-grid { grid-template-columns: 1fr; }
  .filters { width: 100%; justify-content: flex-start; border-radius: var(--radius); }
  .m-content { padding-inline: 20px; }
  .m-hero { aspect-ratio: 16 / 9; }
  .lightbox { padding: 20px; }
  .lightbox__nav { width: 42px; height: 42px; }
  .lightbox__nav--prev { inset-inline-end: 10px; }
  .lightbox__nav--next { inset-inline-start: 10px; }
}
