:root {
  color-scheme: dark;

  --ground:        oklch(15% 0.035 268);
  --surface:       oklch(20% 0.04 268);
  --surface-hi:    oklch(25% 0.05 268);
  --night:         oklch(27% 0.05 268);
  --ink:           oklch(96% 0.012 268);
  --ink-soft:      oklch(76% 0.035 268);
  --accent:        oklch(82% 0.15 78);
  --accent-ink:    oklch(20% 0.05 78);

  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --text:    "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;

  --margin: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

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

html {
  background: var(--ground);
  scrollbar-color: var(--night) var(--ground);
  scroll-padding-top: 24px;
}

body {
  min-height: 100svh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: var(--margin); top: -80px; z-index: 10;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap { position: relative; max-width: 1280px; margin: 0 auto; padding: 0 var(--margin); }

/* The mark, enlarged: an S made of two orbits, with the archived piece in amber */
.sky { position: absolute; inset: 0 0 auto; height: 100svh; overflow: hidden; pointer-events: none; }
.s-art {
  position: absolute;
  top: -8vh;
  right: clamp(-160px, -7vw, -30px);
  height: clamp(420px, 88vh, 900px);
  aspect-ratio: 100 / 116;
}
.s-art path { stroke: var(--surface-hi); }
.s-art circle { fill: var(--accent); }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .s-art { animation: drift linear both; animation-timeline: scroll(root); animation-range: 0 90vh; }
    @keyframes drift { to { transform: translate3d(-3vw, 14vh, 0); } }
  }
}

/* Top bar */
.bar {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 0;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand svg { width: 24px; height: 28px; flex: none; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 20px;
  background: var(--ink); color: var(--ground);
  border: 0; border-radius: 999px;
  font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:hover { background: var(--accent); color: var(--accent-ink); }
.btn:active { transform: scale(.97); }

@media (max-width: 560px) {
  .btn .long { display: none; }
  .s-art { top: 70px; right: -80px; height: 300px; }
}

/* Hero */
.hero { position: relative; padding: clamp(56px, 11vw, 160px) 0 clamp(48px, 7vw, 96px); }
h1 {
  max-width: 11ch;
  font-family: var(--display);
  font-size: clamp(3.25rem, 11vw, 7.5rem);
  font-weight: 700;
  line-height: .92;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.lede {
  max-width: 36ch;
  margin-top: clamp(20px, 3vw, 32px);
  font-size: clamp(1.25rem, 2.2vw, 1.625rem);
  line-height: 1.35;
  text-wrap: pretty;
}
.summary { margin-top: 20px; color: var(--ink-soft); }
.summary strong { color: var(--ink); font-weight: 600; }

@media (prefers-reduced-motion: no-preference) {
  h1, .lede, .summary { animation: rise 800ms var(--ease) both; }
  .lede    { animation-delay: 90ms; }
  .summary { animation-delay: 180ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(24px); } }
}

/* Controls */
.controls { display: grid; gap: 16px; }
.search { position: relative; display: block; }
.search input {
  width: 100%; min-height: 64px;
  padding: 0 76px 0 24px;
  background: var(--surface);
  border: 0; border-radius: 16px;
  font-size: 1.25rem;
  caret-color: var(--accent);
  transition: background-color 160ms var(--ease);
}
.search input::placeholder { color: var(--ink-soft); }
.search input:hover { background: var(--surface-hi); }
.search input:focus-visible { background: var(--surface-hi); outline-offset: 2px; border-radius: 16px; }
.search kbd {
  position: absolute; right: 20px; top: 50%; translate: 0 -50%;
  min-width: 32px; padding: 3px 10px;
  background: var(--night); color: var(--ink-soft);
  border-radius: 8px;
  font: 600 .9rem/1.4 var(--text);
  text-align: center;
  pointer-events: none;
}
.search input:not(:placeholder-shown) ~ kbd { display: none; }

.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.chips, .sort { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 18px;
  background: var(--surface); border: 0; border-radius: 999px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: background-color 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease);
}
.chip small { margin-left: 6px; color: var(--ink-soft); font-size: inherit; }
.chip:hover { background: var(--surface-hi); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .7; }
.sort .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* List */
.list { display: grid; margin-top: 32px; min-height: 240px; }

.repo {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 11rem 8.5rem 28px;
  gap: 6px 24px;
  align-items: center;
  padding: 28px 24px;
  margin-inline: -24px;
  border-radius: 20px;
  text-decoration: none;
  transition: background-color 200ms var(--ease);
}
.repo:hover { background: var(--surface); }
.repo-main { display: grid; gap: 6px; min-width: 0; }
.repo-name {
  font-family: var(--display);
  font-size: clamp(1.625rem, 3.4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
  transition: color 160ms var(--ease), translate 300ms var(--ease);
}
.repo:hover .repo-name { color: var(--accent); translate: 6px 0; }
.repo-desc { max-width: 62ch; color: var(--ink-soft); text-wrap: pretty; }
.repo-lang { display: inline-flex; align-items: center; gap: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--dot, var(--ink-soft)); flex: none; }
.repo-date { color: var(--ink-soft); }
.repo-flags { display: inline-flex; gap: 8px; margin-left: 12px; vertical-align: middle; }
.flag {
  padding: 2px 12px; border-radius: 999px;
  background: var(--surface-hi);
  color: var(--ink);
  font-family: var(--text);
  font-size: .875rem; font-weight: 600; letter-spacing: 0;
}
.flag.live { background: var(--accent); color: var(--accent-ink); }
.go { width: 28px; height: 28px; color: var(--ink-soft); transition: color 160ms var(--ease), translate 300ms var(--ease); }
.repo:hover .go { color: var(--accent); translate: 4px -4px; }

@media (max-width: 860px) {
  .repo { grid-template-columns: minmax(0, 1fr) 28px; padding: 24px 16px; margin-inline: -16px; }
  .repo-main { grid-column: 1; }
  .repo-lang, .repo-date { grid-column: 1; }
  .repo-lang { margin-top: 8px; }
  .go { grid-column: 2; grid-row: 1; align-self: start; margin-top: 6px; }
}

.enter .repo { animation: rise 640ms var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }

.state {
  max-width: 52ch; padding: 32px 0;
  font-size: 1.25rem; line-height: 1.4;
}
.state p + .btn, .state p + .chip { margin-top: 20px; }
.state.error p:first-child { color: var(--accent); }
.skeleton {
  height: 104px; margin-bottom: 12px; border-radius: 20px; background: var(--surface);
  animation: breathe 1.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * 120ms);
}
@keyframes breathe { 50% { opacity: .45; } }

/* Footer: the name comes back */
footer { margin-top: clamp(96px, 14vw, 200px); padding-bottom: 32px; overflow: hidden; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 32px; color: var(--ink-soft); }
.foot-links a { color: var(--ink); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.foot-links a:hover { color: var(--accent); }
.foot-name {
  margin-top: clamp(32px, 6vw, 72px);
  font-family: var(--display);
  font-size: clamp(3rem, 13vw, 13rem);
  font-weight: 800;
  line-height: .8;
  letter-spacing: -0.04em;
  color: var(--ink);
  white-space: nowrap;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .repo:hover .repo-name, .repo:hover .go { translate: none; }
}
