/*
 * Copyright (c) 2025-2026 Evolution Creek Software. All rights reserved.
 *
 * Unauthorized copying, linking, or other unintended use of this file
 * (in part or in whole) is strictly prohibited.
 */

@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 100vw;
  margin: 0 auto;
  background-color: beige;
  opacity: 0;
  animation: fadeIn 0.2s ease-in forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

main {
  display: flex;
  flex-direction: column;
  flex: 1;
  align-items: stretch;
  background-color: beige;
  margin-top: 0;
  height: 100vh;
}

img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

header {
  display: flex;
  background-color: wheat;
  box-shadow: 0 0 10px 3px peru;
  justify-content: center;
  align-items: center;
  padding: 1rem 2rem;
  position: relative;
  top: 0;
  width: 100%;
  box-sizing: border-box;
  transition: opacity 0.2s ease;
}

h1 {
  justify-self: center;
  font-family: 'Salsa', cursive;
  font-weight: 400;
  font-size: 2.5rem;
  margin: 0;
  cursor: default;
  transition: opacity 0.2s ease;
  line-height: 1;
  text-align: center;
  max-width: 70vw;
}

#headerIcon {
  position: absolute;
  left: 0rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 600ms, left 0.3s ease;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  z-index: 1100;
}

.line {
  fill: none;
  transition: stroke-dasharray 600ms, stroke-dashoffset 600ms, stroke 800ms;
  stroke: #000;
  stroke-width: 5.5;
  stroke-linecap: butt;
}

.ham8 .top {
  stroke-dasharray: 40 160;
}

.ham8 .middle {
  stroke-dasharray: 40 142;
  transform-origin: 50%;
  transition: transform 600ms;
}

.ham8 .bottom {
  stroke-dasharray: 40 85;
  transform-origin: 50%;
  transition: transform 600ms, stroke-dashoffset 600ms;
}

.ham8.active .top {
  stroke-dashoffset: -64px;
}

.ham8.active .middle {
  transform: rotate(90deg);
}

.ham8.active .bottom {
  stroke-dashoffset: -64px;
}

#headerIcon.active {
  transform: rotate(45deg);
  position: fixed;
}

#headerIcon.active .line {
  stroke: saddlebrown;
}

#sideMenu {
  position: fixed;
  top: 0;
  left: -250px;
  width: 250px;
  height: 100%;
  background: white;
  box-shadow: 2px 0 5px rgba(0,0,0,0.2);
  padding: 2rem 1rem;
  transition: left 0.3s ease;
  z-index: 1000;
  background-color: beige;
  display: flex;
  flex-direction: column;
}

#sideMenu.active {
  left: 0;
}

#sideMenu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-top: 3rem;
}

#sideMenu li {
  margin: 0.5rem 0;
}

#sideMenu a {
  text-decoration: none;
  font-family: 'Afacad Flux', sans-serif;
  font-weight: 500;
  font-size: 1.5rem;
  color: black;
  transition: color 0.2s ease;
}

#sideMenu a:hover {
  color: saddlebrown;
}

#socialIcons {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0;
  margin-top: auto;
  margin-bottom: -1rem;
}

#socialIcons i {
  font-size: 1.7rem;
  color: black;
  transition: color 0.2s ease;
}

#socialIcons a {
  position: relative;
}

#socialIcons a::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: sienna;
  color: white;
  font-family: 'Salsa', cursive;
  font-size: 1rem;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#socialIcons a:hover::after {
  opacity: 1;
}

#socialIcons a:hover i {
  color: sienna;
}

.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  z-index: 2000;
  width: 80%;
  max-width: 400px;
  border-radius: 10px;
  cursor: default;
  border: 2px solid black;
}

.popup h2 {
  font-size: 2rem;
  font-family: 'Caveat', cursive;
  color: saddlebrown;
}

.popup p {
  font-size: 1.5rem;
  font-family: "Caveat Brush", cursive;
}

.popup a {
  text-decoration: none;
  font-size: 1.5rem;
  font-family: "Caveat Brush", cursive;
}

.popup a:hover {
  color: blue;
}

.popup.active {
  display: block;
}

#popups.active ~ main,
#popups.active ~ header h1 {
  opacity: 0.5;
}

/* ── Full-page grid ── */
.grid {
  display: grid;
  width: 100%;
  flex: 1;
  overflow-x: hidden;
  border-left: 4px solid saddlebrown;
  border-bottom: 2px solid saddlebrown;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  height: 100vh;
}

/* ── Card ── */
.square {
  width: 100%;
  height: 100%;
  aspect-ratio: unset;
  text-decoration: none;
  color: inherit;
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
  font-size: clamp(20px, 2rem, 40px);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s ease;
  background-color: beige;
  border-right: 4px solid saddlebrown;
  border-top: 2px solid saddlebrown;
}

.square img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Title — centered badge overlaid on card ── */
.title {
  background-color: wheat;
  color: saddlebrown;
  position: absolute;
  font-family: 'Afacad Flux', sans-serif;
  font-weight: 600;
  padding: 0.5em 0.5em;
  font-size: 1.5rem;
  text-align: center;
  width: 11rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px 4px rgba(139, 90, 43, 1);
  transition: color 0.2s ease, width 0.5s ease, background-color 0.5s ease;
  z-index: 2;
}

/* ── Description ── */
.square-description {
  opacity: 0;
  transition: opacity 0.3s ease;
  position: absolute;
  top: 60%;
  text-align: center;
  padding: 0.5rem;
  color: black;
  font-family: "Caveat Brush", cursive;
  font-weight: 400;
  font-style: normal;
  font-size: 1.5rem;
  pointer-events: none;
  display: none;
}

@keyframes rotate {
  to { --angle: 360deg; }
}

/* ── Hover (mouse devices only) ── */
@media (hover: hover) and (pointer: fine) {
  .square-description {
    display: block;
  }

  .square:hover .square-description {
    opacity: 1;
  }

  .square:hover img {
    opacity: 0.2;
  }

  .square:hover .title {
    background-color: transparent;
    width: 100%;
  }

  .square:hover {
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: inset 0 0 60px 20px rgba(139, 90, 43, 0.7);
    z-index: 50;
  }
}

@media (hover: none) and (pointer: coarse) {
  .square:hover {
    transform: scale(1.05);
  }
}

footer {
  text-align: center;
  padding: 1rem;
  font-size: 1rem;
  color: #666;
  cursor: default;
  margin-top: auto;
}

/* ── Portrait / narrow screens ── */
@media (orientation: portrait) {
  main {
    display: grid;
    height: 100vh;
    align-content: stretch;
  }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    border-bottom: 4px solid saddlebrown;
  }

  .square {
    height: 100%;
    aspect-ratio: unset;
    border-top: 4px solid saddlebrown;
  }

  .title {
    font-size: 1rem;
    width: 7rem;
    line-height: 1.2;
    padding: 0.4em 0.3em;
  }

  .square-description {
    font-size: 0.9rem;
  }

  footer {
    border-top: 4px solid saddlebrown;
  }
}

@media (max-width: 700px) {
  header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  h1 {
    font-size: 1.5rem;
    line-height: 1;
    max-width: 60vw;
    text-align: center;
    margin-top: 0.5rem;
  }

  #headerIcon {
    left: 0rem;
    padding: 7px;
  }

  #sideMenu.active + #headerIcon,
  #headerIcon.active {
    left: 0rem;
    position: fixed;
  }

  #sideMenu {
    left: -100vw;
    width: 100vw;
    box-sizing: border-box;
  }

  #sideMenu.active {
    left: 0;
  }

  #sideMenu ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  #sideMenu a {
    font-size: 1.5rem;
  }

  #socialIcons {
    margin-top: 0rem;
  }

  #socialIcons i {
    font-size: 1.7rem;
  }

  #socialIcons a::after {
    bottom: -130%;
  }

  main {
    display: grid;
    height: 100vh;
    align-content: stretch;
  }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    border-bottom: 4px solid saddlebrown;
  }

  .square {
    height: 100%;
    aspect-ratio: unset;
    border-top: 4px solid saddlebrown;
  }

  .title {
    font-size: 0.85rem;
    width: 6rem;
    line-height: 1.2;
    padding: 0.4em 0.3em;
  }

  .square-description {
    font-size: 0.9rem;
  }

  footer {
    margin-top: auto;
    border-top: 4px solid saddlebrown;
  }
}