/*
  likhith.dev — shared styles
  Dark is the default look; the toggle switches to light. Page-specific pieces live in
  their own stylesheet (save-slots.css, chart.css, ...) and only read the tokens below.
*/

/* Fonts, served from static/fonts (SIL Open Font License; the license files sit next to them).
   Latin and latin-ext subsets, the same split Google Fonts uses. Schibsted Grotesk is a variable
   font, so one file covers all three weights. */

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fragment Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/fragment-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fragment Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/fragment-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;

  /* Light values are 3d's palette, dimmed (Sep 2026): no pure white, so it isn't glaring */
  --bg: light-dark(#E8E5DE, #161513);
  --text: light-dark(#1C1B19, #EBE8E2);
  --muted: light-dark(#66625A, #8E8A82);
  --soft: light-dark(#514E48, #A9A59D);
  --meta: light-dark(#716D65, #6B6760);
  --faint: light-dark(#9A968C, #5C5953);

  --line: light-dark(#D3CEC4, #262422);
  --hair: light-dark(#DEDAD2, #1F1D1B);
  --fill: light-dark(#DCD8D0, #221F1D);
  --tile: light-dark(#DDD9D1, #1C1B19);
  --card: light-dark(#F2F0EA, #1C1B19);
  --raised: light-dark(#F6F4EF, #2C2A27);
  --screen: light-dark(#EFECE6, #0E0D0C);
  --stripe-a: light-dark(#CFCAC0, #2C2A27);
  --stripe-b: light-dark(#D9D4CB, #34322E);

  --orange: light-dark(oklch(0.62 0.19 38), oklch(0.68 0.19 38));
  --green: light-dark(oklch(0.56 0.13 155), oklch(0.7 0.14 155));
  --yellow: light-dark(oklch(0.66 0.14 75), oklch(0.8 0.13 85));
  --blue: light-dark(oklch(0.55 0.15 255), oklch(0.7 0.13 255));
  --red: light-dark(oklch(0.57 0.2 25), oklch(0.66 0.21 25)); /* the status light's do not disturb */

  --sans: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "Fragment Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 10px;
  --r-sm: 6px;
}

:root[data-theme="light"] { color-scheme: light; }

/* One accent per channel; --ch is whichever applies here */
:root, [data-ch="home"] { --ch: var(--orange); }
[data-ch="gaming"] { --ch: var(--blue); }
[data-ch="music"] { --ch: var(--green); }
[data-ch="books"] { --ch: var(--yellow); }

/* Base */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.7; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--ch); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-sm);
  font-size: 14px;
}
.skip:focus { top: 12px; }

/* Small metadata: the only place mono shows up */
.label { color: var(--meta); font: 400 12px/1.4 var(--mono); }

/* Read by screen readers, not shown */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ch); }
.dot--off { background: var(--faint); }

/* Image placeholder until real art loads */
.ph { display: block; flex: none; overflow: hidden; background: repeating-linear-gradient(135deg, var(--stripe-a) 0 4px, var(--stripe-b) 4px 8px); }
.ph img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Layout: sidebar and page */

.device { display: flex; min-height: 100vh; }

.rail {
  position: sticky;
  top: 0;
  flex: none;
  display: flex;
  flex-direction: column;
  width: 272px;
  height: 100vh;
  overflow-y: auto;
  padding: 32px 28px 28px;
  border-right: 1px solid var(--line);
}

.panel { flex: 1; min-width: 0; padding: 32px 72px 80px; }
.panel-inner { max-width: 960px; }

/* Sidebar */

.badge { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font: 12px var(--mono); }
/* Status light in Discord's colors. Grey while offline and until the status loads; the dot keeps
   its id across refreshes, so HTMX lets the color fade */
.badge .dot { width: 7px; height: 7px; background: var(--faint); transition: background-color 0.6s, box-shadow 0.6s; }
.badge .dot--online { background: var(--green); box-shadow: 0 0 8px var(--green); }
.badge .dot--idle { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.badge .dot--dnd { background: var(--red); box-shadow: 0 0 8px var(--red); }
.badge-status { color: var(--meta); }

.ident { margin-top: 22px; font-size: 30px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; }
.tagline { margin-top: 4px; color: var(--muted); font-size: 14px; }

.nav { display: grid; gap: 2px; margin-top: 48px; font-size: 15px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 -12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--soft);
}
.nav-item:hover { opacity: 1; background: var(--fill); }
.nav-num { width: 16px; color: var(--faint); font: 11px var(--mono); }
.nav-item .dot { margin-left: auto; }
.nav-item[aria-current="page"] { background: var(--fill); color: var(--text); font-weight: 500; }
.nav-item[aria-current="page"] .nav-num { color: var(--meta); }
.nav-item--soon { color: var(--faint); }
.nav-item--soon:hover { background: none; }
.nav-soon { margin-left: auto; font-size: 12px; }

.rail-foot { display: grid; gap: 14px; margin-top: auto; padding-top: 40px; }

.np-tile:empty { display: none; }
.np-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  margin: 0 -10px;
  padding: 10px;
  background: var(--tile);
  border-radius: 8px;
}
.np-tile .ph { width: 36px; height: 36px; border-radius: 4px; }
.np-text { display: grid; min-width: 0; }
.np-text span:first-child { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.np-text span:last-child { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.eq { display: flex; align-items: flex-end; gap: 2px; height: 12px; margin-left: auto; }
.eq i { width: 2px; height: 12px; background: var(--green); transform-origin: bottom; transform: scaleY(0.5); }
.eq.is-playing i { animation: eq 0.9s ease-in-out infinite alternate; }
.eq.is-playing i:nth-child(2) { animation-delay: -0.3s; }
.eq.is-playing i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { from { transform: scaleY(0.3); } to { transform: scaleY(1); } }

/* Nothing playing: a small music note and a muted label */
.np-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 4px; background: var(--fill); color: var(--muted); }
.np-idle { color: var(--muted); font-size: 13px; }

.theme-toggle { display: flex; gap: 6px; color: var(--meta); font-size: 13px; }
.theme-toggle button { padding: 0; background: none; border: 0; color: inherit; cursor: pointer; }
.theme-toggle button[aria-pressed="true"] { color: var(--text); }

/* Page header and intro */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--meta);
  font: 12px var(--mono);
}
.page-head-meta { display: flex; align-items: center; gap: 8px; }

.page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 48px;
  margin-top: 64px;
}

.page-title { font-size: 56px; font-weight: 600; letter-spacing: -0.035em; line-height: 1; }
.page-title + .lede { margin-top: 16px; }
.lede { max-width: 480px; color: var(--muted); font-size: 18px; line-height: 1.5; text-wrap: pretty; }

.intro { max-width: 660px; margin-top: 88px; font-size: 24px; letter-spacing: -0.01em; line-height: 1.5; text-wrap: pretty; }
.intro span { color: var(--muted); }

/* Sections */

.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  margin: 72px 0 16px;
}
.section-title { font-size: 15px; font-weight: 500; }
.section-hint { color: var(--muted); font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }

/* Stat tiles: a row of headline numbers inside a .card */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 20px 24px; padding: 22px 24px; }
.stat { display: grid; gap: 4px; align-content: start; }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; }

/* Segmented control, e.g. 4 weeks / 6 months / 12 months */
.segmented { display: flex; gap: 2px; padding: 3px; background: var(--tile); border-radius: 8px; font-size: 13px; }
.segmented button { padding: 5px 12px; background: none; border: 0; border-radius: var(--r-sm); color: var(--muted); cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--raised); box-shadow: 0 1px 2px rgb(0 0 0 / 0.06); color: var(--text); }
.segmented:has(.htmx-request) { opacity: 0.6; }

/* Thin progress bar */
.progress { display: block; width: 64px; height: 3px; overflow: hidden; background: var(--line); border-radius: 2px; }
.progress i { display: block; width: calc(var(--p, 0) * 1%); height: 100%; background: var(--ch); border-radius: 2px; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ch) 14%, transparent);
  color: var(--ch);
  font-size: 12px;
  white-space: nowrap;
}

.button {
  padding: 7px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.button:hover { background: var(--fill); }
.button[disabled] { opacity: 0.6; cursor: progress; }
a.button { display: inline-block; }

/* Home: the "Right now" panel */

.now-panel { margin-top: 56px; padding: 4px 24px; background: var(--screen); border: 1px solid var(--line); border-radius: var(--r); }
.now-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0 14px; }
.now-head > span:first-child { color: var(--muted); font-size: 14px; }

.now-row {
  display: grid;
  grid-template-columns: 44px 110px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 65px;
  padding: 12px 0;
  border-top: 1px solid var(--hair);
  font-size: 15px;
}
.now-label { color: var(--muted); }
.now-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-value span { color: var(--muted); }
.now-meta { display: flex; align-items: center; gap: 10px; color: var(--meta); font: 12px var(--mono); white-space: nowrap; }

/* Each thumbnail is shaped like the thing: game box, record, book */
.thumb-game { width: 30px; height: 40px; border-radius: 3px; }
.thumb-album { width: 40px; height: 40px; border-radius: 3px; }
.thumb-book { width: 28px; height: 40px; border-radius: 2px; }

/* Failed or empty API reads */

.service-error { padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); color: var(--muted); font-size: 15px; }
.service-error-title { margin-bottom: 4px; color: var(--text); font-size: 16px; font-weight: 500; }
.service-error .button { margin-top: 16px; }

/* Loading placeholders while HTMX fetches */

.skeleton { display: block; height: 12px; margin-bottom: 10px; background: var(--fill); border-radius: 3px; animation: pulse 1.4s ease-in-out infinite; }
.skeleton--title { width: 60%; height: 18px; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* Small screens: the sidebar becomes a top bar with a scrolling nav */

@media (max-width: 860px) {
  .device { flex-direction: column; }

  .rail {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: auto;
    height: auto;
    overflow: visible;
    gap: 12px 16px;
    padding: 16px 16px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .ident { order: 1; margin: 0; font-size: 22px; }
  .badge, .tagline, .np-tile { display: none; }
  .rail-foot { order: 2; margin: 0 0 0 auto; padding: 0; }

  .nav {
    order: 3;
    display: flex;
    width: calc(100% + 32px);
    margin: 0 -16px;
    padding: 0 16px 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; gap: 8px; margin: 0; }
  .nav-item .dot, .nav-soon { display: none; }

  .panel { padding: 24px 16px 56px; }
  .page-intro { grid-template-columns: minmax(0, 1fr); gap: 32px; margin-top: 40px; }
  .page-title { font-size: 44px; }
  .intro { margin-top: 48px; font-size: 20px; }
  .section-head { margin-top: 56px; }

  .now-panel { padding: 4px 16px; }
  .now-row {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas: "thumb label" "thumb value" "thumb meta";
    gap: 2px 14px;
  }
  .now-row > .ph { grid-area: thumb; }
  .now-label { grid-area: label; font-size: 13px; }
  .now-value { grid-area: value; }
  .now-meta { grid-area: meta; }
}

@media (max-width: 560px) {
  .stat-value { font-size: 24px; }
}

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