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

.achtung {
  background-color: pink;
  margin-block: 1em;
  padding-block: 1em;
  border: 3px solid red;
  text-align: center;
}

body {
  /* not wider than 60em, but always leave a 1em margin on each side, even on narrow viewports */
  /* we cannot use margin because that's already used for …auto */
  width: calc(100% - 2em);
  max-width: 60em;
  /* alternatively: ?
   * max-width: clamp(2em;100%;100%); ???
   */
  margin: 1em auto; /* easy centering */ /* `margin: auto` on its own will only do horizontal centering if we don't want top/bottom margins*/
  /*border: 1px solid grey;*/
}

/* remove the link styling */
header a {
  text-decoration: none;
  color: inherit;
  /*background-color: #ccc;*/
}

header {
  /*background-color: #eee;*/
}
header img {
  width: 100%;
}

#die-wurzel-banner {
  /*width: 100%;*/
  /*background-color: #ddd;*/
}

#subtitle-zeitschrift {
  font-weight: 500;
  font-size: 150%;
  font-family: sans-serif;
}

#subtitle-verein {
  font-size: 120%;
  font-family: sans-serif;
}

footer {
  margin-top: 5em;
}

/* justified text to mimic Latex */
/*TODO maybe turn off for very narrow viewports? */
/*TODO another container than `main`, maybe `article`? */
/* only do this for text for now, headings etc. look really bad on mobile */
/*TODO add other */
p {
  text-align: justify;
  hyphens: auto;
}

/* Navigation */

/* common styles for both */
nav {
  font-family: sans-serif;
  ul {
    list-style: none;
    margin: 0;
    /*padding-left: 1em;*/
  }
  > ul {
  padding: 0;
  }

  a {
    text-decoration: underline;
    color: black;
  }
  > ul > li > span,
  > ul > li > a {
    text-decoration: none;
    font-weight: bold;
    background-color: darkgray;
  }
  a:hover {
      text-decoration: underline;
  }
}

/* styles for mobile */
@media screen and (width < 600px) {

  /* smaller header */
  #subtitle-verein,
  #subtitle-zeitschrift,
  header hr {
    display: none
  }

  /*
  nav {
  height: 100dvh;
  width: 80vw;
  top: 0;
  left: 0;
  position: fixed;
  margin: 0;
  }

  nav:popover-open {
  }
  */
  
  /* start with disabled navigation */
  /* TODO doesn't work on live-resizing yet */
  nav {
    display: none;
  }
}

/* nav for big screens */
@media screen and (width >= 600px) {
  
  #menu-toggle {
    display: none;
  }
  
  nav {
    margin-top: 2em;
    margin-bottom: 5em;
    /*padding-block: 0.5em;*/
    /*border: 1px solid;*/
    background-color: darkgray;
  }
  nav ul,
  nav li,
  nav a {
    padding: 0;
    margin: 0;
    text-decoration: none;
  }
  nav > ul {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    padding-block: 0.5em;
    /*align-items: center;*/
  }
  
  /* hide submenus by default, display on hover */
  nav > ul > li > ul {
    display: none;
    position: absolute;
    width: auto;
    height: auto;
    background-color: darkgray;
    white-space: nowrap;
    border: 1px solid;
    /*border-radius: 2px;*/
    z-index: 1;
    padding: 0.5em;
  }
  nav > ul > li:hover > ul {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 0.5em;
  }
  /* align last dropdown to right edge */
  nav > ul > li:last-child > ul {
    right: 0;
  }
  nav ul li {
  display: inline-block;
  position: relative;
  text-align: left;
  /*margin: 0 1rem;*/
}
  
}

/* forms */
/* placement & size */
input[type=text],
input[type=email],
input[type=tel],
input[type=submit],
select,
textarea {
  width: 100%;
  padding: 0.2em;
}
textarea {
  resize: vertical;
  height: 10em;
}

.form-order,
.form-contact,
.form-cancel {
  display: grid;
  gap: 1em;
  /*line-height: 1.3;*/
  width: min(100%,600px);
}
.form-contact label:not(:first-child),
.form-contact input[type=submit] {
  margin-block-start: 20px;
}

.form-address {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2em;
  
  @media(width >= 600px) {
    grid-template-columns: 1fr 3fr;
  }
}

.form-order ul {
  list-style: none;
  padding: 0;
}
.form-order li {
  line-height: 1.25;
  padding-block: 0.25em;
}
#form-order-alle {
  display: grid;
  grid-template-columns: repeat(auto-fit, 100px);
}


/* colors, input validation */
input[type=submit] {
  background-color: darkgray;
  color: black;
}

input {
  /*outline: 2px solid;*/
  outline-width: 1px;
  outline-style: solid;
}

/* to every label immediately before a required input */
label:has(+ input:required)::after,
label:has(+ textarea:required)::after {
  content: ' (*)';
  font-size: small;
}
input:user-valid {
  outline-color: green;
}
input:user-invalid {
  outline-color: red;
  /*border: 1px solid red;*/
}
