/*
 * The forged frame -- every part the interface is built from.
 *
 * Two rules govern this file:
 *
 *   1. No colour literals. Everything reads from liveries.css, which is what
 *      lets a place or a theme change the whole interface by swapping one
 *      block. A hex code here would be a colour that no theme can reach.
 *
 *   2. Wersja II only. The design carried version I and version II side by
 *      side, II softening the boundaries that read "za ostre" on the dark
 *      liveries. Only II ships, so it is written as the plain state rather than
 *      as an override -- a `.v2` class nobody can turn off is just noise.
 *
 * The design prototype faked its mobile view by matching inline styles
 * (`.mob [style*="grid-template-columns"]`). That works on a canvas of hand
 * placed boxes and nowhere else, so the responsive behaviour here is written
 * against this stylesheet's own classes instead.
 */

/* ── Type ──────────────────────────────────────────────────────────────── */

.mw {
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 14px;
  color: var(--ink);
}

.mw b,
.mw strong { color: var(--ink-str); }

.mw a { color: var(--gilt); text-decoration: none; }
.mw a:hover { color: var(--gilt-hi); }

/*
 * Numbers keep a sans face at a smaller size. Garamond's old-style figures sit
 * at different heights, which is handsome in prose and unreadable in a column
 * of gold totals.
 */
.num {
  font-family: Verdana, "DejaVu Sans", sans-serif;
  font-size: 10px;
  color: var(--ink-str);
}

/* ── Panel ─────────────────────────────────────────────────────────────── */

/*
 * The panel fades into the ground rather than being cut out of it: a gradient
 * from panel to page, a soft rule, and an inner hairline that reads as a bevel
 * on the forged metal.
 */
.mp {
  background: linear-gradient(180deg, var(--panel) 0%, var(--page) 100%);
  border: 1px solid var(--rule-soft);
  box-shadow:
    inset 0 0 0 1px var(--hair),
    inset 0 -18px 26px -18px var(--page),
    0 2px 26px -6px var(--page);
}

.mp-h {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  position: relative;
  padding: 8px 14px;
  background: linear-gradient(180deg, var(--head-a) 0%, transparent 100%);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  color: var(--gilt);
}

/* The lozenges flanking a header are set at 70% so they read as punctuation
   rather than as two more pieces of hardware. */
.mp-h::before,
.mp-h::after {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  background: var(--gilt);
  transform: rotate(45deg);
  opacity: 0.7;
}

.mp-h.left { justify-content: flex-start; }
.mp-h.left::after { display: none; }

/* The header has no bottom border of its own; whatever follows it draws the
   faint line, so an empty panel does not end in a rule hanging in space. */
.mp > .mp-h + * { border-top: 1px solid var(--rule-faint); }

/*
 * A panel that folds.
 *
 * <details> with the header as its <summary>: no script, keyboard-operable,
 * and the browser remembers nothing -- which is what we want, since whether a
 * panel starts open is the page's decision and not the last visitor's. The
 * native marker goes; the caret at the right edge is the affordance, and it
 * turns over when the panel opens.
 */
summary.mp-h {
  cursor: pointer;
  list-style: none;
}

summary.mp-h::-webkit-details-marker { display: none; }

.mfold {
  position: absolute;
  right: 12px;
  top: 50%;
  margin-top: -5px;
  font-size: 9px;
  line-height: 1;
  color: var(--gilt);
  opacity: 0.75;
  transition: transform 0.15s ease;
}

.mfold::before { content: "▾"; }

details[open] > summary .mfold { transform: rotate(180deg); }

summary.mp-h:hover { color: var(--gilt-hi); }

summary.mp-h:hover .mfold { opacity: 1; }

/* ── Titles ────────────────────────────────────────────────────────────── */

.mt {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mt span.r {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--rule) 40%, var(--rule) 60%, transparent 100%);
}

.mt span.t {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gilt-br);
  white-space: nowrap;
}

/* ── Navigation ────────────────────────────────────────────────────────── */

.mnav a {
  display: block;
  position: relative;
  padding: 4px 12px 4px 22px;
  color: var(--ink);
  font-size: 13px;
}

.mnav a::before {
  content: "\00BB";
  position: absolute;
  left: 8px;
  color: var(--rule);
}

.mnav a:hover,
.mnav a.on {
  color: var(--gilt-hi);
  background: var(--wash);
}

.mnav a:hover::before,
.mnav a.on::before { color: var(--gilt); }

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.mtab-row {
  display: flex;
  background: linear-gradient(180deg, var(--head-a) 0%, transparent 100%);
  border-top: 1px solid var(--rule-soft);
}

/* Every tab row is laid out the same way, so the row itself carries it -- each
   page that used one was declaring its own display:flex beside it. */
.mtab {
  display: flex;
  flex-wrap: wrap;
}

.mtab a {
  display: block;
  padding: 8px 16px;
  border-right: 1px solid var(--rule-faint);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.mtab a:hover,
.mtab a.on {
  color: var(--gilt-hi);
  background: var(--wash);
}

/* ── Controls ──────────────────────────────────────────────────────────── */

.mbtn {
  padding: 9px 18px;
  border: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--btn-a) 0%, var(--btn-b) 100%);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gilt-hi);
  cursor: pointer;
}

.mbtn:hover {
  border-color: var(--muted);
  background: linear-gradient(180deg, var(--btn-ha) 0%, var(--btn-hb) 100%);
  color: #fff;
}

.min {
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid var(--rule-soft);
  background: var(--field);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 13px;
  color: var(--ink-str);
}

.min:focus {
  outline: none;
  border-color: var(--muted);
}

/*
 * A form label: small caps in the display face, set in muted so the field it
 * names stays the brighter thing.
 */
.mlbl {
  display: block;
  margin-bottom: 6px;
  font-family: "Cinzel", Georgia, serif;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Guidance under a field -- character limits, format rules. */
.mhint {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}

/* ── Small parts ───────────────────────────────────────────────────────── */

.mchip {
  display: inline-block;
  padding: 3px 11px;
  border: 1px solid var(--rule-faint);
  background: var(--chip-bg);
  color: var(--ink);
  font-size: 12px;
}

.mchip:hover {
  border-color: var(--muted);
  color: var(--gilt-hi);
}

.mbar {
  height: 9px;
  padding: 1px;
  border: 1px solid var(--rule-faint);
  background: var(--bar-bg);
}

.mbar > i {
  display: block;
  height: 100%;
}

/* A framed image or glyph: the frame is the hardware, the padding is the mount. */
.mfr {
  padding: 3px;
  border: 1px solid var(--rule-soft);
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--hair), 0 0 20px -6px var(--page);
}

/* Heraldic mark on a forged tile -- a resource, a recipe, an item slot. */
.mi {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--chip-bd);
  background: var(--chip-bg);
  box-shadow: inset 0 0 0 1px var(--hair);
  font-family: Verdana, "DejaVu Sans", sans-serif;
  font-size: 11px;
  line-height: 1;
}

.mi.lg {
  width: 42px;
  height: 42px;
  font-size: 17px;
}

/* ── Rows and lists ────────────────────────────────────────────────────── */

.mrow + .mrow { border-top: 1px solid var(--rule-faint); }

.mlist li { list-style: none; }

/*
 * The mark that pins a place to "moje linki". It is invisible until the row it
 * belongs to is under the pointer, so a list of places reads as a list of
 * places rather than a column of controls.
 */
.mstar {
  padding: 0;
  border: none;
  background: none;
  font-size: 12px;
  line-height: 1;
  color: var(--gilt);
  cursor: pointer;
  visibility: hidden;
}

.mlist li:hover .mstar,
.mrow:hover .mstar,
.mt:hover .mstar,
.mstar.enabled { visibility: visible; }

/*
 * Where there is no hover there is no way to reach it: on a phone the star that
 * pins a place to "moje linki" was permanently invisible, so the whole feature
 * was unusable on touch. It stays out of the way on a pointer and stands there
 * on everything else.
 */
@media (hover: none) {
  .mstar { visibility: visible; }
}

.mstar:hover { color: var(--gilt-hi); }

/* ── Flank artwork ─────────────────────────────────────────────────────── */

/*
 * The art either side of the stage feathers into the frame instead of butting
 * against it. The overlay is a gradient to --page, so it dissolves into
 * whatever ground the livery sets rather than into a fixed black.
 */
.art { position: relative; }

.art::after {
  content: "";
  position: absolute;
  inset: 0;
}

/*
 * The feather starts late. In the design the flanks were half the stage, so a
 * gradient from 45% still left plenty of picture; against a 250px strip it
 * covered nearly all of it and the art read as a smudge. From 70% it softens
 * the seam without eating the scene.
 */
.art-l::after { background: linear-gradient(90deg, transparent 0%, transparent 45%, var(--page) 100%); }
.art-r::after { background: linear-gradient(270deg, transparent 0%, transparent 45%, var(--page) 100%); }

/* ── Logo ──────────────────────────────────────────────────────────────── */

.logo-framed {
  background: #000;
  border: 1px solid var(--rule);
  box-shadow: inset 0 0 0 1px var(--hair);
}

.logo-bare { background: transparent; }

/* ── Layout ────────────────────────────────────────────────────────────── */

/*
 * The stage: art, then a column of fixed maximum width, then art. Centring is
 * the column's job, so the flanks can be any width the viewport leaves them.
 */
.mstage {
  display: flex;
  flex-direction: row;
  justify-content: center;
  min-height: 100vh;
  background: var(--page);
}

/*
 * The flank art stands still while the page moves under it, the way the old
 * build did it: one viewport tall and stuck to the top, rather than a
 * full-height element with a fixed background. The difference matters --
 * `background-attachment: fixed` sizes the image against the viewport, so a
 * narrow flank shows a narrow slice of the middle of the picture. Sticky keeps
 * `cover` sizing against the element, which is what frames the scene.
 *
 * align-self stops the flex row stretching the element, which would defeat
 * sticky by leaving it nothing to scroll within.
 */
.mstage > .art {
  flex: 1 1 0;
  min-width: 0;
  align-self: flex-start;
  position: sticky;
  top: 0;
  height: 100vh;
  background-repeat: repeat-y;
  background-size: cover;
}

.mstage > .art-l { background-position: right; }
.mstage > .art-r { background-position: left; }

.mcol {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 100%;
  /*
   * 1100 flat. An earlier version also reserved a fixed strip for the flank art,
   * which meant the column never actually reached its width on a 1600 screen --
   * it stopped at 1040. The art takes whatever is left over instead, and below
   * the breakpoint it is hidden and this column runs the full width.
   */
  max-width: 1100px;
  padding: 18px;
}

/*
 * Three columns: a fixed rail either side, the reading column between them.
 * The widths are the design's -- 380 for the entry rail, 286 for the ledger.
 */
.mcols {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

/*
 * The design's rails were 380 and 286 in a 1000 column, which left the middle
 * about 300 -- fine for its three-paragraph prologue, a ribbon for the real
 * one. Narrower rails on a wider stage give the reading column ~800.
 */
.mcols > .rail-l { flex: 0 0 250px; width: 250px; }
.mcols > .mid { flex: 1 1 auto; min-width: 0; }
.mcols > .rail-r { flex: 0 0 230px; width: 230px; }

.mstack > * + * { margin-top: 14px; }

/* ── Narrow viewports ──────────────────────────────────────────────────── */

/*
 * One breakpoint, at the width the old main.css already used, so the two
 * stylesheets agree about what "narrow" means while both are in the tree.
 *
 * Below it: the flanking art goes (it is decoration, and it is what makes the
 * stage wider than the reading column), the rails stack under the content, and
 * touch targets grow to 44px.
 */
@media all and (max-width: 1023px) {
  .mstage > .art { display: none; }

  .mcol { padding: 10px; }

  .mcols { flex-wrap: wrap; }

  .mcols > .rail-l,
  .mcols > .mid,
  .mcols > .rail-r {
    flex: 1 1 100%;
    width: auto;
    max-width: 100%;
  }

  /* The entry rail is why anyone is on this page; it goes above the prose. */
  .mcols > .rail-l { order: 1; }
  .mcols > .mid { order: 2; }
  .mcols > .rail-r { order: 3; }

  .mtab-row { flex-wrap: wrap; }

  .mtab a {
    padding: 12px 14px;
    min-height: 44px;
    box-sizing: border-box;
    font-size: 9px;
  }

  .mnav a {
    padding: 12px 14px 12px 24px;
    min-height: 44px;
    box-sizing: border-box;
  }

  .mt span.t {
    font-size: 12px;
    white-space: normal;
  }

  .mp-h {
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  .num { font-size: 10px; }
}
