/* =========================================================
   d4n.uk — landing page
   ---------------------------------------------------------
   Card index in the ping.gg mould: brand and tagline, two big
   product panels on the left, two image cards and a scrolling
   list on the right. Fills the viewport; scrolls on short ones.
   Only index.html uses this file. /stats, /manage and /404 use
   styles.css.
   ========================================================= */

:root {
  --bg:   #000;
  --ink:  #fff;
  --sub:  rgba(255, 255, 255, .6);
  --sub2: rgba(255, 255, 255, .4);
  --line: rgba(255, 255, 255, .1);
  --r:    6px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { font-family: var(--font); }
a { color: inherit; text-decoration: none; }
::selection { background: #fff; color: #000; }

.skip-link { position: fixed; top: -100px; left: 12px; z-index: 100; background: #fff; color: #000; padding: 8px 14px; font-weight: 600; border-radius: 4px; }
.skip-link:focus { top: 12px; }

/* ---------- page: fills the viewport, cards take the slack ---------- */
.page { max-width: 1400px; margin: 0 auto; padding: 0 20px 20px; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- top bar, two lines ---------- */
.top { padding: 26px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.top-left { display: flex; flex-direction: column; gap: 8px; }
.brand   { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.tagline { font-size: 22px; font-weight: 300; letter-spacing: -.01em; color: rgba(255, 255, 255, .85); }

/* ---------- two columns ---------- */
.spot { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-template-rows: minmax(0, 1fr); gap: 14px; }
.col { display: flex; flex-direction: column; min-height: 0; }
.col-panels { gap: 14px; }
.col-side   { gap: 10px; }

/* ---------- shared card bits ---------- */
.card { position: relative; isolation: isolate; overflow: hidden; border-radius: var(--r); display: block; border: 1px solid rgba(255, 255, 255, .06); transition: border-color .3s; }
.card:hover { border-color: rgba(255, 255, 255, .22); }
.card:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.name { font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.name span { color: var(--c); }   /* last word of the name in the project's accent */

/* ---------- big panels (left) ---------- */
.panel { flex: 1; min-height: 300px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); background-image: var(--g); }
.panel-copy { padding: 30px 32px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.panel .name { font-size: clamp(2rem, 3.4vw, 3rem); letter-spacing: -.04em; font-weight: 500; }
.panel-desc { font-size: clamp(1.1rem, 1.6vw, 1.4rem); font-weight: 300; line-height: 1.35; max-width: 24rem; opacity: .9; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--sub); }
.meta :first-child { color: #fff; }
.cta { margin-top: auto; display: inline-block; border-radius: 2px; background: #fff; color: #000; padding: 11px 18px; font-size: 14px; font-weight: 500; transition: transform .55s var(--ease), box-shadow .55s; }
.panel:hover .cta { transform: translateY(-3px); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .6), 0 0 0 4px color-mix(in srgb, var(--c) 35%, transparent); }
.panel-shot { position: relative; min-height: 200px; }
.shot { position: absolute; left: 16px; top: 84px; right: 0; bottom: 0; border-top-left-radius: var(--r); box-shadow: -24px -16px 60px -20px rgba(0, 0, 0, .75); background-size: cover; background-position: left top; transform-origin: 100% 100%; transition: transform .55s var(--ease), box-shadow .55s; will-change: transform; }
.panel:hover .shot { transform: scale(1.03); box-shadow: -30px -20px 70px -18px rgba(0, 0, 0, .85); }

/* soft cloud blobs behind D4N Tools; transform-only drift, composited, no repaint */
.cloud { position: absolute; z-index: -1; pointer-events: none; }
.cloud-a { left: -10%; bottom: -6%; width: 70%; opacity: .95; transform-origin: left bottom; animation: drift-a 26s ease-in-out infinite alternate; will-change: transform; }
.cloud-b { right: -8%; top: 18%; width: 45%; opacity: .8; transform-origin: right top; animation: drift-b 34s ease-in-out infinite alternate; will-change: transform; }
@keyframes drift-a { to { transform: translateX(3%); } }
@keyframes drift-b { to { transform: translateX(-4%); } }

/* ---------- image cards (right, top) ---------- */
.imgcard { flex: none; min-height: 140px; display: flex; align-items: center; padding: 20px 22px; border-color: rgba(255, 255, 255, .1); }
.imgcard-bg { position: absolute; inset: 0; background-size: cover; background-position: var(--pos, center 30%); transition: transform 1.1s var(--ease); will-change: transform; }
.imgcard:hover .imgcard-bg { transform: scale(1.05); }
.imgcard-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(var(--sh), .98) 0%, rgba(var(--sh), .88) 55%, rgba(var(--sh), .5) 100%); }
.imgcard-row { position: relative; display: flex; align-items: center; gap: 22px; width: 100%; }
.imgcard-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.imgcard .name { font-size: clamp(1.5rem, 2.2vw, 1.9rem); font-weight: 700; letter-spacing: -.03em; }
.imgcard-desc { font-size: 14px; line-height: 1.3; opacity: .85; }
.ghost { flex: none; border-radius: 2px; border: 1px solid rgba(255, 255, 255, .3); padding: 8px 16px; font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color .15s, color .15s, border-color .15s; }
.imgcard:hover .ghost { background: var(--c); color: #000; border-color: transparent; }

/* ---------- scrolling list (right, bottom) ---------- */
.listbox { flex: 1 1 0; min-height: 0; position: relative; border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--r); background: #0a0a0d; overflow: hidden; }
.listbox::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; background: linear-gradient(rgba(10, 10, 13, 0), #0a0a0d); pointer-events: none; }
.list { position: absolute; inset: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; padding-bottom: 20px; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 0 var(--c); transition: background-color .2s, box-shadow .3s var(--ease); }
.row:first-child { border-top: 0; }
.row:hover { background: rgba(255, 255, 255, .04); box-shadow: inset 3px 0 0 0 var(--c); }
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.row .name { font-size: 16px; }
.row-desc { font-size: 12.5px; color: rgba(255, 255, 255, .8); font-weight: 300; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-host { font-size: 11px; color: var(--sub2); flex: none; }

/* ---------- intro: staggered rise on load ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.top > *, .col > * { animation: rise .55s var(--ease) both; }
.top > * { animation-delay: 40ms; }
.col-panels > :nth-child(1) { animation-delay: 160ms; }
.col-panels > :nth-child(2) { animation-delay: 260ms; }
.col-side > :nth-child(1) { animation-delay: 200ms; }
.col-side > :nth-child(2) { animation-delay: 300ms; }
.col-side > :nth-child(3) { animation-delay: 400ms; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .page { min-height: 0; padding: 0 16px 16px; }
  .top { padding: 22px 0 16px; }
  .brand { font-size: 36px; }
  .tagline { font-size: 19px; }
  .spot { grid-template-columns: 1fr; grid-template-rows: none; }
  .panel { min-height: 0; grid-template-columns: 1fr; }
  .panel-copy { padding: 22px 22px 18px; }
  .panel-shot { min-height: 170px; }
  .shot { top: 0; left: 24px; }
  .listbox { flex: none; height: 360px; }
  .imgcard-row { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .top > *, .col > *, .cloud { animation: none; }
  .shot, .cta, .imgcard-bg, .ghost, .row { transition: none; }
  .panel:hover .shot, .panel:hover .cta, .imgcard:hover .imgcard-bg { transform: none; }
}
