/* =====================================================
   Mido Hasan — SELECTED WORK (scoped)
   /assets/css/05__selected-work.css
   Lifted verbatim from 05__Selected_Work.html (section CSS only).
   Excluded as duplicate globals: :root, reset, .mht-shell,
   .mht-section, .glass-card(+--elevated), .mht-content-*,
   the .mht-u-btn button system, .mht-modal system, fonts,
   .demo-spacer. Project visuals remain 16:9. [data-reveal] kept
   (section's own reveal). Buttons render via the global system.
   ===================================================== */

.mht-work {
  position: relative;
  background: transparent;
  overflow: clip;
  isolation: isolate;
}
.mht-work::before {
  content: none;
}
.mht-work__inner { position: relative; z-index: 1; }
/* Locked section header spacing: use this same header-to-content gap across all homepage sections. */
.mht-work__intro { margin-bottom: clamp(44px, 6vw, 76px); }
.mht-work__kicker { margin-bottom: var(--sp-5); }
.mht-work-wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 2.5vw, 34px);
}
.mht-work-tile {
  --mx: 50%;
  --my: 50%;
  --mht-work-radius: 20px;
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: clamp(200px, 22vw, 300px);
  border-radius: var(--mht-work-radius);
  overflow: hidden;
  isolation: isolate;
  /* Phase 10.10.8: contain:paint clips child layers to the rounded box. */
  contain: paint;
  /* Phase 10.10.9: clip-path is the nuclear clipping option — guarantees
     child layers cannot bleed outside rounded corners even on scaled images. */
  clip-path: inset(0 round var(--mht-work-radius));
  display: grid;
  place-items: center;
  background: #050505;
  cursor: none;
  transition:
    border-color 980ms var(--ease-soft),
    background-color 980ms var(--ease-soft);
}
/* Phase 10.10.9: image cards use inset shadow as border — avoids the
   painted border edge that can look mis-cut on border-radius + clip-path. */
.mht-work-tile.mht-work-card.has-image {
  border: 0;
  box-shadow:
    inset 0 0 0 1px rgba(197,166,211,0.12),
    0 18px 46px rgba(0,0,0,0.28);
}
.mht-work-tile.glass-card--elevated {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.10),
    0 2px 6px rgba(0,0,0,.08),
    0 8px 18px rgba(0,0,0,.10),
    0 20px 44px rgba(0,0,0,.12),
    0 36px 78px rgba(0,0,0,.10);
}
/* Phase 10.10.8: no transform:translateY — only border-color on hover.
   Image scale (below) is the motion signal. No corner artifact possible. */
.mht-work-tile:hover { border-color: rgba(197,166,211,.28); }
.mht-work-tile__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 35% 18%, rgba(142,99,163,.22), transparent 48%),
    radial-gradient(ellipse at 82% 72%, rgba(197,166,211,.055), transparent 52%),
    linear-gradient(135deg, rgba(255,255,255,.04), rgba(255,255,255,.006));
  transform: scale(1.01);
  /* Phase 10.10.6: filter removed from transition — transform only */
  transition: transform 900ms var(--ease-out);
}
.mht-work-tile:hover .mht-work-tile__bg { transform: scale(1.018); /* Phase 10.10.6: filter:contrast/brightness removed */ }
.mht-work-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  /* Phase 10.8.1A: border-radius: inherit ensures Safari doesn't render a
     square pseudo-element when the parent card gets transform: translateY on hover.
     Without this, Safari drops overflow:hidden clipping on the ::before layer. */
  border-radius: inherit;
  background: radial-gradient(circle 260px at var(--mx) var(--my), rgba(245,243,247,.24), rgba(197,166,211,.13) 28%, rgba(142,99,163,.055) 52%, transparent 74%);
  opacity: 0;
  transition: opacity 420ms var(--ease-out);
  pointer-events: none;
  mix-blend-mode: screen;
}
.mht-work-tile.is-active::before { opacity: .72; }
.mht-work-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  /* Phase 10.8.1A: border-radius: inherit */
  border-radius: inherit;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.08), rgba(0,0,0,.46)),
    radial-gradient(ellipse at center, transparent 22%, rgba(0,0,0,.42) 100%);
  pointer-events: none;
}
.mht-work-tile__visual {
  position: absolute;
  inset: clamp(22px, 3.2vw, 42px);
  z-index: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 18px;
  background: rgba(1,0,5,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 32px 80px rgba(0,0,0,.24);
  transform: scale(1);
  transition: transform 1100ms var(--ease-soft), border-color 760ms var(--ease-soft), background-color 760ms var(--ease-soft), opacity 760ms var(--ease-soft);
}
.mht-work-tile:hover .mht-work-tile__visual {
  transform: scale(1.035);
  border-color: rgba(197,166,211,.24);
  background: rgba(1,0,5,.22);
}
.mht-work-tile__screen {
  width: min(86%, 520px);
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background:
    linear-gradient(180deg, rgba(245,243,247,.08), transparent 46%),
    linear-gradient(135deg, rgba(142,99,163,.42), rgba(13,13,13,.25));
  position: relative;
  overflow: hidden;
  opacity: .86;
}
.mht-work-tile__screen::before {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.09);
  background:
    linear-gradient(90deg, rgba(245,243,247,.16) 0 32%, transparent 32% 100%),
    repeating-linear-gradient(180deg, rgba(245,243,247,.12) 0 1px, transparent 1px 20px);
  opacity: .5;
}
.mht-work-tile__screen::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 32%;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(197,166,211,.18), rgba(183,140,255,.07));
  opacity: .52;
}
.mht-work-tile__meta {
  position: absolute;
  z-index: 4;
  left: clamp(20px, 2.4vw, 34px);
  bottom: clamp(18px, 2.2vw, 30px);
  max-width: calc(100% - 68px);
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  line-height: 1;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 360ms var(--ease-out), transform 360ms var(--ease-out);
}
.mht-work-tile__meta .mht-modal-seg { display: inline-flex; align-items: center; line-height: 1; }
.mht-work-tile:hover .mht-work-tile__meta { opacity: .88; transform: translateY(0); }
.mht-work-tile__cursor {
  position: absolute;
  z-index: 5;
  left: var(--mx);
  top: var(--my);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transform: translate(-50%,-50%) scale(.88);
  /* V9.3.2 project hover circle color — warm white per brand kit. */
  background: #f6f2f7;
  color: #0D0D0D;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(0,0,0,.32), 0 0 22px rgba(246,242,247,.18);
}
.mht-work-tile.is-active .mht-work-tile__cursor { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.mht-work__inner { position: relative; }
.mht-work__head { position: relative; }
.mht-work__footer {
  display: flex;
  justify-content: flex-start;
  padding-top: clamp(34px, 5vw, 64px);
}
@media (min-width: 981px) {
  .mht-work__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: clamp(24px, 4vw, 48px);
    align-items: end;
  }
  .mht-work__head { grid-column: 1; grid-row: 1; margin-bottom: 0; }
  .mht-work__intro.mht-work__head { margin-bottom: 0; }
  .mht-work__footer {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    justify-content: flex-end;
    padding-top: 0;
  }
  .mht-work-wall { grid-column: 1 / -1; grid-row: 2; margin-top: clamp(44px, 6vw, 76px); }
}
.mht-work__head .mht-work__head-cta { flex: 0 0 auto; }

/* Phase 10.2: gated on .js-enabled — content stays visible if JS fails or is disabled */
/* Phase 10.2.2: removed filter:blur — GPU compositing repaint on zoom/resize was causing flicker */
.js-enabled [data-reveal] {
  opacity: 0;
  transform: translateY(18px) scale(.988);
  transition:
    opacity 700ms var(--ease-soft),
    transform 700ms var(--ease-soft);
  transition-delay: var(--rd, 0ms);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* Phase 10.2.2: disable transition after reveal so zoom/resize can't re-trigger the animation */
/* Phase 10.9.0: also drop will-change and force the final state, so a Blink
   (Chrome/Arc) repaint on tab-return/zoom cannot re-run or re-composite the
   reveal. transition:none + explicit final values = nothing left to animate. */
[data-reveal].mht-reveal-done {
  transition: none !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  will-change: auto !important;
}

@media (max-width: 980px) {
  .mht-work-wall { grid-template-columns: 1fr; }
  .mht-work-tile { min-height: clamp(190px, 52vw, 320px); cursor: pointer; }
  .mht-work-tile__cursor { display: none; }
  .mht-work-tile__meta { opacity: .86; transform: none; }
  .mht-work__footer { justify-content: flex-start; }
  .mht-work__footer .mht-u-btn { width: auto; }
}
@media (max-width: 560px) {
  :root { --site-gutter: 40px; }
  .mht-work__footer .mht-u-btn { width: auto; }
  .mht-work__head-cta { width: auto; }
  .mht-work-tile__visual { inset: 18px; }
  .mht-work-tile__screen { width: 76%; }
  .mht-work__footer { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* Project modal meta line (category · industry · year) — uses global modal system */
.mht-modal__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: -6px;
  margin-bottom: var(--sp-4);
  color: var(--accent-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  line-height: 1;
}
.mht-modal__meta .mht-modal-seg {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.mht-modal-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  opacity: .65;
  flex: 0 0 auto;
}

/* =============================================================================
   V9.2 — Real image project cards (extends existing fake-screen styles).
   Cards become clean image surfaces when .has-image is present. Cards without
   an image keep the existing fake-screen visual as a graceful fallback.
   - 16:9 aspect ratio
   - object-fit:cover, object-position:center (no stretching for 1920×1080)
   - subtle grain/noise overlay (inline SVG data-uri, no extra HTTP request)
   - cleaner image-card surface (no glass blur on image-mode cards)
   - footer button moved BELOW the cards, aligned left, even on desktop
   ========================================================================== */

/* === Footer-button: always under the cards, aligned left =================== */
.mht-work__footer {
	display: flex;
	justify-content: flex-start;
	padding-top: clamp(34px, 5vw, 64px);
}

/* Cancel the Phase-4 desktop grid that pulled the CTA up next to the title.
   The CTA now stays under the cards on every viewport. */
@media (min-width: 981px) {
	.mht-work__inner {
		display: block;
	}
	.mht-work__head {
		grid-column: auto;
		grid-row: auto;
		margin-bottom: clamp(44px, 6vw, 76px);
	}
	.mht-work__intro.mht-work__head {
		margin-bottom: clamp(44px, 6vw, 76px);
	}
	.mht-work__footer {
		grid-column: auto;
		grid-row: auto;
		align-self: auto;
		justify-content: flex-start;
		padding-top: clamp(34px, 5vw, 64px);
	}
	.mht-work-wall {
		grid-column: auto;
		grid-row: auto;
		margin-top: 0;
	}
}

/* === Image-card surface (when .has-image) ================================ */
.mht-work-tile.mht-work-card.has-image {
	background: #050505;
	cursor: pointer;
	/* Phase 10.10.11: border removed — inset box-shadow in the earlier
	   .mht-work-tile.mht-work-card.has-image block above carries the
	   visual border. A real painted border was the corner-artifact trigger. */
}
/* Suppress the fake-screen visual on image cards (no nested screen mock). */
.mht-work-tile.mht-work-card.has-image .mht-work-tile__visual,
.mht-work-tile.mht-work-card.has-image .mht-work-tile__bg {
	display: none;
}
/* Phase 10.10.11: backdrop-filter reset block removed — no backdrop-filter
   is used anywhere on the site, so the none reset is dead code. */

/* Cover image — fills the 16:9 frame without stretching. */
.mht-work-card__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	z-index: 0;
	/* Phase 10.8.1A: border-radius: inherit prevents Safari from letting the
	   image bleed outside the card's rounded corners when transform fires on hover.
	   The parent .mht-work-tile has overflow:hidden + border-radius:20px — Safari
	   loses the clip when transform is applied. This ensures the image itself clips. */
	border-radius: inherit;
	/* Phase 10.10.6: filter removed from transition — transform only */
	transition: transform 980ms var(--ease-soft);
}
.mht-work-tile.has-image:hover .mht-work-card__image {
	/* Phase 10.10.9: reduced from 1.025 → 1.012 to minimise corner bleed */
	transform: scale(1.012);
}

/* === Grain / noise overlay (premium editorial texture) =================== */
.mht-work-card__grain {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	opacity: 0.55;
	mix-blend-mode: overlay;
	border-radius: inherit; /* Phase 10.10.8: inherit parent radius */
	/* SVG fractalNoise — single, very small inline data URI, no HTTP request. */
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.42 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
	background-size: 160px 160px;
	background-repeat: repeat;
}

/* Dark shade at the bottom for legibility of meta + cursor labels. */
.mht-work-card__shade {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	border-radius: inherit; /* Phase 10.10.8: inherit parent radius */
	background:
		linear-gradient(to bottom, transparent 38%, rgba(0,0,0,0.22) 70%, rgba(0,0,0,0.55) 100%);
}

/* Meta + cursor live on top of grain + shade. */
.mht-work-card__meta,
.mht-work-card__cursor {
	z-index: 4;
}

/* Placeholder card (no image yet): designed gradient so it still looks intentional. */
.mht-work-tile.mht-work-card.has-placeholder .mht-work-card__placeholder {
	position: absolute;
	inset: 0;
	z-index: 0;
	background:
		radial-gradient(ellipse 60% 50% at 25% 30%, rgba(142, 99, 163, 0.34), transparent 60%),
		radial-gradient(ellipse 50% 40% at 80% 80%, rgba(183, 140, 255, 0.22), transparent 65%),
		linear-gradient(135deg, #1B1620 0%, #141017 100%);
}

@media (prefers-reduced-motion: reduce) {
	.mht-work-card__image { transition: none; }
}

/* --------------------------------------------------------------------------
   Phase 151O.2 — locked project card image ratio
   --------------------------------------------------------------------------
   Project cards use one 16:9 media frame everywhere. Layouts may change card
   width, but image cards should not change crop ratio between homepage and Work.
*/
.mht-work-tile.mht-work-card.has-image {
  aspect-ratio: 16 / 9;
  min-height: 0;
}

.mht-work-tile.mht-work-card.has-image .mht-work-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media (max-width: 980px) {
  .mht-work-tile.mht-work-card.has-image {
    min-height: 0;
  }
}


/* --------------------------------------------------------------------------
   Phase 151O.7 — rendered project cards must own visible geometry
   --------------------------------------------------------------------------
   Root cause: the old foundation layer still forced `.mht-work-card` and
   `.mht-work-tile` to `aspect-ratio:auto !important`. Image-card children are
   absolutely positioned, and 151O.2 also removed min-height on image cards.
   Result: real rendered cards could collapse to a zero-height grid item.
   This scoped rule restores the 16:9 project frame after the old reset without
   touching non-project cards or redesigning the Work/Home layouts.
*/
.mht-work-wall > .mht-work-tile.mht-work-card,
.mht-work-wall .mht-work-tile.mht-work-card.has-image,
.mht-work-wall .mht-work-tile.mht-work-card.has-placeholder {
  aspect-ratio: 16 / 9 !important;
  width: 100%;
  min-height: 0;
}

.mht-work-wall > .mht-work-tile.mht-work-card {
  display: grid;
  visibility: visible;
}

.mht-work-wall .mht-work-tile.mht-work-card.has-placeholder {
  min-height: clamp(200px, 22vw, 300px);
}

@supports not (aspect-ratio: 16 / 9) {
  .mht-work-wall > .mht-work-tile.mht-work-card {
    min-height: clamp(200px, 22vw, 300px);
  }
}
