/* public/css/base.css */

/* ─── CSS Variables & Base Resets ─── */
:root {
  --primary: #cba0f3;
  --secondary: #7a5ba7;
  --accent1: #ffd6e8;
  --acc1a: rgba(255, 214, 232, 0.5);
  --accent2: #f4c95d;
  --acc2a: rgba(244, 201, 93, 1);
  --background: #1c1b2f;
  --box-bg: rgba(42, 42, 42, 0.7);
  --panel-bg: rgba(42, 34, 58, 0.6);
  --box-border: rgba(68, 68, 68, 0.8);
  --text: #edeaf6;
  --header-footer: #2a223a;

  /* Base typography */
  --font-size-base: 1rem; /* 16px default (mobile) */
  --line-height-base: 1.4;
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
}

.hidden {
  display: none !important;
}

html,
body {
  height: 100%; /* html/body fill 100% of the browser window */
  width: 100dvw;
  max-width: 100dvw;
  margin: 0;
  padding: 0;
  display: flex; /* Make <body> a flex container (column) */
  flex-direction: column;
  align-items: stretch;
}

main {
  padding-top: 4rem; /* roughly header’s total height */
  padding-bottom: 3rem; /* roughly footer’s total height */
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
}

html {
  box-sizing: border-box;
  font-size: var(--font-size-base);
}
*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--background);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: var(--line-height-base);
}

/* ------------------------------------------------ */
/*        Mobile-first grid and typography          */
/* ------------------------------------------------ */

.grid-container {
  display: grid;
  grid-template-columns: 1fr; /* single column on phones */
  gap: 1rem; /* rem-based gap for scalability */
  padding-top: 1rem;
  width: 100%;
  box-sizing: border-box;
  min-height: 0;
}

.year-header-text {
  font-size: 1.25rem; /* ~20px on phones */
  font-weight: bold;
  color: var(--accent1);
  margin: 0;
  padding: var(--spacing-sm) 0;
}

/* ------------------------------------------------ */
/*         Tablet and Desktop Overrides             */
/*               (min-width queries)                */
/* ------------------------------------------------ */

@media (min-width: 600px) {
  :root {
    --font-size-base: 1.0625rem; /* ~17px on small tablets */
    --spacing-md: 1.25rem;
  }

  .grid-container {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    min-height: 0;
  }

  .year-header-text {
    font-size: 1.5rem; /* ~24px on tablets+ */
  }
}

@media (min-width: 900px) {
  :root {
    --font-size-base: 1.125rem; /* ~18px on large tablets/desktop */
    --spacing-md: 2rem;
  }

  .grid-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    min-height: 0;
  }
}

/* ------------------------------------------------ */
/*                   Utility Classes                */
/* ------------------------------------------------ */

.text-center {
  text-align: center;
}

.mt-sm {
  margin-top: var(--spacing-sm);
}
.mb-sm {
  margin-bottom: var(--spacing-sm);
}

.book-panel {
  background-color: var(--box-bg); /* reuse box-bg var */
  border-radius: 6px;
  padding: var(--spacing-sm); /* responsive padding */
  color: var(--text);
  width: 100%; /* fill its grid column */
  box-sizing: border-box;
  min-height: 0;
}
#page-overlay {
  transition: opacity 0.3s ease;
}
#page-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

html > body > header.header,
html > body > footer.footer {
  position: sticky !important;
  top: 0 !important; /* for header */
  bottom: 0 !important; /* for footer */
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}
