/**
 * Original Dreamweaver page layouts (P5.9, D13).
 *
 * Fragments from tools/port_layouts.py keep the 1999–2001 tables, layers,
 * spacer cells and `background=` / `bgcolor` cells. This sheet makes them
 * render as they did in the `allesre` frame:
 *
 * - The frame had `marginwidth="30" marginheight="0"`; absolute layers are
 *   placed from the frame's top-left corner, and `height="90%"` tables are
 *   a share of the frame height.
 * - The pages had no doctype (quirks mode). The quirks that change the
 *   layout are copied here: tables reset the font size, and paragraph /
 *   heading margins at the top and bottom of a cell or the page are dropped.
 * - `<font size>` 1–7 is the browser keyword scale (x-small … xxx-large).
 *
 * Phones (< 768 px, no original layout): the same markup stacks into one
 * column and empty spacer elements (`.sp`) are hidden.
 */

/* --- Type, as the browser drew <font> and the default elements --- */

/* Text outside a <font face> (mostly &nbsp; spacers) used the browser
   default serif; its narrow space keeps spacer cells at their old width. */
.legacy {
  font-family: Times, "Times New Roman", serif;
  font-size: medium;
  line-height: normal;
  color: var(--color-text);
}

.legacy table {
  font-size: medium;
  font-weight: normal;
  line-height: normal;
}

.legacy .fs-1 { font-size: x-small; }
.legacy .fs-2 { font-size: small; }
.legacy .fs-3 { font-size: medium; }
.legacy .fs-4 { font-size: large; }
.legacy .fs-5 { font-size: x-large; }
.legacy .fs-6 { font-size: xx-large; }
.legacy .fs-7 { font-size: xxx-large; }

.legacy .ff-g { font-family: var(--font-body); --lh: normal; }
.legacy .ff-c { font-family: var(--font-heading); }

/* The Chicago stand-in (Krungthep) has a taller normal line than the Arial
   that `face="Chicago, arial"` falls back to; keep the old line spacing. */
.legacy :is(.ff-c, .chic9, .chic10, .chic12, .chic14, .chic18, .ort) {
  --lh: 1.15;
}

/* Classes from the original <style> blocks (istudio*, Raum Vorlage). */
.legacy .chic9 { font-family: var(--font-heading); font-size: 9pt; }
.legacy .chic10 { font-family: var(--font-heading); font-size: 10pt; }
.legacy .chic12 { font-family: var(--font-heading); font-size: 12pt; }
.legacy .chic14 { font-family: var(--font-heading); font-size: 14pt; }
.legacy .chic18 { font-family: var(--font-heading); font-size: 18pt; }
.legacy .ort { font-family: var(--font-heading); font-size: 14pt; }

.legacy p,
.legacy .legacy-p {
  margin: 1em 0;
}

.legacy blockquote {
  margin: 1em 40px;
}

.legacy h1,
.legacy h2,
.legacy h3,
.legacy h4,
.legacy h5,
.legacy h6 {
  font-family: inherit;
  font-weight: bold;
}

.legacy h1 { font-size: 2em; margin: 0.67em 0; }
.legacy h2 { font-size: 1.5em; margin: 0.83em 0; }
.legacy h3 { font-size: 1.17em; margin: 1em 0; }
.legacy h4 { font-size: 1em; margin: 1.33em 0; }
.legacy h5 { font-size: 0.83em; margin: 1.67em 0; }
.legacy h6 { font-size: 0.67em; margin: 2.33em 0; }

.legacy b {
  font-weight: bold;
}

.legacy .portrait-strip-figure {
  float: left;
}

/* --- Desktop: the allesre frame --- */

@media (min-width: 768px) {
  #inhalt:has(> .page--legacy) {
    height: 100%;
  }

  .page--legacy {
    position: relative;
    height: 100%;
    margin: 0 calc(-1 * var(--content-margin));
    padding: 0 var(--content-margin);
  }

  .legacy {
    height: 100%;
  }

  .legacy img:not(.portrait-strip-img) {
    max-width: none;
    height: var(--img-h, auto);
  }

  /* Quirks mode: a cell's pixel width="" excludes its padding and border,
     its height="" includes them. Boxes here are border-box (layout.css), so
     port_layouts.py passes the padded pixel width as --cw. */
  .legacy [style*="--cw"] {
    width: var(--cw);
  }

  /* Quirks-mode line height, per line: a line takes the height of the text
     on it, not of the cell's 16 px strut. port_layouts.py wraps a block's
     own text runs in .ln and marks inline boxes with no text on their line
     .lz; every other inline box keeps its normal line height. */
  .legacy :is(td, th, p, div, h1, h2, h3, h4, h5, h6, blockquote),
  .legacy [style*="absolute"] {
    line-height: 0;
  }

  .legacy :is(span, a, b, i, u) {
    line-height: var(--lh, normal);
  }

  .legacy .lz {
    line-height: 0;
  }

  /* Quirks mode: margins of the first / last paragraph or heading in a cell
     or the page do not push the content away from the edge (port_layouts.py
     marks them through any wrapping divs). */
  .legacy .mt0 {
    margin-top: 0;
  }

  .legacy .mb0 {
    margin-bottom: 0;
  }
}

/* --- Phone: one column, spacers hidden --- */

@media (max-width: 767px) {
  .legacy table,
  .legacy tbody,
  .legacy tr,
  .legacy td,
  .legacy th {
    display: block;
    float: none;
    width: auto;
    height: auto;
    padding: 0;
  }

  .legacy td:not(.sp) {
    margin-bottom: var(--space-3);
  }

  .legacy [style*="absolute"] {
    position: static !important;
    width: auto !important;
    height: auto !important;
  }

  .legacy .sp {
    display: none;
  }

  .legacy p,
  .legacy .legacy-p {
    margin: 0 0 var(--space-2);
  }

  .legacy img:not(.portrait-strip-img) {
    max-width: 100%;
  }

  .legacy .portrait-strip-figure {
    margin: 0 var(--space-3) var(--space-2) 0;
  }
}
