/* Shared styles for index.html, 404.html and error.html. Dark is the default theme. */

:root {
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #0b0c0e;
  --panel: #111317;
  --row-hover: #16191e;
  --line: #1f232a;
  --line-strong: #2c323b;
  --text: #e4e6ea;
  --dim: #9aa1ab;
  --faint: #6b737e;
  --accent: #e5484d;
  --accent-ink: #ffffff;
  --ok: #3fb950;
  --warn: #d29922;
  --code: #181b21;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --row-hover: #f0f0ec;
  --line: #e2e2dc;
  --line-strong: #c9c9c1;
  --text: #16171a;
  --dim: #5d6168;
  --faint: #7a7f87;
  --accent: #d42a2a;
  --accent-ink: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --code: #ececE6;
  color-scheme: light;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 24px; }
main { padding-bottom: 72px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0; }
.brand span { font-family: var(--mono); font-size: 14px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav a, .theme-btn {
  font-family: var(--mono); font-size: 12px; color: var(--dim); text-decoration: none;
  padding: 6px 10px; border-radius: 6px; background: none; border: 0; cursor: pointer;
}
.site-nav a:hover, .theme-btn:hover { color: var(--text); background: var(--row-hover); }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; margin-left: 4px; }
.theme-btn svg { width: 16px; height: 16px; }
.i-moon { display: none; }
html[data-theme="light"] .i-sun { display: none; }
html[data-theme="light"] .i-moon { display: block; }

/* Footer */
.site-footer { margin-top: auto; border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.site-footer a { text-decoration: none; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
.site-footer a:hover { color: var(--text); }
.site-footer img { width: 16px; height: 16px; }

/* Intro */
.intro { padding: 48px 0 28px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.intro h1 { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.intro p { color: var(--dim); margin-top: 6px; max-width: 52ch; }
.heartbeat { font-family: var(--mono); font-size: 12px; color: var(--faint); white-space: nowrap; }

/* Project list */
.projects { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.project { padding: 22px 24px; border-top: 1px solid var(--line); }
.project:first-child { border-top: 0; }

.p-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 24px; align-items: start; }
.p-name { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.p-name .repo { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--faint); text-decoration: none; }
.p-name .repo:hover { color: var(--dim); text-decoration: underline; }
.p-desc { color: var(--dim); grid-column: 1; }

.dl {
  grid-column: 2; grid-row: 1 / span 2;
  display: inline-flex; align-items: stretch; text-decoration: none;
  border-radius: 7px; overflow: hidden; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 13px; transition: filter .12s;
}
.dl:hover { filter: brightness(1.08); }
.dl .lbl { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.dl .lbl svg { width: 15px; height: 15px; }
.dl .meta { display: flex; align-items: center; padding: 10px 12px; font-family: var(--mono); font-size: 12px; font-weight: 500; background: rgba(0, 0, 0, .16); white-space: nowrap; }
.dl.off { background: var(--code); color: var(--faint); cursor: not-allowed; }
.dl.off:hover { filter: none; }
.dl.off .meta { background: transparent; }

/* Commit lines */
.commits { margin-top: 16px; font-family: var(--mono); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.cl { display: grid; grid-template-columns: 14px 64px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; }
.cl .dot { width: 8px; height: 8px; border-radius: 50%; align-self: start; justify-self: center; margin-top: 5px; }
.cl.ok .dot { background: var(--ok); }
.cl.warn .dot { border: 1.5px solid var(--warn); }
.cl.idle .dot { border: 1.5px solid var(--faint); }
.cl .sha { color: var(--text); text-decoration: none; }
.cl a.sha:hover { text-decoration: underline; }
.cl .msg { color: var(--dim); overflow-wrap: anywhere; }
.cl .when { color: var(--faint); white-space: nowrap; }
.cl.warn .when { color: var(--warn); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line-strong); color: var(--faint); margin-left: 6px; white-space: nowrap; }

/* Secondary actions */
.p-actions { margin-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.ghost {
  font-family: var(--mono); font-size: 12px; color: var(--dim); background: none;
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 5px 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.ghost:hover { color: var(--text); border-color: var(--faint); }
.ghost svg { width: 13px; height: 13px; transition: transform .15s; }
.ghost[aria-expanded="true"] svg { transform: rotate(180deg); }
.copied, .ghost.copied { color: var(--ok) !important; border-color: var(--ok) !important; }

/* Versions table */
.versions { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.versions[hidden] { display: none; }
.vrow { display: grid; grid-template-columns: 70px minmax(0, 1fr) 92px 64px 136px; gap: 14px; align-items: center; padding: 9px 12px; font-family: var(--mono); font-size: 12px; border-top: 1px solid var(--line); }
.vrow:first-child { border-top: 0; }
.vrow:hover { background: var(--row-hover); }
.vrow.head { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: var(--code); }
.vrow .sha { text-decoration: none; }
.vrow a.sha:hover { text-decoration: underline; }
.vrow .msg { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrow .t, .vrow .s { color: var(--faint); }
.vact { display: flex; gap: 4px; justify-content: flex-end; }
.vact button, .vact a {
  font: inherit; font-size: 11px; color: var(--dim); background: none; border: 1px solid var(--line-strong);
  border-radius: 5px; padding: 3px 8px; cursor: pointer; text-decoration: none;
}
.vact button:hover, .vact a:hover { color: var(--text); border-color: var(--faint); }
.vnote { padding: 10px 12px; font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* Empty / error / loading */
.state { padding: 28px 24px; color: var(--dim); font-family: var(--mono); font-size: 13px; }
.skel { border-radius: 4px; background: linear-gradient(90deg, var(--code) 25%, var(--row-hover) 50%, var(--code) 75%); background-size: 1200px 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { 0% { background-position: -600px 0; } 100% { background-position: 600px 0; } }

/* Error pages */
.panel { margin-top: 72px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 32px; max-width: 560px; }
.panel .code { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-bottom: 8px; }
.panel h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 8px; }
.panel p { color: var(--dim); }
.panel .home { display: inline-block; margin-top: 20px; }

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .intro { padding-top: 32px; }
  .project { padding: 18px 16px; }
  .p-head { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-column: 1; grid-row: 3; margin-top: 10px; }
  .dl .lbl { flex: 1; justify-content: center; }
  .cl { grid-template-columns: 14px 64px minmax(0, 1fr); }
  .cl .when { grid-column: 3; }
  .vrow { grid-template-columns: 70px minmax(0, 1fr) 136px; }
  .vrow .t, .vrow .s { display: none; }
  .site-nav a { display: none; }
  .panel { margin-top: 40px; padding: 24px; }
}
