/* --- Root Variables & Basic Setup --- */
:root {
  --bg-light: #f4f4f9;
  --text-light: #2f2f2f;
  --card-bg-light: #ffffff;
  --shadow-light: 0 5px 25px rgba(0, 0, 0, 0.08);

  --bg-dark: #121212;
  --text-dark: #ecf0f1;
  --card-bg-dark: #1e1e1e;
  --shadow-dark: 0 5px 25px rgba(0, 0, 0, 0.3);

  --accent-color: #3498db;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, sans-serif;
  transition: background-color 0.4s ease, color 0.4s ease;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}
.light-mode {
  background-color: var(--bg-light);
  color: var(--text-light);
}
.dark-mode {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}
.light-mode .bar {
  background-color: var(--text-light);
}
.dark-mode .bar {
  background-color: var(--text-dark);
}

/* --- Navbar --- */
.navbar {
  padding: 1rem 0;
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(5px);
}
.light-mode .navbar {
  background-color: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-light);
}
.dark-mode .navbar {
  background-color: rgba(30, 30, 30, 0.8);
  box-shadow: var(--shadow-dark);
}

.nav-container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between; /* This is key */
  align-items: center;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: inherit;
  text-decoration: none;
}
.nav-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
}
.nav-links a {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}
.nav-links a:hover {
  opacity: 1;
}

/* New wrapper for right-side controls */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 2rem; /* Adjust space between nav links and the toggle */
}

.hamburger {
  display: none;
  cursor: pointer;
}
.bar {
  display: block;
  width: 25px;
  height: 3px;
  margin: 5px auto;
  transition: all 0.3s ease-in-out;
}

/* --- Custom Sun/Moon Theme Toggle --- */
.tdnn {
  cursor: pointer;
  position: relative;
  /* Resized to fit navbar */
  font-size: 2px; /* <-- CHANGE THIS VALUE */
  height: var(--toggleHeight, 16em);
  width: var(--toggleWidth, 30em);
  border-radius: var(--toggleHeight, 16em);
  transition: all 300ms ease-in-out;
  /* Colors adapted to your theme */
  background: #423966; /* Night sky color */
}
/* Day state for the toggle track */
.tdnn.day {
  background: #9ee3fb; /* Day sky color */
}

/* This is the moving element */
.moon {
  position: absolute;
  display: block;
  border-radius: 50%;
  transition: all 400ms ease-in-out;
  top: 3em;
  left: 3em;
  transform: rotate(-75deg);
  width: var(--toggleBtnRadius, 10em);
  height: var(--toggleBtnRadius, 10em);
  background: #423966; /* Night sky color */
  /* This complex shadow creates the moon shape and stars */
  box-shadow: 3em 2.5em 0 0em #d9fbff inset,
    rgba(255, 255, 255, 0.1) 0em -7em 0 -4.5em,
    rgba(255, 255, 255, 0.1) 3em 7em 0 -4.5em,
    rgba(255, 255, 255, 0.1) -4em 7em 0 -4.5em,
    rgba(255, 255, 255, 0.1) 6em 13em 0 -4.5em;
}

/* This class is added by JS to turn the moon into a sun */
.moon.sun {
  top: 4.5em;
  left: 18em;
  transform: rotate(0deg);
  width: 7em;
  height: 7em;
  background: #fff;
  /* This complex shadow creates the sun and its rays */
  box-shadow: 3em 3em 0 5em #fff inset, 0 -5em 0 -2.7em #fff,
    3.5em -3.5em 0 -3em #fff, 5em 0 0 -2.7em #fff, 3.5em 3.5em 0 -3em #fff,
    0 5em 0 -2.7em #fff, -3.5em 3.5em 0 -3em #fff, -5em 0 0 -2.7em #fff,
    -3.5em -3.5em 0 -3em #fff;
}

/* --- Main Content --- */
.container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}
.clock-wrapper {
  text-align: center;
  margin-bottom: 50px;
}
.clock {
  font-size: clamp(3.5rem, 15vw, 9rem);
  font-weight: 600;
  padding: 25px 50px;
  border-radius: 20px;
  margin-bottom: 1rem;
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

@media (max-width: 600px) {
  .clock {
    padding: 20px 30px;
  }
}

.light-mode .clock {
  background-color: var(--card-bg-light);
  box-shadow: var(--shadow-light);
}
.dark-mode .clock {
  background-color: var(--card-bg-dark);
  box-shadow: var(--shadow-dark);
}

.date-display {
  font-size: clamp(1rem, 4vw, 1.5rem);
  font-weight: 500;
  opacity: 0.8;
}

/* --- Clock Flexbox Layout Fix --- */
.clock {
  /* Turn the clock into a flex container */
  display: flex;
  justify-content: center;
  align-items: baseline; /* Aligns AM/PM with the bottom of the time */
  flex-wrap: wrap; /* Allows AM/PM to wrap cleanly if needed */
  row-gap: 0;
  column-gap: 0.25em; /* Adds a small space between time and AM/PM */
}

/* Style the AM/PM indicator */
#ampm {
  font-size: clamp(1rem, 5vw, 2rem); /* Make AM/PM text a bit smaller */
  font-weight: 500;
  opacity: 0.9;
}

#time {
  font-family: 'Source Code Pro', monospace;
}

/* --- Settings & Toggles (No changes) --- */
.settings {
  display: flex;
  gap: 40px;
  align-items: center;
}
.setting {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 1rem;
}
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 28px;
}
.slider:before {
  position: absolute;
  content: '';
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent-color);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* --- Footer --- */
.footer {
  padding: 2rem;
  text-align: center;
  font-size: 0.9rem;
}
.footer-links {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: inherit;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}
.footer-links a:hover {
  opacity: 1;
}
.footer p {
  margin: 0;
  opacity: 0.6;
}

/* --- Responsive Adjustments (for Tablet & Mobile) --- */
@media (max-width: 768px) {
  .nav-menu {
    position: absolute;
    top: 68px;
    left: 0;
    width: 100%;
  }
  .nav-links {
    flex-direction: column;
    width: 100%;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
  }
  .light-mode .nav-links {
    background-color: rgba(255, 255, 255, 0.95);
  }
  .dark-mode .nav-links {
    background-color: rgba(30, 30, 30, 0.95);
  }
  .nav-links li {
    width: 100%;
    text-align: center;
  }
  .nav-links li a {
    display: block;
    padding: 1.2rem 0;
  }
  .nav-links.active {
    max-height: 300px; /* Adjust as needed */
  }
  .hamburger {
    display: block;
  }
  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
  }
  .hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .settings {
    flex-direction: column;
    gap: 25px;
  }
}

/* --- Content Pages (About, Privacy, etc.) --- */
.content-page {
  width: 90%;
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  border-radius: 15px;
  text-align: left;
  line-height: 1.7;
}
.light-mode .content-page {
  background-color: var(--card-bg-light);
  box-shadow: var(--shadow-light);
}
.dark-mode .content-page {
  background-color: var(--card-bg-dark);
  box-shadow: var(--shadow-dark);
}

/* remove padding and background colour from content-page in mobile devices */
@media (max-width: 600px) {
  .content-page {
    padding: 0px;
    background-color: transparent !important;
    box-shadow: none !important;
  }
}

.content-page h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 0.5rem;
}

.content-page h2 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.content-page p,
.content-page li {
  font-size: 1rem;
  opacity: 0.9;
}

.content-page ul {
  padding-left: 20px;
}

/* --- Contact Form --- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label {
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.form-group input,
.form-group textarea {
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  padding: 0.8rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  transition: background-color 0.4s ease, border-color 0.4s ease,
    color 0.4s ease;
}
.light-mode .form-group input,
.light-mode .form-group textarea {
  background-color: #f9f9f9;
  color: var(--text-light);
  border-color: #ddd;
}
.dark-mode .form-group input,
.dark-mode .form-group textarea {
  background-color: #2c2c2c;
  color: var(--text-dark);
  border-color: #444;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}
.submit-btn {
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  background-color: var(--accent-color);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.submit-btn:hover {
  background-color: #2980b9;
}

.info-section {
  /* This ensures the section is properly contained */
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 2rem 0; /* Add some vertical spacing */
}

/* Remove blue tap highlight on mobile for all interactive elements */
a,
button,
.switch,
.tdnn,
.hamburger {
  -webkit-tap-highlight-color: transparent;
}

/* --- Fullscreen "Focus Mode" Styles (REVISED) --- */

/* Style for the icon buttons (both enter and exit) */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.icon-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  transition: transform 0.3s ease;
}
.icon-btn:hover svg {
  transform: scale(1.15);
}

/* Dedicated Exit Button (hidden by default) */
.exit-btn {
  position: fixed; /* Keep it fixed in the corner */
  top: 1rem;
  right: 1.5rem;
  z-index: 110; /* Make sure it's on top of everything */
  display: none; /* Hidden by default */
}

/* This is the magic: what happens when the body has the .fullscreen-mode class */

/* 1. Disable Scrolling */
body.fullscreen-mode {
  overflow: hidden;
}

/* 2. Hide everything except the main container and the new exit button */
.fullscreen-mode .navbar,
.fullscreen-mode .settings,
.fullscreen-mode .info-section,
.fullscreen-mode .footer {
  display: none; /* Remove elements from the layout entirely */
}

/* 3. Make the new exit button visible */
.fullscreen-mode .exit-btn {
  display: flex;
}

/* 4. Ensure perfect centering of the clock */
.fullscreen-mode .container {
  padding: 0;
  height: 100vh; /* Make container take full viewport height */
  width: 100vw;
}

/* --- Homepage Full-Viewport Layout --- */

/* On the homepage, take the navbar out of the normal document flow */
body.home .navbar {
  position: absolute;
  width: 100%;
  /* Remove the shadow on the homepage for a cleaner, overlay look */
  box-shadow: none;
}

/* Force the main container (with the clock) to be exactly the height of the screen */
body.home .container {
  height: 100vh;
  width: 100%;
  max-width: 100%; /* Override container's default max-width */
}

.vhn {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --- NEW STYLES for Contact Page Email Link --- */

.contact-email {
  text-align: center;
  margin: 2.5rem 0; /* Adds vertical spacing */
}

.contact-email a {
  display: inline-block;
  padding: 1rem 2rem;
  font-family: 'Source Code Pro', monospace; /* Matches clock font */
  font-size: 1.2rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  border: 2px solid;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

/* Light Mode Email Button Styles */
.light-mode .contact-email a {
  background-color: #eaf5fc;
  color: #2980b9;
  border-color: #aed6f1;
}

/* Dark Mode Email Button Styles */
.dark-mode .contact-email a {
  background-color: #2c3e50;
  color: #ecf0f1;
  border-color: #34495e;
}

/* Hover effect for both modes */
.contact-email a:hover {
  transform: translateY(-3px);
  background-color: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}
