/* ============================================================
   styles.css — all visual styling for my little corner
   Organised into sections:
     1. Design Tokens (CSS Variables)
     2. Global Reset & Base
     3. Layout
     4. Top Bar & Theme Toggle
     5. Header / Intro Block
     6. Cards (shared)
     7. Card Internals (dot, title, body, mono, pills)
     8. Section Labels & Footer
     9. Carousel Animation
    10. Dark-mode Animations
   ============================================================ */

/* ── 1. Design Tokens ────────────────────────────────────── */
:root {
  --bg:                #05030a;
  --bg-soft:           #0b0714;
  --card:              rgba(16, 9, 30, 0.96);
  --accent-soft:       #f9a8d4;
  --accent-strong:     #fb7185;
  --accent-muted:      #a855f7;
  --text-main:         #f9f5ff;
  --text-muted:        #b5a8d8;
  --border-subtle:     rgba(248, 113, 113, 0.28);
  --shadow-soft:       0 20px 44px rgba(0, 0, 0, 0.85);
  --pill-type-bg:      rgba(250, 204, 21, 0.12);
  --pill-type-border:  #facc15;
  --pill-type-text:    #fef9c3;
}

body.light {
  --bg:                #2b1022;
  --bg-soft:           #3a142a;
  --card:              rgba(255, 244, 252, 0.98);
  --accent-soft:       #fb7185;
  --accent-strong:     #e11d48;
  --accent-muted:      #c084fc;
  --text-main:         #230813;
  --text-muted:        #6b4b5e;
  --border-subtle:     rgba(251, 113, 133, 0.65);
  --shadow-soft:       0 20px 40px rgba(251, 113, 133, 0.4);
  --pill-type-bg:      rgba(251, 191, 36, 0.14);
  --pill-type-border:  #facc15;
  --pill-type-text:    #422006;
}

/* ── 2. Global Reset & Base ──────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Smooth theme transitions on key elements */
html,
body,
.card,
.header-block,
.page {
  transition:
    background       0.55s ease,
    background-color 0.55s ease,
    color            0.4s  ease,
    border-color     0.5s  ease,
    box-shadow       0.5s  ease;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #201139 0, var(--bg) 60%);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  padding: 24px 16px 40px;
}

body.light {
  background: radial-gradient(circle at top, #f973af 0, var(--bg) 60%);
}

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

a:hover {
  color: var(--accent-strong);
  opacity: 1;
  text-decoration: underline;
}

/* ── 3. Layout ───────────────────────────────────────────── */
.page {
  width: 100%;
  max-width: 780px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 10px;
}

@media (min-width: 780px) {
  .grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* ── 4. Top Bar & Theme Toggle ───────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.top-left {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-muted);
  opacity: 0.9;
}

.toggle-btn {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-soft);
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  overflow: hidden;
}

.toggle-btn i {
  font-size: 0.78rem;
  color: var(--accent-soft);
  transition:
    transform 0.45s ease,
    opacity   0.3s  ease,
    color     0.3s  ease;
}

/* Dark (default): show moon, hide sun */
.toggle-btn .sun  { opacity: 0; transform: translateY(10px)  rotate(25deg);  }
.toggle-btn .moon { opacity: 1; transform: translateY(0)      rotate(0deg);   }

/* Light: show sun, hide moon */
body.light .toggle-btn .sun  { opacity: 1; transform: translateY(0)      rotate(0deg);   }
body.light .toggle-btn .moon { opacity: 0; transform: translateY(-10px)  rotate(-25deg); }

/* ── 5. Header / Intro Block ─────────────────────────────── */
.header-block {
  background: linear-gradient(135deg, var(--card), rgba(15, 6, 26, 0.96));
  border-radius: 18px;
  padding: 20px 18px 16px;
  box-shadow: var(--shadow-soft), 0 0 0 1px rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(248, 113, 113, 0.14);
  backdrop-filter: blur(16px);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

body.light .header-block {
  background: linear-gradient(135deg, var(--card), #ffe4f5);
  box-shadow: var(--shadow-soft);
  border-color: rgba(251, 113, 133, 0.4);
}

/* Decorative blurred orb behind the header */
.header-block::before {
  content: "";
  position: absolute;
  right: -70px;
  top: -40px;
  width: 170px;
  height: 170px;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.6), transparent 65%);
  opacity: 0.7;
  filter: blur(3px);
  animation: drift 11s ease-in-out infinite alternate;
  pointer-events: none;
}

body.light .header-block::before {
  background: radial-gradient(circle, rgba(251, 113, 133, 0.5), transparent 60%);
}

@keyframes drift {
  0%   { transform: translate3d(0,      0,   0) scale(1);    opacity: 0.7; }
  50%  { transform: translate3d(-16px,  8px, 0) scale(1.08); opacity: 0.5; }
  100% { transform: translate3d(-6px,  18px, 0) scale(0.98); opacity: 0.6; }
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}

.header-text   { flex: 1 1 auto; }
.avatar-wrapper { flex: 0 0 auto; }

.title {
  font-size: 1.65rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  min-height: 1.2em;
}

.avatar-pixel {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  image-rendering: pixelated;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.avatar-pixel:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.75);
}

/* ── 6. Cards (shared) ───────────────────────────────────── */
.card {
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 14px 14px 13px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(15, 23, 42, 0.6);
  opacity: 0;
  transform: translateY(10px);
  animation: cardIn 0.6s ease forwards;
}

body.light .card {
  background: var(--card);
  box-shadow: var(--shadow-soft), 0 0 0 1px rgba(251, 113, 133, 0.24);
  border-color: rgba(251, 113, 133, 0.35);
}

/* Staggered entrance for up to 5 cards */
.card:nth-of-type(1) { animation-delay: 0.08s; }
.card:nth-of-type(2) { animation-delay: 0.16s; }
.card:nth-of-type(3) { animation-delay: 0.24s; }
.card:nth-of-type(4) { animation-delay: 0.32s; }
.card:nth-of-type(5) { animation-delay: 0.40s; }

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

.card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 26px 42px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(248, 113, 113, 0.45);
}

body.light .card:hover {
  box-shadow:
    0 20px 34px rgba(251, 113, 133, 0.55),
    0 0 0 1px rgba(248, 113, 182, 0.7);
}

/* ── 7. Card Internals ───────────────────────────────────── */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.card-title {
  font-size: 0.86rem;
  text-transform: lowercase;
  letter-spacing: 0.16em;
  color: var(--accent-soft);
}

/* Animated pulse dot */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.85);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 0.9; }
  50%       { transform: scale(1.4); opacity: 0.4; }
}

.card-body {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 4px;
}

/* Monospaced "now playing" line */
.mono-line {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.83rem;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mono-label {
  color: var(--accent-muted);
  opacity: 0.9;
}

/* Image containers inside cards */
.album-art-wrapper {
  flex: 0 0 64px;
}

.album-art-box {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  background: radial-gradient(circle at top left, #a855f7, #4c1d95);
}

.album-art-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-art-wrapper {
  flex: 0 0 90px;
}

.cover-art-box {
  width: 90px;
  height: 90px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.cover-art-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Link pills & tags ─────────────────────────────────── */
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.link-pill {
  font-size: 0.8rem;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 6, 22, 0.9);
  color: var(--accent-soft);
}

body.light .link-pill {
  background: rgba(255, 244, 252, 0.96);
}

.pill-type {
  background: var(--pill-type-bg);
  border-color: var(--pill-type-border);
  color: var(--pill-type-text);
}

/* ── 8. Section Labels & Footer ──────────────────────────── */
.section-label {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.8);
  margin: 18px 2px 6px;
}

.footer {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.75);
  margin-top: 18px;
  text-align: right;
}

/* ── 9. Carousel Animation ───────────────────────────────── */
.carousel-content {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.carousel-content.fade-out-left  { opacity: 0; transform: translateX(-10px); }
.carousel-content.fade-out-right { opacity: 0; transform: translateX(10px);  }
.carousel-content.fade-in        { opacity: 1; transform: translateX(0);     }

/* ── Card link wrapper (journal card is a full <a>) ─────── */
.card-link-wrapper {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card-link-wrapper:hover {
  text-decoration: none;
  opacity: 1;
}

.card-link-wrapper .card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 26px 42px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(248, 113, 113, 0.45);
}

/* ── Fav card — side-by-side layout ─────────────────────── */
.fav-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.fav-text { flex: 1 1 0; }
