/* markinagarden.com — minimal personal site styling.
   Dark mode by default; mobile-first; reads like a small zine. */

:root {
  --bg: #0e0f13;
  --surface: #16181f;
  --surface2: #1c1f27;
  --border: #2a2d36;
  --text: #e6e7ea;
  --muted: #888a93;
  --accent: #f0a830;
  --green: #4caf50;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.site-head {
  padding: 48px 20px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}
/* Header link (e.g. "Everything →") absolute-positions to the right edge
   so it doesn't disrupt the centered title block. */
.site-head .header-link {
  position: absolute;
  top: 12px;
  right: 14px;
  margin-left: 0;
}
.site-title {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 1px;
  margin: 0;
}
.site-sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 6px 0 0;
}

.site-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* News-article row layout: small square thumbnail on the left, text on
   the right. One plant per row, stacked vertically. */
.plant-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
}

.plant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 10px 6px 6px;
  min-height: 80px;
}
.plant-card img {
  width: 80px;
  height: 68px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
  background: var(--surface2);
}
.plant-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.plant-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--muted);
  align-items: center;
}
.plant-cycle {
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.6rem;
}
.plant-cycle.pl-perennial {
  background: color-mix(in srgb, var(--green) 22%, transparent);
  color: var(--green);
}
.plant-cycle.pl-annual {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
}
.plant-date {
  font-size: 0.7rem;
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}

.site-foot {
  text-align: center;
  padding: 24px 16px 40px;
  color: var(--muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

/* Cards on the index are anchors — strip default underline + color. */
a.plant-card {
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
a.plant-card:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  transform: translateY(-2px);
}

/* Per-plant gallery page */
.back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 10px;
}
.back-link:hover { text-decoration: underline; }
.plant-meta-head {
  justify-content: center;
  margin-top: 8px;
}
/* Per-plant gallery as a vertical timeline (newest at top). The center
   rail (line + dots) carries the temporal scale; date sits on the left,
   photo on the right. Year-change inserts a labelled divider banner so
   long histories read at a glance. */
.timeline {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 0;
}
.tl-entry {
  display: grid;
  grid-template-columns: 80px 28px 1fr;
  align-items: stretch;
  min-height: 110px;
}
.tl-date {
  padding: 10px 8px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.tl-line {
  position: relative;
  align-self: stretch;
}
.tl-line::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: color-mix(in srgb, var(--green) 55%, var(--border));
  transform: translateX(-50%);
}
.tl-dot {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 35%, transparent);
  transform: translateX(-50%);
  z-index: 1;
}
.tl-photo {
  margin: 6px 0 18px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.tl-photo img {
  display: block;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface2);
}
/* Plant-name caption on the /everything.html timeline. Each entry shows
   which plant the photo belongs to; tap to jump to that plant's page. */
.tl-plant-link {
  padding: 6px 10px 8px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid var(--border);
}
.tl-plant-link a {
  color: #c9d1d9;
  text-decoration: none;
}
.tl-plant-link a:hover { color: #fff; text-decoration: underline; }
/* "Everything →" link in the index header. Sits to the right of the
   site title, sized like a small secondary action. */
.header-link {
  margin-left: auto;
  font-size: 0.78rem;
  color: #c9d1d9;
  text-decoration: none;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 4px;
}
.header-link:hover { color: #fff; border-color: #fff; }
/* Year divider — small label on the rail, extra breathing room above. */
.tl-year {
  display: grid;
  grid-template-columns: 80px 28px 1fr;
  align-items: center;
  margin: 22px 0 8px;
}
.tl-year::before {
  content: '';
  grid-column: 1;
}
.tl-year > span {
  grid-column: 2 / -1;
  position: relative;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted);
  padding-left: 22px;
}
.tl-year > span::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 7px;
  width: 14px;
  height: 2px;
  background: color-mix(in srgb, var(--green) 55%, var(--border));
  transform: translateY(-50%);
}

/* Tap-to-fullscreen lightbox. iOS Safari handles pinch + double-tap zoom
   on the image natively since the viewport meta doesn't disable scaling. */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: auto;
  touch-action: pinch-zoom;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}
.lightbox-close {
  position: fixed;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }
/* Prev/Next carousel controls — sit centered on each side, visible at all
   times. On narrow screens (≤480px) they fade to barely-there so swipe is
   the primary interaction. */
.lightbox-prev, .lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 56px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: none;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255, 255, 255, 0.26); }
.lightbox-caption {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.42);
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 10000;
  pointer-events: none;
}
@media (max-width: 480px) {
  .lightbox-prev, .lightbox-next {
    background: rgba(255, 255, 255, 0.08);
    font-size: 1.8rem;
    width: 36px;
    height: 44px;
  }
}

/* Sort bar above the plant grid on the index page. Mirrors the moktracker
   plants page (alpha · last updated · longest since update). Buttons are
   simple pills with an accent fill on the active option. */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.sort-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #888;
  margin-right: 4px;
}
.sort-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ccc;
  padding: 4px 10px;
  border-radius: 4px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.sort-btn:hover { color: #fff; border-color: #fff; }
.sort-btn.is-active {
  background: #fff;
  color: #111;
  border-color: #fff;
}
