*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

html {
  -webkit-text-size-adjust: none; /* Never autoresize text */
}

:root {
  --text-width: 60ch;
  --line-height: 1.625;
  --body-font-color: rgb(27, 27, 27);
  --link-color: hsl(210, 100%, 50%);
  --body-font-size: 1rem;
  --sans-serif-font-family: system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',
    sans-serif;
  --serif-font-family: Georgia, 'Times New Roman', Times, serif;
}

body {
  font-family: var(--sans-serif-font-family), serif;
  line-height: var(--line-height);
  margin: 0 20px;
  color: var(--body-font-color);
  font-size: var(--body-font-size);
}

.footnote {
  font-size: small;
  text-indent: 0;
  margin: 1rem 0;
}

.small-caps {
  display: inline;
  font-variant: small-caps;
}

.small {
  font-size: small;
}

.vertical-margin {
  margin: 1em 0;
}

main {
  margin: 0 auto;
  max-width: var(--text-width);
  hyphens: manual;
}

.auto-hyphens {
  hyphens: auto;
}

.indent {
  text-indent: 20px;
}

ul {
  padding-inline-start: 40px;

  + p {
    text-indent: 0;
  }

  &.no-bullets-padding {
    list-style-type: none;
    padding-inline-start: 20px;
  }

  &.inside-indent-text {
    list-style-position: inside;
    padding-inline-start: 0px;
    text-indent: 20px;
  }
}

.padding-left {
  padding-left: 20px;
}

ol {
  padding-inline-start: 20px;
  &.no-bullets-padding {
    list-style-type: none;
  }
}

hr {
  margin: 20px;
}

h1 {
  font-family: var(--sans-serif-font-family), serif;
  border-bottom: solid 1px;
  border-top: solid 1px;
  font-weight: bold;
  hyphens: auto;
  margin: 20px 0;
  padding: 20px 0;
  text-align: center;
  width: 100%;
}

a {
  color: var(--link-color);
  text-decoration: none;
  &.main-route {
    font-style: italic;
  }
  &.arrow::before {
    content: '\2192\00A0';
  }
}

p + p {
  text-indent: 20px;
}

.warning {
  color: red;
  text-align: center;
  margin-bottom: 1em;
}

.indexed-grid {
  display: grid;
  grid-template-columns: auto auto;
  .grid-index {
    padding-inline-end: 1ch;
  }
}

.poetry {
  margin: 1em auto;
  max-width: fit-content;
  text-indent: 0;
  + p {
    text-indent: 0;
  }
}

.longest-line {
  &::before {
    content: '--------- long line content ---------';
    display: block;
    height: 0;
    visibility: hidden;
  }
  width: fit-content;
  margin: 1rem auto;
}

.no-bottom-margin {
  margin-bottom: 0;
}

.hidden {
  visibility: hidden;
}

.math {
  + p {
    text-indent: 0;
  }
}

.no-indent {
  text-indent: 0;
}

.align-center {
  text-align: center;
  + p {
    text-indent: 0;
  }
}

.align-right {
  text-align: right;
  + p {
    text-indent: 0;
  }
}

sup,
sub {
  font-size: small;
  line-height: 0;
}

.spaced {
  letter-spacing: 1ch;
}

h2.inline-title {
  font-size: var(--body-font-size);
  font-family: var(--sans-serif-font-family), serif;
  display: inline;
  font-weight: bold;
  /* + .poetry {
    margin-top: 0;
  } */

  + p:not(.poetry) {
    display: inline;
  }
}

/* Page-specific styles. */

#navigation {
  font-family: var(--sans-serif-font-family), serif;
  hyphens: none;
  margin: 20px 0;
  padding: 20px 0;
  border-top: solid 1px;
  border-bottom: solid 1px;
}

#inhaltsverzeichnis {
  & #bearbeitungsfortschritt {
    margin: 20px 0;
    padding: 20px 0;
    border-top: dashed 1px;
    border-bottom: dashed 1px;
    text-align: center;
    font-style: italic;
  }

  & ol {
    list-style-position: inside;
    padding-inline-start: 0;
  }
}

#title-page-container {
  height: 100dvh;
  display: grid;
  place-items: center;

  & #title-page {
    hyphens: none;
    text-wrap: nowrap;
    text-align: center;
  }

  & #author,
  #druden,
  #lesen {
    font-size: 1.25rem;
  }

  & #druden {
    padding: 20px 0;
    border-top: solid 1px;
    border-bottom: solid 1px;
  }

  & #lexikon,
  #roman {
    font-size: 5rem;
  }
}

#auen-19 {
  & .offset-right {
    text-align: right;
    margin: 1em 20% 1em auto;
    + p {
      text-indent: 0;
    }
  }
}

#barbara-4 {
  & .rahmen {
    padding: 12em 20px;
    font-size: smaller;
    text-align: center;
    border-style: dotted;
    min-width: fit-content;
    max-width: 50%;
    margin: 2em auto;
  }
}

#bezirksgericht-1 {
  & .char {
    display: flex;
    justify-content: center;
    align-content: center;
  }

  & .grid-scroller {
    line-height: 1.3;
    overflow-x: auto;
    margin: 0.5lh 0;
  }

  & #grid-container {
    position: relative;
    margin: 0.5lh 0.5ch;
    min-width: calc(var(--text-width) * 0.75);
  }

  & .grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(45, minmax(0px, 1fr));
    grid-template-rows: repeat(24, auto);
  }

  & .underlay {
    grid-template-rows: repeat(24, minmax(0px, 1fr));
    font-size: x-small;
    position: absolute;
    height: 100%;
    white-space: nowrap;
  }

  & .und-so-schoene {
    grid-column: 3 / 11;
    grid-row: 22;
    text-align: right;
  }

  & .bunte {
    grid-column: 14 / 22;
    grid-row: 22;
    text-align: left;
  }

  & .eich {
    grid-column: 14 / 22;
    grid-row: 10;
    text-align: right;
  }

  & .hoernchen {
    grid-column: 25 / 33;
    grid-row: 8;
    text-align: left;
  }

  & .rennen {
    grid-column: 25 / 33;
    grid-row: 16;
    text-align: right;
  }

  & .draussen {
    grid-column: 36 / 44;
    grid-row: 16;
    text-align: left;
  }

  & .vorbei {
    grid-column: 36 / 44;
    grid-row: 22;
    text-align: right;
  }
}

#bezirksgericht-2 {
  & .grid-scroller {
    margin: 0.5lh 0;
    overflow-x: auto;
    + p {
      text-indent: 0;
    }
  }

  & #grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(16, 1lh);
    margin: 0.5lh 0;
    white-space: nowrap;
  }

  .text {
    &.cell-1 {
      grid-area: 1 / 1 / span 4 / span 1;
    }

    &.cell-2 {
      grid-area: 6 / 1 / span 3 / span 1;
    }

    &.cell-3 {
      grid-area: 10 / 1 / span 6 / span 1;
    }

    &.cell-4 {
      grid-area: 1 / 4 / span 4 / span 1;
    }

    &.cell-5 {
      grid-area: 6 / 4 / span 3 / span 1;
    }

    &.cell-6 {
      grid-area: 10 / 4 / span 6 / span 1;
    }

    &.cell-7 {
      grid-area: 1 / 6 / span 4 / span 1;
    }

    &.cell-8 {
      grid-area: 6 / 6 / span 3 / span 1;
    }

    &.cell-9 {
      grid-area: 10 / 6 / span 6 / span 1;
    }
  }

  & .curly {
    margin: 0 auto;

    .curly-path {
      fill: var(--body-font-color);
      &.right {
        transform: scaleX(-1) translateX(-100%);
      }
    }

    &.cell-1 {
      grid-area: 1 / 2 / span 2 / span 1;
    }

    &.cell-2 {
      grid-area: 10 / 2 / span 2 / span 1;
    }

    &.cell-3 {
      grid-area: 1 / 3 / span 4 / span 1;
    }

    &.cell-4 {
      grid-area: 6 / 3 / span 3 / span 1;
    }

    &.cell-5 {
      grid-area: 10 / 3 / span 6 / span 1;
    }

    &.cell-6 {
      grid-area: 1 / 5 / span 4 / span 1;
    }

    &.cell-7 {
      grid-area: 6 / 5 / span 3 / span 1;
    }

    &.cell-8 {
      grid-area: 10 / 5 / span 6 / span 1;
    }
  }

  & .number {
    margin: auto;
    text-align: center;
    &#cell-1 {
      grid-area: 1 / 8 / span 4 / span 1;
      min-width: 2em;
    }

    &.cell-2 {
      grid-area: 6 / 8 / span 3 / span 1;
    }

    &.cell-3 {
      grid-area: 10 / 8 / span 6 / span 1;
    }

    &.cell-4 {
      width: fit-content;
      border-top: 1px solid;
      grid-area: 16 / 8 / span 6 / span 1;
    }
  }

  & .equal {
    margin: auto;
    min-width: 2em;
    text-align: right;
    &.cell-1 {
      grid-area: 1 / 7 / span 4 / span 1;
    }

    &.cell-2 {
      grid-area: 6 / 7 / span 3 / span 1;
    }

    &.cell-3 {
      grid-area: 10 / 7 / span 6 / span 1;
    }
  }
}

#bordabenteuer-3 {
  & .raum {
    text-align: center;
    font-size: small;
  }
}

#filmtitelspiel-1 {
  .grid {
    /* hyphens: auto; */
    overflow-x: auto;
    margin: 1lh 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
  }
  .grid-element {
    margin: auto 0 0 0;
    padding-left: 20px;
    text-indent: -20px;
  }
}

#filmtitelspiel-2 {
  li::first-line {
    font-style: italic;
  }
}

#fischer-5 {
  .gratisgutschein {
    border: solid 2px;
    padding: 20px;
    margin: 20px 10%;
    .title {
      text-align: center;
      letter-spacing: 0.5ch;
      margin-bottom: 0.5lh;
      hyphens: auto;
    }
  }
}

#frau-und-freude-das-blatt-mit-herzpfiff-3 {
  #eros-test {
    font-variant: small-caps;
    & #line-two {
      padding-inline-start: 12ch;
    }
    #line-three {
      padding-inline-start: 16ch;
    }
  }
  #klopfen {
    margin: 1em 0;
    padding: 1em 0;
    border-top: 1px solid;
    border-bottom: 1px solid;
    p {
      padding-left: 4ch;
      text-indent: -4ch;
    }
  }
}

#gasthaeuser-16 {
  #grid {
    margin: 1em 0;
    display: grid;
    gap: 1em;
    grid-template-columns: 1fr auto 1fr;
    #cell-1 {
      text-align: right;
    }
  }
}

#gasthaeuser-21 {
  #schild {
    margin: 1em auto;
    width: fit-content;
    border: solid 1px;
    padding: 0.5em 1em;
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: 1fr 1fr;
    grid-template:
      'wegen valera'
      'geschlossen geschlossen';

    font-size: 2rem;
    text-align: center;

    .wegen,
    .geschlossen {
      font-weight: bold;
    }
    text-wrap: nowrap;

    .wegen {
      grid-area: wegen;
    }
    .valera {
      grid-area: valera;
      font-size: 1.5rem;
      border-bottom: 3px dotted;
    }

    .hidden-dots {
      grid-area: valera;
      visibility: hidden;
      overflow-x: hidden;
    }
    .geschlossen {
      grid-area: geschlossen;
    }
  }
}

/* #gelbe-schenken-11 { */
.column-grid {
  margin-bottom: 1em;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  grid-auto-flow: column;

  .column-header {
    font-variant: small-caps;
    text-align: center;
    border-bottom: 1px solid;
    margin: 1em 0;
  }

  p:nth-of-type(odd) {
    padding-inline-end: 0.5em;
  }

  p:nth-of-type(even) {
    padding-inline-start: 0.5em;
  }

  @media (max-width: 576px) {
    margin-top: 1em;
    display: block;
    p:nth-of-type(odd) {
      padding-inline-end: 0;
    }

    p:nth-of-type(even) {
      padding-inline-start: 0;
    }
  }
}
/* } */

.list-grid {
  margin: 1em auto;
  width: fit-content;
  display: grid;
  grid-template-columns: repeat(2, auto);
  column-gap: 1ch;

  .num {
    text-align: right;
  }

  &.col-3 {
    grid-template-columns: repeat(3, auto);
  }

  &.left {
    margin: 1em auto 1em 20px;
  }
}

#kreissaege-1 {
  .ni-i-i-i-i-i-li {
    margin: 1em 0;

    .ni-1 {
      padding-inline-start: 20px;
    }
    .ni-2 {
      padding-inline-start: calc(20px + 5ch);
    }
    .ni-3 {
      padding-inline-start: calc(20px + 5ch + 2ch);
    }
    .ni-4 {
      padding-inline-start: calc(20px + 5ch + 2ch + 1.5ch);
    }
    .ni-5,
    .ni-6 {
      padding-inline-start: calc(20px + 5ch + 2ch + 1.5ch + 1ch);
    }
  }
}

#kunststoffliebe {
  .grid {
    margin: 1em 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: repeat(3, auto);
    .eins {
      grid-area: 1 / 2 / 1 / 2;
    }
    .und {
      grid-area: 2 / 1 / 2 / 1;
    }
    .wenn {
      grid-area: 3 / 2 / 3 / 4;
    }
  }
}

/* ===================================================================================== */

#kuessen-2 {
  position: relative;
  .grid {
    overflow-x: auto;
    column-gap: 0.8ch;
    padding: 1em 0;
    display: grid;
    grid-template-columns: repeat(4, auto);

    .text {
      min-width: 40ch;
      padding-left: 20px;
      text-indent: -20px;
    }
  }

  .rel {
    position: relative;
    left: 20px;
  }
}

.abs {
  position: absolute;
}

#lollo {
  .grid {
    display: grid;
    grid-template-columns: 1fr auto;
    .aber {
      grid-column: 1 / 3;
    }
  }
}

#maennlich {
  .grid {
    display: grid;
    grid-template-columns: 1fr auto minmax(1ch, 6ch) auto 1fr;
    margin: 1em auto;
  }
}

#mastmaedchen {
  .grid {
    display: grid;
    overflow-x: auto;
    grid-template-columns: 1fr repeat(6, auto) 1fr;
    column-gap: 0.7ch;

    .leftmost {
      text-align: right;
    }
  }
}

#maturanten-1,
#maturanten-2,
#maturanten-3,
#maturanten-4 {
  .longest-line {
    &::before {
      content: 'ein junger Mensch mit solchem Ziel ist meistens still .....';
    }
  }
}

#menschen {
  .grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }

  @media screen and (max-width: 40ch) {
    .hidden {
      display: none;
    }
  }
}

#nachziehverfahren {
  .grid {
    display: grid;
    grid-template-columns: 8ch auto;
    margin: 1em 0;
  }

  img {
    max-width: calc(var(--text-width) * 0.6);
    width: 100%;
    display: block;
    margin: 1em auto;
  }
}

#oedstaetten-4 {
  .frei {
    width: fit-content;
    font-weight: bold;
    margin: 1em 35% 1em auto;
  }

  @media screen and (max-width: 40ch) {
    .frei {
      margin: 1em auto;
      padding-inline-start: 0;
    }
  }
}
#perspektiven-1 {
  textarea {
    margin: 1em 0;
    width: 100%;
    height: 20lh;
    resize: vertical;
  }
}

#schlager-1,
#schlager-2,
#schlager-3 {
  .longest-line {
    &::before {
      content: 'In Indien werden die Witwen verbrannt, juchhe,';
    }
  }
}

#schwarzmeer-perspektive {
  .moskau {
    max-width: fit-content;
    margin-left: auto;
    margin-right: 1em;
  }
}

#studien-zum-fetischismus-3 {
  .raum {
    width: fit-content;
    text-align: center;
    margin: 3em auto 40em auto;
    font-size: small;
  }
}

.trapezoid-overflow-container {
  position: relative;
  overflow-x: auto;
  .trapezoid-container {
    width: 30ch;
    height: 30ch;
    margin: 1em auto;
    display: flex;
    justify-content: center;
    align-items: center;

    .trapezoid {
      height: 100%;
      .shape {
        fill: none;
        stroke: var(--body-font-color);
        stroke-width: 0.5px;
        stroke-dasharray: 0.5 1;
        stroke-linecap: butt;
        stroke-linejoin: round;
      }
    }
    .text {
      position: absolute;
      font-size: small;
      text-align: center;
      width: fit-content;
      height: fit-content;
    }
  }
}

#susi--und-eiske-epilog {
  .einer-einem {
    vertical-align: middle;
    text-align: center;
    margin: 0 0.5ch;
    display: inline-flex;
    flex-direction: column;
    .einem {
      border-top: solid 1px;
    }
  }
}

#torte-5 {
  .prato {
    text-align: right;
    padding-inline-end: 1em;
  }
}

#wasserereignisse-7 {
  .kaelte {
    text-align: right;
    padding-inline-end: 20%;
  }
}

#wc-8 {
  .grid {
    overflow-x: auto;
    display: grid;
    margin: 1rem 0;
    grid-template-columns: 1fr 1fr;
    column-gap: 3rem;
    row-gap: 1rem;
    align-items: end;

    .schild-container {
      width: 100%;
      .schild {
        margin: 1rem 0;
        font-weight: bold;
        font-size: 2rem;
        border: solid 2px;
        padding: 1rem;
        padding-top: 3rem;
        text-align: center;
        &::after {
          display: block;
          padding-top: 2rem;
          content: 'Verlag E. Winkler';
          font-size: small;
          font-weight: initial;
          text-align: right;
        }
      }
      .fuer-solche {
        margin-bottom: 1rem;
      }
    }
  }

  @media (max-width: 576px) {
    .grid {
      column-gap: 1rem;
      .schild-container {
        .schild {
          padding-top: 1rem;
          &::after {
            padding-top: 1rem;
          }
        }
      }
    }
  }

  @media (max-width: 350px) {
    .grid {
      grid-template-columns: 1fr;
    }
  }
}

#weg-zur-schiffsstation {
  .grid {
    margin: 2rem 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: repeat(3, auto);
    .ein-schiff {
      grid-column: 2 / 3;
      grid-row: 1;
    }
    .fuelte-er {
      grid-column: 1 / span 3;
      grid-row: 2;
    }
    .und-zwar {
      grid-column: 2;
      grid-row: 3;
    }
  }
}

#wein-8 {
  .padding-start {
    padding-inline-start: 6ch;
  }
}

#zeitung-1 {
  .monospace {
    padding-inline-start: 20px;
    display: inline-grid;
    grid-template-columns: 2ch repeat(5, 1ch);
    &.fifth-row {
      grid-template-columns: 4ch repeat(3, 1ch);
    }
  }
  .dots-grid {
    display: grid;

    &.--template-1 {
      grid-template-columns: auto 1fr;
    }

    &.--template-2 {
      grid-template-columns: 1fr auto;
    }
    column-gap: 0.5ch;
    .hidden-dots {
      text-wrap: nowrap;
      overflow-x: hidden;
    }
  }
}

#zeitung-5 {
  .longest-line {
    &::before {
      content: 'Wurstfabrik hat für junge, frische Mädchen Verwendung.';
    }
  }
}

#zeitung-8,
#zeitung-9 {
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 1rem 0;

    .row-6-span-2 {
      grid-column: 2;
      grid-row: 6 / span 2;
    }

    .align-self-end {
      align-self: end;
    }
  }

  .left {
    margin: 0.5rem 0;
    margin-right: 0.5rem;
  }

  .right {
    margin: 0.5rem 0;
    margin-left: 0.5rem;
  }

  .grid-header {
    border-bottom: solid 1px;
    margin: 0 0;
    padding-bottom: 0.5rem;
    &.indent {
      text-indent: 0.5rem;
    }
  }

  .okopenko {
    width: 100%;
    margin: 1rem 0;
  }

  .claudia {
    float: right;
    height: 3lh;
  }
}

#zeitung-9 {
  .grid {
    grid-template-columns: 3fr 2fr;
    .right {
      align-self: end;
    }
  }
}

.triple-indent {
  text-indent: 60px;
}

#ueber-den-lexikon-roman {
  p {
    text-indent: 0;
    margin: 20px 0;
  }
}
