/*
  White, ink and one blue. Always light, whatever the system theme.
  Things are separated by space and hairlines, not boxes. Only controls are rounded.
  Type sizes come from the --fs scale, spacing from a 4px grid.
  Motion: one easing curve, transform and opacity only.
*/

@font-face { font-family: "Schibsted Grotesk"; src: url("/assets/schibsted-grotesk-0a37e4d0.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/assets/geist-mono-a600ad3f.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;

  --bg: #fff;
  --surface: #fff;
  --fill: #f2f2f0;
  --ink: #111316;
  --text: #2a2d33;
  --muted: #6b7079;
  --hair: #e6e7ea;
  --accent: #2340d9;
  --on-accent: #fff;
  --warn: #a14a00;
  --danger: #b3261e;
  --field: #8c9198; /* 3:1 against the surface, the WCAG minimum for input edges */
  --terminal: #111316;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: clamp(1.75rem, 3.6vw, 2.5rem);
  --fs-4xl: clamp(2.25rem, 5vw, 3.75rem);
  --fs-5xl: clamp(2.5rem, 6vw, 4.5rem);

  --sans: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

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

html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }

h1, h2, h3 { margin: 0; color: var(--ink); line-height: 1.08; letter-spacing: -0.035em; font-weight: 600; }
h1 { hanging-punctuation: first; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }

code, pre, .mono { font-family: var(--mono); }
:not(pre) > code { font-size: 0.9em; color: var(--ink); }


.icon { width: 1.1em; height: 1.1em; fill: currentColor; flex: none; vertical-align: -0.15em; }
.avatar { border-radius: 50%; background: var(--fill); flex: none; }
.name { color: var(--ink); font-weight: 550; letter-spacing: -0.02em; }
.version { font: var(--fs-xs) var(--mono); color: var(--muted); letter-spacing: 0; }
.hint { color: var(--muted); font-size: var(--fs-xs); }
.lead { color: var(--muted); font-size: var(--fs-xl); line-height: 1.5; max-width: 58ch; }
.stars { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stars .icon { width: 12px; height: 12px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 28px; }
main.wrap { padding-block: 24px 40px; min-height: 70vh; }

/* Nav: a thin translucent bar */

.nav { position: sticky; top: 0; z-index: 10; background: var(--bg); box-shadow: 0 1px 0 var(--hair); }
.nav__bar { max-width: 1080px; margin: 0 auto; padding: 0 28px; height: 52px; display: flex; align-items: center; gap: 28px; }
.logo { display: flex; align-items: center; gap: 8px; font: 650 var(--fs-md) var(--sans); color: var(--ink); letter-spacing: -0.03em; }
.logo__mark.icon { width: 24px; height: 24px; overflow: visible; }
.logo__eye { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
.logo:hover .logo__eye { animation: blink 0.5s; }
.logo:hover .logo__mark { animation: hop 0.6s var(--ease); }
.nav__search { position: relative; flex: 1; max-width: 300px; display: flex; align-items: center; }
.nav__search .icon { position: absolute; left: 11px; color: var(--muted); width: 15px; height: 15px; }
.nav__search input[type="search"] { padding: 8px 36px 8px 32px; font-size: var(--fs-sm); border-radius: 8px; background: var(--fill); border-color: transparent; }
.nav__search input[type="search"]:focus { background: var(--surface); border-color: var(--accent); }
.nav__search kbd { position: absolute; right: 9px; font: 500 var(--fs-xs) var(--mono); color: var(--muted); border: 1px solid var(--field); border-radius: 4px; padding: 0 4px; line-height: 1.5; }
.nav__links { display: flex; gap: 24px; margin-left: auto; font-size: var(--fs-sm); }
.nav__links a { color: var(--text); transition: color 0.3s var(--ease); }
.nav__links a:hover { color: var(--accent); }

/* Controls */

input[type="search"], input[type="text"], input[type="url"], input[type="email"], textarea, select {
  display: block; width: 100%;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--field); border-radius: 10px;
  padding: 12px 16px;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type="search"]::-webkit-search-cancel-button { display: none; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  font: 550 var(--fs-sm) var(--sans); color: var(--on-accent);
  background: var(--accent); border: 0; border-radius: 10px;
  padding: 12px 24px; cursor: pointer; white-space: nowrap;
  transition: background 0.3s var(--ease), transform 0.3s var(--ease);
}
.button:hover { transform: scale(1.02); }
.button:active { transform: scale(0.98); }
.button:disabled { opacity: 0.7; cursor: progress; }
.button--small { padding: 8px 16px; font-size: var(--fs-xs); }
.button--quiet { padding: 4px 12px; font-size: var(--fs-xs); color: var(--ink); background: var(--fill); }
.button--quiet:hover { background: var(--hair); }

/* A blue text link whose arrow slides on hover. */
.more { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: var(--fs-sm); }
.more .icon { width: 14px; height: 14px; transition: transform 0.4s var(--ease); }
.more:hover .icon { transform: translateX(3px); }

.tag { font: 550 var(--fs-xs)/1 var(--sans); color: var(--accent); white-space: nowrap; }
.tag--warn { color: var(--warn); }

.flash { padding: 12px 0; color: var(--accent); margin-bottom: 20px; box-shadow: 0 1px 0 var(--hair); }
.flash--alert { color: var(--warn); }

/* Flash messages: a dark toast that rises from the bottom and leaves by itself. */
.toasts { position: fixed; z-index: 20; left: 50%; bottom: 28px; transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px 12px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: var(--fs-sm); cursor: pointer;
  box-shadow: 0 18px 40px -12px rgb(17 19 22 / 0.45);
  animation: toast-in 0.6s var(--ease) both;
}
.toast .icon { width: 26px; height: 26px; padding: 4px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.toast--alert .icon { background: var(--warn); }
.toast.is-leaving { animation: toast-out 0.4s var(--ease) forwards; }

/* Canvas for the falling leaves on the home page; under the nav, over the page, never in the way. */
.leaves { position: fixed; inset: 0; z-index: 5; width: 100vw; height: 100vh; pointer-events: none; }

/* Canvas for the fireworks after a mod is listed. */
.fireworks { position: fixed; inset: 0; z-index: 30; width: 100vw; height: 100vh; pointer-events: none; }

/* Sections */

.section { margin-top: 40px; }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-bottom: 28px; }
.section__head h2 { font-size: var(--fs-3xl); }

/* Home: hero */

.hero { padding-top: 32px; text-align: center; }
.hero__title { font-size: clamp(2.5rem, 7.6vw, 5rem); line-height: 1.05; letter-spacing: -0.05em; }
.hero__brand { display: flex; align-items: center; justify-content: center; gap: 0.2em; color: var(--accent); }
.hero__brand .logo__mark.icon { width: 0.9em; height: 0.9em; }
.hero__sub { max-width: 52ch; margin: 24px auto 0; color: var(--muted); font-size: var(--fs-lg); }
.hero__sub a { color: var(--accent); }
.hero__foot { max-width: 640px; margin: 48px auto 0; }
.search { position: relative; display: flex; align-items: center; }
.search input[type="search"] { padding: 16px 56px 16px 20px; font-size: var(--fs-lg); border-radius: 12px; background: var(--fill); border-color: transparent; }
.search input[type="search"]:focus { background: var(--surface); border-color: var(--accent); }
.search__submit { position: absolute; right: 8px; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; transition: color 0.3s var(--ease); }
.search__submit:hover { color: var(--accent); }
.search__submit .icon { width: 22px; height: 22px; }
.hero__row { display: flex; justify-content: center; align-items: center; gap: 48px; margin-top: 40px; }
.hero__cta { font-size: var(--fs-lg); }

/* Home: ranked list */

.ranked { list-style: none; margin: 0; padding: 0; }
.ranked li + li .ranked__row { box-shadow: 0 -1px 0 var(--hair); }
.ranked__row { display: grid; grid-template-columns: 56px 220px 1fr auto; gap: 20px; align-items: baseline; padding: 20px 0; transition: transform 0.5s var(--ease); }
.ranked__row:hover { transform: translateX(6px); }
.ranked__row:hover .name { color: var(--accent); }
.ranked__rank { font: 600 var(--fs-2xl)/1 var(--sans); letter-spacing: -0.05em; color: var(--muted); font-variant-numeric: tabular-nums; }
.ranked .name { font-size: var(--fs-lg); transition: color 0.3s var(--ease); }
.ranked__desc { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Lists and browse */

.page-head { padding: 20px 0 40px; }
.page-head h1 { font-size: var(--fs-4xl); letter-spacing: -0.05em; }
.page-head p { margin-top: 16px; color: var(--muted); font-size: var(--fs-lg); max-width: 60ch; }

.browse { display: grid; grid-template-columns: 190px 1fr; gap: 56px; align-items: start; }
.browse > * { min-width: 0; }
.side { position: sticky; top: 84px; display: grid; gap: 2px; font-size: var(--fs-sm); }
.side a { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); transition: color 0.3s var(--ease); }
.side a small { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.side a:hover, .side a.is-current { color: var(--ink); }
.side a.is-current { font-weight: 600; }

.sort { display: flex; gap: 24px; font-size: var(--fs-sm); box-shadow: inset 0 -1px 0 var(--hair); }
.sort a { padding-bottom: 12px; color: var(--muted); transition: color 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.sort a:hover { color: var(--ink); }
.sort a.is-current { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li .row { box-shadow: 0 -1px 0 var(--hair); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start; padding: 24px 0; }
.row:hover .name { color: var(--accent); }
.row__main { display: grid; gap: 4px; min-width: 0; }
.row__title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.row .name { font-size: var(--fs-lg); transition: color 0.3s var(--ease); }
.row__desc { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text); }
.row__meta { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); }
.row .stars { padding-top: 4px; }

.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 28px; color: var(--muted); font-size: var(--fs-sm); box-shadow: 0 -1px 0 var(--hair); }

.empty { padding: 72px 0; color: var(--muted); }
.empty__title { color: var(--ink); font-weight: 600; font-size: var(--fs-xl); margin-bottom: 8px; }
.empty a { color: var(--accent); }

/* Mod page */

.crumbs { display: flex; align-items: center; gap: 8px; padding-top: 16px; font-size: var(--fs-sm); color: var(--muted); }
.crumbs .icon { width: 12px; height: 12px; }
.crumbs a:hover { color: var(--ink); }
.mod-head { padding: 8px 0 20px; }
.mod-intro { padding-bottom: 48px; }
.mod-head h1 { font-size: var(--fs-4xl); overflow-wrap: anywhere; }
.mod-head h1 .name { font-weight: 600; letter-spacing: -0.055em; }
.mod-head h1 .version { font-size: var(--fs-md); }
.mod-head__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin-top: 24px; }
.author { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 550; }

.mod-layout { display: grid; grid-template-columns: 1fr 280px; gap: 72px; align-items: start; }
.mod-layout > * { min-width: 0; }
.block + .block { margin-top: 56px; }
.block h2 { font-size: var(--fs-xl); margin-bottom: 16px; letter-spacing: -0.02em; }
.prose { max-width: 64ch; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 12px; }
.prose ul { padding-left: 1.2em; }
.prose a { color: var(--accent); }

.terminal { background: var(--terminal); border-radius: 14px; overflow: hidden; }
.terminal__bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 12px 24px; font: 500 var(--fs-xs) var(--mono); color: #8b9099; box-shadow: 0 1px 0 rgb(255 255 255 / 0.08); }
.terminal pre { margin: 0; padding: 20px 24px 24px; color: #e6e9ee; font-size: var(--fs-sm); line-height: 1.85; overflow-x: auto; }
.terminal__copy {
  display: inline-flex; font: 500 var(--fs-xs) var(--sans); color: #fff;
  background: rgb(255 255 255 / 0.1); border: 0; border-radius: 6px; padding: 8px 12px; cursor: pointer;
  transition: background 0.3s var(--ease);
}
.terminal__copy:hover { background: rgb(255 255 255 / 0.18); }
.terminal__copy span { display: inline-flex; align-items: center; gap: 8px; }
.terminal .when-copied { display: none; color: #9fe3b8; }
.terminal.is-copied .when-copied { display: inline-flex; animation: pop 0.5s var(--ease); }
.terminal.is-copied .when-idle { display: none; }
.terminal + .hint { margin-top: 12px; }

.features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px 24px; }
.features li { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.features .icon { width: 22px; height: 22px; color: var(--accent); }


.mod-facts { position: sticky; top: 84px; display: grid; gap: 24px; }
.facts { display: grid; grid-template-columns: auto 1fr; margin: 0; font-size: var(--fs-sm); box-shadow: 0 -1px 0 var(--hair); }
.facts dt, .facts dd { margin: 0; padding: 12px 0; box-shadow: 0 1px 0 var(--hair); }
.facts dt { color: var(--muted); padding-right: 16px; }
.facts dd { text-align: right; color: var(--ink); overflow-wrap: anywhere; }
.facts dd a { color: var(--accent); }

/* Submit */

.submit { padding-bottom: 40px; }
.form { display: grid; gap: 24px; }
.form .button { justify-self: start; }
.field { display: grid; gap: 8px; }
.field label { font-weight: 550; color: var(--ink); }
.field .is-invalid { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); animation: shake 0.4s var(--ease); }
.field__error { display: flex; align-items: center; gap: 8px; color: var(--danger); font-size: var(--fs-xs); animation: rise 0.4s var(--ease); }
.field__error::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.form .button { justify-self: start; }
.trap { position: absolute; left: -9999px; }
.errors { padding: 4px 0 4px 16px; box-shadow: inset 2px 0 0 var(--danger); color: var(--danger); }
.errors p { font-weight: 600; }
.errors ul { margin: 4px 0 0; padding-left: 20px; }

/* Contact: the thank-you after sending */

.sent { display: grid; justify-items: center; gap: 16px; padding: 64px 0 40px; text-align: center; }
.sent h1 { font-size: var(--fs-4xl); letter-spacing: -0.05em; }
.sent p { color: var(--muted); font-size: var(--fs-lg); max-width: 44ch; }
.sent .button { gap: 8px; margin-top: 8px; }
.sent .button .icon { width: 16px; height: 16px; }
.sent__mark { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.sent__mark .icon { width: 36px; height: 36px; }


/* Categories page */

.category-index { list-style: none; margin: 0; padding: 0 0 40px; display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 56px; }
.category-index a { display: grid; grid-template-columns: 36px 1fr auto; column-gap: 16px; align-items: baseline; padding: 24px 0; box-shadow: 0 -1px 0 var(--hair); }
.category-index .icon { width: 26px; height: 26px; color: var(--ink); grid-row: span 2; align-self: start; }
.category-index__name { color: var(--ink); font-weight: 600; font-size: var(--fs-lg); }
.category-index__desc { grid-column: 2; color: var(--muted); font-size: var(--fs-sm); }
.category-index small { grid-row: 1; grid-column: 3; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.category-index a:hover .category-index__name, .category-index a:hover .icon { color: var(--accent); }

/* Footer */

.footer { margin-top: 64px; box-shadow: 0 -1px 0 var(--hair); font-size: var(--fs-sm); color: var(--muted); }
.footer__main { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; padding-block: 48px 56px; }
.footer__brand p { max-width: 36ch; margin-top: 16px; }
.footer__support { gap: 8px; margin-top: 20px; }
.footer__support .icon { width: 16px; height: 16px; }
.footer__col { display: flex; flex-direction: column; align-items: start; gap: 10px; }
.footer__col h2 { font-size: var(--fs-sm); letter-spacing: 0; margin-bottom: 4px; }
.footer__col a { transition: color 0.3s var(--ease); }
.footer__col a:hover { color: var(--accent); }

/* Admin */

.admin-bar { display: flex; align-items: center; gap: 28px; padding: 32px 0 20px; }
.admin-bar .sort { box-shadow: none; }
.admin-bar form { margin-left: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 12px 8px 0; box-shadow: 0 1px 0 var(--hair); }
.table td { padding: 12px 12px 12px 0; box-shadow: 0 1px 0 var(--hair); vertical-align: top; }
.table .muted { color: var(--muted); font-size: var(--fs-xs); }
.inline { display: flex; gap: 8px; }
.inline select { padding: 4px 12px; font-size: var(--fs-xs); }


/* Motion */

@keyframes enter { from { opacity: 0; transform: translateY(24px); } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
@keyframes rise { from { transform: translateY(-4px); opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes toast-in { from { transform: translateY(24px) scale(0.96); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(16px) scale(0.96); opacity: 0; } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.12); } }
@keyframes hop { 40% { transform: translateY(-3px) rotate(-6deg); } }

@media (prefers-reduced-motion: no-preference) {
  /* Nothing waits for JavaScript: the top of the page rises in on load, */
  .hero__title, .hero__sub, .hero__foot, .page-head, .crumbs, .mod-head, .mod-intro { animation: enter 0.9s var(--ease) both; }
  .hero__foot, .mod-head, .mod-intro { animation-delay: 0.08s; }
  .sent__mark { animation: pop 0.6s var(--ease) both; }
  .sent h1, .sent p, .sent .button { animation: enter 0.9s var(--ease) 0.1s both; }

  /* and the rest follows the scroll. Browsers without scroll timelines just show it. */
  @supports (animation-timeline: view()) {
    [data-reveal] { animation: enter linear both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
  }

  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.35s; animation-timing-function: var(--ease); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .logo__eye, .logo__mark, .toast, .field .is-invalid { animation: none !important; }
}

/* Small screens */

@media (max-width: 860px) {
  .wrap, .nav__bar { padding: 0 20px; }
  .nav__bar { height: auto; flex-wrap: wrap; gap: 12px 20px; padding-block: 12px; }
  .nav__search { order: 3; flex-basis: 100%; max-width: none; }
  .nav__search kbd { display: none; }
  .nav__links { gap: 20px; }

  .hero { padding-top: 16px; }
  .hero__foot { margin-top: 36px; }
  .hero__row { gap: 28px; margin-top: 28px; }

  .section { margin-top: 28px; }
  .ranked__row { grid-template-columns: 36px 1fr auto; gap: 16px; }
  .ranked__desc { grid-column: 2 / -1; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
  .ranked .stars { grid-row: 1; grid-column: 3; }

  .browse, .mod-layout, .category-index { grid-template-columns: 1fr; gap: 28px; }
  .side, .mod-facts { position: static; }
  .side { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; }
  .side a { flex: none; gap: 8px; }
  .terminal pre, .terminal__bar { padding-inline: 20px 12px; }
  .admin-bar { flex-wrap: wrap; }
  .footer__main { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer__brand { grid-column: 1 / -1; }
}
