/* Tiles and the bento grid: image, tags, arrow, hover slider,
   video tile and glyph tiles. Home page + "Next project". */

.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: 260px; gap: var(--space-4); }
.tile--l { grid-column: span 4; grid-row: span 2; }
.tile--m { grid-column: span 3; }
.tile--s { grid-column: span 2; }
.tile--w { grid-column: 1 / -1; }   /* full-width row */
@media (max-width: 1000px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 300px; }
  .tile--l { grid-column: span 2; grid-row: span 1; }
  .tile--m, .tile--s { grid-column: span 1; }
  /* 2 columns: a lone last tile (after the full-width first one) fills its row */
  .bento > .tile:last-child:nth-child(even):not(.tile--l) { grid-column: span 2; }
}
@media (max-width: 640px) {
  .bento { grid-template-columns: 1fr; grid-auto-rows: 320px; }
  .tile--l, .tile--m, .tile--s, .bento > .tile:last-child:nth-child(even):not(.tile--l) { grid-column: auto; }
}
.bento--highlights .tile--l { grid-row: span 2; }
.bento--single { grid-template-columns: 1fr; grid-auto-rows: clamp(320px, 42vw, 480px); }

/* Tile: full-bleed image (desaturated + tinted, full colour on hover), title and tags
   bottom-left, round arrow bottom-right. On hover a near-white panel with a
   diagonal edge slides in from the left. */
.tile {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: flex-end;
  border-radius: var(--radius-tile);
  background: var(--color-tile); color: #fff; text-decoration: none;
}
.section:not(.section--dark) .tile { box-shadow: 0 0 0 1px var(--color-line); }
.tile__media { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.7) brightness(0.92); transition: transform 700ms var(--ease), filter 500ms var(--ease); }
.tile::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: rgba(28, 28, 32, 0.38); transition: opacity 500ms var(--ease); }
.tile::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.35) 32%, rgba(0, 0, 0, 0) 52%); }
a.tile:hover .tile__media { transform: scale(1.04); filter: none; }
a.tile:hover::before { opacity: 0; }
a.tile:focus-visible { outline-offset: 4px; }

.tile__body { width: 100%; padding: var(--space-5) calc(var(--space-5) + 52px) var(--space-5) var(--space-5); transition: opacity 300ms var(--ease), transform 400ms var(--ease); }
.tile__body .chips { margin-bottom: var(--space-3); }
.tile .chip { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.22); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tile h3 { font-size: var(--text-xl); font-weight: 500; color: #fff; }
.tile--l h3, .tile--w h3 { font-size: clamp(1.875rem, 3.2vw, 2.75rem); }
.tile--wide-next h3 { font-size: clamp(2rem, 4vw, 3.25rem); }
.tile__body p { margin: var(--space-2) 0 0; font-size: var(--text-sm); color: rgba(255, 255, 255, 0.78); max-width: 52ch; }
.tile--s .tile__body p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tile__arrow {
  position: absolute; bottom: var(--space-4); right: var(--space-4);
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
  font-size: 1.25rem; font-weight: 700;
  transform: rotate(-45deg); transition: transform 400ms var(--ease), background 300ms;
}
a.tile:hover .tile__arrow { transform: rotate(0deg); background: #fff; color: var(--color-ink); box-shadow: 0 0 0 1px #fff; }

/* Hover slider. --cut sets where the diagonal meets the bottom edge;
   the text column always ends just before it. */
.tile__slide {
  --cut: 72%;
  position: absolute; inset: 0 auto 0 0; z-index: 1;
  width: min(78%, 520px);
  display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-3);
  padding: var(--space-6) calc(100% - var(--cut) + var(--space-4)) var(--space-5) var(--space-5);
  background: var(--color-accent); color: var(--color-ink);
  clip-path: polygon(0 0, 100% 0, var(--cut) 100%, 0 100%);
  transform: translateX(-105%);
  transition: transform 560ms var(--ease);
}
/* the light panel sits 4px inside the blue, leaving a thin stroke on the diagonal */
.tile__slide::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--color-panel); clip-path: polygon(0 0, calc(100% - 4px) 0, calc(var(--cut) - 4px) 100%, 0 100%); }
.tile__slide-title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); letter-spacing: -0.025em; line-height: 1.05; }
.tile__slide p { margin: 0; font-size: var(--text-md); line-height: 1.5; color: var(--color-ink); max-width: none; }
.tile__cta { display: inline-flex; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-accent-text); white-space: nowrap; }
.tile--l .tile__slide, .tile--w .tile__slide, .tile--wide-next .tile__slide { width: min(72%, 860px); }
.tile--l .tile__slide-title, .tile--w .tile__slide-title, .tile--wide-next .tile__slide-title { font-size: clamp(1.875rem, 3.2vw, 2.75rem); }
.tile--wide-next .tile__slide p { font-size: var(--text-md); }
/* small tiles: steeper cut, tighter type */
.tile--s .tile__slide, .tile--m .tile__slide { --cut: 84%; width: 94%; padding-top: var(--space-4); padding-bottom: var(--space-4); gap: var(--space-2); }
.tile--s .tile__slide-title { font-size: var(--text-lg); }
.tile--s .tile__slide p, .tile--m .tile__slide p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tile--s .tile__slide p, .tile--m .tile__slide p { font-size: var(--text-sm); line-height: 1.45; }

@media (hover: hover) {
  .tile .tile__body p { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tile:hover .tile__slide, .tile:focus-visible .tile__slide { transform: translateX(0); }
  .tile:hover .tile__body, .tile:focus-visible .tile__body { opacity: 0; transform: translateX(24px); }
}
@media (hover: none) { .tile__slide { display: none; } }

/* Video tile (GDC talk) */
.tile--video { flex-direction: column; align-items: stretch; }
.tile--video::after { display: none; }
.tile--video .tile__body { position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none; padding-top: var(--space-8); background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0)); }

/* Tiles without screenshots: dark grid + one large glyph */
.tile--glyph { background: #141416; }
.tile--glyph::before { display: none; }
.thumb-glyph {
  display: flex; align-items: flex-start; justify-content: flex-end; padding: var(--space-5) var(--space-6);
  background:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
    #141416;
  filter: none;
}
.thumb-glyph span { font-family: var(--font-display); font-weight: 300; font-size: clamp(3.5rem, 7vw, 6rem); letter-spacing: -0.05em; line-height: 1; color: rgba(255, 255, 255, 0.9); }
.tile--soon .thumb-glyph span { color: rgba(255, 255, 255, 0.35); }
