/* Light Mode variables */
:root {
  --bg-color: #ffffff;       /* main background (can be fallback for wallpaper overlay) */
  --text-color: #111111;     /* main text */
  --header-text: #111111;    /* header text */
  --link-color: #1a73e8;     /* link color */
  --link-hover: #0c4da2;     /* link hover */
}

@font-face {
  font-family: "baking-pastry";
  src:
    url(/fonts/Baking-Pastry.woff2) format(woff2),
    url(/fonts/Baking-Pastry.woff) format(woff);
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

header {
  color: var(--header-text);
  margin: 0;
  padding: 1rem 1rem;
}

/* light and dark mode button */
#modeToggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

#modeToggle img {
  width: 50px;
  height: auto;
  display: block;
}

#modeToggle:hover img {
  transform: scale(1.1);
  transition: transform 0.2s;
}

#search {
  color: var(--text-color);
  text-decoration: none;
  font-family: baking-pastry,fantasy,sans-serif;
  font-size: 1.5rem;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  min-height: 100vh;
  position: relative;
  font-family: sans-serif;
  line-height: 2rem;
  font-size: 1.5rem;
}

a {
  color: var(--text-color);
  text-decoration: none;
  font-family: baking-pastry,fantasy,sans-serif;
  font-size: 1.5rem;
}

a:hover {
  color: var(--link-hover);
}

h2 {
  font-family: baking-pastry,fantasy,sans-serif;
  font-size: 2rem;
  font-weight: bold;
}

h4 {
  font-family: baking-pastry,fantasy,sans-serif;
  font-size: 1.5rem;
  text-align: center;
  margin: 0;
}

/* Light Mode image layer */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url(/images/wallpaper.jpg) center / cover no-repeat;
  opacity: 0.1; /*This adjusts the opacity of the background*/
  z-index: -1;
}

/* Dark Mode variables */
body.dark-mode {
  --bg-color: #1e1e1e;
  --text-color: #f0f0f0;
  --header-text: #f0f0f0;
  --link-color: #8ab4f8;
  --link-hover: #a3c0ff;
}

/* Dark mode wallpaper */
body.dark-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url(/images/wallpaperDark.jpg) center / cover no-repeat;
  opacity: 0.1; /* same opacity so overlay behavior is consistent */
  z-index: -1;
}

/* Josh's Recipes */
.title {
  text-align: center;
  font-family: baking-pastry,fantasy,sans-serif;
  font-weight: bold;
  font-size: 8rem;
  line-height: 1.5;
  margin: 0 0 0.2rem 0;
}

/* picture grid */
.nav-links{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 100px;
  row-gap: 8px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
  gap: 15px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.item {
  position: relative;
}

.item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

.icon {
  position: absolute;
  max-width: 60px;
  max-height: 60px;
  top: 5px;
  left: 5px;
  z-index: 10;
}

.item:hover img {
  transform: scale(1.1);
  transition: transform 0.2s;
}

.label {
  margin-top: 8px;
  text-align: left;
  font-family: baking-pastry,fantasy,sans-serif;
  font-weight: bold;
  font-size: 1.6rem;
  color: var(--text-color);
}

/* about dialogue box */
dialog {
  padding: 20px;
}

dialog::backdrop {
  background: rgba(0,0,0,0.6);
}

/*----------------------------------------------------------------------*/
/* -------------------------- RECIPE pages ---------------------------- */

#home {
  font-family: baking-pastry,fantasy,sans-serif;
  font-size: 1.4rem;
  font-weight: bold;
}

/* ingrediants & directions */
.title2 {
  max-width: 60%;
  margin: 0 auto;
  font-family: baking-pastry,fantasy,sans-serif;
  font-weight: bold;
  font-size: clamp(4rem, 4vw, 5rem);
  line-height: 1;
  text-align: center;
  overflow-wrap: break-word;
  word-break: normal;
  padding: 0;
}

body.dark-mode #homeicon{
  content: url(/images/homeIconDark.png);
  width: 30px;
  height: 30px;
}

/* Fonts */
body .qty {
  font-size: 1.6rem;
}

body .wt {
  color:blue;
}

body.dark-mode .wt {
  color:skyblue;
}

body .temp {
  color:red;
}

body.dark-mode .temp {
  color:pink;
}

a.inline {
  font-family: sans-serif;
  color: rgb(73, 185, 223);
}

a.inline:hover {
  color: purple;
}

/* ----- The Toggle Switch ------ */

.batch_number_1 {
  position: absolute;
  top: 7.3rem;
  left: 2rem;
  font-size: 1.8rem;
  color: rgb(193, 183, 183);
}

.batch_number_2 {
  position: absolute;
  top: 7.3rem;
  left: 7.2rem;
  font-size: 1.8rem;
  color: rgb(193, 183, 183);
}


/* box around slider */
.switch {
  position: absolute;
  display: inline-block;
  width: 60px;
  height: 34px;
  top: 7rem;
  left: 3rem;
}

/* hide default html checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* the slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

.slider::before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider::before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

/* rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round::before {
    border-radius: 50%;
}

/* full viewport height minus header */
.recipe-container {
  display: flex; /* splits left/right */
  flex-direction: column;
}

@media (min-width: 768px) {
  .recipe-container {
    flex-direction: row;
  }
}

/* columns */
.recipe-left,
.recipe-right,
.recipe-center {
  flex: 1; /*each takes 50% width*/
  padding: 1rem;
}

/* Recipe image on top*/
.recipe-left {
  position: relative;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.recipe-page-image {
  width: 100%;
  height: auto;
}

.recipe-page-icon {
  position: absolute;
  width: 50px;
  top: 20px;
  left: 20px;
  z-index: 10;
}

/* Print button */
.print-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.4rem;
  font-family: baking-pastry,fantasy,sans-serif;
  background-color: lightgreen;
  border-color: green;
  border-radius: 8px;
  width: 75px;
  height: 35px;
  padding: 1;
  cursor: pointer;
}

.print-btn:hover {
  transform: scale(1.1);
  transition: transform 0.2s;
}

/* ---- Print page ---- */
@media print {
  /* hide site chrome */
  nav,
  .print-btn {
    display: none;
  }
  
  body {
    background: white;
    color: black;
    margin: 0;
  }

  @page {
    margin: 0.5in;
  }

  .recipe-container {
    display: block; /* this turns off flex*/
    column-count: 2;
    column-gap: 2rem;
    column-fill: auto;
  }
  
  .recipe-left,
  .recipe-center,
  .recipe-right {
    break-inside: avoid;
    overflow: visible; /*ensures content can expand visably*/
    margin: 0;
    padding: 0;
  }

  .recipe-left img {
    max-height: 200px;
    width: auto;
  }

  .recipe-page-icon {
    max-width: 40px;
    top: 0;
    left: 0;
    padding: 0.2rem;
  }
  
  h1, h2, h3, h4 {
    break-before: auto;
    break-after: avoid;
    page-break-inside: avoid;
  }
 
  /* improve readability of text */
  .title2 {
    font-size: 30pt;
  }

  h4 {
    font-size: 12pt;
  }

  h2,
  h3 {
    font-size: 14pt;
    margin-top: 0.2em;
    margin-bottom: 0.3em;
  }

  ul, ol {
    margin-top: 0.3em;
    margin-bottom: 0.6em;
    padding-left: 1.2em;
  }
  
  li {
    font-size: 10pt;
    line-height: 20pt;
  }

  body .qty {
    font-size: 11pt;
  }
}