@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;550;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #f8f7f3;
  --surface: #fffefa;
  --ink: #252622;
  --muted: #74766d;
  --line: #e2e2d9;
  --accent: #e7674e;
  --soft: #efeee8;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #181b22;
  --surface: #222630;
  --ink: #edf0f5;
  --muted: #a6aebb;
  --line: #363d4b;
  --accent: #f58b71;
  --soft: #2b313d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
svg { display: block; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.site-header {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.7px;
}
.brand-dot { color: var(--accent); }
nav { display: flex; gap: 25px; align-items: center; }
.profile-link { font-size: 12px; font-weight: 550; }
.profile-link span { margin-left: 5px; }
.profile-link:hover { color: var(--accent); }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
}
.theme-toggle:hover { background: var(--soft); }
main { padding: 55px 0 40px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 35px; }
h1 { font-family: 'Space Grotesk', sans-serif; font-size: 43px; line-height: 1.2; letter-spacing: -2px; font-weight: 600; }
.page-heading p { margin-top: 11px; color: var(--muted); font-size: 13px; }
.project-count { font-size: 11px; color: var(--muted); white-space: nowrap; padding-bottom: 3px; }
.project-search { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); }
.project-search svg { flex-shrink: 0; }
.project-search input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; }
.project-search input::placeholder { color: var(--muted); opacity: 1; }
.project-search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty-state { padding: 35px 0; color: var(--muted); text-align: center; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.project-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .2s, transform .2s;
  min-width: 0;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.project-icon {
  width: 39px;
  height: 39px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: #eee6db;
}
.project-icon[data-color='1'] { background: #e8e1f0; }
.project-icon[data-color='2'] { background: #e5ebde; }
.project-icon[data-color='3'] { background: #e2e8ef; }
.project-icon[data-color='4'] { background: #f3e2df; }
.project-stars { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.project-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.project-description { color: var(--muted); font-size: 12px; line-height: 1.75; margin-top: 10px; margin-bottom: 23px; overflow-wrap: anywhere; }
.project-warning { color: #8b481d; background: #fff2df; border-left: 2px solid #d48a43; border-radius: 3px; padding: 10px 12px; margin-bottom: 20px; font-size: 11px; line-height: 1.7; }
:root[data-theme='dark'] .project-warning { color: #f0c391; background: #383025; }
.project-links { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 15px; margin-top: auto; border-top: 1px solid var(--line); }
.project-links a { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 550; }
.project-links a:hover { color: var(--accent); }
.project-links .source-link { color: var(--muted); }
.project-links .source-link:hover { color: var(--accent); }
.load-status { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); margin-top: 24px; }
.load-status button { border: 0; padding: 0; background: none; text-decoration: underline; font-size: inherit; }
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer a:hover { color: var(--accent); }
.site-footer a span { margin-left: 5px; }

@media (max-width: 900px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 36px); }
  .site-header { height: 78px; }
  .brand { font-size: 18px; }
  nav { gap: 14px; }
  main { padding-top: 35px; }
  h1 { font-size: 37px; }
  .page-heading { margin-bottom: 26px; align-items: flex-start; }
  .page-heading p { max-width: 220px; font-size: 12px; }
  .project-count { margin-top: 15px; font-size: 10px; }
  .project-grid { grid-template-columns: 1fr; gap: 15px; }
  .project-card { padding: 22px; }
  .card-top { margin-bottom: 18px; }
  .project-description { margin-bottom: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Gist-specific controls and previews; the shared gallery styles match poop. */
.gist-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin: -6px 0 24px; }
.gist-controls label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.gist-controls select { min-width: 0; max-width: 230px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 7px 25px 7px 10px; font: inherit; }
.gist-controls select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.reset-button { margin-left: auto; padding: 7px 0; background: transparent; border: 0; color: var(--muted); font-size: 11px; }
.reset-button:hover { color: var(--accent); }
.gist-date { font-size: 10px; color: var(--muted); }
.gist-files { font-size: 11px; color: var(--muted); margin: 12px 0 16px; overflow-wrap: anywhere; }
.gist-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.gist-tag { background: var(--soft); color: var(--muted); border: 1px solid var(--line); padding: 3px 7px; border-radius: 5px; font-size: 10px; overflow-wrap: anywhere; max-width: 100%; }
button.gist-tag:hover, button.gist-tag[aria-pressed='true'] { color: var(--accent); border-color: var(--accent); }
.preview-button { display: inline-flex; align-items: center; gap: 7px; padding: 0; font-size: 11px; font-weight: 550; background: none; border: 0; color: var(--muted); }
.preview-button:hover { color: var(--accent); }
.preview-dialog { width: min(880px, calc(100% - 36px)); max-height: 88vh; padding: 24px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.preview-dialog::backdrop { background: #080b12b8; }
.preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.preview-heading h2 { font-family: 'Space Grotesk', sans-serif; font-size: 20px; letter-spacing: -.5px; overflow-wrap: anywhere; }
.preview-heading button { flex-shrink: 0; }
.preview-hint { font-size: 11px; color: var(--muted); margin: 12px 0 20px; }
.preview-hint a { color: var(--accent); }
.preview-frame { width: 100%; height: 55vh; border: 1px solid var(--line); border-radius: 6px; background: white; }
@media (max-width: 560px) {
  .gist-controls { gap: 12px; }
  .gist-controls label { flex: 1 1 100%; justify-content: space-between; }
  .gist-controls select { width: 70%; max-width: none; }
  .reset-button { margin-left: 0; }
  .preview-dialog { padding: 18px; }
}
