/* Modern playful design */
:root {
  --primary: #14213d;
  --primary-light: #f8f7f4;
  --secondary: #fca311;
  --accent: #ff6b35;
  --background: #ffffff;
  --surface: #14213d;
  --foreground: #2d3748;
  --on-primary: #ffffff;
  --on-secondary: #14213d;
  --shadow-color: rgba(20, 33, 61, 0.12);
  --shadow-hover: rgba(20, 33, 61, 0.2);
  --radius: 12px;
  --radius-sm: 8px;
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
}

body {
  background: var(--primary-light);
  color: var(--foreground);
  font-family: var(--font-main);
  padding: 0;
  line-height: 1.6;
}

header, nav, main, footer {
  box-shadow: 0 4px 16px var(--shadow-color);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius);
  margin: 1.5rem auto;
  background: var(--background);
}

header {
  background: linear-gradient(135deg, var(--primary) 0%, #1a2d4d 100%);
  color: var(--on-primary);
  text-align: left;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  border: none;
  padding: 1.5rem;
}

nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  background: var(--background);
  flex-wrap: wrap;
  padding: 1rem;
}

header a {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border-radius: 50px;
  transition: all 0.2s ease;
  background: transparent;
}

header a:hover {
  background: var(--on-primary);
  color: var(--primary);
  transform: translateY(-2px);
}

nav a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  transition: all 0.2s ease;
  background: transparent;
}

nav a:hover {
  background: var(--secondary);
  color: var(--primary);
  transform: translateY(-2px);
}

main {
  background: var(--background);
  min-height: 300px;
  padding: 1rem;
}

footer {
  background: var(--primary);
  color: var(--on-primary);
  text-align: center;
  font-size: 0.9rem;
  border: none;
  padding: 1rem;
}

footer a {
  color: var(--secondary);
}

h1 {
  color: var(--primary);
  margin-top: 0;
  font-size: 2.25rem;
  font-weight: 700;
  position: relative;
  display: inline-block;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 0;
  width: 100%;
  height: 8px;
  background: var(--secondary);
  opacity: 0.4;
  z-index: -1;
  border-radius: 4px;
}

h2 {
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--secondary);
  display: inline-block;
}

h3 {
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

hr {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin: 2rem 0;
}

img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px var(--shadow-color);
  margin: 1.5rem auto;
  display: block;
  width: 80%;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--secondary);
}

.article-meta {
  background: var(--primary-light);
  border-left: 4px solid var(--secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--foreground);
}

.button {
  background: var(--secondary);
  color: var(--on-secondary);
  border: none;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 50px;
  box-shadow: 0 4px 12px rgba(252, 163, 17, 0.3);
  transition: all 0.2s ease;
}

.button:hover {
  background: var(--accent);
  color: var(--on-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(252, 163, 17, 0.4);
}

ol li, ul li {
  margin-bottom: 0.75rem;
}

/* Hero Section */
.hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.photo-placeholder {
  width: 120px;
  height: 120px;
  min-width: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  box-shadow: 0 4px 16px rgba(252, 163, 17, 0.3);
}

.profile-photo {
  width: 120px;
  height: 120px;
  min-width: 120px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(252, 163, 17, 0.3);
}

.hero-text h1 {
  margin-bottom: 0.5rem;
}

.hero-text p {
  margin: 0;
  font-size: 1.1rem;
  color: var(--foreground);
}

/* Card Styles */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.card {
  background: var(--background);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--shadow-hover);
  cursor: pointer;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.card p {
  margin: 0;
  font-size: 0.9rem;
  color: #666;
}

.card {
  position: relative;
}

.card a {
  color: var(--primary);
  font-weight: 600;
}

.card a.card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card .date {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.5rem;
}

/* Section spacing */
section {
  margin-bottom: 2rem;
}

section:last-child {
  margin-bottom: 0;
}

/* Talks list */
.talks-list {
  list-style: none;
  padding: 0;
}

.talks-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.talks-list li:last-child {
  border-bottom: none;
}

.talk-title {
  font-weight: 600;
  color: var(--primary);
}

a.talk-title {
  text-decoration: none;
}

a.talk-title:hover {
  color: var(--accent);
}

.talk-venue {
  font-size: 0.85rem;
  color: #666;
  background: var(--primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
}

/* Upcoming venue pills with gradient border and badge */
.talk-venue.upcoming {
  position: relative;
  background: linear-gradient(#e5e7eb, #e5e7eb) padding-box,
              linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%) border-box;
  border: 3px solid transparent;
  padding: 0.35rem 1rem;
  margin-right: 0.5rem;
}

.upcoming-badge {
  position: absolute;
  top: -10px;
  right: -6px;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  color: var(--primary);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 50px;
  box-shadow: 0 2px 6px rgba(252, 163, 17, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

[data-theme="dark"] .talk-venue.upcoming {
  background: linear-gradient(#4a4a4a, #4a4a4a) padding-box,
              linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%) border-box;
}

[data-theme="dark"] .upcoming-badge {
  color: var(--on-secondary);
}

/* Code styling */
code, pre {
  font-family: var(--font-mono);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}

code {
  padding: 0.2rem 0.4rem;
  font-size: 0.9em;
}

pre {
  padding: 1rem;
  overflow-x: auto;
}

/* Theme Toggle Button */
.theme-toggle {
  background: transparent;
  border: 2px solid currentColor;
  border-radius: 50%;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--on-primary);
}

.theme-toggle:hover {
  background: var(--secondary);
  color: var(--on-secondary);
  transform: scale(1.1);
}

/* Dark Mode Styles - Gruvbox */
[data-theme="dark"] {
  --primary: #fe8019;
  --primary-light: #3c3836;
  --secondary: #fabd2f;
  --accent: #fb4934;
  --background: #282828;
  --surface: #3c3836;
  --foreground: #ebdbb2;
  --on-primary: #282828;
  --on-secondary: #282828;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --shadow-hover: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] header {
  background: linear-gradient(135deg, #3c3836 0%, #282828 100%);
  color: var(--secondary);
}

[data-theme="dark"] footer {
  background: var(--surface);
  color: var(--foreground);
}

[data-theme="dark"] .card {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .card p {
  color: #a0a0a0;
}

[data-theme="dark"] .card .date {
  color: #808080;
}

[data-theme="dark"] .talk-venue {
  color: #a0a0a0;
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .talks-list li {
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] hr {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-toggle {
  color: var(--primary);
}

/* Responsive */
@media (max-width: 600px) {
  .hero {
    flex-direction: column;
    text-align: center;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .talks-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  header {
    justify-content: center;
  }

  .header-links {
    order: 1;
    width: 100%;
    justify-content: center;
  }

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

/* Cheat Sheet Styles */
.search-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-sm);
  background: var(--background);
  color: var(--foreground);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(252, 163, 17, 0.2);
}

.search-count {
  font-size: 0.8rem;
  color: #666;
  white-space: nowrap;
}

.app-section {
  margin-bottom: 1.5rem;
}

.app-title {
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
  text-transform: capitalize;
  font-weight: 700;
}

.grouped-view {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1rem;
}

.category-section {
  margin-bottom: 1rem;
  padding-left: 0;
}

.category-title {
  font-size: 0.85rem;
  color: var(--foreground);
  margin-bottom: 0.35rem;
  padding-bottom: 0.15rem;
  border-bottom: 2px solid var(--secondary);
  display: inline-block;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.shortcuts-table {
  display: grid;
  gap: 0.15rem;
}

.shortcut-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--primary-light);
}

.shortcut-row.search-result {
  grid-template-columns: auto auto 120px 1fr;
  gap: 0.5rem;
  padding: 0.35rem 0;
}

.shortcut-row:last-child {
  border-bottom: none;
}

kbd {
  display: inline-block;
  padding: 0.2rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--surface);
  color: var(--on-primary);
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px var(--shadow-color);
  text-align: center;
  min-width: fit-content;
  line-height: 1;
}

.description {
  color: var(--foreground);
  font-size: 0.85rem;
}

.app-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 50px;
}

.category-tag {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  font-size: 0.65rem;
  background: var(--secondary);
  color: var(--on-secondary);
  border-radius: 3px;
}

.no-results {
  text-align: center;
  padding: 1rem;
  color: #666;
  font-style: italic;
  font-size: 0.9rem;
}

/* Dark mode adjustments for cheat sheet */
[data-theme="dark"] .search-input {
  background: var(--surface);
  border-color: var(--primary-light);
  color: var(--foreground);
}

[data-theme="dark"] .search-input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(250, 189, 47, 0.2);
}

[data-theme="dark"] .shortcut-row {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] kbd {
  background: var(--primary-light);
  color: var(--foreground);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .search-count {
  color: #a0a0a0;
}

[data-theme="dark"] .no-results {
  color: #a0a0a0;
}

/* Sidebar Styles */
.main-with-sidebar {
  position: relative;
  z-index: 10;
}

.sidebar {
  display: none;
}

.sidebar-content {
  background: var(--background);
  border-radius: var(--radius);
  padding: 0.75rem;
  box-shadow: 0 2px 8px var(--shadow-color);
  min-width: 120px;
}

.sidebar h3 {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(252, 163, 17, 0.3);
  padding-bottom: 0.4rem;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin-bottom: 0.4rem;
}

.sidebar li:last-child {
  margin-bottom: 0;
}

.sidebar a {
  display: block;
  padding: 0.25rem 0;
  font-size: 0.85rem;
  color: var(--secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

.sidebar a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  padding-left: 0.25rem;
}

[data-theme="dark"] .sidebar-content {
  border-color: rgba(255, 255, 255, 0.08);
}

/* Desktop sidebar - attached/sliding out from main content */
@media (min-width: 1100px) {
  .sidebar {
    display: block;
    position: absolute;
    top: 100px;
    left: 100%;
    margin-left: 0;
    z-index: -1;
  }
  
  .sidebar-content {
    border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: -2px 2px 8px var(--shadow-color), 2px 2px 8px var(--shadow-color);
    margin-left: -1px;
    border-top: 3px solid transparent;
    border-right: 3px solid transparent;
    border-bottom: 3px solid transparent;
    border-left: none;
    background: linear-gradient(var(--background), var(--background)) padding-box,
                linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%) border-box;
    padding: 0.75rem;
  }
}

[data-theme="dark"] .sidebar-content {
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
              linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%) border-box;
}

/* Responsive adjustments for cheat sheet */
@media (max-width: 768px) {
  .grouped-view {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .shortcut-row {
    grid-template-columns: 90px 1fr;
    gap: 0.35rem;
    padding: 0.15rem 0;
  }

  .shortcut-row.search-result {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    padding: 0.5rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.35rem;
  }

  .search-container {
    flex-direction: row;
    gap: 0.5rem;
  }

  .search-input {
    font-size: 0.85rem;
  }

  .app-title {
    font-size: 1.1rem;
  }
}
