/* Hype wears the Cory Land paper: cream paper and charcoal ink by day,
   warm night paper after dark, Georgia for display, Geist for everything
   you operate, and rust as the single accent. Tokens match pages.cory.land
   and murm; every color below is one of them. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Paper is the default. Night paper follows the system setting unless the
   reader picks one with the toggle (stored as html[data-theme]). */
:root {
  color-scheme: light;
  --background: #f6f4ed;
  --foreground: #292c2a;
  --secondary: #eeece3;
  --surface: #f1efe7;
  --raised: #fbfaf5;
  --prose: #2d2f2c;
  --muted-foreground: #686b64;
  --subtle-foreground: #777a72;
  --border: #d6d4cb;
  --border-strong: #b5b4a9;
  --shadow-color: 32 22% 18%;

  /* Rust: the one accent. Focus, the selected thing, saved items. */
  --brand: #a84e36;
  --brand-soft: #a84e3612;
  --tint-brand: #ecdcd2;
  --tint-brand-text: #793c2d;
  --destructive: hsl(0 66% 47%);
  --success: #556944;

  /* Source markers borrow the collection's data colors. */
  --viz-day: #c9a24a;
  --viz-b: #859078;
  --viz-ink: #4d524c;

  --radius: 3px;
  --radius-sm: 2px;

  --font-sans:
    "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:
    "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --font-serif: Georgia, "Times New Roman", serif;

  --motion-fast: 140ms;
  --motion-settle: 240ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* The collection's sleeve: topbar and content share these edges. */
  --sleeve: min(100% - 88px, 1232px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #1c1d1a;
    --foreground: #e9e5d9;
    --secondary: #282925;
    --surface: #222320;
    --raised: #262723;
    --prose: #dcd8cc;
    --muted-foreground: #a6a397;
    --subtle-foreground: #8f8d82;
    --border: #393a35;
    --border-strong: #56574f;
    --shadow-color: 40 12% 3%;
    --brand: #d97c5d;
    --brand-soft: #d97c5d1a;
    --tint-brand: #4a2f25;
    --tint-brand-text: #f0b9a3;
    --destructive: hsl(4 72% 64%);
    --success: #a3ba8e;
    --viz-day: #c9a75c;
    --viz-b: #8f9d81;
    --viz-ink: #b9b6aa;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #1c1d1a;
  --foreground: #e9e5d9;
  --secondary: #282925;
  --surface: #222320;
  --raised: #262723;
  --prose: #dcd8cc;
  --muted-foreground: #a6a397;
  --subtle-foreground: #8f8d82;
  --border: #393a35;
  --border-strong: #56574f;
  --shadow-color: 40 12% 3%;
  --brand: #d97c5d;
  --brand-soft: #d97c5d1a;
  --tint-brand: #4a2f25;
  --tint-brand-text: #f0b9a3;
  --destructive: hsl(4 72% 64%);
  --success: #a3ba8e;
  --viz-day: #c9a75c;
  --viz-b: #8f9d81;
  --viz-ink: #b9b6aa;
}

/* ---------------------------------------------------------------- base */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  background: var(--background);
}
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings:
    "rlig" 1,
    "calt" 1,
    "ss01" 1,
    "cv11" 1;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection {
  background: color-mix(in srgb, var(--brand) 22%, transparent);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
a {
  color: var(--foreground);
  text-decoration-color: var(--border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-color: var(--foreground);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
:where(button, a, input, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3 {
  text-wrap: balance;
}

.shell {
  width: var(--sleeve);
  margin: 0 auto;
}

/* ------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 74px;
  border-bottom: 1px solid var(--border);
}
.brand {
  color: var(--foreground);
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: -0.6px;
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-standard);
}
.brand:hover {
  color: var(--brand);
}
.views {
  display: flex;
  align-self: stretch;
  gap: 22px;
  /* Active underline sits on the topbar rule, like the source tabs. */
  margin-bottom: -1px;
}
.views a {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid transparent;
  color: var(--muted-foreground);
  font-size: 13px;
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-standard);
}
.views a:hover {
  color: var(--brand);
}
.views a.active {
  color: var(--foreground);
  border-color: var(--brand);
}
#saved-count {
  color: var(--subtle-foreground);
  font-family: var(--font-mono);
  font-size: 10px;
}
.outlinks {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}
.outlinks a {
  color: var(--muted-foreground);
  font-size: 13px;
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-standard);
}
.outlinks a:hover {
  color: var(--brand);
}

/* Theme toggle: a quiet circle, moon by day and sun by night. */
.theme-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--muted-foreground);
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard);
}
.theme-toggle:hover {
  border-color: var(--border-strong);
  color: var(--foreground);
}
.theme-toggle svg {
  position: absolute;
  inset: 0;
  width: 15px;
  height: 15px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition:
    opacity var(--motion-settle) var(--ease-standard),
    transform var(--motion-settle) var(--ease-standard);
}
.theme-toggle .theme-icon-sun {
  opacity: 0;
  transform: rotate(-40deg) scale(0.7);
}
:root[data-theme="dark"] .theme-toggle .theme-icon-sun {
  opacity: 1;
  transform: none;
}
:root[data-theme="dark"] .theme-toggle .theme-icon-moon {
  opacity: 0;
  transform: rotate(40deg) scale(0.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .theme-icon-sun {
    opacity: 1;
    transform: none;
  }
  :root:not([data-theme="light"]) .theme-toggle .theme-icon-moon {
    opacity: 0;
    transform: rotate(40deg) scale(0.7);
  }
}

/* -------------------------------------------------------------- intro */

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 48px 0 36px;
}
.intro-art {
  width: clamp(120px, 18vw, 192px);
  height: auto;
  flex-shrink: 0;
  aspect-ratio: 1;
  border-radius: var(--radius);
}
h1 {
  margin: 0 0 10px;
  font: 400 clamp(32px, 3.6vw, 44px) / 1.12 var(--font-serif);
  letter-spacing: -0.035em;
}
.intro p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 16px;
  line-height: 1.65;
}
.freshness,
.eyebrow {
  color: var(--subtle-foreground);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.freshness {
  display: block;
  margin-top: 18px;
}

/* ------------------------------------------------------------ sources */

.sources {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.sources a {
  padding: 14px 0 13px;
  border-bottom: 1px solid transparent;
  color: var(--muted-foreground);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--motion-fast) var(--ease-standard);
}
.sources a:hover {
  color: var(--brand);
}
.sources a.active {
  color: var(--foreground);
  border-color: var(--brand);
}

/* ------------------------------------------------------------ toolbar */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 8px;
}
.search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--background);
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}
.search:hover {
  border-color: var(--border-strong);
}
/* Fields focus with a soft rust halo instead of a hard outline. */
.search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.search svg {
  width: 17px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--subtle-foreground);
  stroke-width: 1.6;
}
.search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
}
.search input::placeholder {
  color: var(--subtle-foreground);
}
kbd {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--subtle-foreground);
  font: 11px var(--font-mono);
}

/* Segmented: one choice from a few. The chosen option is pressed in. */
.sort {
  display: inline-flex;
  gap: 2px;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
}
.sort button {
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard);
}
.sort button:hover {
  color: var(--foreground);
}
.sort button.active {
  background: var(--secondary);
  color: var(--foreground);
  box-shadow: inset 0 0 0 1px var(--border);
}

select {
  height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  -webkit-appearance: none;
  appearance: none;
  background: var(--background)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%238f8d82' stroke-width='1.5'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  color: var(--foreground);
  font-size: 13px;
  cursor: pointer;
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}
select:hover {
  border-color: var(--border-strong);
}
select:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* --------------------------------------------------------------- feed
   A numbered catalogue, like the collection's Index view. */

.posts {
  margin: 0;
  padding: 0;
  list-style: none;
}
.post {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--border);
}
.rank {
  min-width: 22px;
  padding-top: 6px;
  color: var(--subtle-foreground);
  font-family: var(--font-mono);
  font-size: 11px;
}
.post-content {
  flex: 1;
  min-width: 0;
}
.title {
  color: var(--foreground);
  font: 400 20px/1.3 var(--font-serif);
  letter-spacing: -0.02em;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color var(--motion-fast) var(--ease-standard);
}
.title:visited {
  color: var(--muted-foreground);
}
.title:hover {
  color: var(--brand);
}
.description {
  display: -webkit-box;
  margin: 5px 0 8px;
  overflow: hidden;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--subtle-foreground);
  font-size: 12px;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--viz-ink);
}
.dot.huggingface {
  background: var(--viz-day);
}
.dot.hackernews,
.dot.reddit {
  background: var(--brand);
}
.dot.replicate {
  background: var(--viz-b);
}

/* Ghost button: no chrome until hovered. */
.bookmark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--subtle-foreground);
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard);
}
.bookmark svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.bookmark:hover {
  background: color-mix(in srgb, var(--foreground) 7%, transparent);
  color: var(--foreground);
}
.bookmark[aria-pressed="true"] {
  color: var(--brand);
}
.bookmark[aria-pressed="true"] svg {
  fill: var(--tint-brand);
}

/* ------------------------------------------------------------ buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}
.button:hover {
  border-color: var(--border-strong);
  background: var(--secondary);
}
.button:active {
  transform: scale(0.98);
}
.pagination {
  padding: 28px;
  text-align: center;
}

/* ------------------------------------------------------- states, about */

.notice {
  padding: 10px 0;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.6;
}
.notice .button {
  min-height: 34px;
  margin-left: 6px;
  padding: 6px 13px;
  font-size: 13px;
}
.empty {
  padding: 64px 16px 72px;
  text-align: center;
}
.empty h2,
.about h2 {
  margin: 0 0 10px;
  font: 400 28px/1.25 var(--font-serif);
  letter-spacing: -0.025em;
}
.empty p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 15px;
  line-height: 1.65;
}
.empty .button {
  margin-top: 20px;
}
.about {
  max-width: 760px;
  padding: 8px 0 56px;
}
.about p {
  color: var(--prose);
  font-size: 17px;
  line-height: 1.8;
}
.about h3 {
  margin: 36px 0 0;
  font: 400 23px/1.35 var(--font-serif);
  letter-spacing: -0.015em;
}
.about a {
  color: var(--foreground);
}
.about a:hover {
  color: var(--brand);
  text-decoration-color: var(--brand);
}
.status-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}
.status-list li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.status-list strong {
  font-weight: 500;
}
.status-list span {
  color: var(--muted-foreground);
}
.about .credit {
  margin-top: 36px;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.7;
}

/* ------------------------------------------------------------- footer */

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 62px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--subtle-foreground);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
}
footer a {
  color: var(--muted-foreground);
}
footer a:hover {
  color: var(--brand);
  text-decoration-color: var(--brand);
}

#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  max-width: 90vw;
  padding: 12px 18px;
  transform: translateX(-50%);
  border-radius: var(--radius);
  background: var(--foreground);
  color: var(--background);
  font-size: 13px;
  box-shadow: 0 12px 24px -12px hsl(var(--shadow-color) / 0.6);
}
.skip {
  position: absolute;
  top: -80px;
  left: 16px;
  z-index: 2;
  padding: 10px;
  background: var(--background);
}
.skip:focus {
  top: 10px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------- mobile */

@media (max-width: 900px) {
  .freshness {
    display: block;
    margin-top: 18px;
    padding: 0;
  }
  .sort button {
    padding: 0 12px;
  }
}
@media (max-width: 767px) {
  :root {
    --sleeve: calc(100% - 40px);
  }
  .topbar {
    gap: 20px;
    min-height: 60px;
  }
  .brand {
    font-size: 21px;
  }
  .views {
    gap: 16px;
  }
  .outlinks {
    gap: 14px;
  }
  .outlinks a {
    display: none;
  }
}
@media (max-width: 600px) {
  .intro {
    padding: 32px 0 24px;
    gap: 16px;
    align-items: flex-start;
  }
  .intro-art {
    width: 88px;
  }
  h1 {
    font-size: 32px;
  }
  .intro p {
    font-size: 15px;
  }
  .sources {
    gap: 20px;
    margin-right: -20px;
    padding-right: 20px;
  }
  .toolbar {
    flex-wrap: wrap;
    margin-top: 16px;
    gap: 10px;
  }
  .search {
    flex-basis: 100%;
  }
  .search input,
  select {
    font-size: 16px;
  }
  kbd {
    display: none;
  }
  .sort {
    flex: 1;
  }
  .sort button {
    flex: 1;
  }
  select {
    width: 140px;
  }
  .post {
    gap: 12px;
    padding: 18px 0 16px;
  }
  .rank {
    display: none;
  }
  .title {
    font-size: 18px;
  }
  .description {
    font-size: 13px;
  }
  .meta {
    gap: 6px;
    font-size: 11px;
  }
  .bookmark {
    width: 32px;
    height: 32px;
    margin-right: -6px;
  }
  .about p {
    font-size: 16px;
  }
  footer {
    display: block;
    padding: 18px 0 24px;
    line-height: 1.9;
  }
  footer > a {
    display: block;
    margin-top: 4px;
  }
  .status-list li {
    display: block;
  }
  .status-list span {
    display: block;
    margin-top: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
