/* ----- Base ----- */
:root {
  --green: #2E5E3C;
  --green-deep: #20432B;
  --sage: #7A9C82;
  --cream: #F8F5EE;
  --paper: #FBFAF5;
  --ink: #1F2920;
  --muted: #6E726C;
  --line: #E5E0D5;
  --tint: #EAF2EB;
  --ok: #3F8B57;
  --watch: #C58B2B;
  --due: #B5483A;
  --shadow: 0 4px 20px rgba(31, 41, 32, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

/* ----- Header ----- */
.site-header {
  background: var(--green);
  color: #F8F5EE;
  padding: 22px 0;
  border-bottom: 4px solid var(--green-deep);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 22px; height: 22px;
  background: radial-gradient(circle at 30% 30%, #A6C9AE 0%, #7A9C82 60%, #4D7A57 100%);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}
h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin: 0;
}
.today { margin: 0; font-size: 13px; color: rgba(248,245,238,0.78); }

/* ----- Weather ----- */
.weather {
  margin: 28px 0 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px 20px;
}
.weather-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 14px;
}
.weather-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--green-deep);
  font-size: 20px; font-weight: 600; margin: 0;
}
.weather-loc { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.weather-note {
  font-size: 13px; color: var(--green-deep);
  background: var(--tint);
  padding: 5px 10px; border-radius: 999px;
}
.weather-note.muted { background: transparent; color: var(--muted); }
.forecast-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.forecast {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 8px 14px;
  text-align: center;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s, background .15s;
}
.forecast.rainy {
  border-color: rgba(46,94,60,0.35);
  background: var(--tint);
}
.forecast-day {
  font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--green-deep);
}
.forecast-icon {
  display: flex; align-items: center; justify-content: center;
  color: var(--green);
  margin: 4px 0;
}
.forecast-icon svg { width: 36px; height: 36px; }
.forecast-temp {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px; color: var(--ink); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.forecast-temp .lo { color: var(--muted); font-weight: 500; font-size: 16px; }
.forecast-rain {
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.forecast-rain .drop { color: var(--sage); margin-right: 2px; }
.forecast.rainy .forecast-rain { color: var(--green-deep); font-weight: 600; }
.forecast.rainy .forecast-rain .drop { color: var(--green); }
.weather-error { padding: 8px 0; }

@media (max-width: 720px) {
  .weather { padding: 14px 14px 16px; }
  .forecast-row { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .forecast { padding: 10px 4px; }
  .forecast-icon svg { width: 28px; height: 28px; }
  .forecast-temp { font-size: 18px; }
  .forecast-temp .lo { font-size: 13px; }
  .forecast-day { font-size: 11px; }
  .forecast-rain { font-size: 11px; }
}

/* ----- Intro ----- */
.intro {
  padding: 40px 0 24px;
  display: flex; align-items: end; justify-content: space-between; gap: 20px;
  flex-wrap: wrap;
}
.lede {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 22px;
  color: var(--green);
  margin: 0;
}
.legend {
  font-size: 13px; color: var(--muted);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.status-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 4px; margin-left: 10px;
}
.status-dot:first-child { margin-left: 0; }
.status-dot.ok    { background: var(--ok); }
.status-dot.watch { background: var(--watch); }
.status-dot.due   { background: var(--due); }

/* ----- Dashboard grid ----- */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 22px;
  padding-bottom: 48px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-photo {
  width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block;
  background: var(--tint);
}
.card-body { padding: 16px 18px 18px; }
.card-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px; font-weight: 600;
  margin: 0;
  color: var(--green-deep);
  line-height: 1.15;
}
.card-sci {
  font-style: italic;
  color: var(--muted);
  font-size: 13px;
  margin: 2px 0 12px;
}
.water-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}
.water-meta { font-size: 13px; color: var(--ink); }
.water-meta .when { font-weight: 600; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase; font-weight: 600;
  padding: 4px 9px; border-radius: 999px;
}
.status.ok    { background: rgba(63,139,87,0.12); color: #2D6A41; }
.status.watch { background: rgba(197,139,43,0.14); color: #8E6014; }
.status.due   { background: rgba(181,72,58,0.14); color: #8B3327; }

.btn {
  display: inline-block;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  font: 600 13px/1 'Inter', sans-serif;
  letter-spacing: 0.3px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--green-deep); border-color: var(--green-deep); }
.btn.ghost {
  background: transparent; color: var(--green); border-color: var(--green);
}
.btn.ghost:hover { background: var(--tint); color: var(--green-deep); }
.btn.small { padding: 7px 11px; font-size: 12px; }
.btn.full { width: 100%; }

/* ----- Add photos section ----- */
.add-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin: 16px 0 60px;
}
.add-section h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--green-deep); font-size: 24px; font-weight: 600;
  margin: 0 0 6px;
}
.muted { color: var(--muted); font-size: 14px; }
code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--tint);
  padding: 2px 6px; border-radius: 4px; font-size: 0.9em;
  color: var(--green-deep);
}
.uploader {
  margin-top: 18px;
  border: 2px dashed var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 22px;
  display: flex; align-items: center;
  transition: border-color .15s, background .15s;
}
.uploader.drag { border-color: var(--green); background: var(--tint); }
#upload-results { margin-top: 18px; display: grid; gap: 14px; }
.upload-item {
  background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px;
  display: grid; grid-template-columns: 110px 1fr; gap: 14px;
  align-items: start;
}
.upload-item img { width: 110px; aspect-ratio: 4/5; object-fit: cover; border-radius: 6px; }
.upload-form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.upload-form-row label { font-size: 12px; color: var(--muted); }
.upload-form-row select, .upload-form-row input[type=date] {
  font: inherit; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink);
}
.snippet {
  background: var(--green-deep); color: #E8F0EA;
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 12px 14px; border-radius: 8px;
  white-space: pre-wrap; word-break: break-word;
  margin-top: 10px;
}
.snippet .label {
  display: block; font-family: 'Inter', sans-serif; font-size: 11px;
  color: rgba(255,255,255,0.55); letter-spacing: 0.4px; text-transform: uppercase;
  margin-bottom: 4px;
}

/* ----- Modal ----- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(31,41,32,0.55);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative; z-index: 1;
  background: var(--paper);
  border-radius: var(--radius);
  width: 100%; max-width: 920px; max-height: 92vh;
  overflow: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
  border: 1px solid var(--line);
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px; border: 0;
  background: rgba(0,0,0,0.06); color: var(--ink);
  font-size: 22px; line-height: 1;
  border-radius: 50%; cursor: pointer;
  z-index: 2;
}
.modal-close:hover { background: rgba(0,0,0,0.12); }

.detail {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  min-height: 100%;
}
.detail .photo {
  width: 100%; aspect-ratio: 4/5;
  object-fit: cover; display: block;
  background: var(--tint);
}
.detail .info { padding: 28px 32px; }
.detail h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--green-deep); font-size: 32px; font-weight: 600;
  line-height: 1.1; margin: 0;
}
.detail h2 + .sci { font-style: italic; color: var(--muted); margin: 4px 0 18px; }
.attrs { margin: 18px 0; }
.attr {
  display: grid; grid-template-columns: 110px 1fr; gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.attr:last-child { border-bottom: 1px solid var(--line); }
.attr .key {
  font-size: 11px; letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--green); font-weight: 700;
  padding-top: 2px;
}
.attr .val { font-size: 14px; color: var(--ink); }

.water-block {
  margin-top: 18px;
  background: var(--tint);
  border-radius: 10px;
  padding: 16px 18px;
}
.water-block .last { font-size: 13px; color: var(--muted); }
.water-block .when {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 24px; color: var(--green-deep); font-weight: 600;
  display: block; margin: 4px 0 12px;
}
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-log {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 6px 4px 10px;
}
.back-log input[type=date] {
  font: inherit; font-size: 13px;
  border: 0; background: transparent;
  color: var(--ink);
  padding: 0;
  font-variant-numeric: tabular-nums;
}
.back-log input[type=date]:focus { outline: none; }

.archive-section {
  padding: 28px 32px;
  border-top: 1px solid var(--line);
  grid-column: 1 / -1;
}
.archive-section h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--green-deep); font-size: 22px; font-weight: 600;
  margin: 0 0 16px;
}
.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.archive-item { text-align: center; }
.archive-item img {
  width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 8px;
  background: var(--tint); border: 1px solid var(--line);
}
.archive-item .archive-date {
  display: block; margin-top: 6px;
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ----- Footer ----- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 28px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.site-footer code { font-size: 0.95em; }

/* ----- Responsive ----- */
@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; }
  .detail .photo { aspect-ratio: 1/1; }
  .archive-section { padding: 22px; }
  .add-section { padding: 22px; }
  h1 { font-size: 22px; }
  .intro { padding: 28px 0 18px; }
  .upload-item { grid-template-columns: 1fr; }
  .upload-item img { width: 100%; max-width: 220px; }
}
