/*──────────────────────────────────────────────
  Royal Velvet CSS — v3.0 (Actually Fixed Edition)
──────────────────────────────────────────────*/

/*──────────────────────────────────────────────
  Light Theme (Warm Velvet Daylight)
──────────────────────────────────────────────*/

:root {
  --background-primary: #f8f3ea;
  --background-secondary: #f2e9dd;
  --background-tertiary: #e9dfd2;

  --text-normal: #000000;
  --text-muted: #000000;

  --lavender: #a78bd9;
  --sapphire: #4a7be0;
  --teal: #4fbfa8;
  --gold: #d6a85a;
  --rose: #d97a8c;

  --text-accent: var(--lavender);
  --border-color: #d8c9b8;
  --rv-surface: #ffffff;
}

/*──────────────────────────────────────────────
  Dark Theme
──────────────────────────────────────────────*/

html.theme-dark {
  --background-primary: #111;
  --background-secondary: #1a1a1a;
  --background-tertiary: #222;

  --text-normal: #ffffff;
  --text-muted: #ffffff;

  --lavender: #cba6f7;
  --sapphire: #89b4fa;
  --teal: #94e2d5;
  --gold: #f9e2af;
  --rose: #f38ba8;

  --text-accent: var(--lavender);
  --border-color: #2a2a2a;
  --rv-surface: #1a1a1a;
}

/*──────────────────────────────────────────────
  Base Layout
──────────────────────────────────────────────*/

body {
  background-color: var(--background-primary);
  color: var(--text-normal);
  margin: 0;
  padding: 0;
  font-family: "Roboto", system-ui, sans-serif !important;
  font-weight: 100;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* FIXED: this used to target .markdown-preview-view (an Obsidian class
   that doesn't exist in the rendered Jekyll HTML), so content had no
   max-width/centering/padding at all. The real wrapper is .rv-content. */
.rv-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.3rem 1.6rem;
}

/*──────────────────────────────────────────────
  Typography
──────────────────────────────────────────────*/

h1 {
  background: linear-gradient(
    90deg,
    #ff6ec7,
    #ffa95f,
    #fff56e,
    #6effa3,
    #6ebaff,
    #c86eff
  );
  background-size: 300%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;

  font-weight: 400 !important;
  letter-spacing: -0.35px;
  line-height: 1.14;

  font-size: 1.906rem;
  margin: 0.5em 0 0.35em;
}

h2 { margin: 0.45em 0 0.3em; line-height: 1.22; color: var(--teal) !important; }
h3 { margin: 0.4em 0 0.28em; line-height: 1.24; color: var(--sapphire) !important; }
h4 { margin: 0.35em 0 0.25em; line-height: 1.26; color: var(--lavender) !important; }
h5 { color: var(--gold) !important; }
h6 { color: var(--rose) !important; }

p {
  color: var(--text-normal);
  font-size: 1.35rem;
  line-height: 2;
  margin: 0.6em 0;
  font-weight: 100;
}

/*──────────────────────────────────────────────
  Gradient Links
──────────────────────────────────────────────*/

a {
  background: linear-gradient(
    90deg,
    #c86eff,
    #6ebaff,
    #6effa3,
    #fff56e,
    #ffa95f,
    #ff6ec7
  );
  background-size: 300%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  transition: background-position 0.4s ease;
  font-weight: 200 !important;
}

a:hover {
  background-position: 100% 0;
}

/*──────────────────────────────────────────────
  Code
──────────────────────────────────────────────*/

pre,
code {
  background: var(--background-secondary);
  color: var(--text-normal);
  padding: 0.45em 0.65em;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 100;
  margin: 0.8em 0;
}

/*──────────────────────────────────────────────
  Blockquotes
──────────────────────────────────────────────*/

blockquote {
  border-left: 3px solid var(--text-accent);
  padding-left: 0.9em;
  color: var(--text-muted);
  margin: 1em 0;
  font-weight: 100;
  font-size: 1.3rem;
  line-height: 1.62;
}

/*──────────────────────────────────────────────
  Gradient Border Card
──────────────────────────────────────────────*/

.rv-page-card {
  position: relative;
  padding: 1.35rem;
  margin: 1.5rem 0;
  border-radius: 14px;
  background: var(--background-primary);
  z-index: 1;
}

.rv-page-card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    #4ade80 0%,
    #7ed957 25%,
    #c8b53b 50%,
    #f59e2a 75%,
    #f97316 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: -1;
}

/*──────────────────────────────────────────────
  Centered Markdown Utility
──────────────────────────────────────────────*/

.center-md {
  text-align: center;
}

.center-md * {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/*──────────────────────────────────────────────
  Header + Footer
──────────────────────────────────────────────*/

header.rv-blog-header.royal-crest {
  text-align: center;
  padding: 2.4rem 1rem 2.0rem;
  margin-bottom: 0.6rem;
}

header.rv-blog-header.royal-crest .rv-crest-line,
footer.rv-blog-footer .rv-crest-line {
  height: 1px;
  width: 100%;
  background: linear-gradient(
    90deg,
    #ff6ec7,
    #ffa95f,
    #fff56e,
    #6effa3,
    #6ebaff,
    #c86eff
  );
  opacity: 0.6;
  margin: 1.2rem 0;
}

footer.rv-blog-footer.royal-crest {
  text-align: center;
  padding: 1.6rem 1rem 1.8rem;
  margin-top: 2.2rem;
  opacity: 0.95;
}

header.rv-blog-header.royal-crest .rv-header-image {
  display: block;
  margin: 0.6rem auto 0.6rem;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

/*──────────────────────────────────────────────
  Theme Toggle
──────────────────────────────────────────────*/

.rv-theme-toggle {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background-primary);
  color: var(--text-normal);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
}

.rv-theme-toggle:hover {
  transform: scale(1.06);
}

/*──────────────────────────────────────────────
  Gallery — Refreshed (A4 size)
──────────────────────────────────────────────*/

.rv-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin: 2.4rem auto;
  max-width: 900px;
}

/* FIXED: no breakpoint existed before — 3 fixed columns on a phone
   squeezed thumbnails down to unreadable sizes. */
@media (max-width: 640px) {
  .rv-gallery {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .rv-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

.rv-gallery-item {
  position: relative;
}

/* Gradient frame */
.rv-gallery-item::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: 14px;
  background: linear-gradient(
    90deg,
    #ff6ec7,
    #ffa95f,
    #fff56e,
    #6effa3,
    #6ebaff,
    #c86eff
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

/* A4 image size */
.rv-gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1.414;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  z-index: 1;
}

/* Centered link under image — FIXED */
.rv-gallery-item > a:last-of-type {
  display: block;
  text-align: center;
  padding: 0.6rem 0;
}

/*──────────────────────────────────────────────
  Lightbox
──────────────────────────────────────────────*/

.rv-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.rv-lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.rv-lightbox.active {
  display: flex;
}

/* FIXED: close button is now a real <button> in the HTML (with working
   click handler), not a ::after pseudo-element carrying invalid CSS
   properties like role/tabindex/aria-label. */
.rv-lightbox-close {
  position: absolute;
  top: 1.2rem;
  right: 1.6rem;
  font-size: 3rem;
  line-height: 1;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 300;
  padding: 0;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

.post-list li {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
}

.post-list a {
  text-decoration: none;
  font-weight: 600;
}

.post-date {
  display: block;
  font-size: 0.9rem;
  opacity: 0.6;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

/* FIXED: was `background: var(--rv-surface, #fff)` — --rv-surface was
   never defined, so it always fell back to white, including in dark
   mode, making white .card text invisible on a white card. --rv-surface
   is now defined per-theme above. */
.card {
  display: block;
  background: var(--rv-surface);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card-title {
  margin: 0 0 0.4rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.card-date {
  font-size: 0.9rem;
  opacity: 0.6;
  margin-bottom: 0.6rem;
}

.card-excerpt {
  font-size: 1rem;
  opacity: 0.85;
  line-height: 1.4;
}
