/* Homepage: the hero and the card grid. Header, footer and the search modal
   come from ../../css/chrome.css. Loads after global.css + atmosphere.css. */

/* Flex in both states: justify-content only has free space to distribute while
   min-height is holding the box open, so the landing and the ordinary page are
   the same layout, and opening one into the other is a single animated length.
   min-height must be 0 rather than auto here — auto cannot be interpolated, and
   a transition into it snaps. */
.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  transition: min-height 0.55s var(--ease);
}

/* ── hero ───────────────────────────────────────────── */
.hero {
  padding: 92px 0 78px;
  max-width: 780px;
  transition: padding 0.55s var(--ease);
}
.hero > * { animation: rise 0.6s var(--ease) both; }
.hero > *:nth-child(2) { animation-delay: 0.09s; }
.hero > *:nth-child(3) { animation-delay: 0.18s; }
.hero > *:nth-child(4) { animation-delay: 0.27s; }
.hero > *:nth-child(5) { animation-delay: 0.36s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.hero .eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 20px;
}
.hero h1 {
  font-family: var(--display);
  font-size: 3.6rem;
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 0 0 22px;
  text-wrap: balance;
  transition: font-size 0.55s var(--ease);
}
.hero p {
  font-size: 1.16rem;
  line-height: 1.62;
  color: var(--lede);
  margin: 0 0 34px;
  max-width: 620px;
  text-wrap: pretty;
}

.cta-row { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin-bottom: 44px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 22px;
  border: none;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: filter var(--t) var(--ease), transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.btn:hover { filter: brightness(1.12); transform: translateY(-2px); color: var(--ink); text-decoration: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 6px 20px rgba(28, 63, 170, 0.4);
}
.btn-primary:hover { box-shadow: 0 10px 28px rgba(28, 63, 170, 0.55); }
.btn-ghost { border: 1px solid var(--line-mid); background: var(--tab); color: var(--strong); }
.btn-ghost:hover { border-color: var(--line-hard); background: #1f1f1f; color: var(--strong); }
/* Patreon and Ko-fi. --brand is set inline from site.js. */
.btn-brand {
  border: 1px solid color-mix(in srgb, var(--brand) 38%, transparent);
  background: color-mix(in srgb, var(--brand) 12%, var(--tab));
  color: var(--strong);
}
.btn-brand:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 20%, var(--tab));
  color: var(--ink);
}

.runs-on {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.runs-on span { display: flex; align-items: center; gap: 9px; color: var(--muted); }

/* ── section rule ───────────────────────────────────── */
.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.rule::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* ── cards ──────────────────────────────────────────── */
.shelf { padding-bottom: 34px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.3s var(--spring), border-color 0.3s var(--ease),
              background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
/* Hover light that traces the border, tinted to the widget's own accent. */
.tile::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--a), transparent 0 0.6turn, var(--brand) 0.78turn, transparent 0.95turn);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
  z-index: 6;
}
.tile:hover, .tile:focus-within {
  transform: translateY(-4px);
  border-color: var(--line-mid);
  background: var(--raised-2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.tile:hover::after, .tile:focus-within::after { opacity: 1; animation: trace 1.6s linear infinite; }

/* The card is one big link. It has to be a real element rather than a stretched
   ::after, because a pseudo-element resolves against .tile-body and so never
   reached the thumbnail. */
.tile-cover { position: absolute; inset: 0; z-index: 4; border-radius: inherit; }
@keyframes trace { to { --a: 1turn; } }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(145deg, var(--wash-a), var(--wash-b) 52%, rgba(22, 22, 22, 0) 78%), #131313;
}
.thumb img.art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.ghost {
  position: absolute;
  right: -14px;
  bottom: -22px;
  width: 116px;
  height: 116px;
  opacity: 0.14;
  z-index: 0;
  transition: opacity 0.3s var(--ease), transform 0.45s var(--spring);
}
.tile:hover .ghost { opacity: 0.26; transform: scale(1.12) rotate(-7deg); }

.eyebrow-chip {
  position: absolute;
  top: 13px;
  left: 14px;
  z-index: 2;
  padding: 4px 10px;
  border: 1px solid;
  border-radius: var(--r-pill);
  background: rgba(16, 16, 16, 0.7);
  backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.13em;
}

.tile-body { position: relative; display: flex; flex-direction: column; gap: 11px; padding: 17px 18px 18px; }
.tile-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tile-name {
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.tile-body p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--lede);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge {
  padding: 3px 9px;
  border: 1px solid;
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.badge-free { border-color: rgba(47, 158, 81, 0.4); background: rgba(47, 158, 81, 0.15); color: #8ad6a5; }
.badge-pro { border-color: rgba(255, 132, 56, 0.42); background: rgba(255, 132, 56, 0.15); color: #ffb37a; }
/* Freemium reads as one pill split in two, not two separate badges. */
.badge-split { display: inline-flex; align-items: stretch; font-family: var(--mono); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.1em; }
.badge-split .badge { border-radius: 0; }
.badge-split .badge:first-child { border-right: none; border-radius: var(--r-pill) 0 0 var(--r-pill); }
.badge-split .badge:last-child { border-radius: 0 var(--r-pill) var(--r-pill) 0; }

.tile-foot { display: flex; align-items: center; gap: 14px; padding-top: 3px; }
.plat-row { display: flex; align-items: center; gap: 14px; }
/* Heights differ per logo because each file frames its glyph differently. */
.plat { display: block; width: auto; flex: none; opacity: 0.92; transition: opacity var(--t) var(--ease); }
.tile:hover .plat { opacity: 1; }

/* Above the cover, so these three keep their own destinations. */
.tile-links { margin-left: auto; display: flex; align-items: center; gap: 14px; position: relative; z-index: 5; }
.tile-links a { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.tile-links a:hover { color: var(--brand); text-decoration: none; }
.tile-go { display: flex; align-items: center; gap: 6px; color: var(--muted); transition: color var(--t) var(--ease); }
.tile-go:hover { color: var(--brand); text-decoration: none; }
.tile:hover .tile-go { color: var(--brand); }

/* ── landing ────────────────────────────────────────── */
/* A fresh homepage is the hero and the footer, centred together as one group on
   a single screen with the shelves closed to nothing between them. Browse widgets
   drops .is-landing: the page stops being held open, the shelves grow, and the
   group rises to the top as the free space around it runs out. No rule here sets
   a layout mode or a keyword — every one of them is a length that interpolates. */
.is-landing .page-wrap { min-height: calc(100vh - var(--header-h)); }
.is-landing .hero { padding: 0 0 28px; }
.is-landing .hero h1 { font-size: clamp(3.6rem, 6.4vw, 5rem); }

/* The shelves grow open from nothing rather than hiding in place, so everything
   below them keeps its position in the flow. 0fr → 1fr animates to the content's
   own height, which no max-height guess can do. The clip is only needed while
   that runs — left on, it would cut the top row's hover lift. */
.shelves {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.55s var(--ease);
}
.shelves > div { min-height: 0; }
.is-landing .shelves { grid-template-rows: 0fr; }
.is-landing .shelves > div, .is-opening .shelves > div { overflow: hidden; }

.shelf {
  transition: opacity 0.5s var(--ease) 0.12s, transform 0.5s var(--ease) 0.12s, visibility 0s;
}
.is-landing .shelf {
  opacity: 0;
  transform: translateY(20px);
  visibility: hidden;
  transition-delay: 0s, 0s, 0.55s;
}

/* The footer never leaves the flow. On the landing the shelves above it have no
   height, so it comes to rest directly under the hero, one screen down; opening
   them slides it to the bottom of the page. Its rule stays out of the way until
   there is something above it worth dividing. */
.site-footer {
  animation: rise 0.6s var(--ease) 0.45s both;
  transition: margin-top 0.55s var(--ease), border-color 0.55s var(--ease);
}
.is-landing .site-footer { margin-top: 0; border-top-color: transparent; }

/* ── narrow ─────────────────────────────────────────── */
@media (max-width: 860px) {
  .page-wrap { padding: 0 18px; }
  .hero { padding: 46px 0 40px; }
  .hero h1 { font-size: 2.3rem; letter-spacing: -0.03em; }
  .hero p { font-size: 1rem; }
  .cta-row { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; height: 48px; }
  .is-landing .hero { padding-bottom: 24px; }
  .is-landing .hero h1 { font-size: 2.9rem; }
  .grid { grid-template-columns: 1fr; }
}
