/*
 * Reininsparlament - CSS
 * Plain CSS with native nesting, delivered as is (no build step).
 */

/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  /* Colors */
  --color-white: #fff;
  --color-black: #000;
  --color-text: #fff;
  --color-link: #fc0;
  --color-navigation: #1a505a;
  --color-accent: #dc0c46;
  --color-content-background: #497878;
  --color-input-border: #7bb3b6;
  --color-border: #999;
  --color-footer-text: #666;
  --color-lehrlingsparlament-background: #e9dfc5;
  --color-lehrlingsparlament-active: #990000;

  /* Fonts */
  --font-family: verdana, arial, sans-serif;
  --font-size-small: 11px;

  /* Layout: fixed width, columns positioned absolutely */
  --layout-width: 970px;
  --top-bar-offset: 50px; /* space for the fixed bar "Parlament Österreich" */
  --header-height: 372px; /* header image */
  --sidebar-width: 300px;
  --content-width: 450px;
  --content-top: calc(var(--top-bar-offset) + 200px);
  --badge-left: 750px; /* left edge of the "Lehrlingsparlament" badge in the header image */
  --badge-width: calc(var(--layout-width) - var(--badge-left));
}

/* ==========================================================================
   Base: only what still differs from the browser defaults
   (formerly normalize.css v1.0.1; browsers from 2022 on)
   ========================================================================== */

html {
  -webkit-text-size-adjust: 100%; /* iOS Safari: no font scaling in landscape */
  text-size-adjust: 100%;
  font-family: sans-serif;
  /* always show the scrollbar, so that the centred layout does not shift between short and long pages
     (scrollbar-gutter: stable does not reserve the space of the root scrollbar in Chrome) */
  overflow-y: scroll;
}

body {
  margin: 0;
}

code, kbd, pre, samp {
  font-family: monospace, serif; /* the generic "monospace" alone shrinks the font size */
  font-size: 1em;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

small {
  font-size: 80%;
}

/* sub/sup without affecting the line height */
sub, sup {
  position: relative;
  font-size: 75%;
  line-height: 0;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

ol, dl, dd, figure {
  margin: 0;
}

button, input, select, textarea {
  margin: 0;
  font-family: sans-serif;
  font-size: 100%;
  vertical-align: baseline;
}

button, input:is([type="button"], [type="reset"], [type="submit"]) {
  cursor: pointer;
}

:is(button, input):disabled {
  cursor: default;
}

textarea {
  vertical-align: top;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ==========================================================================
   Typography
   ========================================================================== */

body {
  background: var(--color-white) url(../Images/Layout/background.webp);
  color: var(--color-text);
  font-family: var(--font-family);
}

/* The pseudo-classes keep the specificity, so that links win against other styles as before */
a, a:is(:link, :visited, :focus, :hover, :active) {
  color: var(--color-link);
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  padding-top: 0;
  font-size: 1.6em;
  font-weight: normal;
  line-height: 1.3em;
}

h2 {
  font-size: 1.4em;
}

h3 {
  font-size: 1.3em;
}

h4 {
  font-size: 1.2em;
}

h5 {
  font-size: 1.1em;
}

h6 {
  font-size: 1em;
}

h4, h5, h6 {
  font-weight: bold;
}

p {
  line-height: 1.6em;
}

/* ==========================================================================
   Forms
   ========================================================================== */

fieldset {
  width: 100%;
  margin-bottom: 1em;
  margin-left: 0;
  padding-left: 0;
  border: 0;
}

label {
  display: block;
  width: 100%;
  padding-right: 5px;
}

input, textarea {
  border: 1px solid var(--color-input-border);
  background: var(--color-white);
  color: var(--color-black);
}

input {
  width: 90%;
}

textarea {
  width: 100%;
}

/* ==========================================================================
   Page grid
   ========================================================================== */

/* Centered column of fixed width; the auto margins become 0 on narrower screens (no negative offset) */
#center {
  position: relative; /* containing block of the absolutely positioned areas */
  width: var(--layout-width);
  margin-inline: auto;
  font-size: .75em;
}

/* Centered container of the top bar and the footer */
.wrapper {
  position: relative;
  width: 100%;
  max-width: var(--layout-width);
  margin: 0 auto;
}

/* ==========================================================================
   Top bar "Parlament Österreich" (fixed, smaller when scrolled)
   ========================================================================== */

#parlament-logo-header {
  position: fixed;
  top: 0;
  z-index: 200001;
  width: 100%;
  height: 55px;
  padding-top: 5px;
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-white);
  transition: 0.2s;

  & .wrapper {
    padding-left: 40px;

    @media screen and (max-width: 1020px) {
      margin: 0 0 0 20px;
      padding-left: 0;
    }
  }

  & .parlament-logo-link {
    display: block;
    margin-top: 5px;
  }

  & .parlament-logo-full {
    display: block;
    max-height: 40px;
  }

  & .parlament-logo-small {
    display: none;
    max-height: 30px;
  }

  &.scrolled {
    height: 40px;

    & .parlament-logo-link {
      margin-top: 2px;
    }

    & .parlament-logo-full {
      display: none;
    }

    & .parlament-logo-small {
      display: block;
    }
  }
}

/* ==========================================================================
   Header image (970x372, transparent), behind the navigation and the content
   ========================================================================== */

#header {
  position: absolute;
  top: var(--top-bar-offset);
  left: 0;
  width: var(--layout-width);
  height: var(--header-height);

  & img {
    display: block;
  }
}

/* Clickable areas on the header image */
.header-link {
  position: absolute;
}

.header-link-home {
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 215px;
}

.header-link-lehrlingsparlament {
  top: 212px;
  left: var(--badge-left);
  width: var(--badge-width);
  height: calc(var(--header-height) - 212px);
}

/* ==========================================================================
   Navigation: main navigation (left) and "Lehrlingsparlament" (below the badge)
   ========================================================================== */

:is(#navi, #navi-lehrlingsparlament) {
  & .first {
    margin-bottom: 3em;
  }

  & ul {
    margin: 0;
    padding: 0 1em 0 2em;
    color: var(--color-navigation);
    list-style-type: none;
  }

  & ul ul {
    padding: 0 1em;
    color: var(--color-accent);
    list-style-type: disc;
  }

  & li {
    margin-top: 1em;
    text-indent: -.9em;
  }

  & li li {
    margin-top: .8em;
    text-indent: 0;
  }

  & a {
    color: var(--color-navigation);
    line-height: 1.2em;
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  & .active {
    color: var(--color-accent);
    font-weight: bold;
  }

  & .active li {
    font-weight: normal;
  }

  & li .active {
    font-weight: bold;
  }

  & li li a {
    color: var(--color-accent);
  }
}

#navi {
  position: absolute;
  top: var(--content-top);
  left: 0;
  width: var(--sidebar-width);
  padding-top: 30px;
  padding-bottom: 80px;
}

/* Pulled up by 20px to cover the irregular lower edge of the badge */
#navi-lehrlingsparlament {
  --color-accent: var(--color-lehrlingsparlament-active); /* sub entries, bullets and active entries in dark red */

  position: absolute;
  top: calc(var(--top-bar-offset) + var(--header-height) - 20px);
  left: var(--badge-left);
  width: var(--badge-width);
  padding: calc(1em + 20px) 0 0;
  background-color: var(--color-lehrlingsparlament-background);
  font-size: .9em;
}

/* ==========================================================================
   Content
   ========================================================================== */

#content-wrapper {
  position: absolute;
  top: var(--content-top);
  left: var(--sidebar-width);
  width: var(--content-width);
}

#content {
  width: 100%;
  background: url(../Images/Layout/content-background.webp) no-repeat top left var(--color-content-background);
}

/* Space after every content element: .frame, or the main element of a content element without frame */
#content-margins > :is(.frame, [class^="ce-"]) {
  padding-bottom: 14px; /* padding, not margin: the bottom margin of the last child must not collapse with it */
}

#content-margins {
  margin-bottom: 100px;
  padding: 50px 20px;
}

/* ==========================================================================
   Quick links (on the header image)
   ========================================================================== */

#hot-links {
  position: absolute;
  top: calc(var(--content-top) - 13px);
  left: var(--sidebar-width);
  z-index: 1;
  width: 600px;
  color: var(--color-text);
  font-size: .9em;
  text-align: right;

  & * {
    color: var(--color-text);
    font-size: 1em;
  }

  & ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
  }

  & li {
    display: inline;
    margin: 0;
    padding: 0;
  }

  & a {
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }
}

/* ==========================================================================
   Footer (fixed)
   ========================================================================== */

.logo-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 10px 0;
  background-color: var(--color-white);

  & .footer-left {
    float: left;
    width: 20%;
  }

  & .footer-center {
    float: left;
    width: 60%;
    padding-top: 12px;
    color: var(--color-footer-text);
    font-size: var(--font-size-small);
    text-align: center;
  }

  & .footer-right {
    float: left;
    width: 20%;
    padding-top: 12px;
    color: var(--color-footer-text);
    font-size: var(--font-size-small);
    text-align: right;
  }

  & .parlament-logo-link-bottom {
    display: block;

    & img {
      height: 35px;
    }
  }
}

/* ==========================================================================
   Content elements
   ========================================================================== */

div.ce-textpic {
  & figure {
    margin-bottom: 10px;
  }
}

div.ce-gallery {
  & video {
    width: 410px;
  }

  /* Video.js 10 player around self-hosted videos */
  & video-skin {
    display: block;
    width: 410px;
    max-width: 100%;

    & video {
      width: 100%;
    }
  }

  /* Video.js puts its container in fullscreen; the video has to fill it instead of keeping its width */
  & :fullscreen video {
    width: 100%;
    height: 100%;
  }
}

/* Chapter list below a video, built by videoPlayer.js */
.video-chapters {
  width: 410px;
  max-width: 100%;
  margin-top: 10px;
  text-align: left;

  & .video-chapters-heading {
    margin: 0 0 5px;
    font-weight: bold;
  }

  & ol {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  & button {
    display: flex;
    gap: 10px;
    width: 100%;
    padding: 4px 6px;
    border: 0;
    background: none;
    color: var(--color-link);
    font: inherit;
    text-align: left;
    cursor: pointer;

    &:hover,
    &:focus-visible {
      text-decoration: underline;
    }

    &:focus-visible {
      outline: 2px solid var(--color-link);
      outline-offset: -2px;
    }

    &[aria-current] {
      background-color: var(--color-navigation);
      font-weight: bold;
    }
  }

  & .video-chapters-time {
    flex: none;
    min-width: 3.5em;
    font-variant-numeric: tabular-nums;
  }
}

/* PhotoSwipe lightbox below the top bar */
.pswp {
  margin-top: 55px;

  body.scrolled & {
    margin-top: 40px;
  }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

/* Text alignment from the rich text editor */
.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

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

.text-justify {
  text-align: justify;
}

/* Hidden visually, but read by screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
