/* ============================================================
   THE MEME CEMETERY
   Gothic graveyard aesthetic. No gradients, no glassmorphism,
   no purple-pink vibes. Stone, bone, gold, moss, and night.
   ============================================================ */

@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/cinzel-400.woff2") format("woff2");
}
@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/cinzel-700.woff2") format("woff2");
}
@font-face {
  font-family: "Fell SC";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/fell-sc-400.woff2") format("woff2");
}

:root {
  --night: #0b0b0e;
  --night-deep: #070709;
  --panel: #15161a;
  --stone-a: #9a9488;
  --stone-b: #8d877a;
  --stone-c: #a49e91;
  --stone-engrave: #38352d;
  --bone: #e9e4d6;
  --bone-dim: #b9b3a4;
  --gold: #b8a35a;
  --gold-dim: #8a7a44;
  --moss: #3e4a36;
  --grass: #171b15;
  --flame: #d96a3a;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--night);
  color: var(--bone);
  font-family: var(--serif);
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* ---------- Night sky ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--night-deep);
  background-image: url("/assets/stars.svg");
  background-repeat: repeat;
  background-size: 256px 256px;
  animation: drift 240s linear infinite;
}

@keyframes drift {
  from { background-position: 0 0; }
  to   { background-position: 256px 256px; }
}

.fog {
  position: fixed;
  left: -20%;
  width: 140%;
  height: 26px;
  z-index: 1;
  pointer-events: none;
  background: #17191d;
  filter: blur(14px);
  opacity: .55;
}
.fog:nth-of-type(1) { top: 34%; animation: fog-a 90s linear infinite; }
.fog:nth-of-type(2) { top: 62%; animation: fog-b 130s linear infinite; }

@keyframes fog-a {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(-8%); }
  100% { transform: translateX(0); }
}
@keyframes fog-b {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(7%); }
  100% { transform: translateX(0); }
}

/* ---------- Masthead ---------- */

.masthead {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 4.5rem 1rem 2.5rem;
}

.moon {
  width: 74px;
  height: 74px;
  margin: 0 auto 1.4rem;
  border-radius: 50%;
  background: var(--bone);
  box-shadow:
    0 0 0 1px rgba(233, 228, 214, .25),
    0 0 26px 4px rgba(233, 228, 214, .28),
    0 0 60px 18px rgba(184, 163, 90, .12);
}

.site-title {
  font-family: "Cinzel", var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3.6rem);
  letter-spacing: .18em;
  text-transform: uppercase;
  margin: 0;
  color: var(--bone);
  text-shadow: 0 0 18px rgba(184, 163, 90, .35);
}

.site-title::before,
.site-title::after {
  content: "";
  display: block;
  width: min(520px, 80vw);
  height: 1px;
  margin: .9rem auto;
  background: var(--gold-dim);
  box-shadow: 0 0 8px rgba(184, 163, 90, .4);
}

.tagline {
  margin: .4rem 0 0;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--bone-dim);
  letter-spacing: .04em;
}

.notice {
  margin: 1.1rem auto 0;
  max-width: 46ch;
  font-size: .82rem;
  color: var(--gold-dim);
  font-style: italic;
}

/* ---------- Toolbar ---------- */

.toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .8rem 1.1rem;
  max-width: 1100px;
  margin: 0 auto 1.4rem;
  padding: 1rem 1.2rem;
  background: var(--panel);
  border: 1px solid #26282e;
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .9);
}

.search {
  flex: 1 1 240px;
  max-width: 340px;
  padding: .55rem .8rem;
  font-family: var(--serif);
  font-size: .95rem;
  color: var(--bone);
  background: var(--night-deep);
  border: 1px solid #2e3138;
  outline: none;
}
.search::placeholder { color: #5c5f68; font-style: italic; }
.search:focus { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.chip {
  font-family: var(--serif);
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bone-dim);
  background: transparent;
  border: 1px solid #2e3138;
  padding: .35rem .7rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--gold-dim); color: var(--bone); }
.chip.active {
  color: var(--night);
  background: var(--gold);
  border-color: var(--gold);
}

.sort {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: var(--bone-dim);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.sort select {
  font-family: var(--serif);
  font-size: .85rem;
  color: var(--bone);
  background: var(--night-deep);
  border: 1px solid #2e3138;
  padding: .4rem .5rem;
  outline: none;
}
.sort select:focus { border-color: var(--gold); }

/* ---------- Per-meme SEO pages ---------- */

.masthead-small {
  padding: 2.2rem 1rem 1.4rem;
}

.memorial-page {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.2rem 3rem;
}

.breadcrumb {
  font-size: .78rem;
  letter-spacing: .05em;
  color: var(--bone-dim);
  margin: 0 0 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.breadcrumb a {
  color: var(--gold-dim);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--gold); text-decoration: underline; }
.breadcrumb span[aria-current] { color: var(--bone); }

.meme-article {
  background: var(--panel);
  border: 1px solid #2e3138;
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .9);
  padding: 2rem 1.6rem 1.8rem;
}

.meme-head {
  text-align: center;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--gold-dim);
}

.meme-stone {
  width: 118px;
  margin: 0 auto 1.2rem;
}

.meme-title {
  font-family: "Cinzel", var(--serif);
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: .08em;
  color: var(--gold);
  margin: 0;
}

.meme-years {
  font-family: "Cinzel", var(--serif);
  font-size: .8rem;
  letter-spacing: .16em;
  color: var(--bone-dim);
  margin: .45rem 0 0;
}

.meme-epitaph {
  font-style: italic;
  font-size: 1rem;
  color: var(--bone);
  margin: .7rem 0 0;
}

.meme-body { padding: 1.2rem 0 .2rem; }

.meme-section {
  font-family: "Cinzel", var(--serif);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 .6rem;
}

.meme-eulogy {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--bone);
  margin: 0 0 1.3rem;
}

.meme-actions {
  display: flex;
  justify-content: center;
  padding-top: .4rem;
}

.candle-link {
  display: inline-block;
  font-family: var(--serif);
  font-size: .9rem;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--gold-dim);
  padding: .55rem 1.1rem;
  text-decoration: none;
}
.candle-link:hover {
  color: var(--night);
  background: var(--gold);
  border-color: var(--gold);
}

/* related plots */
.neighbors {
  margin-top: 2rem;
}
.neighbors-title {
  font-family: "Cinzel", var(--serif);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-dim);
  text-align: center;
  margin: 0 0 1rem;
}
.neighbors-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .8rem;
}
.neighbor {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 1rem .6rem;
  background: var(--panel);
  border: 1px solid #26282e;
}
.neighbor:hover { border-color: var(--gold-dim); }
.neighbor-name {
  display: block;
  font-family: "Fell SC", var(--serif);
  font-size: 1.05rem;
  color: var(--bone);
}
.neighbor-years {
  display: block;
  font-family: "Cinzel", var(--serif);
  font-size: .68rem;
  letter-spacing: .1em;
  color: var(--bone-dim);
  margin-top: .3rem;
}

/* ---------- Ad slot ---------- */

.ad-slot {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto 2.2rem;
  padding: .7rem 1.4rem .9rem;
  background: var(--panel);
  border: 1px solid #2e3138;
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .9);
  text-align: center;
}

.ad-kicker {
  margin: 0 0 .5rem;
  font-family: "Cinzel", var(--serif);
  font-size: .62rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.ad-creative {
  display: block;
  padding: .9rem 1rem 1rem;
  border: 1px solid #26282e;
  text-decoration: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.ad-creative:hover {
  border-color: var(--gold-dim);
  box-shadow: 0 0 18px -6px rgba(217, 106, 58, .45);
}

.ad-headline,
.ad-text,
.ad-cta {
  display: block;
}

.ad-headline {
  font-family: "Cinzel", var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
}

.ad-text {
  margin: .45rem auto .7rem;
  max-width: 52ch;
  font-size: .88rem;
  line-height: 1.5;
  color: var(--bone-dim);
  font-style: italic;
}

.ad-cta {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--bone);
  border: 1px solid var(--gold-dim);
  padding: .35rem .8rem;
}
.ad-creative:hover .ad-cta {
  color: var(--night);
  background: var(--gold);
  border-color: var(--gold);
}

.ad-empty {
  margin: .2rem 0 .3rem;
  font-size: .88rem;
  font-style: italic;
  color: var(--bone-dim);
}

.ad-email {
  display: inline-block;
  font-family: "Cinzel", var(--serif);
  font-size: .78rem;
  letter-spacing: .08em;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: .4rem .9rem;
  text-decoration: none;
}
.ad-email:hover {
  color: var(--night);
  background: var(--gold);
  border-color: var(--gold);
}

/* ---------- Graveyard ---------- */

.graveyard {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.2rem 4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 2.2rem 1.4rem;
}

.digging {
  grid-column: 1 / -1;
  text-align: center;
  font-style: italic;
  color: var(--bone-dim);
  padding: 3rem 0;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  font-style: italic;
  color: var(--bone-dim);
  padding: 3rem 0;
}
.empty strong { color: var(--bone); }

.plot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  outline: none;
  padding-bottom: 26px;
}

/* grass mound under each stone */
.plot::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -14%;
  width: 128%;
  height: 22px;
  border-radius: 50%;
  background: var(--grass);
  box-shadow: inset 0 4px 6px -4px rgba(0, 0, 0, .9);
  z-index: 0;
}

.tombstone {
  position: relative;
  width: 118px;
  height: 158px;
  border-radius: 52% 52% 5px 5px / 24% 24% 5px 5px;
  z-index: 1;
  transition: transform .18s ease, box-shadow .18s ease;
}

/* engraved text panel on the stone */
.tombstone::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 12px;
  right: 12px;
  bottom: 14px;
  border-radius: 46% 46% 4px 4px / 22% 22% 4px 4px;
  background: rgba(0, 0, 0, .16);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2), inset 0 8px 14px -10px rgba(0, 0, 0, .6);
}

.tombstone .t-name,
.tombstone .t-years,
.tombstone .t-epitaph {
  position: absolute;
  left: 6%;
  right: 6%;
  text-align: center;
  color: var(--stone-engrave);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .22);
  z-index: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tombstone .t-name {
  top: 18%;
  font-family: "Fell SC", var(--serif);
  font-size: 1.05rem;
  line-height: 1.15;
  white-space: nowrap;
  max-width: 92%;
  margin: 0 auto;
}

.tombstone .t-years {
  top: 44%;
  font-family: "Cinzel", var(--serif);
  font-size: .68rem;
  letter-spacing: .08em;
}

.tombstone .t-epitaph {
  top: 58%;
  font-style: italic;
  font-size: .66rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* stone shades — cycled by JS via data-shade */
.tombstone[data-shade="0"] { background: var(--stone-a); }
.tombstone[data-shade="1"] { background: var(--stone-b); }
.tombstone[data-shade="2"] { background: var(--stone-c); }
.tombstone[data-shade="3"] { background: #948e82; }

.tombstone[data-tilt="0"] { transform: rotate(-1.1deg); }
.tombstone[data-tilt="1"] { transform: rotate(0.9deg); }
.tombstone[data-tilt="2"] { transform: rotate(-0.5deg); }
.tombstone[data-tilt="3"] { transform: rotate(1.4deg); }

.plot:hover .tombstone,
.plot:focus-visible .tombstone {
  transform: translateY(-4px) rotate(0deg);
  box-shadow:
    0 0 0 1px rgba(233, 228, 214, .18),
    0 0 22px 2px rgba(217, 106, 58, .35),
    0 18px 26px -12px rgba(0, 0, 0, .85);
}

/* newest plot — the most recently departed resident */
.plot.newest .tombstone {
  box-shadow:
    0 0 0 1px rgba(184, 163, 90, .55),
    0 0 20px 3px rgba(184, 163, 90, .30);
}

.newest-plaque {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-family: "Cinzel", var(--serif);
  font-size: .54rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--night);
  background: var(--gold);
  padding: .18rem .55rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}

/* grave walk — the stone being visited pulses like a candle */
.plot.walking .tombstone {
  animation: walk-glow .9s ease-in-out infinite alternate;
  z-index: 3;
}

@keyframes walk-glow {
  from {
    box-shadow: 0 0 0 1px rgba(217, 106, 58, .35),
                0 0 12px 1px rgba(217, 106, 58, .4);
  }
  to {
    box-shadow: 0 0 0 1px rgba(217, 106, 58, .95),
                0 0 34px 8px rgba(217, 106, 58, .75);
  }
}

/* candle that appears when you visit a plot */
.plot .candle-visitor {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.2rem;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  filter: drop-shadow(0 0 6px rgba(217, 106, 58, .8));
  animation: candle-flicker 1.1s ease-in-out infinite alternate;
  transition: opacity .2s ease;
}
.plot:hover .candle-visitor,
.plot:focus-visible .candle-visitor { opacity: 1; }

@keyframes candle-flicker {
  from { transform: translateX(-50%) translateY(0) scale(1); }
  to   { transform: translateX(-50%) translateY(-3px) scale(1.08); }
}

/* ---------- Modal / obelisk ---------- */

.obelisk {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(640px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid #34373f;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .6),
    0 0 40px 2px rgba(184, 163, 90, .12),
    0 30px 60px -20px rgba(0, 0, 0, .95);
  color: var(--bone);
  padding: 2.2rem 2rem 1.6rem;
}
.obelisk::backdrop {
  background: rgba(5, 5, 7, .82);
}

.close {
  position: absolute;
  top: .7rem;
  right: .8rem;
  background: none;
  border: none;
  color: var(--bone-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: .35rem .5rem;
}
.close:hover { color: var(--bone); }

.memorial-head {
  text-align: center;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--gold-dim);
}

.memorial-name {
  font-family: "Cinzel", var(--serif);
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: .1em;
  color: var(--gold);
  margin: 0;
}

.memorial-years {
  font-family: "Cinzel", var(--serif);
  font-size: .8rem;
  letter-spacing: .14em;
  color: var(--bone-dim);
  margin: .4rem 0 0;
}

.memorial-epitaph {
  font-style: italic;
  font-size: 1rem;
  color: var(--bone);
  margin: .7rem 0 0;
}

.memorial-body { padding: 1.1rem 0 .4rem; }

.memorial-eulogy {
  font-size: .98rem;
  line-height: 1.65;
  color: var(--bone);
  margin: 0 0 1.2rem;
}

.memorial-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: .55rem;
  margin: 0;
  padding: 1rem 1rem .9rem;
  border: 1px solid #2e3138;
  background: var(--night-deep);
}
.memorial-facts div {
  display: flex;
  gap: .8rem;
  align-items: baseline;
}
.memorial-facts dt {
  flex: 0 0 128px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gold-dim);
}
.memorial-facts dd {
  margin: 0;
  font-size: .92rem;
  color: var(--bone);
}

.memorial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: 1.2rem;
}
.memorial-actions button {
  flex: 1 1 auto;
  font-family: var(--serif);
  font-size: .92rem;
  padding: .6rem 1rem;
  cursor: pointer;
}
.candle {
  color: var(--bone);
  background: transparent;
  border: 1px solid #5c4126;
}
.candle:hover { border-color: var(--flame); box-shadow: 0 0 14px -2px rgba(217, 106, 58, .5); }
.share {
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--gold-dim);
}
.share:hover { border-color: var(--gold); }
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: .92rem;
  padding: .6rem 1rem;
  color: var(--bone);
  background: transparent;
  border: 1px solid #2e3138;
  text-decoration: none;
}
.page-link:hover { border-color: var(--bone-dim); }

/* ---------- Buy Me a Coffee button ---------- */
/* Self-hosted replica of the official BMC widget — same yellow, same cup,
   same destination. No third-party script, works with JS disabled. */

.bmc {
  display: inline-flex;
  align-items: center;
  height: 44px;
  background: #FFDD00;
  color: #000000;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 15px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 24px;
  font-weight: bold;
  text-decoration: none;
  box-shadow: 0 4px 15px 0 rgba(0, 0, 0, .2);
  margin: 0 auto 1.2rem;
}
.bmc:hover {
  box-shadow: 0 4px 18px 0 rgba(217, 106, 58, .45);
}
.bmc:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.bmc-icon {
  width: 28px;
  height: auto;
  display: block;
}

.bmc-text {
  margin-left: 8px;
  white-space: nowrap;
}

/* ---------- Footer ---------- */

.foot {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2.4rem 1rem 3rem;
  border-top: 1px solid #1d1f25;
}
.foot p { margin: 0 0 .3rem; color: var(--bone-dim); font-size: .9rem; }
.foot-small { color: #5c5f68 !important; font-size: .74rem !important; letter-spacing: .06em; }

.noscript {
  position: relative;
  z-index: 2;
  max-width: 46ch;
  margin: 0 auto;
  padding: 1.4rem;
  text-align: center;
  color: var(--bone-dim);
  border: 1px solid #2e3138;
}

/* ---------- Walk controls ---------- */

.walk-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: .7rem;
}

.newest-link {
  font-family: var(--serif);
  font-size: .82rem;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px dashed var(--gold-dim);
  padding-bottom: .1rem;
}
.newest-link:hover { color: var(--bone); border-color: var(--gold); }

.walk-btn {
  font-family: var(--serif);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bone-dim);
  background: transparent;
  border: 1px solid #2e3138;
  padding: .4rem .85rem;
  cursor: pointer;
}
.walk-btn:hover { border-color: var(--gold-dim); color: var(--bone); }

/* ---------- Focus + motion ---------- */

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .sky, .fog, .candle-visitor, .plot.walking .tombstone { animation: none !important; }
  .plot:hover .tombstone { transform: none; }
}

@media (max-width: 560px) {
  .memorial-facts div { flex-direction: column; gap: .15rem; }
  .memorial-facts dt { flex: none; }
}
