/* PaddleBuddha — shared styles
   Light: rice paper & ink.  Dark: winter night under court lights. */

:root {
  --bg: #f3eee4;
  --bg-2: #ebe4d6;
  --surface: #fbf8f2;
  --ink: #2a2925;
  --ink-soft: #5d5a52;
  --ink-faint: #8f8a7e;
  --line: #ddd5c5;
  --accent: #6e7f5e;        /* moss */
  --accent-ink: #f7f4ec;
  --warm: #b8784e;          /* lantern clay */
  --mist-a: rgba(110, 127, 94, 0.10);
  --mist-b: rgba(184, 120, 78, 0.08);
  --shadow: 0 1px 2px rgba(42, 41, 37, .05), 0 12px 40px -12px rgba(42, 41, 37, .18);
  --radius: 22px;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Karla", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151b;
    --bg-2: #181c24;
    --surface: #1c2029;
    --ink: #ebe5d8;
    --ink-soft: #b5ae9f;
    --ink-faint: #7d786d;
    --line: #2c313c;
    --accent: #d6b46c;      /* court-light gold */
    --accent-ink: #1a1c22;
    --warm: #e09a6a;
    --mist-a: rgba(214, 180, 108, 0.07);
    --mist-b: rgba(120, 140, 190, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 50px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151b;
  --bg-2: #181c24;
  --surface: #1c2029;
  --ink: #ebe5d8;
  --ink-soft: #b5ae9f;
  --ink-faint: #7d786d;
  --line: #2c313c;
  --accent: #d6b46c;
  --accent-ink: #1a1c22;
  --warm: #e09a6a;
  --mist-a: rgba(214, 180, 108, 0.07);
  --mist-b: rgba(120, 140, 190, 0.08);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 50px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .6s ease, color .6s ease;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Slow drifting mist behind everything */
.mist {
  position: fixed; inset: -20%;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(40% 35% at 25% 30%, var(--mist-a), transparent 70%),
    radial-gradient(35% 40% at 75% 70%, var(--mist-b), transparent 70%);
  animation: drift 40s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(2%, 2%, 0) scale(1.06); }
}

/* Header */
.top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px clamp(16px, 4vw, 44px);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.brand-mark { width: 30px; height: 30px; color: var(--accent); transition: transform .8s ease; }
.brand:hover .brand-mark { transform: rotate(-25deg); }
.brand-name { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; letter-spacing: .01em; }
.brand-name em { font-style: italic; color: var(--accent); }

.sports { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.sport {
  font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--ink-soft);
}
.sport.is-active { background: var(--accent); color: var(--accent-ink); }
.sport.is-soon { opacity: .45; cursor: default; }

.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .5s ease, border-color .3s;
}
.theme-toggle:hover { transform: rotate(20deg); border-color: var(--accent); }
.theme-toggle svg { width: 20px; height: 20px; fill: var(--ink); stroke: var(--ink); stroke-width: 1.6; }
.theme-toggle .icon-sun circle { fill: none; }
.theme-toggle .icon-moon { display: none; stroke: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* Stage */
.stage {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 16px 40px;
}
.intro {
  margin: 0 0 22px;
  font-size: .8rem; letter-spacing: .32em; text-transform: uppercase; color: var(--ink-faint);
  text-align: center;
}

.meme {
  margin: 0;
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: opacity .7s ease, transform .7s ease;
}
.meme.is-fading { opacity: 0; transform: translateY(6px) scale(.995); }

.meme-frame { position: relative; aspect-ratio: 1 / 1; background: var(--bg-2); }
.meme-frame img { width: 100%; height: 100%; object-fit: cover; }
.meme-loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .3s; }
.meme.is-loading .meme-loading { opacity: 1; }
.meme-loading span { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.meme figcaption { padding: 26px clamp(20px, 5vw, 38px) 28px; text-align: center; }
.meme blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3.6vw, 1.75rem);
  line-height: 1.32;
  font-weight: 500;
  text-wrap: balance;
}
.meme cite {
  display: block; margin-top: 12px;
  font-style: normal; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint);
}
.meme cite:empty { display: none; }

.actions { margin-top: 26px; }
.btn-next {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px;
  border-radius: 999px; border: 1px solid var(--line);
  background: transparent; cursor: pointer;
  font-size: .95rem; letter-spacing: .02em; color: var(--ink-soft);
  transition: border-color .3s, color .3s, background .3s;
}
.btn-next svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; transition: transform .8s ease; }
.btn-next:hover { border-color: var(--accent); color: var(--ink); }
.btn-next:hover svg { transform: rotate(180deg); }

.share { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.share-label { font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-faint); margin-right: 6px; }
.share-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  color: var(--ink-soft); text-decoration: none;
  transition: transform .3s ease, color .3s, border-color .3s;
}
.share-btn svg { width: 18px; height: 18px; fill: currentColor; }
.share-btn svg.stroke { fill: none; stroke: currentColor; stroke-width: 1.8; }
.share-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

.local-note { margin-top: 18px; font-size: .8rem; color: var(--ink-faint); }
.local-note button { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: var(--ink-soft); }

/* Footer */
.foot { position: relative; z-index: 1; text-align: center; padding: 10px 16px 26px; color: var(--ink-faint); }
.foot p { margin: 4px 0; }
.foot > p:first-child { font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--ink-soft); }
.foot-small { font-size: .75rem; letter-spacing: .06em; display: flex; justify-content: center; gap: 10px; align-items: center; }
.quiet-link { text-decoration: none; opacity: .35; font-size: 1rem; padding: 0 4px; transition: opacity .4s; }
.quiet-link:hover, .quiet-link:focus-visible { opacity: 1; color: var(--accent); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: .88rem;
  max-width: calc(100vw - 32px); text-align: center;
  transition: opacity .35s, transform .35s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .top { flex-wrap: wrap; }
  .sports { order: 3; width: 100%; justify-content: center; }
  .brand-name { font-size: 1.3rem; }
  .meme { border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 560px) {
  .share-label { width: 100%; text-align: center; margin: 0 0 4px; }
  .intro { letter-spacing: .22em; }
}
