/* WeirdlyTemp — editorial minimal design system.
   Warm monochrome canvas, one hairline border weight, pastel accents used
   only for semantic state. No gradients, no heavy shadows. */

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-sunk: #f7f6f3;
  --line: #eaeaea;
  --line-strong: #dcdcda;

  --ink: #1a1a18;
  --ink-soft: #2f3437;
  --muted: #787774;
  --faint: #9b9a97;

  --green-bg: #edf3ec; --green-ink: #346538;
  --blue-bg:  #e1f3fe; --blue-ink:  #1f6c9f;
  --amber-bg: #fbf3db; --amber-ink: #956400;
  --red-bg:   #fdebec; --red-ink:   #9f2f2d;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "JetBrains Mono", monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --r: 8px;
  --r-lg: 12px;

  --glow: rgba(180, 150, 90, 0.05);
  --shadow: rgba(0, 0, 0, 0.04);
  --scrim: rgba(26, 26, 24, 0.42);
  --on-ink: #ffffff;
  color-scheme: light;
}

/* Dark palette. Warm charcoal rather than black, so the editorial feel of the
   light theme carries over instead of becoming a generic dark UI.
   The same block appears twice: once for an explicit choice, once for the
   system preference. Keep them in sync. */
:root[data-theme="dark"] {
  --bg: #131211;
  --surface: #1a1918;
  --surface-sunk: #201f1d;
  --line: #2c2a28;
  --line-strong: #3d3a36;

  --ink: #f2efea;
  --ink-soft: #ddd8d1;
  --muted: #9c958c;
  --faint: #726b63;

  --green-bg: #1b2a1c; --green-ink: #8fce93;
  --blue-bg:  #16283a; --blue-ink:  #8fc6ef;
  --amber-bg: #322612; --amber-ink: #e3b562;
  --red-bg:   #32191a; --red-ink:   #f0a3a1;

  --glow: rgba(200, 165, 100, 0.06);
  --shadow: rgba(0, 0, 0, 0.5);
  --scrim: rgba(0, 0, 0, 0.62);
  --on-ink: #131211;
  color-scheme: dark;
}

/* Follow the system when the visitor has not chosen explicitly. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131211;
    --surface: #1a1918;
    --surface-sunk: #201f1d;
    --line: #2c2a28;
    --line-strong: #3d3a36;

    --ink: #f2efea;
    --ink-soft: #ddd8d1;
    --muted: #9c958c;
    --faint: #726b63;

    --green-bg: #1b2a1c; --green-ink: #8fce93;
    --blue-bg:  #16283a; --blue-ink:  #8fc6ef;
    --amber-bg: #322612; --amber-ink: #e3b562;
    --red-bg:   #32191a; --red-ink:   #f0a3a1;

    --glow: rgba(200, 165, 100, 0.06);
    --shadow: rgba(0, 0, 0, 0.5);
    --scrim: rgba(0, 0, 0, 0.62);
    --on-ink: #131211;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* A single slow warm light spot for depth. Fixed and inert. */
body::before {
  content: "";
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(60% 60% at 30% 0%, var(--glow), transparent 70%);
  animation: drift 28s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-3%, 0, 0) scale(1); }
  to   { transform: translate3d(4%, 2%, 0) scale(1.08); }
}

/* ---------- structure ---------- */

.shell { position: relative; z-index: 1; max-width: 1000px; margin: 0 auto; padding: 0 24px 120px; }
.narrow { max-width: 760px; }

nav {
  display: flex; align-items: baseline; gap: 28px;
  padding: 28px 0 44px;
}

.brand {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand em { font-style: italic; }

.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  display: block; flex-shrink: 0;
  transition: transform 320ms var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }

nav a.link {
  font-size: 14px; color: var(--muted); text-decoration: none;
  padding-bottom: 2px; border-bottom: 1px solid transparent;
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}
nav a.link:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
nav a.link[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

.theme-toggle {
  align-self: center;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
  transition: color 180ms var(--ease), border-color 180ms var(--ease),
              background 180ms var(--ease), transform 120ms var(--ease);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-sunk); }
.theme-toggle:active { transform: scale(0.94); }

/* One icon is shown at a time; the pair cross-fades and rotates on switch. */
.theme-toggle svg {
  grid-area: 1 / 1;
  transition: opacity 260ms var(--ease), transform 380ms var(--ease);
}
.theme-toggle { display: grid; place-items: center; }
.theme-toggle .ico-sun  { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle .ico-moon { opacity: 0; transform: rotate(-70deg) scale(0.6); }
.theme-toggle[aria-pressed="true"] .ico-sun  { opacity: 0; transform: rotate(70deg) scale(0.6); }
.theme-toggle[aria-pressed="true"] .ico-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* Repainting the whole page on a theme flip looks abrupt; ease the surfaces.
   Excluded from the transition are anything already animating. */
body, .card, .msg, input, pre, .key, dialog, footer, .theme-toggle {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 260ms;
  transition-timing-function: var(--ease);
}

h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-weight: 400;
  margin: 0 0 14px;
}
h1 em { font-style: italic; color: var(--muted); }

h2 {
  font-family: var(--serif);
  font-size: 25px; line-height: 1.2; letter-spacing: -0.02em;
  color: var(--ink); font-weight: 400; margin: 0 0 16px;
}

h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint); font-weight: 600; margin: 0 0 14px;
}

.lede { font-size: 16px; color: var(--muted); margin: 0 0 40px; max-width: 62ch; }

section { margin-bottom: 72px; }

/* ---------- surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: box-shadow 220ms var(--ease), border-color 220ms var(--ease);
}
.card.interactive:hover {
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px var(--shadow);
}

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

button, .btn {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  padding: 9px 16px; border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: background 160ms var(--ease), border-color 160ms var(--ease),
              transform 120ms var(--ease), color 160ms var(--ease);
}
button:hover, .btn:hover { background: var(--surface-sunk); border-color: var(--muted); }
button:active, .btn:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

button.primary, .btn.primary {
  background: var(--ink); border-color: var(--ink); color: var(--on-ink);
}
button.primary:hover, .btn.primary:hover { opacity: 0.86; }

button.quiet {
  border-color: transparent; background: transparent; color: var(--muted);
  padding: 6px 10px;
}
button.quiet:hover { background: var(--surface-sunk); color: var(--ink); }

button.danger { color: var(--red-ink); }
button.danger:hover { background: var(--red-bg); border-color: var(--red-ink); }

input, textarea {
  font-family: var(--sans); font-size: 14px;
  padding: 10px 12px; width: 100%;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--ink);
  transition: border-color 160ms var(--ease);
}
input:focus, textarea:focus { outline: none; border-color: var(--ink); }
input::placeholder { color: var(--faint); }
input.mono { font-family: var(--mono); }

label {
  display: block; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--faint); margin-bottom: 7px;
}

.field { margin-bottom: 18px; }

/* ---------- tags, code, keys ---------- */

.tag {
  display: inline-block; border-radius: 9999px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; padding: 3px 10px;
  background: var(--surface-sunk); color: var(--muted);
}
.tag.green { background: var(--green-bg); color: var(--green-ink); }
.tag.blue  { background: var(--blue-bg);  color: var(--blue-ink); }
.tag.amber { background: var(--amber-bg); color: var(--amber-ink); }
.tag.red   { background: var(--red-bg);   color: var(--red-ink); }

code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--surface-sunk); padding: 2px 6px; border-radius: 4px;
  color: var(--ink);
}

pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  background: var(--surface-sunk); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 20px; margin: 0;
  overflow-x: auto;
}
pre code { background: none; padding: 0; font-size: inherit; }

kbd {
  font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 4px; background: var(--surface-sunk);
  padding: 2px 6px; color: var(--muted);
}

/* ---------- feedback ---------- */

.notice {
  border-radius: var(--r); padding: 12px 16px; font-size: 14px;
  border: 1px solid var(--line); background: var(--surface-sunk);
  margin-bottom: 20px;
}
.notice.error { background: var(--red-bg); border-color: #f3d6d7; color: var(--red-ink); }
.notice.ok    { background: var(--green-bg); border-color: #d9e5d8; color: var(--green-ink); }
.notice[hidden] { display: none; }

.dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green-ink); margin-right: 8px; vertical-align: middle;
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.25; } }

.empty {
  text-align: center; padding: 72px 24px; color: var(--faint);
  font-family: var(--serif); font-size: 18px; font-style: italic;
}

/* ---------- motion ---------- */

.reveal { opacity: 0; transform: translateY(12px); }
.reveal.shown {
  opacity: 1; transform: none;
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.enter { animation: enter 420ms var(--ease) backwards; }

@keyframes flash {
  0%   { background: var(--amber-bg); }
  100% { background: var(--surface); }
}
.flash { animation: flash 1600ms var(--ease); }

@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 700ms linear infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- utility ---------- */

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.grow { flex: 1; min-width: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hairline { height: 1px; background: var(--line); border: 0; margin: 0; }
[hidden] { display: none !important; }

footer {
  border-top: 1px solid var(--line);
  padding-top: 28px; margin-top: 88px;
  font-size: 13px; color: var(--faint);
}

.footer-grid {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.footer-credit { margin-right: auto; }
.credit-name { font-size: 14px; color: var(--ink); }
.credit-name strong { font-weight: 600; }
.credit-sub { font-size: 12.5px; color: var(--faint); margin-top: 2px; }

.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; transition: color 160ms var(--ease); }
.footer-links a:hover { color: var(--ink); }

.footer-actions { display: flex; gap: 10px; align-items: center; }

.discord-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 500; text-decoration: none;
  padding: 8px 15px; border-radius: 6px;
  background: #5865f2; color: #fff; border: 1px solid #5865f2;
  transition: background 160ms var(--ease), transform 120ms var(--ease);
}
.discord-btn:hover { background: #4752c4; border-color: #4752c4; }
.discord-btn:active { transform: scale(0.98); }
.discord-btn svg { flex-shrink: 0; }

.donate-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; padding: 8px 15px;
}
.donate-btn svg { color: var(--red-ink); flex-shrink: 0; }

#donate-dialog {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink-soft);
  max-width: 460px; width: 92%; padding: 0;
  box-shadow: 0 8px 40px var(--shadow);
}
#donate-dialog::backdrop { background: var(--scrim); }
#donate-dialog[open] { animation: enter 300ms var(--ease); }

.donate-head { padding: 26px 28px 18px; }
.donate-title {
  font-family: var(--serif); font-size: 22px; color: var(--ink);
  letter-spacing: -0.02em; margin-bottom: 8px;
}
.donate-body { padding: 0 28px 24px; }
.ltc {
  font-family: var(--mono); font-size: 12.5px; word-break: break-all;
  background: var(--surface-sunk); border: 1px solid var(--line);
  border-radius: 6px; padding: 13px 15px; color: var(--ink); line-height: 1.5;
}
.donate-foot {
  border-top: 1px solid var(--line); background: var(--surface-sunk);
  padding: 13px 28px; display: flex; justify-content: flex-end;
}
