/* =====================================================================
   the star archive — main stylesheet
   A dark reading room beneath the star map.
   ===================================================================== */

/* ------------------------------ tokens ------------------------------ */
:root {
  color-scheme: dark;
  --font-body: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #06070d;
  --bg-elevated: #0c0e17;
  --bg-soft: #10121c;
  --bg-sunk: #05060b;
  --text: #e9e8f1;
  --text-strong: #ffffff;
  --muted: #a6a3ba;
  --faint: #77748c;
  --border: rgba(190, 200, 255, 0.14);
  --border-strong: rgba(190, 200, 255, 0.28);
  --accent: #bcd2ff;
  --accent-soft: rgba(188, 210, 255, 0.1);
  --accent-2: #ffcf8a;
  --highlight: rgba(188, 210, 255, 0.18);
  --mark: rgba(255, 207, 138, 0.28);
  --shadow: none;
  --shadow-soft: none;
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 312px;
  --right-w: 312px;
  --reading-width: 44rem;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Aliases used by inline cards inside the original Obsidian notes. */
  --background-primary: var(--bg);
  --background-secondary: var(--bg-soft);
  --background-modifier-border: var(--border);
  --text-normal: var(--text);
  --text-muted: var(--muted);
  --text-faint: var(--faint);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--highlight);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.18s var(--ease), opacity 0.18s var(--ease);
}

a:hover {
  color: var(--accent-2);
}

a.internal {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 34%, transparent);
}

a.internal:hover {
  text-decoration-color: currentColor;
}

a.external::after {
  content: "↗";
  display: inline-block;
  margin-left: 0.18em;
  font-family: var(--font-mono);
  font-size: 0.72em;
  opacity: 0.55;
  transform: translateY(-0.08em);
}

img {
  max-width: 100%;
  height: auto;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-strong);
  font-family: var(--font-body);
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

mark {
  background: var(--mark);
  color: inherit;
  padding: 0.05em 0.2em;
  border-radius: 2px;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.1em 0.35em;
  color: var(--faint);
  background: var(--bg-soft);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: none;
}

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

.muted {
  color: var(--muted);
}

/* --------------------------- page layout ---------------------------- */
.page {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--right-w);
  align-items: start;
  max-width: 1680px;
  margin: 0 auto;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  font-size: 0.9rem;
}

.sidebar::-webkit-scrollbar {
  width: 7px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}

.sidebar.left {
  padding: 1.7rem 1.35rem 2.5rem;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, var(--bg-soft));
}

.sidebar.right {
  padding: 1.7rem 1.35rem 2.5rem;
  border-left: 1px solid var(--border);
}

.center {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: calc(var(--reading-width) + 6rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: 2.2rem clamp(1.4rem, 4vw, 3.4rem) 4rem;
  min-width: 0;
}

.center > .site-footer {
  margin-top: auto;
}

/* --------------------------- sidebar bits --------------------------- */
.page-title {
  margin: 0 0 1.1rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-title a {
  color: var(--text-strong);
}

.page-title a:hover {
  color: var(--accent);
}

.sidebar-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.35rem;
}

.search-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 0.82rem;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}

.search-button:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--bg-soft);
}

.search-button svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.search-button span {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.18s var(--ease);
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-soft);
}

.icon-button:active {
  transform: scale(0.94);
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.menu-toggle,
.mobile-nav-toggle {
  display: none;
}

/* explorer */
.explorer {
  margin-top: 0.2rem;
}

.explorer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.2rem 0;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.explorer-heading h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
}

.explorer-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease);
  margin-right: 0.2rem;
}

.explorer-heading[aria-expanded="false"] .explorer-chevron {
  transform: rotate(-45deg);
}

.explorer-content {
  overflow: hidden;
}

.explorer-content[hidden] {
  display: none;
}

.explorer-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.explorer-list .explorer-list {
  margin-left: 0.72rem;
  padding-left: 0.62rem;
  border-left: 1px solid var(--border);
}

.explorer-list li {
  margin: 0;
}

.explorer-link,
.explorer-overview {
  display: block;
  padding: 0.26rem 0.42rem;
  margin-left: -0.42rem;
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.explorer-link:hover,
.explorer-overview:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.explorer-link.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.explorer-folder {
  margin: 0.08rem 0;
}

.explorer-folder > summary {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.3rem 0.42rem;
  margin-left: -0.42rem;
  border-radius: 5px;
  list-style: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  transition: background 0.15s var(--ease);
}

.explorer-folder > summary::-webkit-details-marker {
  display: none;
}

.explorer-folder > summary:hover {
  background: var(--bg-soft);
}

.folder-chevron {
  width: 6px;
  height: 6px;
  border-right: 1.4px solid var(--faint);
  border-bottom: 1.4px solid var(--faint);
  transform: rotate(-45deg);
  transition: transform 0.2s var(--ease);
  flex: none;
}

.explorer-folder[open] > summary .folder-chevron {
  transform: rotate(45deg);
}

.explorer-folder-body {
  padding: 0.1rem 0 0.35rem 0.72rem;
}

.explorer-overview {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.explorer-overview.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.recent-notes h3 {
  margin: 0 0 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
}

.recent-notes ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-notes li {
  padding: 0.42rem 0;
  border-bottom: 1px solid var(--border);
}

.recent-notes li:last-child {
  border-bottom: 0;
}

.recent-notes li > a {
  display: block;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.4;
}

.recent-notes li > a:hover {
  color: var(--accent);
}

.recent-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.22rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--faint);
}

.recent-meta .tag-link {
  font-size: inherit;
}

/* --------------------------- page header ---------------------------- */
.page-header {
  margin-bottom: 2rem;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--faint);
}

.breadcrumbs a {
  color: var(--muted);
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumbs span {
  opacity: 0.45;
}

.article-title {
  margin: 0 0 0.7rem;
  font-size: clamp(1.85rem, 3.6vw, 2.7rem);
  line-height: 1.12;
}

.content-meta {
  margin: 0 0 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.02em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
}

.tag-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.6;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 18%, transparent);
  border-radius: 999px;
  padding: 0.02rem 0.52rem;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.tag-link:hover {
  color: var(--bg-elevated);
  background: var(--accent-2);
  border-color: var(--accent-2);
}

/* --------------------------- note content --------------------------- */
.note-content {
  font-size: 1rem;
  line-height: 1.85;
}

.note-content > :first-child {
  margin-top: 0;
}

.note-content p {
  margin: 1.1em 0;
}

.note-content h1,
.note-content h2,
.note-content h3,
.note-content h4 {
  margin: 2.2em 0 0.6em;
  scroll-margin-top: 2rem;
}

.note-content h1 {
  font-size: 1.8rem;
}

.note-content h2 {
  font-size: 1.42rem;
  padding-bottom: 0.28em;
  border-bottom: 1px solid var(--border);
}

.note-content h3 {
  font-size: 1.16rem;
}

.note-content h4 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.note-content ul,
.note-content ol {
  padding-left: 1.35em;
  margin: 1em 0;
}

.note-content li {
  margin: 0.35em 0;
}

.note-content li::marker {
  color: var(--faint);
}

.note-content blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 2px solid var(--accent-2);
  color: var(--muted);
  font-style: italic;
}

.note-content blockquote p {
  margin: 0.55em 0;
}

.note-content code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08em 0.32em;
}

.note-content pre {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.65;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  overflow-x: auto;
}

.note-content pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

.note-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.6rem auto;
  border-radius: var(--radius-sm);
}

.note-content figure {
  margin: 1.6rem 0;
}

.note-content figcaption {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--faint);
  text-align: center;
}

.note-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.88rem;
}

.note-content th,
.note-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.note-content th {
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.note-content iframe {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1.6rem 0;
}

.note-content .broken {
  color: var(--muted);
  border-bottom: 1px dashed var(--border-strong);
}

/* inline album / book info cards from the Markdown */
.note-content div[style*="background-color"] {
  color: var(--text);
}

.note-content div[style*="background-color"] img {
  margin: 0;
  box-shadow: none;
  border-radius: 4px;
}

.note-content div[style*="background-color"] strong {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* callouts */
.callout {
  margin: 1.6em 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  overflow: hidden;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.callout-icon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.callout-content {
  padding: 0 0.95rem 0.3rem;
  font-size: 0.94rem;
}

.callout-content > :first-child {
  margin-top: 0;
}

.callout-content > :last-child {
  margin-bottom: 0.8rem;
}

.callout[data-callout="warning"],
.callout[data-callout="danger"],
.callout[data-callout="caution"] {
  border-left-color: #c47a5a;
}

.callout[data-callout="warning"] .callout-title,
.callout[data-callout="danger"] .callout-title,
.callout[data-callout="caution"] .callout-title {
  color: #c47a5a;
}

.callout[data-callout="tip"],
.callout[data-callout="success"],
.callout[data-callout="check"] {
  border-left-color: var(--accent-2);
}

.callout[data-callout="tip"] .callout-title,
.callout[data-callout="success"] .callout-title,
.callout[data-callout="check"] .callout-title {
  color: var(--accent-2);
}

/* footnotes */
.note-content .footnote {
  font-size: 0.8rem;
  color: var(--muted);
}

.note-content .footnote-ref a {
  font-family: var(--font-mono);
  font-size: 0.7em;
}

/* --------------------------- right rail ----------------------------- */
.mini-graph {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 0.9rem;
  box-shadow: var(--shadow-soft);
}

.mini-graph-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.mini-graph-header h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.mini-graph-header a {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  white-space: nowrap;
}

.mini-graph-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 7 / 5;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at 50% 45%, rgba(143, 159, 169, 0.14), transparent 62%),
    var(--bg-sunk);
  overflow: hidden;
}

.mini-graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.mini-graph-hint {
  margin: 0.45rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--faint);
}

.mini-graph-tooltip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 0.2rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text);
  box-shadow: var(--shadow);
}

.toc h3,
.backlinks h3,
.related h3 {
  margin: 0 0 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
}

.toc {
  margin: 1.6rem 0;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list .toc-list {
  padding-left: 0.72rem;
  border-left: 1px solid var(--border);
  margin-left: 0.15rem;
}

.toc-list li {
  margin: 0.1rem 0;
}

.toc-list a {
  display: block;
  padding: 0.18rem 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.toc-list a:hover {
  color: var(--accent);
}

.toc-list a.active {
  color: var(--accent);
  font-weight: 600;
}

.backlinks,
.related {
  margin: 1.6rem 0;
}

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-list li {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.45;
}

.link-list li:last-child {
  border-bottom: 0;
}

.link-list a {
  color: var(--muted);
}

.link-list a:hover {
  color: var(--accent);
}

/* --------------------------- list pages ----------------------------- */
.list-intro {
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.folder-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1.6rem;
  padding: 0;
}

.folder-list a {
  display: inline-block;
  padding: 0.32rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--bg-elevated);
}

.folder-list a:hover {
  color: var(--accent);
  border-color: var(--border-strong);
}

.note-list {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
}

.note-list-item {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--border);
}

.note-list-main {
  flex: 1;
  min-width: 0;
}

.note-list-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.3;
}

.note-list-title:hover {
  color: var(--accent);
}

.note-list-excerpt {
  margin: 0.32rem 0 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-list-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--faint);
}

.note-list-kind {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  margin-top: 0.2rem;
}

/* tag index */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag-cloud li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
  background: var(--bg-elevated);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.tag-cloud li span {
  color: var(--faint);
  font-size: 0.62rem;
}

/* --------------------------- galleries ------------------------------ */
.album-gallery,
.book-gallery {
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
}

.album-gallery {
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
}

.book-gallery {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.album-card,
.book-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  transition: border-color 0.22s var(--ease);
}

.album-card:hover,
.book-card:hover {
  border-color: var(--border-strong);
}

.album-cover,
.book-cover {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg-sunk);
}

.album-cover {
  aspect-ratio: 1 / 1;
}

.book-cover {
  aspect-ratio: 2 / 3;
}

.album-cover img,
.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  transition: transform 0.3s var(--ease);
}

.album-card:hover .album-cover img,
.book-card:hover .book-cover img {
  transform: scale(1.035);
}

.placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 120px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.album-info,
.book-info {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0 0.15rem 0.2rem;
  min-width: 0;
}

.album-info strong,
.book-info strong {
  font-size: 0.82rem;
  line-height: 1.32;
  color: var(--text-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.artist,
.author {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-data {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  margin-top: 0.18rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--faint);
}

.rating {
  color: var(--accent-2);
}

.status-badge {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.54rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.status-done {
  color: var(--accent-2);
}

.status-reading {
  color: var(--accent);
}

/* stickers */
.sticker-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin: 1.4rem 0 2rem;
  padding: 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.sticker-item {
  display: inline-grid;
  place-items: center;
  width: 78px;
  height: 78px;
  padding: 0.25rem;
  border-radius: 8px;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}

.sticker-item:hover {
  transform: translateY(-3px) rotate(-2deg);
  background: var(--bg-elevated);
}

.sticker-item img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  margin: 0;
  box-shadow: none;
  border-radius: 0;
}

/* --------------------------- footer --------------------------------- */
.site-footer {
  margin-top: 4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--faint);
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer p {
  margin: 0;
}

/* --------------------------- search modal --------------------------- */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: start center;
  padding: 10vh 1rem 2rem;
}

.search-modal[hidden] {
  display: none;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 13, 0.78);
  animation: fade-in 0.2s var(--ease);
}

.search-panel {
  position: relative;
  width: min(680px, 100%);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop-in 0.22s var(--ease);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.search-input-wrap svg {
  width: 18px;
  height: 18px;
  color: var(--faint);
  flex: none;
}

.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 1rem;
  color: var(--text);
}

.search-input::placeholder {
  color: var(--faint);
}

.search-close {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.16rem 0.4rem;
}

.search-close:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.search-results {
  overflow-y: auto;
  padding: 0.45rem;
  min-height: 3rem;
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
}

.search-result:hover,
.search-result[aria-selected="true"] {
  background: var(--accent-soft);
}

.search-result-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.search-result-kind {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
}

.search-result-excerpt {
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-empty {
  padding: 1.4rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--faint);
}

.search-footer {
  display: flex;
  gap: 1.1rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--faint);
}

/* --------------------------- lightbox ------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 2.5rem;
  background: rgba(6, 7, 13, 0.94);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 92vw;
  max-height: 84vh;
  border-radius: 4px;
  animation: pop-in 0.25s var(--ease);
}

.lightbox-caption {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80vw;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.3rem;
  transition: background 0.2s var(--ease);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
}

.lightbox-prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

/* --------------------------- misc ----------------------------------- */
.not-found-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 30% 20%, rgba(158, 197, 255, 0.08), transparent 55%),
    radial-gradient(circle at 75% 70%, rgba(255, 207, 138, 0.07), transparent 55%),
    #0b0b12;
  color: #e9e7f2;
}

.not-found {
  max-width: 560px;
  padding: 2rem;
  text-align: center;
}

.not-found h1 {
  color: #fff;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin: 0.4rem 0 0.8rem;
}

.not-found p {
  color: #a8a4bc;
}

.not-found .home-kicker {
  color: #8f8aa8;
}

/* --------------------------- animations ----------------------------- */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

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

/* --------------------------- responsive ----------------------------- */
@media (max-width: 1380px) {
  :root {
    --sidebar-w: 286px;
    --right-w: 286px;
  }
}

@media (max-width: 1160px) {
  .page {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .sidebar.right {
    display: none;
  }
}

@media (max-width: 880px) {
  :root {
    --sidebar-w: min(84vw, 320px);
  }

  .page {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar.left {
    position: fixed;
    z-index: 100;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.3s var(--ease);
    border-right: 1px solid var(--border-strong);
  }

  body.sidebar-open .sidebar.left {
    transform: none;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(6, 7, 13, 0.72);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-toggle,
  .mobile-nav-toggle {
    display: inline-grid;
  }

  .mobile-nav-toggle {
    position: fixed;
    z-index: 90;
    top: 0.8rem;
    left: 0.8rem;
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
  }

  .center {
    padding-top: 4rem;
  }

  .note-list-item {
    gap: 0.7rem;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15px;
  }

  .center {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  .article-title {
    font-size: 1.75rem;
  }

  .note-content {
    font-size: 0.96rem;
  }

  .album-gallery {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }

  .book-gallery {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  }

  .note-list-kind {
    display: none;
  }

  .sticker-item {
    width: 64px;
    height: 64px;
  }

  .search-modal {
    padding-top: 4vh;
  }

  .search-panel {
    max-height: 84vh;
  }
}

/* reader mode */
body.reader-mode .sidebar {
  display: none;
}

body.reader-mode .page {
  display: block;
  max-width: 760px;
}

body.reader-mode .center {
  max-width: 760px;
  padding-top: 4rem;
}

body.reader-mode .site-footer {
  margin-top: auto;
}

body.reader-mode .mobile-nav-toggle {
  display: none;
}

.reader-exit {
  position: fixed;
  z-index: 130;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-soft);
}

.reader-exit:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.reader-exit[hidden] {
  display: none;
}

body.reader-mode .note-content {
  font-size: 1.06rem;
  line-height: 1.95;
}
