/* Paper: the light theme used by the site, dashboard, admin and share pages. */
:root {
  --bg: #f3f0e8;
  --bg-2: #ebe7dc;
  --panel: #fbf9f3;
  --panel-2: #efebe0;
  --panel-3: #e3decf;
  --field: #fffdf8;
  --border: #dcd6c6;
  --border-2: #c4bca6;
  --text: #17150f;
  --text-2: #4a463a;
  --muted: #6f6a5a;
  --accent: #ffd60a;
  --accent-2: #17150f;
  --accent-soft: #fff0a3;
  --on-accent: #17150f;
  --fill: #17150f;
  --green: #1a7f4b;
  --yellow: #a85a00;
  --red: #c8321f;
  --stage: #11110f;
  --scroll: #cbc4b0;
  --focus-border: #17150f;
  --focus-ring: #ffd60a;
  --cta-border: #17150f;
  --cta-shadow: 3px 3px 0 #17150f;
  --pop-border: #17150f;
  --pop-shadow: 6px 6px 0 #17150f;
  --shadow: 0 1px 0 rgba(23, 21, 15, 0.04), 0 14px 36px rgba(23, 21, 15, 0.14);
  --backdrop: rgba(23, 21, 15, 0.45);
  --radius: 6px;
  --radius-sm: 4px;
  --font: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  color-scheme: light;
}

/* Darkroom: the graphite theme used by the editor (and dark blocks on light pages). */
[data-theme='dark'] {
  --bg: #0f0f0d;
  --bg-2: #161614;
  --panel: #1c1c19;
  --panel-2: #24241f;
  --panel-3: #2e2e28;
  --field: #131311;
  --border: #2c2c26;
  --border-2: #3f3f37;
  --text: #f2efe6;
  --text-2: #bdb9aa;
  --muted: #86826f;
  --accent: #ffd60a;
  --accent-2: #ffe04a;
  --accent-soft: rgba(255, 214, 10, 0.13);
  --on-accent: #17150f;
  --fill: #ffd60a;
  --green: #4cc38a;
  --yellow: #ff9d3c;
  --red: #ff6452;
  --stage: #0a0a09;
  --scroll: #3a3a33;
  --focus-border: #ffd60a;
  --focus-ring: rgba(255, 214, 10, 0.2);
  --cta-border: transparent;
  --cta-shadow: none;
  --pop-border: #3f3f37;
  --pop-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  --backdrop: rgba(0, 0, 0, 0.62);
  color-scheme: dark;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
a:not([class]) { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
img, video, canvas { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.12; letter-spacing: -0.02em; font-family: var(--display); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
/* Highlighter swipe behind a phrase. */
.grad-text { background: linear-gradient(transparent 56%, var(--accent) 56% 92%, transparent 92%); padding: 0 0.08em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
[data-theme='dark'] .grad-text { background: none; padding: 0; color: var(--accent); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
:focus-visible { outline: 2px solid var(--focus-border); outline-offset: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--border-2);
  background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s, box-shadow 0.08s, opacity 0.12s; white-space: nowrap;
  text-decoration: none !important;
}
.btn:hover { background: var(--panel-2); border-color: var(--text-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.primary:hover { background: var(--text-2); border-color: var(--text-2); }
/* The one loud button per screen: solid highlighter fill. */
.btn.grad { background: var(--accent); border-color: var(--cta-border); color: var(--on-accent); box-shadow: var(--cta-shadow); }
.btn.grad:hover { background: var(--accent); border-color: var(--cta-border); filter: brightness(1.05); transform: translate(-1px, -1px); }
.btn.grad:active { transform: translate(2px, 2px); box-shadow: none; }
.btn.grad:disabled { transform: none; filter: none; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); border-color: transparent; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: var(--radius-sm); }
.btn.lg { height: 48px; padding: 0 24px; font-size: 16px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--border-2);
  background: var(--field); color: var(--text); font: inherit; outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.input::placeholder { color: var(--muted); opacity: 0.75; }
.input:focus { border-color: var(--focus-border); box-shadow: 0 0 0 3px var(--focus-ring); }
.input:disabled { background: var(--panel-2); color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { accent-color: var(--fill); width: 16px; height: 16px; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 3px; font: 600 10.5px/1.5 var(--mono);
  background: var(--panel-3); color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em;
}
.badge.accent { background: var(--accent-soft); color: var(--accent-2); }
.badge.green { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.badge.red { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.badge.yellow { background: color-mix(in srgb, var(--yellow) 16%, transparent); color: var(--yellow); }

/* Top nav */
.nav {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--text);
}
.logo { display: inline-flex; align-items: center; gap: 10px; font: 800 19px var(--display); color: var(--text) !important; text-decoration: none !important; letter-spacing: -0.03em; }
.logo-mark { width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); border: 1px solid var(--cta-border); display: grid; place-items: center; }
.logo-mark svg { width: 17px; height: 17px; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { color: var(--text-2); padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 500; text-decoration: none; }
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--panel-2); }

.avatar {
  width: 34px; height: 34px; border-radius: var(--radius); background: var(--text); color: var(--bg); display: grid; place-items: center;
  font: 700 14px var(--display); cursor: pointer; border: 0; text-transform: uppercase;
}
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--panel); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow); z-index: 100;
}
.menu-pop .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-pop button, .menu-pop a {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); border: 0; background: none;
  color: var(--text); font: inherit; cursor: pointer; text-align: left; text-decoration: none;
}
.menu-pop button:hover, .menu-pop a:hover { background: var(--panel-2); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(3px); z-index: 1000; display: grid; place-items: center;
  padding: 16px; animation: fade 0.15s ease;
}
.modal {
  width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--pop-border);
  border-radius: 8px; box-shadow: var(--pop-shadow); animation: pop 0.16s ease;
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.modal-head h3 { margin: 0; font-size: 19px; flex: 1; }
.modal-body { padding: 16px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* Toasts: inverted against the page in either theme. */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--text); border-left: 4px solid var(--accent); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-weight: 600; animation: pop 0.2s ease; max-width: min(520px, calc(100vw - 32px));
}
.toast.error { border-left-color: #ff6452; }
.toast.success { border-left-color: #4cc38a; }

/* Progress */
.progress { height: 8px; border-radius: 2px; background: var(--panel-3); overflow: hidden; }
.progress > div { height: 100%; background: var(--fill); transition: width 0.2s; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font: 600 10.5px var(--mono); color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border-2); background: var(--panel); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.06em; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--panel-2); }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--panel-3); border-top-color: var(--fill); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-page { min-height: 60vh; display: grid; place-items: center; }

.announcement { background: var(--text); color: var(--bg); text-align: center; padding: 8px 16px; font-weight: 600; font-size: 13px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: var(--accent); color: var(--on-accent); }

@media (max-width: 720px) {
  .nav { padding: 0 16px; gap: 10px; }
  .nav-links { display: none; }
}

/* Long-form pages (terms, privacy) */
.prose { max-width: 760px; margin: 0 auto; padding: 48px 20px 72px; font-size: 15px; line-height: 1.7; color: var(--text-2); }
.prose h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; color: var(--text); margin-bottom: 6px; }
.prose h2 { font-size: 20px; color: var(--text); margin: 36px 0 10px; padding-top: 18px; border-top: 1px solid var(--border-2); }
.prose ul { padding-left: 20px; margin: 0 0 1em; }
.prose li { margin: 4px 0; }
.prose strong { color: var(--text); }
.site-foot { border-top: 1px solid var(--text); padding: 24px; color: var(--muted); font-size: 13px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--text); }
