/*
======================================================================
  5150 CHARACTER JOURNAL  -  THE LOOK  (journal.css)
======================================================================
  The colours, fonts, page, buttons and hazard strip come from
  ../shared/console.css (loaded first). This file only has this tool's
  own parts:

    1. CONTROLS AND TABS
    2. THE CAST CARDS   one per person, 475 x 455 pixels (95 x 91 mm),
                        so six fit an A4 page, like the book (p.238)
    3. THE DIARY
    4. THE POP-UPS      editing a card or a diary entry
    5. PHONES
    6. PRINTING         A4 upright: the tab you're on
======================================================================
*/


/* ------------------------------------------------------------------
   1. CONTROLS AND TABS
------------------------------------------------------------------ */
.toolbar .tool-group { flex-basis: 280px; }
.journal-for { margin: 0 0 8px; color: var(--ui-text); }
.journal-for b { color: var(--ink); font-weight: normal; }
button.big { font-size: 16px; padding: 9px 16px; }
button.danger:hover { background: var(--accent); }

.journal { padding: 0 16px 24px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button {
  font-family: var(--font-heading);
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 22px;
  background: transparent;
  color: var(--ink);
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.panel-buttons { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-bottom: 14px; }
.panel-buttons label { display: flex; flex-direction: column; font-size: 13px; color: var(--ui-soft); }
.empty-note {
  margin: 0;
  padding: 14px;
  color: var(--ui-soft);
  background: rgba(12, 14, 17, 0.88);
  border: 1px solid #555a61;
}
.empty-note b { color: var(--ink); font-weight: normal; }


/* ------------------------------------------------------------------
   2. THE CAST CARDS
------------------------------------------------------------------ */
.cast { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.card-slot { display: grid; gap: 6px; }
.card-buttons { display: flex; gap: 4px; }
.card-buttons button { font-size: 12px; padding: 3px 8px; }

.jcard {
  position: relative;
  width: 475px;
  height: 455px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 10px;
  font-family: var(--font-sheet);
  font-weight: 800;
  color: var(--ink);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, var(--lines) 0 1px, transparent 1px 3px);
  border: 2px solid var(--frame);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.jcard.is-star { border-color: var(--accent); }
.jcard.is-out .j-body, .jcard.is-out .j-notes { opacity: 0.5; }

.j-top { display: flex; gap: 8px; align-items: center; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); min-height: 22px; }
.j-role { font-family: var(--font-heading); color: var(--ink); }
.j-tag, .j-status { padding: 1px 8px; border: 1px solid var(--accent); color: var(--accent); }
.j-status { margin-left: auto; border-color: var(--ink-dim); color: var(--ink-dim); }
/* The Arjade line, small, at the right of the top bar (on every card PNG and print). */
.j-brand { margin-left: auto; font-size: 11px; letter-spacing: 0.04em; text-transform: none; white-space: nowrap; }
.j-status + .j-brand { margin-left: 0; }
/* One line always: a long tag (who they are to you) is shortened with an ellipsis; the rest stay whole. */
.j-top { flex-wrap: nowrap; white-space: nowrap; gap: 6px; letter-spacing: 0.06em; }
.j-top .j-tag, .j-top .j-status { padding: 1px 6px; }
.j-top .j-brand { font-size: 10px; letter-spacing: 0.02em; }
.j-top > * { flex: none; }
.j-top > .j-tag { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.j-body { display: grid; grid-template-columns: 120px 1fr; gap: 14px; }
.j-portrait {
  width: 120px; height: 120px;
  border: 1px solid var(--frame);
  background: var(--panel);
  overflow: hidden;
  display: grid; place-items: center;
  color: var(--ink-dim); font-size: 11px; letter-spacing: 0.1em;
}
.j-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.05); }
.j-info { min-width: 0; display: grid; align-content: start; gap: 3px; }
.j-name { font-size: 24px; line-height: 1.1; text-shadow: 0 0 8px var(--glow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.j-sub { font-size: 16px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.j-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.j-stats div { border: 1px solid var(--frame); background: var(--panel); text-align: center; padding: 1px 0 2px; }
.j-stats b { display: block; font-size: 28px; line-height: 1.05; }
.j-stats span { display: block; font-size: 11px; letter-spacing: 0.14em; color: var(--ink-dim); }

/* "WEAPON ....... Assault Rifle" lines. */
.j-line { display: flex; gap: 10px; font-size: 16px; padding-bottom: 3px; border-bottom: 1px dashed color-mix(in srgb, var(--frame) 70%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.j-line span { color: var(--ink-dim); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; padding-top: 3px; flex: none; }

/* The Star's career boxes (from the book's Character Journal). */
.j-career { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.j-career div { border: 1px solid var(--frame); background: var(--panel); padding: 3px 6px; text-align: center; }
.j-career span { display: block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.j-career b { font-size: 18px; color: var(--accent); }

/* Notes fill the rest of the card (the whole notes are in the text export). */
.j-notes { flex: 1; min-height: 0; overflow: hidden; font-size: 15px; line-height: 1.3; white-space: pre-wrap; color: var(--ink); }

[data-theme="print"] .j-portrait img { filter: grayscale(1); }


/* ------------------------------------------------------------------
   3. THE DIARY
------------------------------------------------------------------ */
.diary { display: grid; gap: 14px; max-width: 900px; }
.entry {
  background: var(--paper);
  background-image: repeating-linear-gradient(0deg, var(--lines) 0 1px, transparent 1px 3px);
  border: 2px solid var(--frame);
  border-left: 4px solid var(--accent);
  padding: 12px 16px 14px;
  color: var(--ink);
  font-family: var(--font-sheet);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.entry-head { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin-bottom: 8px; }
.entry-date { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.entry-head h3 { flex: 1; margin: 0; font-family: var(--font-heading); font-size: 19px; letter-spacing: 0.06em; text-shadow: 0 0 8px var(--glow); }
.entry-text { font-size: 17px; line-height: 1.45; white-space: pre-wrap; }


/* ------------------------------------------------------------------
   4. THE POP-UPS
------------------------------------------------------------------ */
.editor-dialog {
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  background: #0b0c0e;
  color: var(--ui-text);
  border: 2px solid #7b8088;
  padding: 16px 18px;
}
.editor-dialog::backdrop { background: rgba(0, 0, 0, 0.75); }
.editor-dialog h2 { margin: 0 0 8px; font-family: var(--font-heading); font-size: 17px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 10px 0; }
.form-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ui-soft); }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; font-size: 15px; padding: 5px 7px; }
.form-grid textarea { resize: vertical; font-family: inherit; line-height: 1.4; }
.form-grid :disabled { opacity: 0.6; }
.dialog-buttons { margin: 12px 0 0; }
.dialog-buttons .danger { margin-left: auto; }


/* ------------------------------------------------------------------
   5. PHONES: the cards shrink to fit (PNGs stay full size).
------------------------------------------------------------------ */
@media (max-width: 540px) {
  .journal { padding: 0 8px 20px; }
  .jcard { zoom: 0.7; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .entry-text { font-size: 16px; }
}


/* ------------------------------------------------------------------
   6. PRINTING: A4 upright, only the tab you're on. Cast cards print at
   95 x 91 mm, two across and three down (six a page, like the book).
   Pick Greyscale colours first to save ink.
------------------------------------------------------------------ */
@media print {
  @page { size: A4 portrait; margin: 8mm; }
  body { background: none; }
  .top-bar, .toolbar, .hazard-strip, .page-foot, .tabs, .no-print, .empty-note, dialog { display: none !important; }
  .journal { padding: 0; }
  .cast { display: block; }
  .card-slot { display: inline-block; vertical-align: top; margin: 0 1mm 1.5mm 0; break-inside: avoid; }
  /* 475 pixels -> 95 mm */
  .jcard { zoom: 0.7559; }
  .diary { max-width: none; }
  .entry { break-inside: avoid; }
}
