/*
  Josh's Custom CSS Reset
  https://www.joshwcomeau.com/css/custom-css-reset/
*/

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

* {
  margin: 0;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

p {
  text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

#root,
#__next {
  isolation: isolate;
}

/* ************************* */
/* GLOBAL VARIABLES & STYLES */
/* ************************* */

:root {
  /* Colors */
  --background-color-default: #00121a;
  --text-color-default: #e8f4f8;
  --title-color-default: #ff9500;
  --bento-color-default: #0ea5e9;
  --bento-text-color: #ffffff;
  --modal-bg: #ffffff;
  --modal-text: #333333;
  --modal-text-secondary: #444444;
  --modal-overlay: rgba(0, 0, 0, 0.6);

  /* Shadows */
  --shadow-inset: rgba(0, 0, 0, 0.15);
  --shadow-exterior: rgba(255, 255, 255, 0.1);
  --bento-shadow-depth: 4px;

  /* Spacing */
  --border-radius: 1rem;
  --padding-xs: 0.5rem;
  --padding-sm: 1rem;
  --padding-md: 1.5rem;
  --padding-lg: 2rem;
  --gap: 1.25rem;

  /* Typography */
  --font-size-large: 5rem;
  --font-size-modal-close: 2rem;

  /* Layout */
  --grid-cell-size: 80px;
  --grid-columns: 10;
  --max-width: min(100vw, 1040px);
  --mobile-breakpoint: 768px;
}

html {
  background-color: var(--background-color-default);
  color: var(--text-color-default);
  font-family:
    "Space Grotesk",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--title-color-default);
}

a {
  color: var(--text-color-default);
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  max-width: var(--max-width);
  padding: var(--padding-lg);
}

/* H1 alignment */
main h1 {
  align-self: flex-start;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  body {
    align-items: flex-start;
  }

  main {
    padding: var(--padding-sm);
  }

  main > h1 {
    padding-left: var(--padding-xs);
  }
}

/* ***************** */
/* BENTO GRID STYLES */
/* ***************** */

.bento-container {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), var(--grid-cell-size));
  grid-auto-rows: var(--grid-cell-size);
  grid-auto-flow: row dense;
  gap: var(--gap);
  justify-content: center;
  padding: var(--padding-sm);
}

.bento-container > a {
  border-radius: var(--border-radius);
  padding: var(--padding-lg);
  text-decoration: none;
  color: var(--bento-text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bento-color-default);
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.5s ease-out;
  box-shadow:
    inset var(--bento-shadow-depth) var(--bento-shadow-depth) 0
      var(--shadow-inset),
    var(--bento-shadow-depth) var(--bento-shadow-depth) 0 var(--shadow-exterior);
}

.bento-container > a > span {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(2.5rem, 20vw, var(--font-size-large));
  margin-bottom: 0.5rem;
}

.bento-container > a > img,
.bento-container > a > span {
  transform: translateZ(20px);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* External link icon styling */
.external-link-icon {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  width: 16px !important;
  height: 16px !important;
  transform: translateZ(30px) !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)) !important;
  opacity: 0.8;
  z-index: 10;
}

/* Bento size variants */
.bento-2x2 {
  grid-column: span 2;
  grid-row: span 2;
}
.bento-4x2 {
  grid-column: span 4;
  grid-row: span 2;
}
.bento-2x4 {
  grid-column: span 2;
  grid-row: span 4;
  display: flex;
  flex-direction: column;
}
.bento-4x4 {
  grid-column: span 4;
  grid-row: span 4;
}

/* Circular mask class for any image */
.circular {
  border-radius: 50%;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

@media (max-width: 768px) {
  .bento-container {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0.5rem !important;
    padding: 0.5rem !important;
    justify-content: stretch !important;
  }

  .bento-container > a {
    padding: var(--padding-md);
  }

  .bento-2x2 {
    grid-column: span 2;
    grid-row: span 2;
  }
  .bento-4x2 {
    grid-column: span 4;
    grid-row: span 2;
  }
  .bento-2x4 {
    grid-column: span 2;
    grid-row: span 4;
  }
}

/* ************ */
/* MODAL STYLES */
/* ************ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height - accounts for mobile browser UI */
  background-color: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.modal:target {
  opacity: 1;
  visibility: visible;
}

/* Prevent background scrolling when modal is open */
.modal:target ~ * {
  overflow: hidden;
}

body:has(.modal:target) {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

.modal:target .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-content {
  background-color: var(--background-color-default);
  padding: var(--padding-lg);
  border-radius: var(--border-radius);
  border: 1px solid var(--title-color-default);
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  max-width: 800px;
  transform: scale(0.8) translateY(-20px);
  opacity: 0;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.modal-content-text {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal-content > img {
  width: 100%;
  height: 100%;
  max-width: 200px;
}

.modal-close {
  position: absolute;
  top: var(--padding-sm);
  right: var(--padding-sm);
  font-size: var(--font-size-modal-close);
  text-decoration: none;
  color: var(--title-color-default);
  line-height: 1;
}

.modal h1 h2 h3 {
  margin-bottom: var(--padding-sm);
  color: var(--title-color-default);
}
.modal p {
  color: white;
  line-height: 1.6;
}

.modal img[src$=".svg"] {
  filter: brightness(0) invert(1);
}

@media (max-width: 768px) {
  .modal {
    align-items: flex-end;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
  }

  .modal-content {
    flex-direction: column;
    height: 85%;
    justify-content: flex-start;
    max-height: 100%;
    width: 100%;
    max-width: 100%;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    /* Hide scrollbar on mobile while keeping scroll functionality */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
    scrollbar-width: none; /* Firefox */
    border-bottom: none;
  }

  .modal-content::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
  }

  .modal-content > img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    align-self: center;
    border-radius: 50%;
  }
}

marquee {
  color: var(--title-color-default);
  overflow: hidden;
  white-space: nowrap;
}

@media (max-width: 768px) {
  marquee {
    display: none;
  }
}

/* Video container for responsive YouTube embeds */
.video-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  margin: 1rem 0;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
