/* Pompliano Case Files - Light/Dark Theme */

/* Light mode (default) */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #eef1f4;
  --text-primary: #1f2328;
  --text-secondary: #59636e;
  --text-muted: #6e7781;
  --border-color: #d1d9e0;
  --link-color: #0969da;
  --link-hover: #0550ae;
  --accent-featured: #d4740c;
  --accent-badge: #1a7f37;
  --shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Dark mode */
[data-theme="dark"] {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --border-color: #30363d;
  --link-color: #58a6ff;
  --link-hover: #79c0ff;
  --accent-featured: #f0883e;
  --accent-badge: #238636;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* System preference: dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --link-color: #58a6ff;
    --link-hover: #79c0ff;
    --accent-featured: #f0883e;
    --accent-badge: #238636;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Layout */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.header-left {
  flex: 1;
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

/* Show sun in dark mode, moon in light mode */
[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun-icon {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .moon-icon {
    display: none;
  }
}

.site-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: var(--text-primary);
}

.site-title a {
  color: inherit;
}

.site-title a:hover {
  text-decoration: none;
  color: var(--link-color);
}

.site-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
}

/* Navigation */
nav {
  margin-top: 1rem;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

nav a:hover,
nav a.active {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom-color: var(--link-color);
}

/* Main Content */
main {
  flex: 1;
  padding: 2rem 0;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 1.5rem 0;
  color: var(--text-primary);
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 1rem 0;
  color: var(--text-primary);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

/* Case/Article Lists */
.case-list,
.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.case-item,
.article-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.case-item:hover,
.article-item:hover {
  border-color: var(--text-muted);
  box-shadow: var(--shadow);
}

.case-item a,
.article-item a {
  display: block;
  padding: 1rem 1.25rem;
  color: var(--text-primary);
}

.case-item a:hover,
.article-item a:hover {
  text-decoration: none;
}

.item-title {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.item-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.item-source {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Featured Items */
.case-item.featured,
.article-item.featured {
  border-left: 3px solid var(--accent-featured);
  background-color: var(--bg-tertiary);
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.badge-featured {
  background-color: var(--accent-featured);
  color: #000;
}

.badge-notable {
  background-color: var(--accent-badge);
  color: #fff;
}

/* External Link Icon */
.external-link::after {
  content: " ↗";
  font-size: 0.8em;
  opacity: 0.6;
}

/* Footer */
footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: auto;
}

.footer-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.copyright {
  margin-bottom: 1rem;
}

.disclaimer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.disclaimer h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.disclaimer p {
  margin: 0;
  line-height: 1.7;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 0 1rem;
  }

  .header-content {
    flex-wrap: wrap;
  }

  .site-title {
    font-size: 1.25rem;
  }

  nav ul {
    gap: 1rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .case-item a,
  .article-item a {
    padding: 0.875rem 1rem;
  }

  .badge {
    display: block;
    margin: 0.5rem 0 0 0;
    width: fit-content;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }
}

/* Skip Link for Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--link-color);
  color: #000;
  padding: 8px;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Visual Enhancements */

/* Subtle gradient on header */
header {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

/* Hover lift effect on cards */
.case-item,
.article-item {
  transform: translateY(0);
}

.case-item:hover,
.article-item:hover {
  transform: translateY(-2px);
}

/* Animated underline on nav */
nav a {
  position: relative;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--link-color);
  transition: width 0.2s ease;
}

nav a:hover::after,
nav a.active::after {
  width: 100%;
}

nav a:hover,
nav a.active {
  border-bottom-color: transparent;
}

/* Pulse animation on featured badge */
@keyframes subtle-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.badge-featured {
  animation: subtle-pulse 2s ease-in-out infinite;
}

/* Better focus states for accessibility */
a:focus,
button:focus {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

/* Smooth theme transition */
body,
header,
footer,
.case-item,
.article-item,
.theme-toggle {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Count indicator styles (for future use) */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--bg-tertiary);
  border-radius: 999px;
  margin-left: 0.5rem;
}

/* Form Styles */
.form-container {
  max-width: 600px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.form-group .required {
  color: #dc3545;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--link-color);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e7781' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-help {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background-color: var(--link-color);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.submit-btn:hover {
  background-color: var(--link-hover);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(0);
}

.form-note {
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.form-note h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--text-primary);
}

.form-note ul {
  margin: 0 0 1rem 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
}

.form-note li {
  margin-bottom: 0.25rem;
}

.form-note p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Thank You Page Styles */
.thanks-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.thanks-icon {
  color: var(--accent-badge);
  margin-bottom: 1.5rem;
}

.thanks-icon svg {
  width: 64px;
  height: 64px;
}

.thanks-container h1 {
  margin-bottom: 1rem;
}

.thanks-message {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.thanks-notice {
  text-align: left;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.thanks-notice h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--text-primary);
}

.thanks-notice p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.thanks-notice ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
}

.thanks-notice li {
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

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

.thanks-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--link-color);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--link-hover);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--text-muted);
  text-decoration: none;
}

/* Gallery Styles */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.gallery-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.gallery-link {
  display: block;
  aspect-ratio: 3/4;
  overflow: hidden;
  background-color: var(--bg-tertiary);
}

.gallery-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-link img {
  transform: scale(1.05);
}

.gallery-caption {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gallery-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.gallery-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.gallery-source {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  border-radius: 6px;
}

.gallery-empty code {
  background-color: var(--bg-tertiary);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85rem;
}

.gallery-note {
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.gallery-note h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--text-primary);
}

.gallery-note p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-caption {
  margin-top: 1rem;
  color: #fff;
  text-align: center;
  font-size: 0.95rem;
  max-width: 600px;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.5rem;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  padding: 1rem;
  opacity: 0.8;
  transition: opacity 0.2s ease, background-color 0.2s ease;
  border-radius: 4px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .gallery-caption {
    padding: 0.5rem 0.75rem;
  }

  .gallery-name {
    font-size: 0.85rem;
  }

  .gallery-date,
  .gallery-source {
    font-size: 0.75rem;
  }

  .lightbox-prev,
  .lightbox-next {
    padding: 0.75rem;
    font-size: 1.5rem;
  }

  .lightbox-close {
    font-size: 2rem;
  }
}

/* Print Styles */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  header, footer {
    background: #fff;
  }

  a {
    color: #000;
  }

  .case-item,
  .article-item {
    border: 1px solid #ccc;
  }

  .lightbox {
    display: none !important;
  }
}
