/* ===== Variables & base ===== */
:root {
  --color-bg: #faf9f6;
  --color-surface: #fff;
  --color-text: #1a1a1a;
  --color-muted: #555;
  --color-accent: #2d5a27;
  --color-accent-hover: #3d7a35;
  --color-border: #e0ddd8;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 8px;
  --font-sans: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
  text-align: center;
}

.site-header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.site-header .tagline {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.site-header nav {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.site-header nav a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.site-header nav a:hover {
  text-decoration: underline;
}

/* ===== Main ===== */
main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.home-main .intro {
  background: var(--color-surface);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.home-main .intro h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
}

.home-main .intro p {
  margin: 0 0 1.5rem 0;
  color: var(--color-muted);
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
}

.btn:hover {
  background: var(--color-accent-hover);
}

/* ===== Gallery ===== */
.gallery-main h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.gallery-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.gallery-card .img-wrap {
  aspect-ratio: 4 / 3;
  background: var(--color-border);
  overflow: hidden;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-card .caption {
  padding: 0.75rem 1rem;
}

.gallery-card .caption .variety {
  font-weight: 600;
  margin: 0 0 0.25rem 0;
}

.gallery-card .caption .meta {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 0;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lightbox.is-open {
  display: flex;
}

.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: #000;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.lightbox-content {
  text-align: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 70vh;
}

.lightbox-caption {
  margin-top: 0.75rem;
  color: #eee;
  font-size: 0.9rem;
}

.lightbox-caption .meta {
  color: #ccc;
  font-size: 0.85rem;
}

.lightbox-close {
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-prev { left: 0.25rem; }
.lightbox-next { right: 0.25rem; }

.gallery-loading,
.gallery-error {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-muted);
}

.gallery-error {
  color: #a00;
}

.gallery-error code {
  background: #f5f5f5;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

/* ===== Footer ===== */
.site-footer {
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* ===== Admin ===== */
.admin-main h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
}

.admin-main .muted {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.admin-main .muted code {
  background: #f0f0f0;
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

.admin-actions {
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.admin-actions .btn {
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.admin-actions .btn-secondary {
  background: var(--color-muted);
}

.admin-actions .btn-secondary:hover {
  background: #444;
}

.photo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.photo-item {
  background: var(--color-surface);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.photo-item .row {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.photo-item .thumb-wrap {
  width: 80px;
  height: 80px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-border);
}

.photo-item .thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-item label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.photo-item input,
.photo-item textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
}

.photo-item textarea {
  min-height: 60px;
  resize: vertical;
}

.photo-item .item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.photo-item .btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: var(--color-accent);
  color: #fff;
}

.photo-item .btn-small:hover {
  background: var(--color-accent-hover);
}

.photo-item .btn-small.btn-delete {
  background: #a03030;
}

.photo-item .btn-small.btn-delete:hover {
  background: #c04040;
}

.add-form {
  background: var(--color-surface);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px dashed var(--color-border);
  margin-bottom: 1.5rem;
}

.add-form h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
}

.add-form .form-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.add-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.add-form input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 1rem;
}

.admin-login {
  max-width: 320px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-login h2 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
}

.admin-login label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.admin-login input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.admin-login .error {
  color: #a00;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* ===== Responsive ===== */
@media (min-width: 600px) {
  .photo-item .row {
    grid-template-columns: 1fr 1fr;
  }

  .add-form .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
