* { box-sizing: border-box; }

/* force scrollbar, prevents initial gap */
html {
  overflow-y: scroll;
}

body {
  font-family: sans-serif;
}

:root{
  --unit-width: 155px;
  --unit-height: 155px;
}

/* ---- grid ---- */

.grid {
  background: #DDD;
}

/* clear fix */
.grid:after {
  content: '';
  display: block;
  clear: both;
}

/* ---- .element-item ---- */

/* 5 columns, percentage width */
.grid-item,
.grid-sizer {
  width: 10%;
}

.grid-item {
  float: left;
  width: var(--unit-width);
  height: var(--unit-height);
  background: #0D8;
  border: 2px solid #333;
  border-color: hsla(0, 0%, 0%, 0.7);
}

/*
supported tile size:
  21  - 2x1
  32  - 3x2
  43  - 4x3
  7   - 10x7
  17  - 40x17
*/

.grid-item--width2 { width: 280px; }
.grid-item--height2 { height: 280px; }

.grid-item--width32 { width: 220px; }
.grid-item--height32 { height: 220px; }

.grid-item--width43 { width: 193px; }
.grid-item--height43 { height: 193px; }

.grid-item--width7 { width: 210px; }
.grid-item--height7 { height: 210px; }

.grid-item--width8 { width: 185px; }
.grid-item--height8 { height: 190px; }

.grid-item--width7m { width: 595px; height:425px}
.grid-item--height7m { height: 595px; width:420px}

.grid-item--width17 { width: 320px; height: 150px; }
.grid-item--height17 { height: 320px; width: 150px;}

* { box-sizing: border-box; }

body {
  font-family: sans-serif;
}

/* ---- button ---- */

.button {
  display: inline-block;
  padding: 0.5em 1.0em;
  background: #EEE;
  border: none;
  border-radius: 7px;
  background-image: linear-gradient( to bottom, hsla(0, 0%, 0%, 0), hsla(0, 0%, 0%, 0.2) );
  color: #222;
  font-family: sans-serif;
  font-size: 16px;
  text-shadow: 0 1px white;
  cursor: pointer;
}

.button-read {
  display: inline-block;
  padding: 0.5em 1.0em;
  background: #EEE;
  border: none;
  border-radius: 7px;
  background-image: linear-gradient( to bottom, hsla(0, 0%, 0%, 0), hsla(0, 0%, 0%, 0.2) );
  color: #222;
  font-family: sans-serif;
  font-size: 16px;
  text-shadow: 0 1px white;
  cursor: pointer;
}

.button:hover {
  background-color: #8CF;
  text-shadow: 0 1px hsla(0, 0%, 100%, 0.5);
  color: #222;
}

.button:active,
.button.is-checked {
  background-color: #28F;
}

.button.is-checked {
  color: white;
  text-shadow: 0 -1px hsla(0, 0%, 0%, 0.8);
}

.button:active {
  box-shadow: inset 0 1px 10px hsla(0, 0%, 0%, 0.8);
}

/* ---- button-group ---- */

.button-group {
  margin-bottom: 20px;
}

.button-group:after {
  content: '';
  display: block;
  clear: both;
}

.button-group .button {
  float: left;
  border-radius: 0;
  margin-left: 0;
  margin-right: 1px;
}

.button-group .button:first-child { border-radius: 0.5em 0 0 0.5em; }
.button-group .button:last-child { border-radius: 0 0.5em 0.5em 0; }

/* ---- isotope ---- */

.grid {
  border: 1px solid #333;
}

/* clear fix */
.grid:after {
  content: '';
  display: block;
  clear: both;
}

/* ---- .element-item ---- */

.element-item {
  position: relative;
  float: left;
/*  width: 155px;
  height: 155px;*/
  margin: 5px;
  padding: 10px;
  background: #888;
  color: #262524;
}

.element-item > * {
  margin: 0;
  padding: 0;
}

.element-item .year {
  position: absolute;

  left: 10px;
  top: 60px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: normal;
}

.element-item .name {
  position: absolute;
  left: 10px;
  top: 0px;
  font-size: 42px;
  font-weight: bold;
  color: white;
}

.element-item .date {
  position: absolute;
  text-align: center;
  bottom: 15px;
  color: white;
}

.element-item .action {
  position: absolute;
  left: 10px;
  top: 76px;
  font-size: 12px;
}

.element-item.writing          { background: #F00; background-image: linear-gradient( to bottom, hsla(20, 100%, 50%, 0), hsla(0, 0%, 0%, 0.2) ); }
.element-item.remarkable  { background: #F80; background-image: linear-gradient( to bottom, hsla(36, 100%, 50%, 0), hsla(0, 0%, 0%, 0.2) ); }
.element-item.poem      { background: #FF0; background-image: linear-gradient( to bottom, hsla(72, 100%, 50%, 0), hsla(0, 0%, 0%, 0.2) ); }
.element-item.video        { background: #F2F; background-image: linear-gradient( to bottom, hsla(100, 100%, 50%, 0), hsla(0, 0%, 0%, 0.2) ); }
.element-item.procreate      { background: #0F8; background-image: linear-gradient( to bottom, hsla(144, 100%, 50%, 0), hsla(0, 0%, 0%, 0.2) ); }
.element-item.drawing { background: #FFF; background-image: linear-gradient( to bottom, hsla(180, 100%, 50%, 0), hsla(0, 0%, 0%, 0.2) ); }
.element-item.metalloid       { background: #08F; background: hsl( 216, 100%, 50%); }
.element-item.diatomic        { background: #00F; background: hsl( 252, 100%, 50%); }
.element-item.halogen         { background: #F0F; background: hsl( 288, 100%, 50%); }
.element-item.noble-gas       { background: #F08; background: hsl( 324, 100%, 50%); }

.image-container {
  position: relative; /* This makes the container the reference for positioning the child elements absolutely */
  display: inline-block; /* This shrinks the container to fit the image's width */
}

.tile-container img {
  display: block; /* Ensures the image takes up the full width of its container */
  width: 100%; /* Makes the image responsive to the container's width */
  height: auto; /* Keeps the image's aspect ratio */
}

.content-container img {
  display: block; /* Ensures the image takes up the full width of its container */
  width: 100%; /* Makes the image responsive to the container's width */
  height: auto; /* Keeps the image's aspect ratio */
}

.content-text {
  position: absolute; /* Positions the text div over the image */
  bottom: 0; /* Aligns the text div at the bottom of the image */
  left: 0; /* Aligns the text div to the left of the container */
  width: 100%; /* Ensures the text div matches the image/container width */
  /* Additional styling for visibility and aesthetics */
  color: white; /* Text color */
  background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background for the text for readability */
  text-align: center; /* Centers the text within the div */
  padding: 10px 0; /* Adds some padding inside the text div */
}

.overlay-text {
  position: absolute; /* Positions the text div over the image */
  bottom: 0; /* Aligns the text div at the bottom of the image */
  left: 0; /* Aligns the text div to the left of the container */
  width: 100%; /* Ensures the text div matches the image/container width */
  /* Additional styling for visibility and aesthetics */
  color: white; /* Text color */
  background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background for the text for readability */
  text-align: center; /* Centers the text within the div */
  padding: 10px 0; /* Adds some padding inside the text div */
  opacity: 0;
}

.drawing:hover .overlay-text {
    opacity: 1;
}

.drawing .caption {
    position: absolute;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5); /* Black background with opacity */
    color: #f1f1f1; /* Light grey text */
    /*width: ;*/
    text-align: center;
    padding: 20px 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    font-family: Arial, sans-serif; /* Example font */
}

.drawing:hover .caption {
    opacity: 1;
}

/* Grey overlay that appears on hover */
.drawing:hover img {
    filter: grayscale(40%);
}

.procreate .play {
    position: absolute;
    bottom: 0;
    background: rgba(A0, A0, A0, .5); /* Black background with opacity */
    color: #f1f1f1; /* Light grey text */
    width: 90%;
    text-align: center;
    padding: 20px 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    font-family: Arial, sans-serif; /* Example font */
}

.procreate:hover .play  {
    opacity: 1;
}
