/* ============================================================
   SIMEIJA — TOKENS.CSS
   ------------------------------------------------------------
   Theme-agnostic structural rules. ALL appearance decisions
   (colour, typography, sizes, weights, paddings, borders,
   radii) live in the theme files. This file owns:
     • reset
     • layout grid + responsive breakpoints
     • view-switching (display rules)
     • default visibility for theme-conditional elements
   ============================================================ */

/* ---------- reset ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-feature-settings: "kern", "liga", "tnum";
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
hr { box-sizing: content-box; height: 0; }

/* ---------- view switching ---------- */
.view { display: none; }
.view.view-active { display: block; }

/* ---------- masthead layout ---------- */
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.brand { display: flex; align-items: baseline; }
.topnav { display: flex; align-items: baseline; }

/* Default visibility for theme-conditional elements.
   Each theme can override these with display: <whatever>. */
.brand-sub      { display: none; }   /* notebook only */
.brand-meta     { display: none; }   /* technical, admin */
.topnav-user-label { display: none; } /* admin only */

.pane-subtitle  { display: none; }   /* admin only */
.title-rule     { display: none; border: 0; margin: 0; }   /* admin only */
.edit-attrs-label { display: none; } /* technical, admin */

/* ---------- main two-pane layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  min-height: calc(100vh - 80px);
}
.pane-left  { position: relative; }
.pane-right { position: relative; }

/* ---------- index entries ---------- */
.index-list { list-style: none; padding: 0; margin: 0; }
.index-entry {
  cursor: pointer;
  position: relative;
}
.index-entry { display: grid; grid-template-columns: 1fr; gap: 0; }

/* ---------- reading view ---------- */
.issue-eyebrow { display: flex; align-items: baseline; flex-wrap: wrap; }
.issue-by-line { /* prose flow */ }

/* ---------- meta rail ---------- */
.meta-rail { position: absolute; }
.rail-list { margin: 0; padding: 0; }
.rail-row {
  display: flex; justify-content: space-between; align-items: baseline;
}
.rail-actions { display: flex; flex-direction: column; }
.rail-action {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  font-family: inherit;
}

/* ---------- section break ---------- */
.section-break { display: flex; align-items: center; }
.section-break-rule { flex: 1; }

/* ---------- comments ---------- */
.comment { position: relative; }
.comment-head { display: flex; align-items: baseline; }
.comment-actions {
  margin-left: auto;
  display: flex;
  opacity: 0;
  transition: opacity 100ms ease;
}
.comment:hover .comment-actions { opacity: 1; }
.comment-action {
  background: transparent;
  border: 0;
  font-family: inherit;
}
.comment-attach {
  display: inline-flex;
  align-items: center;
}

/* ---------- reply composer ---------- */
.reply-composer { /* container */ }
.reply-textarea { width: 100%; font-family: inherit; resize: vertical; }
.reply-toolbar { display: flex; align-items: center; }
.reply-submit { margin-left: auto; }

/* ---------- edit shell ---------- */
.edit-shell { /* container */ }
.edit-eyebrow { display: flex; align-items: center; }
.edit-back { cursor: pointer; }
.edit-title-input { width: 100%; font-family: inherit; }
.edit-description { width: 100%; font-family: inherit; resize: vertical; }
.edit-attach-row { display: flex; align-items: center; }
.edit-attrs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.edit-attr { display: flex; flex-direction: column; }
.edit-attr-input { font-family: inherit; }
.edit-actions { display: flex; align-items: center; }
.edit-action--delete { margin-left: auto; }

/* ---------- forms reset ---------- */
.filter-input,
.filter-summary,
.edit-attr-input,
.edit-title-input,
.edit-description,
.reply-textarea {
  outline: none;
}
.filter-grid { display: grid; }

.chips { display: flex; flex-wrap: wrap; }
.chip { font-family: inherit; cursor: pointer; user-select: none; }

/* ---------- demo controls (always present) ---------- */
.demo-controls {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 999;
  font-family: -apple-system, BlinkMacSystemFont, "Inter Tight", system-ui, sans-serif;
  font-size: 11px;
}
.theme-switch,
.view-switch {
  background: rgba(20,20,20,0.92);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 4px;
  gap: 2px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  border-radius: 4px;
  backdrop-filter: blur(10px);
}
.theme-switch-label {
  padding: 0 8px 0 6px;
  color: rgba(255,255,255,0.55);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.theme-switch-button,
.view-switch-button {
  background: transparent;
  border: 0;
  padding: 5px 11px;
  color: rgba(255,255,255,0.6);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
  border-radius: 3px;
  font-weight: 500;
}
.theme-switch-button:hover,
.view-switch-button:hover {
  color: rgba(255,255,255,0.95);
}
.theme-switch-button--active,
.view-switch-button--active {
  background: rgba(255,255,255,0.95);
  color: #1a1a1a;
}

/* ---------- responsive (single-column) ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .meta-rail { position: static; width: auto; }
  .edit-attrs { grid-template-columns: repeat(2, 1fr); }
  .demo-controls { flex-direction: column; align-items: center; gap: 6px; }
}

/* ---------- entrance animation ---------- */
@keyframes simeijaFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.view-active .pane-right > *,
.view-active .edit-shell > * {
  animation: simeijaFadeUp 380ms ease both;
}
.view-active .pane-right > *:nth-child(1) { animation-delay: 30ms; }
.view-active .pane-right > *:nth-child(2) { animation-delay: 70ms; }
.view-active .pane-right > *:nth-child(3) { animation-delay: 110ms; }
.view-active .pane-right > *:nth-child(4) { animation-delay: 150ms; }
.view-active .pane-right > *:nth-child(5) { animation-delay: 190ms; }
.view-active .pane-right > *:nth-child(6) { animation-delay: 230ms; }

/* ---------- form errors (v1.1) ----------
   Theme-agnostic baseline. Themes may override colours/border to
   match their palette; the defaults here render readably against
   any of the four theme backgrounds.

   Used by:
     - <p class="form-errors"> sibling to a form field's widget
       (per-field error rendering in issue_form.html,
       comment_edit_form.html, login.html, _share_section.html)
     - <div class="form-errors form-errors--top"> for
       top-of-form non_field_errors blocks. */
.form-errors {
  color: #b91c1c;            /* a red dark enough to read on white */
  font-size: 12px;
  margin: 6px 0 0;
  line-height: 1.4;
}
.form-errors--top {
  margin: 0 0 14px;
  padding: 8px 12px;
  border: 1px solid #fecaca;  /* light red border */
  background: #fef2f2;        /* very light red wash */
  border-radius: 4px;
  font-size: 13px;
}
.form-errors ul { margin: 0; padding-left: 18px; }
