/* Home page: logo, call to action, the 3 latest videos and an "All videos" pop-up. Loads after site.css. */

/* Keep the whole page on one screen: narrower content on short screens so the videos fit. */
/* (Only the main area; the header and footer stay the same width as every other page.) */
body.home main { --wrap: clamp(40rem, (100vh - 14rem) * 2.4, 78rem); --wrap: clamp(40rem, (100svh - 14rem) * 2.4, 78rem); }

/* Latest: one big video and two beside it. */
.latest { padding-top: clamp(1.25rem, 4vh, 2.5rem); padding-bottom: clamp(1.5rem, 4vh, 3rem); }
.latest-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 0.9rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.latest-head h2 { margin: 0; font-size: clamp(1.7rem, 3.2vw, 2.1rem); padding-right: 0.08em; }
.view-all { display: inline-flex; align-items: center; gap: 6px; padding: 6px 2px; border: 0; background: none; color: var(--muted); font: 600 0.92rem/1 var(--body); cursor: pointer; }
.view-all svg { width: 1em; height: 1em; transition: transform .15s ease; }
.view-all:hover { color: var(--text); }
.view-all:hover svg { transform: translateX(3px); }
.va-n { color: var(--faint); font-variant-numeric: tabular-nums; }
.view-all:hover .va-n { color: var(--muted); }

.trio { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: 2fr 1fr; grid-template-rows: auto auto; }
.trio > li:first-child { grid-row: 1 / 3; }
.tile a { position: relative; display: block; height: 100%; min-height: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--surface); color: #fff; text-decoration: none; isolation: isolate; }
.trio > li:first-child .tile-a { aspect-ratio: auto; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .35s ease; }
.tile a::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.45) 32%, rgba(0, 0, 0, 0) 58%); }
.tile a:hover img, .tile a:focus-visible img { transform: scale(1.03); }
.tile-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px; }
.tile-title { margin: 0; font: 600 1rem/1.3 var(--body); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { margin: 5px 0 0; font: 500 0.8rem/1.2 var(--body); color: rgba(255, 255, 255, 0.72); font-variant-numeric: tabular-nums; }
.tile-meta b { color: var(--yellow); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.72rem; margin-right: 8px; }
.trio > li:first-child .tile-text { padding: 22px 24px; }
.trio > li:first-child .tile-title { font: 800 italic clamp(1.5rem, 2.6vw, 2.2rem)/1.02 var(--head); text-transform: uppercase; letter-spacing: 0.01em; padding-right: 0.1em; max-width: 26em; }
.trio > li:first-child .tile-meta { margin-top: 8px; font-size: 0.85rem; }

/* Loading placeholders */
.tile.skel { border-radius: 12px; aspect-ratio: 16 / 9; background: linear-gradient(100deg, var(--surface) 30%, #1f1f26 50%, var(--surface) 70%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.trio > li.skel:first-child { aspect-ratio: auto; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Phones: big one on top, the other two side by side. */
@media (max-width: 640px) {
  body.home main { --wrap: 78rem; }
  .trio { grid-template-columns: 1fr 1fr; gap: 10px; }
  .trio > li:first-child { grid-row: auto; grid-column: 1 / -1; }
  .trio > li:first-child .tile-a, .trio > li.skel:first-child { aspect-ratio: 16 / 9; }
  .trio > li:first-child .tile-text { padding: 14px 16px; }
  .trio > li:first-child .tile-title { font-size: 1.45rem; }
  /* the two small ones: title under the picture */
  .trio > li:not(:first-child) .tile-a { aspect-ratio: auto; height: auto; overflow: visible; background: none; color: var(--text); }
  .trio > li:not(:first-child) .tile-a::after { content: none; }
  .trio > li:not(:first-child) img { position: relative; aspect-ratio: 16 / 9; height: auto; border-radius: 10px; }
  .trio > li:not(:first-child) .tile-text { position: static; padding: 8px 0 0; }
  .trio > li:not(:first-child) .tile-title { font-size: 0.85rem; text-shadow: none; }
  .trio > li:not(:first-child) .tile-meta { color: var(--faint); font-size: 0.75rem; }
}

/* All videos pop-up */
body:has(dialog.all[open]) { overflow: hidden; }
dialog.all { padding: 0; margin: 0; border: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; background: transparent; color: var(--text); }
dialog.all::backdrop { background: rgba(6, 6, 8, 0.86); }
.all-panel { display: flex; flex-direction: column; width: min(100% - 2 * clamp(12px, 3vw, 40px), 84rem); height: calc(100% - 2 * clamp(12px, 4vh, 48px)); margin: clamp(12px, 4vh, 48px) auto; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
dialog.all[open] .all-panel { animation: pop .22s ease-out; }
dialog.all[open]::backdrop { animation: fade .22s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
@keyframes fade { from { opacity: 0; } }
.all-head { display: flex; align-items: center; gap: 12px; padding: 16px clamp(16px, 2.5vw, 28px); border-bottom: 1px solid var(--line); }
.all-head h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2rem); padding-right: 0.08em; }
.all-count { color: var(--faint); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.all-close { margin-left: auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.all-close svg { width: 16px; height: 16px; }
.all-close:hover { color: var(--text); border-color: #3a3a44; background: rgba(255, 255, 255, 0.04); }
.all-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: clamp(16px, 2.5vw, 28px); }
.agrid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem 1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.card a { display: block; color: inherit; text-decoration: none; }
.card .thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--surface); }
.card { content-visibility: auto; contain-intrinsic-size: auto 15rem; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s ease, transform .3s ease; }
.card .thumb img.in { opacity: 1; }
.card a:hover .thumb img, .card a:focus-visible .thumb img { transform: scale(1.03); }
.card .len { position: absolute; right: 6px; bottom: 6px; padding: 2px 6px; border-radius: 5px; background: rgba(0, 0, 0, 0.8); color: #fff; font: 600 0.72rem/1.3 var(--body); font-variant-numeric: tabular-nums; }
.card .ttl { margin: 0.6rem 0 0; font: 600 0.92rem/1.35 var(--body); color: #e8e8ec; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card a:hover .ttl { color: var(--text); }
.card .ago { margin: 3px 0 0; color: var(--faint); font-size: 0.8rem; }
.card.skel .thumb { background: linear-gradient(100deg, var(--surface) 30%, #1f1f26 50%, var(--surface) 70%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.card.skel .ttl { height: 2.5em; border-radius: 6px; background: var(--surface); }
.all-end { display: flex; justify-content: center; padding: 2rem 0 0.5rem; color: var(--faint); font-size: 0.9rem; }
.all-end:empty { padding: 0; }
@media (max-width: 640px) {
  .all-panel { width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; }
  .agrid { grid-template-columns: 1fr 1fr; gap: 1.1rem 0.7rem; }
  .card .ttl { font-size: 0.84rem; }
}

.vids-note { color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .tile img, .card .thumb img, .view-all svg { transition: none; }
  .tile.skel, .card.skel .thumb { animation: none; }
  dialog.all[open] .all-panel, dialog.all[open]::backdrop { animation: none; }
}

