/* AI Author Blocks — dark editorial theme
   Palette lifted from the markdown-reader design: near-black chrome, warm serif
   display type, and a deep red accent with a soft red for links/active state. */

:root {
  /* Core chrome (dark UI frame) */
  --chrome:   #14161b;   /* page background */
  --chrome-2: #1c1f26;   /* topbar, cards, panels */
  --chrome-3: #23262f;   /* raised: inputs, buttons, tiles */
  --line:     #2a2e38;   /* borders */
  --line-2:   #3a4150;   /* hover borders / stronger lines */

  /* Text */
  --ui:       #d2d7e0;   /* primary text */
  --ui-soft:  #aab0bd;   /* strong secondary */
  --ui-dim:   #878d9b;   /* dim secondary */

  /* Accent (deep red) */
  --accent:      #b23a3a;
  --accent-soft: #d96b6b;
  --accent-hover:#c64a49;
  --accent-tint: rgba(178,58,58,.14);
  --accent-tint-2: rgba(178,58,58,.26);

  --ok:      #4fa07d;  --ok-tint:    rgba(79,160,125,.15);
  --warn:    #c8964a;  --warn-tint:  rgba(200,150,74,.15);
  --danger:  #e0645c;  --danger-tint:rgba(224,100,92,.14);

  /* Legacy aliases so page-level styles keep working with the new palette. */
  --paper:     var(--chrome);
  --paper-2:   var(--chrome-3);
  --card:      var(--chrome-2);
  --ink:       var(--ui);
  --ink-2:     var(--ui-soft);
  --muted:     var(--ui-dim);
  --tile:      var(--chrome-3);
  --accent-700:var(--accent-soft);      /* links must read light on dark */
  --accent-050:var(--accent-tint);
  --accent-100:var(--accent-tint-2);
  --ok-050:    var(--ok-tint);
  --danger-050:var(--danger-tint);

  --radius:   14px;
  --radius-sm:10px;
  --shadow:   0 1px 2px rgba(0,0,0,.4), 0 14px 34px rgba(0,0,0,.45);
  --shadow-lift: 0 3px 10px rgba(0,0,0,.5), 0 28px 60px rgba(0,0,0,.6);

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ui);
  background-color: var(--chrome);
  background-image: radial-gradient(1100px 520px at 50% -12%, rgba(217,107,107,.06), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

a { color: var(--accent-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Typography ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent-soft); margin: 0 0 8px;
}
.muted { color: var(--ui-dim); }
h1 { font-family: var(--display); font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.35rem); font-weight: 600; letter-spacing: -.01em; margin: 0 0 6px; color: var(--ui); }
h2 { font-family: var(--display); font-size: 1.2rem; font-weight: 600; letter-spacing: -.005em; margin: 0 0 4px; color: var(--ui); }

/* ---------- Brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-glyph { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; font-size: 1.08rem; color: var(--ui); }
.brand-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ui-dim); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px;
}

/* ---------- Card w/ registration crosshairs ---------- */
.card {
  position: relative;
  background: var(--chrome-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card.reg::before, .card.reg::after {
  content: ""; position: absolute; width: 9px; height: 9px; pointer-events: none;
  background:
    linear-gradient(var(--line-2), var(--line-2)) center / 100% 1px no-repeat,
    linear-gradient(var(--line-2), var(--line-2)) center / 1px 100% no-repeat;
  opacity: .7;
}
.card.reg::before { top: 9px; left: 9px; }
.card.reg::after  { bottom: 9px; right: 9px; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans); font-size: .92rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--chrome-3); color: var(--ui);
  padding: 10px 15px; border-radius: var(--radius-sm); cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
  display: inline-flex; align-items: center; gap: 8px; line-height: 1;
}
.btn:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-tint); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ui-soft); padding-left: 8px; padding-right: 8px; }
.btn-ghost:hover { background: var(--chrome-3); box-shadow: none; }
.btn-sm { font-size: .82rem; padding: 7px 11px; }

/* ---------- Fields ---------- */
.field { display: block; margin-bottom: 14px; }
.field > label {
  display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ui-dim); margin-bottom: 7px;
}
.input, select.input {
  width: 100%; font-family: var(--sans); font-size: .95rem; color: var(--ui);
  background: var(--chrome-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 12px; transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--ui-dim); }
.input:focus, select.input:focus, .btn:focus-visible, a:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
select.input option { background: var(--chrome-2); color: var(--ui); }

/* Native file input — style the "Choose File" button to match the theme. */
input[type="file"].input { padding: 7px 10px; cursor: pointer; color: var(--ui-dim); font-size: .9rem; }
input[type="file"].input::file-selector-button {
  font-family: var(--sans); font-weight: 600; font-size: .85rem;
  background: var(--accent-tint); color: var(--accent-soft);
  border: 1px solid var(--accent-tint-2); border-radius: 8px;
  padding: 7px 14px; margin-right: 12px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
input[type="file"].input::file-selector-button:hover {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 22px;
  background: rgba(20,22,27,.82);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .right { display: flex; align-items: center; gap: 10px; }
.userchip {
  display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--ui-soft);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 12px; background: var(--chrome-3);
}
.avatar {
  width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent-soft); font-weight: 700; font-size: .8rem;
  font-family: var(--mono);
}

/* ---------- Layout ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 34px 22px 70px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Badges ---------- */
.badge {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ui-dim); background: var(--chrome-3);
}
.badge.role-admin { color: var(--accent-soft); border-color: var(--accent-tint-2); background: var(--accent-tint); }
.badge.ok { color: var(--ok); border-color: rgba(79,160,125,.4); background: var(--ok-tint); }
.badge.warn { color: var(--warn); border-color: rgba(200,150,74,.4); background: var(--warn-tint); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: #0f1115; color: var(--ui); border: 1px solid var(--line-2);
  padding: 11px 16px; border-radius: 10px; font-size: .9rem;
  box-shadow: var(--shadow-lift); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
  max-width: min(92vw, 460px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--danger); color: var(--danger); }

/* ---------- Entrance animation ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .4s cubic-bezier(.2,.7,.2,1) both; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .btn:hover { transform: none; }
}
