/* IPARR. Pine and amber on sage, one type family, rows over cards. */

:root {
  --bg: #eef2f0;
  --surface: #ffffff;
  --sunken: #e3e9e6;
  --ink: #16201c;
  --muted: #56655f;
  --line: #d3dcd8;
  --pine: #2f6f5e;
  --pine-ink: #ffffff;
  --amber: #b8860b;
  --amber-bg: #f7edd0;
  --danger: #a33a2b;
  --icon-radius: 22%;
  --r: 12px;
  --page: 1440px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101715; --surface: #18221f; --sunken: #0c1210; --ink: #e8efeb; --muted: #a3b2ab;
    --line: #2a3833; --pine: #7cc9ae; --pine-ink: #0c1411; --amber: #e8c15a; --amber-bg: #3a3218;
    --danger: #ef8a7a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101715; --surface: #18221f; --sunken: #0c1210; --ink: #e8efeb; --muted: #a3b2ab;
  --line: #2a3833; --pine: #7cc9ae; --pine-ink: #0c1411; --amber: #e8c15a; --amber-bg: #3a3218;
  --danger: #ef8a7a; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.55 var(--font); font-feature-settings: "ss01";
}
img { max-width: 100%; }
a { color: var(--pine); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--pine); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 5.4vw, 3.4rem); font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: 1.45rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .86em; }
.dim { color: var(--muted); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 9; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Header */
.top {
  max-width: var(--page); margin: 0 auto; padding: 20px 32px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand svg { width: 28px; height: 28px; color: var(--pine); }
.brand .blip { fill: var(--amber); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--sunken); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.theme { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; }
.theme:hover { color: var(--ink); background: var(--sunken); }
.theme svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: none; }
  :root:not([data-theme="light"]) .theme .moon { display: block; }
}

main { max-width: var(--page); margin: 0 auto; padding: 8px 32px 72px; }
section + section { margin-top: 56px; }

/* Hero: the search box is the hero */
.hero { padding: 48px 0 8px; max-width: 880px; }
.hero h1 { max-width: 14ch; }
.hero .lede { margin-top: 14px; font-size: 1.12rem; color: var(--muted); max-width: 56ch; }
.search { position: relative; margin-top: 28px; }
.search input {
  width: 100%; font: inherit; font-size: 1.15rem; color: var(--ink);
  background: var(--surface); border: 2px solid var(--ink); border-radius: 14px;
  padding: 18px 20px 18px 56px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pine) 22%, transparent); }
.search > svg { position: absolute; left: 18px; top: 50%; translate: 0 -50%; width: 22px; height: 22px; color: var(--muted); pointer-events: none; }
.search kbd { position: absolute; right: 14px; top: 50%; translate: 0 -50%; font: 500 .8rem var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
/* The one moment of motion: a single radar sweep when the page opens. */
.search { isolation: isolate; }
.search .sweep {
  position: absolute; inset: -3px; border-radius: 16px; pointer-events: none; z-index: -1; opacity: 0; overflow: hidden;
  animation: sweep-fade 1.6s ease .2s 1 both;
}
.search .sweep::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 200%; aspect-ratio: 1; translate: -50% -50%;
  background: conic-gradient(from 0deg, transparent 0 78%, var(--pine) 96%, transparent 100%);
  animation: sweep-turn 1.4s cubic-bezier(.4, 0, .2, 1) .2s 1 both;
}
@keyframes sweep-turn { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes sweep-fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.hint { margin-top: 10px; color: var(--muted); font-size: .92rem; }
.hint a { color: inherit; }

/* Live suggestions */
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px -12px rgb(0 0 0 / .28); z-index: 5; overflow: hidden; }
.suggest a { display: flex; align-items: center; gap: 12px; padding: 9px 14px; color: var(--ink); text-decoration: none; }
.suggest a[aria-selected="true"], .suggest a:hover { background: var(--sunken); }
.suggest img, .suggest .ph { width: 32px; height: 32px; }
.suggest small { color: var(--muted); display: block; }

/* Get the repo panel */
.getrepo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.getrepo h2 { margin-bottom: 6px; }
.getrepo > p { color: var(--muted); max-width: 64ch; }
.feeds { display: grid; gap: 10px; margin-top: 18px; }
.feed { display: grid; grid-template-columns: 9.5rem 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.feed:first-child { border-top: 0; }
.feed b { font-weight: 600; }
.feed .url { font-family: var(--mono); font-size: .88rem; overflow-wrap: anywhere; color: var(--muted); }
.feed .count { color: var(--muted); font-size: .88rem; display: block; }
.addto { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }
.addto > span { color: var(--muted); font-size: .92rem; margin-right: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 600 .95rem var(--font); cursor: pointer;
  padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none;
}
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--pine); border-color: var(--pine); color: var(--pine-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 10px; font-size: .86rem; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* App rows */
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.head p { color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); column-gap: 40px; }
.row { display: grid; grid-template-columns: 60px 1fr auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row .name { font-weight: 600; color: var(--ink); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name::after { content: ""; position: absolute; inset: 0; }
.row { position: relative; }
.row .meta { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .get { position: relative; z-index: 1; }
.icon, .ph { width: 60px; height: 60px; border-radius: var(--icon-radius); object-fit: cover; background: var(--sunken); display: block; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06); }
.ph { display: grid; place-content: center; justify-items: center; gap: 2px; color: var(--muted); background: var(--sunken); }
.ph svg { width: 46%; height: 46%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ph small { display: none; font-size: .68rem; font-weight: 500; line-height: 1; }
.apphead .ph small { display: block; }
.apphead .ph svg { width: 40%; height: 40%; }
.new { color: var(--amber); font-weight: 600; }

/* Filters and pager */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0 8px; }
.filters input[type=search] { flex: 1 1 260px; }
.filters select { flex: 1 1 12rem; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.filters input, .filters select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
}
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 28px; color: var(--muted); }
.empty { padding: 48px 0; max-width: 52ch; }
.empty h2 { margin-bottom: 8px; }

/* App page */
.crumbs { font-size: .92rem; color: var(--muted); margin: 12px 0 20px; }
.crumbs a { color: inherit; }
.apphead { display: grid; grid-template-columns: 136px 1fr; gap: 28px; align-items: start; }
.apphead .icon, .apphead .ph { width: 136px; height: 136px; font-size: 2.2rem; }
.apphead > div { min-width: 0; }
.apphead .sub { color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 28px; }
.facts div { padding: 12px 14px; box-shadow: 1px 1px 0 var(--line); }
.facts dt { color: var(--muted); font-size: .84rem; }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.prose { max-width: 78ch; white-space: pre-line; margin-top: 10px; overflow-wrap: anywhere; }
.md { white-space: normal; }
.md > :first-child { margin-top: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre { margin: 0 0 .8em; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-size: 1.05rem; font-weight: 600; margin: 1.1em 0 .4em; letter-spacing: 0; }
.md ul, .md ol { padding-left: 1.3em; }
.md li { margin: .15em 0; }
.md blockquote { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: .7em 1em; }
.md blockquote > :last-child { margin-bottom: 0; }
.md code { background: var(--sunken); border-radius: 5px; padding: .08em .35em; }
.md pre { background: var(--sunken); border-radius: 10px; padding: .8em 1em; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.shots { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; margin-top: 12px; }
.shots img { height: 380px; width: auto; border-radius: 14px; scroll-snap-align: start; border: 1px solid var(--line); }
table.versions { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .94rem; }
table.versions th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); }
table.versions td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tablewrap { overflow-x: auto; position: relative; }
.share { display: flex; gap: 18px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.share img { width: 132px; height: 132px; border-radius: 8px; background: #fff; padding: 4px; }

/* Sources */
.srclist { list-style: none; padding: 0; margin: 0; }
.src { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); position: relative; }
.src .icon, .src .ph { width: 52px; height: 52px; border-radius: 10px; font-size: 1rem; }
.src .name { display: block; font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src .name::after { content: ""; position: absolute; inset: 0; }
.src .meta { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src .count { text-align: right; font-variant-numeric: tabular-nums; }
.src .count small { display: block; color: var(--muted); font-size: .82rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pine); margin-right: 6px; vertical-align: middle; }
.dot.off { background: var(--danger); }
.dot.stale { background: var(--amber); }
details.offline { margin-top: 28px; }
details.offline summary { cursor: pointer; color: var(--muted); }
details.offline li { padding: 6px 0; font-size: .92rem; overflow-wrap: anywhere; }

/* Footer */
.foot { max-width: var(--page); margin: 0 auto; padding: 28px 20px 48px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: .92rem; }
.foot-bot { font-size: 1rem; }
.foot .dim a { color: inherit; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; z-index: 20; }

@media (max-width: 900px) {
  .rows { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 28px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .top { gap: 10px; flex-wrap: wrap; padding: 14px 16px; }
  .nav { order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .nav a { padding: 6px 9px; white-space: nowrap; }
  .actions .btn.primary { flex: 1 1 100%; justify-content: center; }
  .theme { margin-left: auto; }
  main { padding: 4px 16px 48px; }
  .hero { padding-top: 16px; }
  .feed { grid-template-columns: 1fr auto; }
  .feed .url { grid-column: 1 / -1; grid-row: 2; }
  .rows { grid-template-columns: 1fr; }
  .apphead { grid-template-columns: 72px 1fr; gap: 14px; }
  .apphead .icon, .apphead .ph { width: 72px; height: 72px; }
  .shots img { height: 300px; }
  .search kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .search .sweep, .search .sweep::before { animation: none; }
  * { scroll-behavior: auto; }
}
