/* Import Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Playfair+Display:wght@700&display=swap");

/* Define color palette, typography, and other design tokens */
:root {
  --color-background: #ffffff;
  --color-surface: #f9f9f9;
  --color-text-primary: #212121;
  --color-text-secondary: #5f6368;
  --color-primary: #0d47a1;
  --color-accent: #ffc107;
  --color-border: #e0e0e0;
  --font-heading: "Playfair Display", serif;
  --font-body: "Lato", sans-serif;
  --spacing-unit: 8px;
  --border-radius: 4px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

html.dark {
  --color-background: #121212;
  --color-surface: #1e1e1e;
  --color-text-primary: #e0e0e0;
  --color-text-secondary: #a0a0a0;
  --color-primary: #42a5f5;
  --color-accent: #ffca28;
  --color-border: #424242;
}

/* General Body Styles */
body {
  background-color: var(--color-background);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  margin: 0;
  transition: background-color 0.3s, color 0.3s;
  overflow-x: hidden;
}

.container {
  max-width: 1100px;
  margin: auto;
  padding: 0 2rem;
  width: 100%;
  box-sizing: border-box;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  color: var(--color-text-primary);
  margin-top: calc(var(--spacing-unit) * 3);
  margin-bottom: calc(var(--spacing-unit) * 2);
}
.subtitle {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  margin-top: calc(var(--spacing-unit) * -1);
}

/* Navigation */
header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-unit) 0;
  transition: background-color 0.3s;
}
nav.sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
}
nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
}
nav .logo {
  color: var(--color-primary);
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  order: 1;
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  order: 3;
  margin-left: auto;
  margin-right: calc(var(--spacing-unit) * 2);
}
nav ul li a {
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: var(--spacing-unit) calc(var(--spacing-unit) * 2);
  transition: color 0.3s;
  font-weight: 700;
}
nav ul li a:hover {
  color: var(--color-primary);
}

/* Dropdown Menu Styles */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--color-surface);
  min-width: 220px;
  box-shadow: var(--shadow-md);
  z-index: 1;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
}
.dropdown-content a {
  color: var(--color-text-secondary);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-size: 0.9rem;
}
.dropdown-content a:hover {
  background-color: var(--color-background);
  color: var(--color-primary);
}
.dropdown:hover .dropdown-content {
  display: block;
}
.dropbtn {
  cursor: pointer;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  cursor: pointer;
  padding: var(--spacing-unit);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}

.menu-icon {
  width: 24px;
  height: 24px;
  color: var(--color-text-secondary);
}

.mobile-menu-toggle:hover .menu-icon {
  color: var(--color-primary);
}

/* Theme Toggle Button */
.theme-toggle-button {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  padding: var(--spacing-unit);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: calc(var(--spacing-unit) * 2);
  order: 4;
}

.toggle-icon {
  height: 20px;
  width: 20px;
  color: var(--color-text-secondary);
}

/* Mobile Navigation Styles */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
    order: 2;
    margin-left: auto;
    margin-right: calc(var(--spacing-unit) * 2);
  }

  nav .container {
    padding: calc(var(--spacing-unit) * 2) 1rem;
    gap: 0;
  }

  nav .logo {
    font-size: 1.4rem;
    order: 1;
  }

  .theme-toggle-button {
    margin-left: 0;
    order: 3;
  }

  nav ul {
    flex-direction: column;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    order: 4;
    flex-basis: 100%;
    margin-top: calc(var(--spacing-unit) * 2);
    margin-left: 0;
    margin-right: 0;
  }

  nav ul.active {
    max-height: 600px;
    border-top: 1px solid var(--color-border);
    padding-top: calc(var(--spacing-unit) * 2);
  }

  nav ul li {
    width: 100%;
    text-align: left;
  }

  nav ul li a {
    display: block;
    padding: calc(var(--spacing-unit) * 2);
    border-bottom: 1px solid var(--color-border);
  }

  nav ul li:last-child a {
    border-bottom: none;
  }

  .dropdown-content {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    min-width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }

  .dropdown.active .dropdown-content {
    max-height: 400px;
  }

  .dropdown-content a {
    padding-left: calc(var(--spacing-unit) * 4);
    background-color: var(--color-background);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.85rem;
  }

  .container {
    padding: 0 1rem;
  }
}

/* Hero Section */
.hero {
  background: var(--color-surface);
  padding: calc(var(--spacing-unit) * 6) 0;
}
.hero-content {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing-unit) * 5);
  flex-wrap: wrap;
}
.hero-text {
  flex: 2;
  min-width: 300px;
}
.profile-picture {
  flex: 1;
  max-width: 250px;
  min-width: 200px;
  height: auto;
  border-radius: 50%;
  border: 5px solid var(--color-primary);
  box-shadow: var(--shadow-md);
}

/* Mobile Hero Adjustments */
@media (max-width: 768px) {
  .hero {
    padding: calc(var(--spacing-unit) * 3) 0;
  }

  .hero-content {
    flex-direction: column;
    text-align: center;
  }

  .profile-picture {
    max-width: 180px;
  }

  .hero-text {
    min-width: 100%;
  }
}

/* Philosophy Section */
.philosophy-section {
  display: flex;
  gap: calc(var(--spacing-unit) * 3);
  margin-top: calc(var(--spacing-unit) * 4);
  flex-wrap: wrap;
}
.philosophy-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: calc(var(--spacing-unit) * 3);
  border-radius: var(--border-radius);
  flex: 1;
  min-width: 280px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .philosophy-card {
    min-width: 100%;
  }
}

/* General Content Sections */
.content-section {
  background: var(--color-surface);
  padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 3);
  margin-bottom: calc(var(--spacing-unit) * 2);
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.content-section * {
  max-width: 100%;
  box-sizing: border-box;
}

/* Ensure inputs, selects, and text areas are responsive */
input,
select,
textarea,
button {
  max-width: 100%;
  box-sizing: border-box;
}

/* Prevent iframes from overflowing */
iframe {
  max-width: 100%;
}

@media (max-width: 768px) {
  .content-section {
    padding: calc(var(--spacing-unit) * 2);
  }

  h1 {
    font-size: 1.8rem;
    word-wrap: break-word;
  }

  h2 {
    font-size: 1.4rem;
    word-wrap: break-word;
  }

  /* Fix search input centering on mobile */
  .search-container {
    padding: 0 1rem;
  }

  .search-container input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Ensure form elements don't overflow */
  input,
  select,
  textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    width: 100%;
  }

  /* Make sure select dropdowns fit */
  select {
    max-width: 100%;
  }

  /* Responsive blockquotes */
  blockquote {
    padding-left: calc(var(--spacing-unit) * 2);
    padding-right: calc(var(--spacing-unit) * 2);
    margin-left: 0;
    margin-right: 0;
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: calc(var(--spacing-unit) * 3);
  padding: calc(var(--spacing-unit) * 3) 0;
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: calc(var(--spacing-unit) * 3);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--color-text-primary);
  transition: transform 0.3s, box-shadow 0.3s;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}
.card h3 {
  margin-top: 0;
  color: var(--color-primary);
  word-wrap: break-word;
}

/* Journal & Reflections */
.journal-entry,
.acronym-entry {
  padding-bottom: calc(var(--spacing-unit) * 2);
}
.journal-entry .meta {
  color: var(--color-text-secondary);
  font-style: italic;
  font-size: 0.9rem;
}

/* Footer */
footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  text-align: center;
  padding: calc(var(--spacing-unit) * 3) 0;
  margin-top: calc(var(--spacing-unit) * 4);
}

/* Theme Toggle Button */
.theme-toggle-button {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  padding: var(--spacing-unit);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: calc(var(--spacing-unit) * 2);
}
.toggle-icon {
  height: 20px;
  width: 20px;
  color: var(--color-text-secondary);
}
.hidden {
  display: none;
}
/* Presentation Container Responsiveness */
.presentation-container {
  position: relative;
  width: 100%;
  padding-bottom: 59.375%; /* 16:9.5 aspect ratio (569/960) */
  height: 0;
  overflow: hidden;
}

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