/* Castle Cary Guide - Stylesheet */

:root {
  --color-primary: #2d5016;
  --color-primary-light: #4a7c23;
  --color-accent: #8b4513;
  --color-bg: #faf9f7;
  --color-bg-alt: #f0ede8;
  --color-card: #ffffff;
  --color-text: #2a2a2a;
  --color-text-light: #555555;
  --color-text-muted: #777777;
  --color-border: #e0ddd8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;

  /* Category colors */
  --color-walks: #2e7d32;
  --color-food: #e65100;
  --color-drink: #6d4c41;
  --color-wellness: #00838f;
  --color-creative: #7b1fa2;
  --color-events: #1565c0;
  --color-free: #388e3c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  padding: 3rem 1.5rem;
  text-align: center;
  position: relative;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

header .header-content {
  position: relative;
  z-index: 1;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header .subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
}

/* Navigation */
nav {
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  padding: 1rem;
  cursor: pointer;
  color: var(--color-text);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  padding: 0.5rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-links li a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.nav-links li a:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
}

.nav-links li a.active {
  background: var(--color-primary);
  color: white;
}

.nav-links li a:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Main content */
main {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section {
  padding: 3rem 1.5rem;
}

.section.alt-bg {
  background: var(--color-bg-alt);
}

.section h2 {
  font-size: 2rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--color-primary);
  display: inline-block;
}

.section h3 {
  font-size: 1.3rem;
  color: var(--color-accent);
  margin: 2rem 0 1rem;
}

.section-intro {
  color: var(--color-text-light);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.card.highlight {
  border-left: 4px solid var(--color-primary);
}

/* Category-colored cards */
.card.walks { border-left: 4px solid var(--color-walks); }
.card.food { border-left: 4px solid var(--color-food); }
.card.drink { border-left: 4px solid var(--color-drink); }
.card.wellness { border-left: 4px solid var(--color-wellness); }
.card.creative { border-left: 4px solid var(--color-creative); }
.card.events { border-left: 4px solid var(--color-events); }

.card h3, .card h4 {
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.card h4 {
  font-size: 1.1rem;
}

.card p {
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-right: 0.35rem;
  margin-bottom: 0.35rem;
  white-space: nowrap;
}

.badge-free {
  background: #e8f5e9;
  color: var(--color-free);
}

.badge-dog {
  background: #fff3e0;
  color: #e65100;
}

.badge-book {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-top {
  background: #fce4ec;
  color: #c2185b;
}

.card ul {
  margin-left: 1.25rem;
  color: var(--color-text);
}

.card ul li {
  margin-bottom: 0.25rem;
}

.card .meta {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 0.25rem;
}

.card a {
  color: var(--color-primary);
  text-decoration: none;
}

.card a:hover {
  text-decoration: underline;
}

/* Link list */
.link-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.link-list a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.link-list a:hover {
  text-decoration: underline;
}

/* Footer */
footer {
  background: var(--color-primary);
  color: white;
  text-align: center;
  padding: 2rem 1.5rem;
}

footer p {
  margin-bottom: 0.75rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.footer-links a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
  text-decoration: underline;
}

footer .small {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* Mobile styles */
@media (max-width: 768px) {
  header {
    padding: 1.5rem 1rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  header .subtitle {
    font-size: 0.95rem;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    padding: 0 0 1rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li a {
    padding: 0.75rem 1rem;
  }

  .section {
    padding: 1.5rem 1rem;
  }

  .section h2 {
    font-size: 1.4rem;
  }

  .section h3 {
    font-size: 1.15rem;
  }

  .section-intro {
    font-size: 1rem;
  }

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

  .card {
    padding: 1rem;
  }

  .card h4 {
    font-size: 1rem;
  }

  .link-list {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Collapsible sections on mobile */
  details summary {
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }

  details .details-content {
    padding: 0.875rem 1rem;
  }

  details .details-content li {
    padding: 0.625rem 0;
    font-size: 0.9rem;
  }

  /* Event date styling on mobile */
  .event-date {
    display: block;
    margin-bottom: 0.25rem;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.4rem;
  }

  .section {
    padding: 1.25rem 0.75rem;
  }

  .section h2 {
    font-size: 1.25rem;
  }

  .card {
    padding: 0.875rem;
  }

  details summary {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  details .details-content {
    padding: 0.75rem;
  }
}

/* Touch-friendly tap targets */
@media (pointer: coarse) {
  .nav-links li a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  details summary {
    min-height: 48px;
  }

  .card a {
    display: inline-block;
    padding: 0.25rem 0;
  }

  .link-list a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* Prevent text size adjustment on orientation change */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Collapsible sections */
details {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

details summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-text-light);
  transition: transform 0.2s;
}

details[open] summary::after {
  content: '−';
}

details[open] summary {
  border-bottom: 1px solid var(--color-border);
}

details .details-content {
  padding: 1rem 1.25rem;
}

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

details .details-content li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

details .details-content li:last-child {
  border-bottom: none;
}

details .details-content .event-date {
  font-size: 0.85rem;
  color: var(--color-primary);
  font-weight: 600;
}

details .details-content .event-name {
  display: block;
}

details .details-content a {
  color: var(--color-text);
  text-decoration: none;
}

details .details-content a:hover {
  color: var(--color-primary);
}

/* Quick Reference card styling */
#quick-reference .card {
  border-top: 3px solid var(--color-primary);
}

#quick-reference .card:nth-child(1) {
  border-top-color: var(--color-free);
}

#quick-reference .card:nth-child(2) {
  border-top-color: #e65100;
}

#quick-reference .card:nth-child(3) {
  border-top-color: #1565c0;
}

#quick-reference .card:nth-child(4) {
  border-top-color: #c2185b;
}

#quick-reference .card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

/* Print styles */
@media print {
  nav, .nav-toggle, .footer-links {
    display: none !important;
  }

  header {
    background: none !important;
    color: var(--color-text);
    padding: 1rem 0;
  }

  header::before {
    display: none;
  }

  header h1 {
    color: var(--color-primary);
    text-shadow: none;
  }

  .section {
    padding: 1rem 0;
    page-break-inside: avoid;
  }

  .section.alt-bg {
    background: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .card-grid {
    display: block;
  }

  .card-grid .card {
    margin-bottom: 0.75rem;
  }

  details {
    border: 1px solid #ccc;
  }

  details[open] {
    page-break-inside: avoid;
  }

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

  .card a[href^="http"]::after,
  .meta a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: #666;
    word-break: break-all;
  }

  .badge {
    border: 1px solid currentColor;
  }

  footer {
    background: none;
    color: var(--color-text);
    border-top: 2px solid var(--color-primary);
  }
}
