/* palette */
:root {
  --bg:      #2d373e;
  --text:    #d5d7d8;
  --muted:   #758997;
  --accent:  #5db7da;
  --soft:    #abc7d9;
  --green:   #5ab247;
  --sand:    #9e8c78;
  --dim:     rgba(80, 142, 166, 0.14);
  --dim-s:   rgba(158, 140, 120, 0.18);
  --surface: rgba(20, 28, 36, 0.62);
  --font:    'JetBrainsMono Nerd Font Mono', 'JetBrainsMonoNL Nerd Font Mono', 'JetBrainsMono NFM', 'JetBrainsMono Nerd Font', 'JetBrains Mono', 'Cascadia Code NF', 'Cascadia Code', monospace;
  --r:       10px;
  --gap:     6px;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 17px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* background image + dim overlay */
.bg {
  position: fixed;
  inset: 0;
  background-image: url('assets/bg.png');
  background-size: cover;
  background-position: center;
  z-index: 0;
}
.bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 16, 0.32);
  pointer-events: none;
}
#rain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* viewport shell — tiles float freely */
.site {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* scrollable column of tiles */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
/* makes dev/music tiles flow as direct flex siblings of fastfetch + footer */
.sections { display: contents; }
.page::-webkit-scrollbar { width: 3px; }
.page::-webkit-scrollbar-thumb { background: rgba(80, 142, 166, 0.25); border-radius: 2px; }

/* footer prompt typography */
.pg-prompt {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  user-select: none;
}

.pp-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pp-chev { color: var(--green); font-weight: 700; }
.pp-word { color: var(--muted); }

.pp-seg {
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(80, 142, 166, 0.14);
}
.pp-os     { background: rgba(91, 183, 218, 0.16);  color: var(--accent); }
.pp-path   { background: rgba(171, 199, 217, 0.16); color: var(--soft);   }
.pp-time   { background: rgba(158, 140, 120, 0.20); color: var(--sand);   }
.pp-git    { background: rgba(90, 178, 71, 0.16);   color: var(--green);  }
.pp-status { background: rgba(91, 183, 218, 0.16);  color: var(--accent); }

.pp-line2 { display: flex; align-items: center; }
.pp-arr   { color: var(--muted); margin-right: 8px; opacity: 0.7; }

/* shared tile spec (fastfetch / dev / music / footer) */
.ff-wrap,
.ws-section,
.pg-prompt {
  background: rgba(20, 28, 36, 0.86);
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
}

.ff-wrap   { padding: 26px 32px 24px; }
.ws-section { padding: 4px 22px; }
.pg-prompt {
  padding: 14px 22px 14px;
  /* grows to fill empty space when dev/music are collapsed */
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  min-height: 78px;
}

/* terminal prompt */
.t-line { display: block; min-height: 1.6em; }
.p-host { color: var(--accent); font-weight: 700; }
.p-path { color: var(--soft); }
.p-chev { color: var(--green); margin-left: 5px; }
.p-cmd  { color: var(--text); }

/* blinking caret */
.cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--green);
  vertical-align: text-bottom;
  margin-left: 2px;
  border-radius: 1px;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 0.85; }
  50%       { opacity: 0; }
}

/* fastfetch body: [img] [info] [about] */
.ff-body { display: flex; gap: 32px; align-items: stretch; }

/* square image column via aspect-ratio */
.ff-img-col {
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  position: relative;
}
.ff-img-col img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 7px;
  display: block;
}
.ff-img-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(22, 32, 38, 0.92), rgba(10, 16, 20, 0.96));
  border-radius: 7px;
  border: 1px solid var(--dim);
}

/* fastfetch info — single <pre> keeps box-drawing chars column-aligned */
.ff-info {
  position: relative;
  flex-shrink: 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.35;
  white-space: pre;
  letter-spacing: 0.01em;
  color: var(--text);
  font-variant-ligatures: none;
  font-feature-settings: "calt" 0;
}

/* fills micro-gaps between │ chars so the column reads as one line */
.ff-info::before {
  content: '';
  position: absolute;
  left: calc(0.5ch - 0.5px);
  top:    calc(0.5lh + 2px);
  bottom: calc(0.5lh + 2px);
  width: 1px;
  background: var(--muted);
  opacity: 0.45;
  pointer-events: none;
}

.ff-oc     { color: var(--muted); opacity: 0.55; user-select: none; }
.ff-u-user { color: var(--soft);   font-weight: 700; }
.ff-u-at   { color: var(--muted);  opacity: 0.7; }
.ff-u-host { color: var(--accent); font-weight: 700; }
.ff-bar    { color: var(--muted); opacity: 0.55; user-select: none; }

.ff-sec-title  { color: var(--sand); font-weight: 700; }
.ff-icon       { color: var(--soft); font-size: 1.2em; line-height: 1; vertical-align: -0.06em; }
.ff-item-key   { color: var(--accent); font-weight: 700; }
.ff-item-val   { color: var(--text); }
.ff-dot        { font-size: 0.95em; }
.ff-link       { color: var(--soft); text-decoration: none; }
.ff-link:hover { color: var(--accent); text-decoration: underline; }

/* about column */
.ff-about {
  flex: 1;
  min-width: 0;
  padding-left: 28px;
  border-left: 1px solid var(--dim-s);
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--muted);
}
.ff-about p           { margin-bottom: 0.75em; }
.ff-about p:last-child { margin-bottom: 0; }
.ff-about strong      { color: var(--soft); font-weight: 700; }
.ff-about a           { color: var(--soft); text-decoration: none; }
.ff-about a:hover     { color: var(--accent); text-decoration: underline; }

/* collapsible section header */
.ws-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 12px;
  cursor: pointer;
  user-select: none;
}

.ws-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 12px 3px 10px;
  border-radius: 999px;
  background: rgba(91, 183, 218, 0.13);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  transition: background 0.16s ease;
}
.ws-hd:hover .ws-pill { background: rgba(91, 183, 218, 0.22); }

.ws-chev {
  color: var(--green);
  font-size: 0.78rem;
  flex-shrink: 0;
  transition: transform 0.22s ease;
  line-height: 1;
}
.ws-section.open .ws-chev { transform: rotate(90deg); }

.ws-name { color: inherit; }

.ws-count {
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(80, 142, 166, 0.10);
}

/* expand/collapse via grid-template-rows trick */
.ws-bd {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}
.ws-section.open .ws-bd { grid-template-rows: 1fr; }
.ws-bd-inner   { overflow: hidden; min-height: 0; }
.ws-bd-content { padding-bottom: 16px; }

/* card grid */
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.card-empty { font-size: 0.85rem; color: var(--muted); padding: 2px 0; }

.card {
  position: relative;
  border: 1px solid rgba(80, 142, 166, 0.16);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 16, 22, 0.32);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.card:hover {
  border-color: rgba(91, 183, 218, 0.40);
  background: rgba(10, 16, 22, 0.46);
  transform: translateY(-2px);
}

/* hover-reveal stars/forks pill */
.card-stats {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 2;
  pointer-events: none;
}
.card:hover .card-stats { opacity: 1; transform: translateY(0); }
.card-stat {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(10, 16, 22, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--soft);
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid rgba(80, 142, 166, 0.22);
}
.card-stat-star { color: #e8d287; }
.card-stat-fork { color: var(--soft); }

.card-lang { cursor: pointer; transition: filter 0.12s; }
.card-lang:hover { filter: brightness(1.25); }

/* filter chip rail */
.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-bar:empty { display: none; }
.filter-bar:not(:empty) { padding-bottom: 12px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 11px;
  border-radius: 999px;
  background: rgba(91, 183, 218, 0.18);
  border: 1px solid rgba(91, 183, 218, 0.28);
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.12s;
}
.filter-chip:hover { filter: brightness(1.20); }
.filter-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.20);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.card-thumb { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(145deg, rgba(24, 34, 40, 0.92), rgba(12, 18, 22, 0.96));
}

.card-body { padding: 14px 15px; }

.card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 7px;
  text-decoration: none;
  display: block;
}
a.card-title:hover { color: var(--accent); }

.card-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.56;
  margin-bottom: 11px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.74rem;
  min-height: 18px;
}

.card-langs { display: flex; flex-wrap: wrap; gap: 5px; }
.card-lang {
  color: var(--muted);
  background: rgba(80, 142, 166, 0.14);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.7rem;
}

.card-date {
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding: 1px 9px;
  border-radius: 999px;
  background: rgba(80, 142, 166, 0.10);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-date-dot { color: var(--green); }

/* keyboard-focused card */
.card-focused {
  border-color: var(--green) !important;
  box-shadow: 0 0 0 2px rgba(90, 178, 71, 0.22);
}

/* density toggle pill */
.density-toggle {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 10;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(91, 183, 218, 0.14);
  color: var(--accent);
  border: 1px solid rgba(91, 183, 218, 0.20);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  text-transform: lowercase;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.density-toggle::before { content: '⌖ '; opacity: 0.7; }
.density-toggle:hover  { background: rgba(91, 183, 218, 0.22); }
.density-toggle:active { transform: scale(0.96); }

/* density modes affect card grid and card chrome */
body[data-density="comfy"]   .card-row { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
body[data-density="tile"]    .card-row { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
body[data-density="compact"] .card-row { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }

body[data-density="compact"] .card-thumb { aspect-ratio: 21 / 9; }
body[data-density="compact"] .card-body  { padding: 8px 11px; }
body[data-density="compact"] .card-title { font-size: 0.84rem; margin-bottom: 4px; }
body[data-density="compact"] .card-desc  { display: none; }
body[data-density="compact"] .card-footer { font-size: 0.68rem; }

body[data-density="tile"] .card-body  { padding: 11px 12px; }
body[data-density="tile"] .card-desc  { -webkit-line-clamp: 2; }

/* distant lightning flash (radial from top) */
.lightning-flash {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse 100% 70% at 50% -10%,
      rgba(220, 235, 255, 0.38) 0%,
      rgba(190, 215, 255, 0.18) 35%,
      transparent 75%);
  mix-blend-mode: screen;
  will-change: opacity;
}

/* scroll progress stripe */
.scroll-bar {
  position: absolute;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--accent));
  z-index: 5;
  transition: width 0.12s ease-out;
  pointer-events: none;
  border-top-left-radius: var(--r);
  border-top-right-radius: var(--r);
}

/* ? shortcuts overlay */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 12, 16, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.16s ease;
}
.shortcuts-overlay.hidden { opacity: 0; pointer-events: none; }
.shortcuts-panel {
  background: rgba(20, 28, 36, 0.92);
  border: 1px solid rgba(91, 183, 218, 0.24);
  border-radius: 14px;
  padding: 22px 28px 20px;
  min-width: 320px;
  font-size: 13px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.shortcuts-title {
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.shortcuts-panel ul { list-style: none; padding: 0; margin: 0 0 12px 0; }
.shortcuts-panel li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 5px 0;
  color: var(--soft);
}
.shortcuts-panel li > :last-child { color: var(--muted); font-size: 12.5px; }
.kbds { display: inline-flex; gap: 4px; min-width: 78px; }
.shortcuts-panel kbd {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 5px;
  background: rgba(80, 142, 166, 0.18);
  color: var(--accent);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid rgba(91, 183, 218, 0.22);
  border-bottom-width: 2px;
  min-width: 14px;
  text-align: center;
  line-height: 1.3;
}
.shortcuts-hint {
  border-top: 1px solid rgba(80, 142, 166, 0.16);
  padding-top: 10px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
  font-style: italic;
}

/* stack fastfetch under 900px */
@media (max-width: 900px) {
  .ff-body { flex-wrap: wrap; gap: 18px; }
  .ff-img-col { width: 180px; max-width: 40vw; }
  .ff-info {
    flex: 1 1 100%;
    order: 3;
    overflow-x: auto;
  }
  .ff-about {
    flex: 1 1 100%;
    order: 4;
    padding-left: 0;
    border-left: none;
    padding-top: 16px;
    border-top: 1px solid var(--dim-s);
    margin-top: 4px;
  }
  .ff-wrap     { padding: 20px 22px 18px; }
  .page        { padding: 10px; gap: 10px; }
  .density-toggle { top: 10px; right: 10px; }
}

@media (max-width: 600px) {
  .ff-img-col { width: 100%; max-width: none; max-height: 240px; aspect-ratio: 16 / 9; }
  .ff-img-col img { object-position: center; }
}
