/* RustWheel Magazine — area redazione. Riprende colori e testo del sito. */
@import url("magazine.css?v=1");

body.ed { font-family: var(--sans); font-size: 15px; background: var(--paper-2); }

.ed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--paper);
}
.ed-brand {
  color: var(--paper);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 19px;
}
.ed-brand em { color: #E08B6F; font-weight: 600; }
.ed-brand span {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .7;
  margin-left: 6px;
}
.ed-user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.ed-user a { color: var(--paper); }
.ed-user form { margin: 0; }

.ed-main { max-width: 860px; margin: 0 auto; padding: 20px 16px 120px; }

.ed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.ed-head h1 { font-family: var(--display); font-size: 28px; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  font: 600 14px var(--sans);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn.primary:hover { background: var(--rust-dark); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.link-btn.danger { color: var(--rust); }

.ed-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 24px;
}
.ed-login { max-width: 420px; margin: 40px auto; }
.ed-login h1 { font-family: var(--display); margin: 0 0 6px; }
.ed-login form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }

.ed-help { color: var(--ink-3); font-size: 13.5px; font-weight: 400; margin: 6px 0 0; }
.ed-error, .ed-notice { padding: 10px 14px; border-radius: 6px; margin: 0 0 14px; }
.ed-error { background: #F8DDD6; border: 1px solid #E2A496; color: #6E1E12; }
.ed-notice { background: #DDEBD9; border: 1px solid #A9C9A1; color: #1F4A1A; }
.ed-empty { color: var(--ink-2); padding: 30px 0; text-align: center; }

.ed-list { display: flex; flex-direction: column; gap: 8px; }
.ed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.ed-row:hover { border-color: var(--ink-3); }
.ed-thumb { flex: none; width: 72px; height: 54px; border-radius: 4px; overflow: hidden; background: var(--paper-2); }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-thumb.no-cover span { font-size: 20px; }
.ed-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ed-row-main strong { font-family: var(--display); font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-row-main span { font-size: 12.5px; color: var(--ink-3); }

.badge {
  flex: none;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}
.badge.pub { background: #DDEBD9; color: #1F4A1A; }
.badge.draft { background: #F3E3B5; color: #5E4A0B; }

/* ===== Modulo articolo ===== */

.ed-back { margin: 0 0 10px; font-size: 14px; }
.ed-back a { color: var(--ink-2); }
.ed-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; margin-bottom: 14px; }
.ed-info { color: var(--ink-3); }

.ed-form { display: flex; flex-direction: column; gap: 18px; }

.fld, .ed-login label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}
.fld small { font-weight: 400; color: var(--ink-3); }

input[type=text], input[type=email], input[type=password], textarea, select {
  font: 400 16px var(--sans);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 10px 12px;
  width: 100%;
}
input[name=title] { font: 800 22px var(--display); }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, .editor:focus { outline: 2px solid var(--rust); outline-offset: 1px; }

.cover-box {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 340px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper);
  border: 1px dashed var(--ink-3);
}
.cover-box img { width: 100%; height: 100%; object-fit: cover; }
.cover-box .cover-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  font-weight: 400;
}
.cover-box.empty img { display: none; }
.cover-box.empty .cover-placeholder { display: flex; }
.cover-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upload-state { font-weight: 400; font-size: 13px; color: var(--ink-3); }
.upload-state.err { color: var(--rust); }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  background: var(--ink);
  border-radius: 6px 6px 0 0;
}
.toolbar button {
  min-height: 36px;
  min-width: 36px;
  padding: 0 10px;
  font: 600 13.5px var(--sans);
  color: var(--paper);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.toolbar button:hover, .toolbar button.on { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .2); }
.toolbar .sep { width: 1px; background: rgba(255, 255, 255, .2); margin: 4px 2px; }

.editor {
  position: relative;
  min-height: 360px;
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
}
.editor:empty::before, .editor.is-empty::before {
  content: "Scrivi qui il tuo articolo…";
  color: var(--ink-3);
  position: absolute;
  pointer-events: none;
}
.editor > p:first-child::first-letter { all: unset; }
.editor figure { position: relative; user-select: none; }
.editor figure.sel img { outline: 3px solid var(--rust); }
.editor figcaption:empty::before { content: "(nessuna didascalia)"; font-style: italic; }

.fig-tools {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  font-family: var(--sans);
}
.fig-tools button {
  min-height: 32px;
  padding: 0 10px;
  font: 600 12.5px var(--sans);
  background: rgba(30, 24, 20, .82);
  color: #fff;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.ed-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
  background: linear-gradient(to bottom, rgba(234, 224, 207, 0), var(--paper-2) 30%);
}
.ed-actions .upload-state { margin-right: auto; }

.ed-delete { margin-top: 24px; text-align: right; font-size: 14px; }

@media (max-width: 520px) {
  .ed-card { padding: 18px; }
  .editor { padding: 16px; }
  .ed-actions .btn { flex: 1; }
}

/* ===== Eventi (redazione) ===== */
.ed-nav { display: flex; gap: 16px; font-size: 14px; font-weight: 600; }
.ed-nav a { color: var(--paper); text-decoration: none; opacity: .85; }
.ed-nav a:hover { opacity: 1; text-decoration: underline; }
.ed-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ed-cols.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) { .ed-cols, .ed-cols.three { grid-template-columns: 1fr; } }
.ed-check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ed-date { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; background: var(--ink); color: var(--paper); }
.ed-date b { font-size: 22px; line-height: 1; letter-spacing: 0; }
.poster-box { aspect-ratio: 3 / 4; max-width: 280px; }
.poster-box img { object-fit: contain; background: #111; }
.ed-regs { margin-top: 28px; }
.ed-regs h2 { font-family: var(--display); font-size: 22px; margin: 0 0 10px; }
.ed-table-wrap { overflow-x: auto; }
.ed-table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); color: var(--ink); }
.ed-table th, .ed-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ed-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.ed-table small { color: var(--ink-3); }
