/* === Custom Properties === */
:root {
  --color-primary: #4caf50;
  --color-primary-dark: #388e3c;
  --color-bg: #ffffff;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-link: #4caf50;
  --color-link-hover: #2e7d32;
  --color-border: #e0e0e0;
  --color-card-bg: #f9f9f9;
  --color-tag-bg: #e8f5e9;
  --color-tag-text: #2e7d32;
  --max-width: 1100px;
  --nav-breakpoint: 768px;
}

/* === Reset & Base === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.8;
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

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

h1, h2, h3, h4 {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
  margin-bottom: 0.6em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.65rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.3rem); }

p { margin-bottom: 1.2em; }

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

/* === Layout === */
header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

footer {
  max-width: var(--max-width);
  margin: 0 auto;
  border-top: 1px solid var(--color-border);
  padding: 1.5rem;
  font-size: 0.875rem;
  color: var(--color-text-light);
  text-align: center;
}

/* === Utility: Screen Reader Only === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* === Navigation (mobile-first) === */
nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

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

#main-menu {
  display: none;
  list-style: none;
  width: 100%;
  flex-direction: column;
  gap: 0;
}

#main-menu.open {
  display: flex;
}

#main-menu li a {
  display: block;
  padding: 0.75rem 0;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.9375rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--color-border);
}

#main-menu li a:hover {
  color: var(--color-primary);
}

#main-menu li.active a,
#main-menu li[aria-current="page"] a {
  color: var(--color-primary);
  font-weight: 700;
}

.lang-switcher {
  display: flex;
  gap: 0.25rem;
}

.lang-switcher a {
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--color-text-light);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.lang-switcher a:hover {
  background-color: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* Desktop navigation (≥ 768px) */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  #main-menu {
    display: flex;
    flex-direction: row;
    width: auto;
    gap: 0;
  }

  #main-menu li a {
    padding: 0.5rem 0.75rem;
    border-bottom: 3px solid transparent;
  }

  #main-menu li a:hover {
    border-bottom-color: var(--color-primary);
  }

  #main-menu li.active a,
  #main-menu li[aria-current="page"] a {
    border-bottom-color: var(--color-primary);
  }
}

/* === Breadcrumb === */
nav[aria-label] ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.8125rem;
  padding: 0.75rem 0;
  color: var(--color-text-light);
}

nav[aria-label] ol li + li::before {
  content: "›";
  margin-right: 0.35rem;
  color: #aaa;
}

nav[aria-label] ol li a {
  color: var(--color-link);
}

nav[aria-label] ol li[aria-current="page"] {
  color: var(--color-text);
  font-weight: 600;
}

/* === Card Grid (seed library & guide listings) === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.75rem;
  margin-top: 1.5rem;
}

/* === Seed Card === */
.seed-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow 0.2s ease;
}

.seed-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.seed-card h2,
.seed-card h3 {
  font-size: 1.125rem;
  margin-bottom: 0;
}

.seed-card .seed-meta {
  font-size: 0.8125rem;
  color: var(--color-text-light);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.seed-card .seed-meta span {
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.seed-card .seed-note {
  flex: 1;
  color: var(--color-text-light);
  font-size: 0.9375rem;
}

.seed-card .seed-link {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.875rem;
}

/* === Guide Card === */
.card-grid article {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1.5rem;
  transition: box-shadow 0.2s ease;
}

.card-grid article:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.card-grid article h2 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.card-grid article h2 a {
  color: var(--color-text);
}

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

.card-grid article p {
  color: var(--color-text-light);
  font-size: 0.9375rem;
  margin-bottom: 0;
}

/* === Video Container (16:9 responsive) === */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin: 1.5rem 0;
  border-radius: 6px;
  overflow: hidden;
}

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

/* === Focus Indicators === */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* === Pagination === */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.pagination .active,
.pagination a:hover {
  background-color: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* === Filter Controls === */
.filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.filter-controls label {
  font-weight: 600;
  margin-right: 0.25rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-light);
}

/* === Not Found (404) === */
.not-found {
  text-align: center;
  padding: 3rem 1rem;
}

.not-found h1 {
  font-size: 4rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

/* === Seed Photo Gallery === */
.seed-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}

.seed-thumb {
  border: 2px solid var(--color-border);
  border-radius: 6px;
  padding: 0;
  background: none;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
  line-height: 0;
}

.seed-thumb:hover,
.seed-thumb:focus-visible {
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.seed-thumb img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

/* === Lightbox === */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.lightbox-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-img {
  max-width: 85vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  z-index: 1001;
}

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 3rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s ease;
  z-index: 1001;
}

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

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.875rem;
  z-index: 1001;
}

@media (max-width: 480px) {
  .seed-thumb img {
    width: 80px;
    height: 60px;
  }

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

/* === Clickable Seed Tags === */
.seed-meta a {
  text-decoration: none;
  color: inherit;
}

.seed-meta a:hover span {
  background: var(--color-primary);
  color: #fff;
}
