/* === Global / Layout === */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&display=swap');

#wave-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: -1;            /* behind content */
  pointer-events: none;
  background: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Montserrat', sans-serif;
  color: #000;
  overflow-x: hidden;

  /* left padding for fixed sidebar */
  padding-left: 11rem;
  transition: padding-left 0.3s ease;
  box-sizing: border-box;
  display: block;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 3rem;
  box-sizing: border-box;
  text-align: center;

  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* === Left Sidebar === */

.sidebar-left {
  width: 16rem;
  height: 100vh;
  padding: 2rem 1.5rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  top: 0; left: 0;
  align-items: center;
  text-align: center;
  border-right: 1px solid #000;
}

.title-block { margin-bottom: 2rem; }

.menu-title {
  font-weight: 700;
  font-size: clamp(1.2rem, 2.5vw, 2.2rem);
  letter-spacing: 2px;
  margin: 0;
  color: #000;
  text-align: left;
}

/* Tagline */
.tagline {
  font-weight: 300;
  font-size: 0.75rem;
  font-style: italic;
  text-align: center;
  color: #000;
  margin-top: 1rem;
}

.cursor {
  display: inline-block;
  margin-left: 2px;
  color: #000;
  animation: blink 0.8s steps(1) infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%,100% { opacity: 0; }
}

/* Nav */
.nav-items {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

.nav-items li {
  list-style: none;
  width: 100%;
  text-align: center;
}

.nav-items li:hover {
  color: #777;
  transform: translateX(6px);
}

.nav-items a {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 0.75rem 0;
  text-align: center;
  transition: color 0.3s, transform 0.3s;
}

.nav-items a:hover {
  color: #777;
  transform: scale(1.05);
}

/* Dropdown */
.has-dropdown .dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease, opacity 0.6s ease;
  opacity: 0;
  padding: 0;
  margin: 0;
}

.has-dropdown .dropdown li a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: #777;
  background: transparent;
  transition: background 0.3s;
}

.has-dropdown .dropdown li a:hover {
  background: transparent;
  color: #000;
}

.has-dropdown.hover-active .dropdown {
  max-height: 500px;
  opacity: 1;
}

.social-icons a {
  color: #000;
  margin-right: 1rem;
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.2s ease;
}

.social-icons a:hover { color: #777; }

/* === Main Content (center column) === */

#main-content {
  padding: 1rem 3rem 2rem 3rem;
  box-sizing: border-box;
  overflow-y: auto;
  flex: 1 1 auto;
  max-width: 1200px;     /* set your desired centered column width */
  margin: 0 auto;        /* centers the main content */
  min-height: 100vh;
}

/* Center direct children inside the main content column */
#main-content > * {
  margin-left: auto;
  margin-right: auto;
}

/* Misc content styles */
#theme-label span {
  font-weight: 600;
  font-size: 1.1rem;
  color: #777;
}

#theme-label p {
  font-weight: 300;
  font-size: 0.9rem;
  margin-top: 0.3rem;
  margin-bottom: 1rem;
  color: #777;
}

.difficulty-buttons {
  margin: 1rem 0 2rem 0;
  text-align: center;
}

.difficulty-buttons button {
  background: #000;
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  margin-right: 1rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.difficulty-buttons button:hover {
  background: #777;
  transform: scale(1.05);
}

/* === Crossword Layout Row (Puzzle + Clues) === */

.puzzle-wrapper {
  display: flex;
  flex-wrap: nowrap;               /* stay side-by-side */
  align-items: flex-start;          /* align tops instead of stretch */
  justify-content: center;          /* center as a block */
  gap: clamp(1rem, 4vw, 6rem);
  max-width: 100%;
  margin: 0 auto;                   /* ensures centering in main content */
}

/* Smooth text animations */
@keyframes fadeLoop { 0%,100% { opacity: 0; } 50% { opacity: 1; } }
.theme-text { animation: fadeLoop 3s ease-in-out infinite; }

/* === Crossword Column === */
#crossword {
  flex: 0 0 auto;                              /* fixed to content width */
  max-width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;                                /* prevent flex overflow in Chromium */
}

/* === Grid === */
#grid {
  width: fit-content;                          /* hug content */
  display: grid;
  grid-template-columns: repeat(15, 2rem);
  grid-template-rows:    repeat(15, 2rem);
  gap: 2px;
  background-color: #000;
  border: 2px solid #111;
  border-radius: 5px;
  padding: 5px;
  box-sizing: border-box;                      /* safer with borders/padding */
}

.cell {
  width: 2rem;
  height: 2rem;
  background: #fff;
  position: relative;
  border-radius: 2px;
  box-sizing: border-box;
}

.cell input {
  width: 100%; height: 100%;
  border: none; outline: none;
  text-transform: uppercase;
  font-weight: 600; font-size: 18px;
  text-align: center;
  align-items: center;
  background: transparent;
  color: #000;
  cursor: pointer;
  padding: 0; margin: 0;
  user-select: text;
}

.cell input:disabled {
  background: #000;
  cursor: default;
}

.clue-number {
  position: absolute;
  top: 1px; left: 2px;
  font-size: 8px;
  font-weight: 500;
  color: #000;
  user-select: none;
}

/* === Clues Column (wider, no scroll, vertically centered) === */
#clues {
  flex: 0 0 500;                   /* only as wide as needed */
  max-width: 600px;                 /* cap it so it doesn’t get huge */
  padding: 1rem 1.5rem;             /* breathing room for text */
  box-sizing: border-box;
  border: 2px solid #000;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.clue-columns { display: block; }

.clue-column { margin-bottom: 1.5rem; }

.clue-column ul {
  max-height: none;
  overflow: visible;
  padding-left: 0;
  list-style-position: inside;
}

#clues h3 {
  color: #777;
  font-style: italic;
}

.clue-column li {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  font-weight: 400;
  font-size: 0.75rem;
  border-radius: 4px;
  color: #000;
  margin: 0 auto 0.3rem auto;
  max-width: 90%;
  text-align: left;
  transition: background-color 0.2s ease;
}

.clue-num {
  width: 2rem;
  text-align: right;
  font-weight: 600;
  color: #555;
  flex-shrink: 0;
}

.clue-text { flex: 1; text-align: left; }

.clues-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 auto;
}

.clue-header {
  margin: 0 0 0.75rem 0;
  font-weight: 700;
  font-size: 1.5rem;
  color: #000;
  text-align: center;
}

.clue-column li:hover { background-color: #ccc; }

.clue-column li.completed {
  text-decoration: line-through;
  color: #ccc;
}

.clue-column li.active-focus {
  background-color: #777;
  color: #fff;
}

/* === Input Focus === */
input.active-focus {
  color: #000 !important;
  box-shadow: 0 0 10px 4px rgba(255,255,255,0.8);
}

/* === Buttons === */
.buttons {
  padding-top: 1rem;
  text-align: center;
}

.buttons button {
  background-color: #000;
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  margin-right: 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  border-radius: 4px;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.buttons button:hover {
  background: #777;
  transform: scale(1.05);
}

/* === Completion message === */
#completion-message {
  display: none;
  font-size: 1.5rem;
  color: #000;
  font-weight: 700;
  margin-top: 1rem;
  user-select: none;
  text-align: center;
}

#completion-message.show { display: block; }

/* === Celebration effect on grid (optional) === */
#grid.celebrate { animation: pulse 1.5s ease infinite alternate; }
@keyframes pulse { from { box-shadow: 0 0 10px #fff; } to { box-shadow: 0 0 30px #000; } }

/* === Responsive === */
@media (max-width: 768px) {
  body { padding-left: 0; }

  .sidebar-left {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #000;
    padding: 1.5rem 1rem;
    text-align: center;
    align-items: center;
  }

  .container {
    padding: 1rem;
    max-width: 100%;
  }

  .puzzle-wrapper {
    flex-direction: column;                 /* stack on mobile */
    align-items: center;
    gap: 2rem;
  }

  #crossword {
    width: 100%;
    max-width: 510px;
    margin-bottom: 2rem;
  }

  .clues-wrapper,
  #clues {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 1rem;
  }
}

/* Sidebar mini-footer */
.site-footer {
  width: 100%;
  padding: 0.5rem 0;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 300;
  color: #777;
}
