/* =======================================================================
   STYLE.CSS  —  content-first editorial layout
   ======================================================================= */

:root {
  --ink:        #1c1917;
  --ink-soft:   #292524;
  --muted:      #57534e;
  --faint:      #78716c;
  --line:       #e7e5e4;
  --line-soft:  #f5f5f4;
  --paper:      #ffffff;
  --paper-2:    #fafaf9;
  --paper-3:    #f5f5f4;
  --accent:     #c2410c;
  --accent-2:   #9a3412;
  --accent-3:   #ea580c;
  --accent-wash:#fff7ed;
  --ok:         #15803d;
  --no:         #b91c1c;
  --dark:       #1c1917;
  --dark-2:     #292524;

  --serif: 'Spectral', Georgia, 'Times New Roman', serif;
  --sans:  'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;

  --sh-1: 0 1px 2px rgba(28,25,23,.06);
  --sh-2: 0 6px 20px rgba(28,25,23,.09);
  --sh-3: 0 18px 44px rgba(28,25,23,.16);

  --ease: .22s cubic-bezier(.4,0,.2,1);
  --bar: 64px;
  --bound: 1160px;
  --read: 760px;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar) + 16px); }
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--muted);
  background: var(--paper-2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--accent); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--accent-2); }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; color: var(--ink); }
h1 { font-family: var(--serif); font-weight: 700; color: var(--ink); line-height: 1.18; }
p { margin: 0 0 1em; }
strong, b { font-weight: 700; color: var(--ink-soft); }

.rl-bound { max-width: var(--bound); margin: 0 auto; padding: 0 22px; }
.rl-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* span-based section captions (no heading tags outside the article body) */
.rl-toc-cap, .rl-share-cap, .rl-vote-cap, .rl-talk-cap, .rl-rel-cap,
.rl-card-cap, .rl-foot-cap, .rl-modal-cap {
  font-family: var(--serif); color: var(--ink); display: block;
}

/* ---- progress ---- */
.rl-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  z-index: 1400; transition: width .08s linear;
}

/* =======================================================================
   MASTHEAD  (fixed; sits visually on top although later in source)
   ======================================================================= */
.rl-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000; height: var(--bar);
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow var(--ease);
}
.rl-head.is-stuck { box-shadow: var(--sh-2); }
.rl-head .rl-bound { display: flex; align-items: center; height: 100%; gap: 22px; }
.rl-mark { display: inline-flex; align-items: center; flex-shrink: 0; }
.rl-mark img { height: 33px; width: auto; }

.rl-nav { display: flex; align-items: center; flex: 1; gap: 16px; }
.rl-nav-list { display: flex; align-items: center; gap: 2px; }
.rl-nav-a {
  display: inline-flex; align-items: center; padding: 9px 14px;
  font-size: 14.5px; font-weight: 500; color: var(--muted); border-radius: var(--r-s);
  transition: color var(--ease), background var(--ease);
}
.rl-nav-a:hover { color: var(--ink); background: var(--paper-3); }
.rl-nav-cta {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 20px; font-size: 14px; font-weight: 500; color: #fff; background: var(--accent);
  border-radius: var(--r-m); transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
}
.rl-nav-cta:hover { background: var(--accent-2); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(194,65,12,.28); }

.rl-burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; padding: 8px; border-radius: var(--r-s); margin-left: auto;
}
.rl-burger i { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: transform var(--ease), opacity var(--ease); }
.rl-burger.is-open i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.rl-burger.is-open i:nth-child(2) { opacity: 0; }
.rl-burger.is-open i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- buttons ---- */
.rl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; font-family: var(--sans); font-size: 14.5px; font-weight: 500;
  color: #fff; background: var(--accent); border-radius: var(--r-m);
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease); white-space: nowrap;
}
.rl-btn:hover { background: var(--accent-2); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(194,65,12,.26); }
.rl-btn--block { width: 100%; padding: 12px 22px; margin-top: 4px; }
.rl-btn--full-sm { align-self: flex-start; padding: 12px 28px; font-size: 15px; }

/* =======================================================================
   MAIN  (content-first; cleared from the fixed masthead)
   ======================================================================= */
.rl-main { padding-top: var(--bar); }
.rl-flow { max-width: var(--read); margin: 0 auto; padding: 30px 0 64px; }

/* =======================================================================
   POST
   ======================================================================= */
.rl-post {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-l); padding: 46px; box-shadow: var(--sh-1);
}
.rl-post-title {
  font-size: clamp(1.85rem, 1.2rem + 2.4vw, 2.6rem); font-weight: 700;
  line-height: 1.16; letter-spacing: -.014em; color: var(--ink); margin-bottom: 16px;
}
.rl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding-bottom: 26px; margin-bottom: 30px; border-bottom: 1px solid var(--line-soft); }
.rl-meta-i { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--faint); }
.rl-meta-i svg { opacity: .65; }
.rl-meta-dot { color: var(--line); }

/* ---- toc ---- */
.rl-toc { margin-bottom: 32px; background: var(--accent-wash); border: 1px solid #fde0c8; border-left: 3px solid var(--accent); border-radius: var(--r-m); padding: 18px 22px; }
.rl-toc[hidden] { display: none; }
.rl-toc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rl-toc-cap { font-weight: 600; font-size: 15px; }
.rl-toc-x { font-size: 12px; font-weight: 500; color: var(--accent); padding: 3px 9px; border-radius: var(--r-s); transition: background var(--ease); }
.rl-toc-x:hover { background: rgba(194,65,12,.1); }
.rl-toc-list { display: flex; flex-direction: column; gap: 5px; }
.rl-toc-list a { display: block; padding: 3px 0; font-size: 14px; color: var(--muted); border-left: 2px solid transparent; transition: color var(--ease), padding-left var(--ease); }
.rl-toc-list a:hover { color: var(--accent); padding-left: 7px; }
.rl-toc-list a.lv-h3 { padding-left: 16px; font-size: 13.5px; }
.rl-toc-list a.lv-h3:hover { padding-left: 22px; }
.rl-toc-list a.lv-h4 { padding-left: 30px; font-size: 13px; color: var(--faint); }

/* ---- body (the only place real headings appear) ---- */
.rl-body { font-size: 17.5px; line-height: 1.78; color: var(--ink-soft); }
.rl-body > *:first-child { margin-top: 0; }
.rl-body h2 { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; margin: 1.9em 0 .55em; color: var(--ink); letter-spacing: -.01em; }
.rl-body h3 { font-family: var(--serif); font-size: 1.28rem; font-weight: 600; margin: 1.5em 0 .45em; color: var(--ink); }
.rl-body h4 { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; margin: 1.3em 0 .4em; color: var(--ink); }
.rl-body p { margin: 0 0 1.25em; }
.rl-body ul, .rl-body ol { margin: 0 0 1.3em 1.4em; }
.rl-body ul { list-style: disc; }
.rl-body ol { list-style: decimal; }
.rl-body li { margin-bottom: .45em; }
.rl-body li::marker { color: var(--accent); }
.rl-body a { text-decoration: underline; text-decoration-color: rgba(194,65,12,.35); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.rl-body a:hover { text-decoration-color: var(--accent-2); }
.rl-body img { border-radius: var(--r-m); margin: 1.7em 0; }
.rl-body blockquote { margin: 1.7em 0; padding: 16px 26px; border-left: 3px solid var(--accent); background: var(--paper-2); border-radius: 0 var(--r-m) var(--r-m) 0; font-family: var(--serif); font-style: italic; font-size: 1.12em; color: var(--ink); }
.rl-body blockquote:empty { display: none; }
.rl-body pre { background: var(--dark); color: #e7e5e4; padding: 20px 22px; border-radius: var(--r-m); overflow-x: auto; margin: 1.7em 0; font-size: 14.5px; line-height: 1.6; }
.rl-body code { font-family: 'SFMono-Regular', 'Fira Code', Consolas, monospace; font-size: .9em; }
.rl-body :not(pre) > code { background: var(--paper-3); padding: 2px 6px; border-radius: 4px; color: var(--accent-2); }
.rl-body table { width: 100%; border-collapse: collapse; margin: 1.7em 0; font-size: 15px; }
.rl-body th, .rl-body td { padding: 11px 15px; border: 1px solid var(--line); text-align: left; }
.rl-body th { background: var(--paper-2); font-weight: 700; color: var(--ink); }
.rl-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

/* ---- share ---- */
.rl-share { display: flex; align-items: center; gap: 14px; margin-top: 36px; }
.rl-share-cap { font-size: 12px !important; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint) !important; }
.rl-share-row { display: flex; gap: 9px; }
.rl-share-a {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: var(--r-m); background: var(--paper-2); color: var(--muted); border: 1px solid var(--line);
  transition: all var(--ease);
}
.rl-share-a:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 5px 12px rgba(194,65,12,.22); }

.rl-sep { border: 0; border-top: 1px solid var(--line-soft); margin: 30px 0; }

/* ---- vote ---- */
.rl-vote { display: flex; align-items: center; gap: 18px; }
.rl-vote-cap { font-size: 15px; font-weight: 600; }
.rl-vote-row { display: flex; gap: 10px; }
.rl-vote-a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 17px; font-size: 14px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper); transition: all var(--ease); }
.rl-vote-a b { font-weight: 700; }
.rl-vote-up:hover { border-color: var(--ok); color: var(--ok); background: #f0fdf4; }
.rl-vote-down:hover { border-color: var(--no); color: var(--no); background: #fef2f2; }
.rl-vote-a.is-voted { opacity: .7; pointer-events: none; }

/* =======================================================================
   SECONDARY SECTIONS  (rendering-optimised)
   ======================================================================= */
.rl-talk, .rl-rel, .rl-aside, .rl-contact {
  margin-top: 36px;
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}
.rl-talk, .rl-rel, .rl-contact {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-l); padding: 34px; box-shadow: var(--sh-1);
}
.rl-talk-cap, .rl-rel-cap { font-size: 1.3rem; font-weight: 600; margin-bottom: 22px; }
.rl-card-cap { font-size: 16px; font-weight: 600; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--accent); display: inline-block; }
.rl-card-p { font-size: 13.5px; color: var(--faint); margin-bottom: 15px; }

/* inputs */
.rl-input {
  display: block; width: 100%; padding: 11px 15px; font-size: 15px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m);
  outline: none; transition: border-color var(--ease), box-shadow var(--ease);
}
.rl-input::placeholder { color: var(--faint); }
.rl-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194,65,12,.13); }
.rl-textarea { resize: vertical; min-height: 130px; line-height: 1.6; }

.rl-talk-form, .rl-contact-form { display: flex; flex-direction: column; gap: 16px; }
.rl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* more reading */
.rl-rel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.rl-rel-a { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--paper-2); border: 1px solid var(--line-soft); border-radius: var(--r-m); transition: all var(--ease); }
.rl-rel-a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--sh-1); }
.rl-rel-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.rl-rel-t { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.38; }

/* utility cards */
.rl-aside { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.rl-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); padding: 24px; box-shadow: var(--sh-1); }

.rl-join { display: flex; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; background: var(--paper); }
.rl-join .rl-input { border: 0; border-radius: 0; }
.rl-join .rl-input:focus { box-shadow: none; }
.rl-join-btn { display: flex; align-items: center; justify-content: center; width: 46px; flex-shrink: 0; background: var(--accent); color: #fff; transition: background var(--ease); }
.rl-join-btn:hover { background: var(--accent-2); }

.rl-hot-list { display: flex; flex-direction: column; }
.rl-hot-list li a { display: block; padding: 9px 0; font-size: 14.5px; color: var(--muted); border-bottom: 1px solid var(--line-soft); transition: color var(--ease), padding-left var(--ease); }
.rl-hot-list li:last-child a { border-bottom: 0; }
.rl-hot-list li a:hover { color: var(--accent); padding-left: 5px; }
.rl-hot-n { display: inline-block; width: 22px; font-family: var(--serif); font-weight: 700; color: var(--line); }
.rl-hot-list li a:hover .rl-hot-n { color: var(--accent-3); }

/* =======================================================================
   FOOTER
   ======================================================================= */
.rl-foot { background: var(--dark); color: #d6d3d1; content-visibility: auto; contain-intrinsic-size: auto 360px; }
.rl-foot-main { padding: 60px 0 42px; }
.rl-foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.1fr; gap: 44px; }
.rl-foot-mark img { height: 33px; width: auto; margin-bottom: 18px; filter: brightness(0) invert(1); }
.rl-foot-copy { font-size: 13px; color: #78716c; margin-bottom: 18px; }
.rl-foot-cap { font-size: 13px; font-weight: 600; color: #fff; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 16px; }
.rl-foot-links { display: flex; flex-direction: column; gap: 9px; }
.rl-foot-links a { font-size: 14px; color: #a8a29e; transition: color var(--ease), padding-left var(--ease); }
.rl-foot-links a:hover { color: #fff; padding-left: 5px; }
.rl-foot-mail { margin-top: 18px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; color: #78716c; }

.rl-soc { display: flex; gap: 10px; }
.rl-soc a { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); color: #a8a29e; transition: all var(--ease); }
.rl-soc a:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-2px); }

.rl-foot-base { padding: 20px 0; border-top: 1px solid rgba(255,255,255,.06); text-align: center; }
.rl-foot-base p { font-size: 13px; color: #57534e; margin: 0; }

/* =======================================================================
   TO-TOP + COOKIE
   ======================================================================= */
.rl-top {
  position: fixed; right: 24px; bottom: 24px; width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff;
  border-radius: var(--r-m); box-shadow: var(--sh-2); opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s, background var(--ease); z-index: 900;
}
.rl-top.is-on { opacity: 1; visibility: visible; transform: translateY(0); }
.rl-top:hover { background: var(--accent-2); transform: translateY(-2px); box-shadow: var(--sh-3); }

.rl-cookie {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; background: var(--dark-2); color: #d6d3d1;
  padding: 16px 0; transform: translateY(100%); transition: transform .4s var(--ease); box-shadow: 0 -6px 24px rgba(0,0,0,.18);
}
.rl-cookie.is-on { transform: translateY(0); }
.rl-cookie .rl-bound { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.rl-cookie p { font-size: 13px; color: #a8a29e; margin: 0; flex: 1; }
.rl-cookie a { color: var(--accent-3); text-decoration: underline; }

/* =======================================================================
   MODALS  (pure CSS :target, opened via #signin / #signup)
   ======================================================================= */
.rl-modal { position: fixed; inset: 0; z-index: 1300; display: none; align-items: center; justify-content: center; padding: 22px; }
.rl-modal:target { display: flex; }
.rl-modal-veil { position: absolute; inset: 0; background: rgba(28,25,23,.55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.rl-modal-box {
  position: relative; z-index: 1; width: 100%; max-width: 400px; background: var(--paper);
  border-radius: var(--r-l); box-shadow: var(--sh-3); padding: 28px; animation: rl-pop .25s var(--ease);
}
@keyframes rl-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.rl-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.rl-modal-cap { font-size: 1.3rem; font-weight: 600; }
.rl-modal-x { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-s); color: var(--faint); transition: background var(--ease), color var(--ease); }
.rl-modal-x:hover { background: var(--paper-3); color: var(--ink); }
.rl-modal-body { display: flex; flex-direction: column; gap: 13px; }
.rl-modal-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.rl-check { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); cursor: pointer; }
.rl-check input { accent-color: var(--accent); }
.rl-modal-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 14px; color: var(--faint); text-align: center; }
.rl-modal-switch { font-weight: 600; }

/* =======================================================================
   RESPONSIVE
   ======================================================================= */
@media (max-width: 900px) {
  .rl-foot-grid { grid-template-columns: 1fr 1fr; gap: 36px; }
}
@media (max-width: 768px) {
  :root { --bar: 58px; }
  body { font-size: 16px; }
  .rl-burger { display: flex; }
  .rl-nav {
    display: none; position: absolute; top: var(--bar); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 6px;
    background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: var(--sh-3); padding: 16px 22px;
  }
  .rl-nav.is-open { display: flex; }
  .rl-nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .rl-nav-a { width: 100%; padding: 11px 14px; }
  .rl-nav-cta { margin-left: 0; width: 100%; margin-top: 8px; }

  .rl-post { padding: 28px 22px; }
  .rl-body { font-size: 16.5px; }
  .rl-row { grid-template-columns: 1fr; }
  .rl-share { flex-wrap: wrap; gap: 10px; }
  .rl-vote { flex-direction: column; align-items: flex-start; gap: 12px; }
  .rl-talk, .rl-rel, .rl-contact { padding: 26px 22px; }
  .rl-foot-grid { grid-template-columns: 1fr; gap: 34px; }
  .rl-cookie .rl-bound { flex-direction: column; text-align: center; gap: 12px; }
}
@media (max-width: 480px) {
  .rl-bound { padding: 0 16px; }
  .rl-post { padding: 22px 16px; }
  .rl-talk, .rl-rel, .rl-contact, .rl-card { padding: 20px 16px; }
  .rl-rel-grid { grid-template-columns: 1fr; }
  .rl-modal-box { padding: 22px; }
  .rl-top { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
