/*
Ordning på CSS
0. sparat från boilerplate
1. Färger
2. Grundelement (body, länkar, bilder, footer)
3. Dynamiska element: Main + js-anslutet
4. Skärmstorlek
5. Popup m tidslinje
*/


/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* FÄRGER */
:root {
  --main-box-primary:#42002E;
  --main-box-contrast:#A85275;
  --main-box-invert:#FFF9DD;;
  --second-box-primary:#46000D;
  --second-box-contrast:#321003;
  --second-box-invert:#A87265;
  --darkest:#32001E;
  --palest:#F2EAFE;
  --shadow-rgb: 30, 30, 30;
  --shadow-opacity: 0.5;
  --shadow: 0 4px 8px rgba(var(--shadow-rgb), var(--shadow-opacity));
  --main-box-contrast-rgb: 168, 82, 117;
}

/* GRUNDELEMENT */
body {
  background-color: var(--darkest);
  color: var(--palest);
  background-image: url("/img/bg.jpg");
  background-size: contain;
  background-attachment: fixed;
  margin: 0;
  padding: 0;
  line-height: 1.4;
  font-size: 0.9em;
}

a {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--main-box-contrast);
  text-decoration: underline; /* Lägg tillbaka understrykning vid hovring */
}

.avdela { /* dekorativ text-avdelare, svartvit bild */
  filter: invert(100%);
  height: 90px;
  width: auto;
  display: block;
  margin: 15px auto;
}

/* när bilden visas i en av kolumnerna */
#filter-column .avdela {
  height: 45px;
  margin: 10px auto;
}

/*när visa omslagsbild*/
.cover-image {
  max-width: 90%;
  height: auto;
  display: block;
  border: 1px solid var(--main-box-contrast);
  margin-top: 10px;
  margin-bottom: 10px;
}
.quote {
  font-family: "Calibri Light", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--main-box-contrast);
  letter-spacing: 0.09rem;
}

footer {
  font-family: "Calibri Light", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  background-color: var(--second-box-primary);
  color: var(--second-box-invert);
  width:100%;
  text-align: center;
  padding:0.1rem;
}

/* DYNAMISKA ELEMENT */

main {
  font-family: Calibri, "Trebuchet MS", sans-serif;
  background-color: var(--main-box-primary);
  color: var(--main-box-invert);
  padding-left:40px;
  padding-right:40px;
  padding-bottom:25px;
  padding-top:10px;
  margin:20px;
  border-width:2px;
  border-color: var(--main-box-contrast);
  border-style: double;
}

h1, h2 {
  font-family: Calibri, "Trebuchet MS", sans-serif;
}

#output {
  margin-top: 20px;
  padding: 20px;
  background-color: var(--main-box-primary);
  border-radius: 8px;
}

.big-button {
  border-width: 5px;
  border-style: double;
  border-radius:30% / 70%;
  padding: 15px;
  margin: 8px;
  background-color: var(--main-box-contrast);
  color: var(--darkest);
  font-size: 1.1rem;
  font-weight: bold;
}

.smaller-button {
  border-width: 2px;
  border-style: double;
  border-radius:30% / 70%;
  padding: 5px;
  margin: 3px;
  background-color: var(--second-box-contrast);
  color: var(--second-box-invert);
  font-size: 0.8rem;
}

.ten-titles-list {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 10px 0;
  gap: 15px;
  color: var(--palest);
}

.ten-list-item {
  column-count: 1 !important;
  flex: 0 0 100%;
  box-sizing: border-box;
  margin-bottom: 0px;
  padding-left: 20px;
  position: relative;
}

.ten-titles-list .ten-list-item::before {
  content: '❧'; /*floral heart som bullet */
  color: var(--palest);
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1.1em;
  line-height: 1.1;
}

/* SKÄRMSTORLEK  */

/* Mobil/standardskärm */
#resp-layout-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

#filter-column {
  order: 1; /* först: mer filter */
}
#book-results-column {
  order: 2; /* två: resultat */
}
#reset-column {
  order: 3; /* sist: reset */
}


/* Flex-objekt (Kolumner) */
#book-results-column,
#filter-column,
#reset-column {
  padding: 15px;
  background-color: var(--main-box-primary);
  border-radius: 4px;
  box-sizing: border-box;
}

/* Mellanstor skärm (2 kolumner, min-width 600px) */
@media (min-width: 600px) {
  .ten-titles-list .ten-list-item {
    /* 50% bredd minus halva gapet (7.5px) */
    flex: 0 0 calc(50% - 7.5px);
  }

  #resp-layout-box {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  #book-results-column {
    flex: 1 1 calc(50% - 10px);
    order: 1;
  }
  #filter-column {
    flex: 1 1 calc(50% - 10px);
    order: 2; /* Kommer efter boklistan */
  }

  #reset-column {
    flex: 1 1 100%;
    order: 3;
    text-align: right;
  }
}

/* Stor skärm (3 kolumner, min-width: 1000px) */
@media (min-width: 1000px) {
  main {
    margin: 40px 100px;
    padding: 60px 80px 40px;
  }

  body {
    font-size: 1em;
  }

  .ten-titles-list .ten-list-item {
    /* 33.333% bredd minus en del av gapet (10px) */
    flex: 0 0 calc(33.333% - 10px);
  }
  #book-results-column {
    flex: 1 1 calc(33.333% - 15px);
    order: 1;
  }
  #filter-column {
    flex: 1 1 calc(33.333% - 15px);
    order: 2;
  }
  #reset-column {
    flex: 1 1 calc(33.333% - 15px);
    order: 3;
    text-align: left;
  }
}

/*
====================
POPUP
====================
*/

.modal-overlay {
  display: none; /* Dölj som standard */
  position: fixed;
  z-index: 1000; /* överst */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
  background-color: var(--main-box-primary);
  margin: 5% auto;
  padding: 25px;
  border: 5px double var(--main-box-contrast);
  width: 80%;
  max-width: 1000px;
  border-radius: 8px;
}

.close-button {
  color: var(--main-box-contrast);
  float: right;
  font-size: 36px;
  font-weight: bold;
}

.close-button:hover,
.close-button:focus {
  color: var(--palest);
  text-decoration: none;
  cursor: pointer;
}

.timeline-style {
  font-family: "Calibri Light", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.1em;
  color: var(--main-box-invert);
}

.timeline-style.obs {
  font-family: Calibri, Helvetica, sans-serif;
  font-weight: bolder;
  color: var(--palest);
}

.timeline-heading {
  font-style: italic;
  font-weight: bolder;
  font-size: 1.5rem;
  color: var(--second-box-invert);
}

.timeline-entry {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(var(--main-box-contrast-rgb), 0.3);
}

.timeline-image {
  flex-shrink: 0;
  width: 150px;
  height: auto;
  border: 1px solid var(--main-box-contrast);
  box-shadow: var(--shadow);
}
