/* ==========================================================
   RusticLantern Style System  (namespace: rl-)
   Centered layout, sidebar nav, pill footer
   ========================================================== */

/* ======== Color Tokens ======== */
:root {
  --rl-primary: #b86b30;
  --rl-surface: #f6f4ef;
  --rl-paper: #1b1a17;
  --rl-ink: #eae7e0;
  --rl-muted: rgba(255,255,255,0.7);
  --rl-shadow: rgba(0,0,0,0.1);
  --rl-edge-strong: rgba(0,0,0,0.3);

  --rl-motion-fast: 150ms;
  --rl-motion-med: 260ms;
  --rl-motion-slow: 420ms;
  --rl-easing: cubic-bezier(.22,.61,.36,1);
}

/* ======== Reset ======== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  height: 100%;
  background: var(--rl-paper);
  color: var(--rl-ink);
  font-family: Georgia, Cambria, "Times New Roman", Times, serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ======== Background Motion ======== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(90% 70% at 80% 10%, rgba(255,255,255,0.03), transparent 70%),
    linear-gradient(120deg, rgba(255,255,255,0.02), rgba(0,0,0,0.02));
  animation: rl-wash 24s ease-in-out infinite alternate;
  opacity: 0.35;
}
@keyframes rl-wash {
  0% { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(0,-2%,0) scale(1.02); }
}

/* ======== Site Frame Centering ======== */
.rl-site-frame {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
}

/* ======== Sidebar (fixed, left of centered frame) ======== */
.rl-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-640px); /* half of total width (1280/2) */
  width: 230px;
  height: 100vh;
  background: rgba(0,0,0,0.25);
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  box-shadow: 4px 0 16px rgba(0,0,0,0.25);
  z-index: 999;
}

/* ======== Sidebar Navigation ======== */
.rl-logo {
  height: 150px;
  width: auto;
  margin-bottom: 2rem;
}
.rl-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  text-align: center;
}
.rl-nav a {
  display: block;
  color: var(--rl-ink);
  font-weight: 600;
  text-decoration: none;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  transition: background var(--rl-motion-fast) var(--rl-easing),
              color var(--rl-motion-fast) var(--rl-easing);
}
.rl-nav a:hover,
.rl-nav a.active {
  background: var(--rl-primary);
  color: #111;
}

/* ======== Main Layout (content column) ======== */
.rl-main {
  margin-left: calc(230px + (50vw - 640px)); /* space for sidebar + centering */
  max-width: 960px;
  padding: 2.5rem 2rem 4rem;
}
.rl-article h1 {
  font-size: 2.6rem;
  color: var(--rl-primary);
  margin-bottom: 1rem;
}
.rl-dek {
  font-style: italic;
  color: var(--rl-muted);
  margin-bottom: 2rem;
}
.rl-hero {
  margin-bottom: 2.5rem;
}
.rl-hero img {
  width: 100%;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.08);
  box-shadow: 0 6px 18px var(--rl-shadow);
  display: block;
}

/* ======== Typography ======== */
h2 {
  color: var(--rl-primary);
  margin-top: 3rem;
  margin-bottom: 1rem;
  font-size: 1.8rem;
}
p {
  margin-bottom: 1.5rem;
}

/* ======== Paragraph Justification ======== */
article p,
section p,
main p,
p {
  text-align: justify !important;
  text-justify: inter-word !important;
  -webkit-hyphens: auto !important;
  -ms-hyphens: auto !important;
  hyphens: auto !important;
}

/* ======== Section Separator ======== */
.rl-section {
  position: relative;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 2.5rem;
}
.rl-section::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--rl-primary), transparent);
  transition: width var(--rl-motion-slow) var(--rl-easing);
}
.rl-section.is-seen::before {
  width: 100%;
}

/* ======== Footer (pill copyright) ======== */
.rl-footer {
  margin-left: calc(230px + (50vw - 640px));
  text-align: center;
  padding: 3rem 1rem;
  background: rgba(0,0,0,0.15);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.rl-footer p {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--rl-muted);
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  text-align: center;
}

/* 🔧 Footer centering fix on ultra-wide screens */
/* Match footer width to main width so the pill center lines up exactly */
@media (min-width: 1100px) {
  .rl-footer {
    width: 960px;
    max-width: 960px;
  }
}

/* ======== Card Lift ======== */
.rl-card {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 1rem;
  transition:
    transform var(--rl-motion-fast) var(--rl-easing),
    box-shadow var(--rl-motion-fast) var(--rl-easing),
    border-color var(--rl-motion-fast) var(--rl-easing);
}
.rl-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--rl-shadow);
  border-color: var(--rl-edge-strong);
}

/* ======== Reading Progress Bar ======== */
.rl-progress {
  position: fixed;
  left: 0;
  top: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--rl-primary), transparent);
  z-index: 9998;
  transition: width var(--rl-motion-fast) linear;
}

/* ======== Back to Top ======== */
.rl-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: var(--rl-primary);
  color: #111;
  font: 700 18px/46px system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  text-align: center;
  cursor: pointer;
  opacity: 0 !important;
  transform: translateY(10px) !important;
  pointer-events: none !important;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
  z-index: 9999 !important;
  overflow: hidden;
}
.rl-to-top:hover { background: #fff; }
.rl-to-top.rl-show {
  opacity: 1 !important;
  transform: translateY(0) !important;
  pointer-events: auto !important;
}
.rl-to-top .ripple {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.35;
  transform: translate(-50%,-50%) scale(0);
  background: #fff;
  animation: rl-ripple 0.6s ease-out forwards;
}
@keyframes rl-ripple {
  to { transform: translate(-50%,-50%) scale(8); opacity: 0; }
}

/* ======== Links ======== */
a.rl-link {
  color: var(--rl-primary);
  text-decoration: none;
  position: relative;
}
a.rl-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px; height: 2px;
  background: linear-gradient(90deg, var(--rl-primary), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--rl-motion-med) var(--rl-easing);
}
a.rl-link:hover::after { transform: scaleX(1); }

/* ======== Responsive ======== */
@media (max-width: 900px) {
  .rl-header {
    position: relative;
    left: 0;
    transform: none;
    width: 100%;
    height: auto;
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .rl-main,
  .rl-footer {
    margin-left: 0;
  }
  .rl-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }
  .rl-nav a {
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ======== Refined Shapes: Rustic Facets & Circular Control ======== */

/* Hex-cut copyright badge */
.rl-footer p {
  position: relative;
  background: linear-gradient(160deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  padding: 0.9rem 2rem;
  color: var(--rl-ink);
  border: 1px solid rgba(255,255,255,0.18);
  clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0 50%);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow:
    inset 0 0 8px rgba(255,255,255,0.08),
    0 4px 14px rgba(0,0,0,0.25);
  transition: transform var(--rl-motion-fast) var(--rl-easing),
              box-shadow var(--rl-motion-fast) var(--rl-easing);
}
.rl-footer p:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 10px rgba(255,255,255,0.1),
    0 6px 20px rgba(0,0,0,0.35);
}

/* Circular Back-to-Top button */
.rl-to-top {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: radial-gradient(circle at 30% 30%, var(--rl-primary), #d49460 80%);
  color: #111;
  font: 700 20px/52px system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.3),
    inset 0 0 6px rgba(255,255,255,0.15);
  transition: transform var(--rl-motion-fast) var(--rl-easing),
              box-shadow var(--rl-motion-fast) var(--rl-easing),
              background var(--rl-motion-fast) var(--rl-easing);
}
.rl-to-top:hover {
  transform: translateY(-3px);
  background: radial-gradient(circle at 70% 70%, #fff, var(--rl-primary) 70%);
  box-shadow:
    0 6px 18px rgba(0,0,0,0.35),
    inset 0 0 10px rgba(255,255,255,0.25);
}
