/* ===== PLANT WIKI — SHARED STYLES =====
   RTL Hebrew | Modern Wiki | Mobile-First
   ======================================= */

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700;800&family=Noto+Serif+Hebrew:wght@400;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --green-deep:   #1a4a2e;
  --green-mid:    #2d7a4f;
  --green-light:  #4caf7d;
  --green-pale:   #e8f5ee;
  --green-tint:   #f2faf5;
  --amber:        #d48c2a;
  --amber-pale:   #fdf6e3;
  --red-warn:     #c0392b;
  --red-pale:     #fdecea;
  --blue-info:    #2471a3;
  --blue-pale:    #eaf4fc;
  --text-main:    #1c1c1e;
  --text-muted:   #6b7280;
  --text-light:   #9ca3af;
  --border:       #d1d5db;
  --border-light: #e5e7eb;
  --bg:           #fafaf8;
  --bg-card:      #ffffff;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
  --radius:       10px;
  --radius-sm:    6px;
  --font-display: 'Noto Serif Hebrew', 'Times New Roman', serif;
  --font-body:    'Rubik', 'Arial Hebrew', sans-serif;
  --max-w:        1100px;
  --sidebar-w:    280px;
}

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

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-main);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--green-mid); text-decoration: none; }
a:hover { color: var(--green-deep); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

h1,h2,h3,h4 { font-family: var(--font-display); line-height: 1.3; }

/* ---- Site Header ---- */
.site-header {
  background: var(--green-deep);
  color: #fff;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.site-header .logo {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.site-header .logo span.leaf { font-size: 1.4rem; }

.site-header .location-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  padding: .2rem .8rem;
  font-size: .78rem;
  color: rgba(255,255,255,.9);
  white-space: nowrap;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  padding: .6rem 1.5rem;
  font-size: .82rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  background: #fff;
}
.breadcrumb a { color: var(--green-mid); }
.breadcrumb span { margin: 0 .3rem; }

/* ========== HOME PAGE ========== */

.home-hero {
  background: linear-gradient(135deg, var(--green-deep) 0%, var(--green-mid) 100%);
  color: #fff;
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
}
.home-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  margin-bottom: .5rem;
  color: #fff;
}
.home-hero p {
  font-size: 1rem;
  opacity: .85;
  max-width: 520px;
  margin: 0 auto;
}

.home-controls {
  max-width: var(--max-w);
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 180px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: .6rem 2.5rem .6rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: .95rem;
  background: #fff;
  outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--green-light); }
.search-box .icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  padding: .3rem .8rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font-body);
  color: var(--text-muted);
}
.chip:hover, .chip.active {
  background: var(--green-deep);
  border-color: var(--green-deep);
  color: #fff;
}

.plant-grid {
  max-width: var(--max-w);
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.25rem;
}

.plant-grid.is-loading { min-height: 320px; }

.skeleton-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.skeleton-media {
  aspect-ratio: 3/2;
  background: linear-gradient(90deg, #eef2f0 20%, #f7faf8 38%, #eef2f0 54%);
  background-size: 220% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-content { padding: .9rem 1rem; }
.skeleton-line {
  height: 11px;
  border-radius: 999px;
  margin-bottom: .55rem;
  background: linear-gradient(90deg, #edf1ef 20%, #f7faf8 38%, #edf1ef 54%);
  background-size: 220% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-line.w-90 { width: 90%; }
.skeleton-line.w-65 { width: 65%; }
.skeleton-line.w-40 { width: 40%; }

.plant-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.plant-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.plant-card .thumb-wrap {
  aspect-ratio: 3/2;
  overflow: hidden;
  background: var(--green-pale);
  position: relative;
}
.plant-card .thumb-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #e8efea 20%, #f8fbf9 38%, #e8efea 54%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  z-index: 1;
}
.plant-card .thumb-wrap.loaded::before {
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease;
}
.plant-card .thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s;
  position: relative;
  z-index: 2;
  opacity: 0;
}
.plant-card .thumb-wrap img.loaded {
  opacity: 1;
  transition: opacity .3s ease, transform .35s ease;
}
.plant-card:hover .thumb-wrap img { transform: scale(1.05); }

.plant-card .card-body {
  padding: .9rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.plant-card .hebrew-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green-deep);
}
.plant-card .sci-name {
  font-size: .78rem;
  font-style: italic;
  color: var(--text-muted);
}
.plant-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .4rem;
}
.plant-card .tag {
  font-size: .72rem;
  padding: .1rem .5rem;
  background: var(--green-pale);
  color: var(--green-deep);
  border-radius: 999px;
}
.plant-card .uncertain-badge {
  font-size: .72rem;
  padding: .15rem .55rem;
  background: var(--amber-pale);
  color: var(--amber);
  border-radius: 999px;
  border: 1px solid #f0d080;
}

.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  display: block;
  grid-column: 1/-1;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ========== PLANT PAGE ========== */

.plant-page-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem;
}

.plant-page-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--green-deep);
  margin-bottom: .25rem;
}
.plant-page-sci {
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 1rem;
}
.uncertain-banner {
  background: var(--amber-pale);
  border: 1px solid #f0d080;
  border-radius: var(--radius-sm);
  padding: .7rem 1rem;
  font-size: .9rem;
  color: #7a5a00;
  margin-bottom: 1rem;
}

.plant-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.infobox {
  flex-shrink: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: .88rem;
  box-shadow: var(--shadow-sm);
  order: -1;
  position: relative;
}

.infobox.img-pending::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(90deg, #e8efea 20%, #f8fbf9 38%, #e8efea 54%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  z-index: 2;
}

.infobox-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  opacity: 1;
}
.infobox-img.loaded {
  opacity: 1;
  transition: opacity .35s ease;
}

.infobox-caption {
  padding: .5rem .75rem;
  font-size: .78rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  text-align: center;
}

.infobox table {
  width: 100%;
  border-collapse: collapse;
}
.infobox table tr {
  border-bottom: 1px solid var(--border-light);
}
.infobox table tr:last-child { border-bottom: none; }
.infobox table td {
  padding: .45rem .75rem;
  vertical-align: top;
}
.infobox table td:first-child {
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
  width: 40%;
}

.article-content {
  flex: 1;
  min-width: 0;
}

.toc {
  background: var(--green-tint);
  border: 1px solid #c3e0d0;
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  font-size: .88rem;
}
.toc-title {
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: .5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.toc ol {
  padding-right: 1.2rem;
  list-style: decimal;
}
.toc li { margin: .2rem 0; }
.toc a { color: var(--green-mid); }
.toc a:hover { text-decoration: underline; }

.article-content section { margin-bottom: 2rem; }
.article-content h2 {
  font-size: 1.3rem;
  color: var(--green-deep);
  border-bottom: 2px solid var(--green-pale);
  padding-bottom: .4rem;
  margin-bottom: .9rem;
}
.article-content h3 {
  font-size: 1.05rem;
  color: var(--text-main);
  margin: .8rem 0 .4rem;
}
.article-content p { margin-bottom: .7rem; }
.article-content ul, .article-content ol {
  padding-right: 1.5rem;
  margin-bottom: .7rem;
}
.article-content li { margin-bottom: .3rem; }

.callout {
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  margin: .75rem 0;
  font-size: .92rem;
  border-right: 4px solid;
}
.callout.do {
  background: var(--green-pale);
  border-color: var(--green-light);
  color: var(--green-deep);
}
.callout.dont {
  background: var(--red-pale);
  border-color: var(--red-warn);
  color: #7a1a12;
}
.callout.info {
  background: var(--blue-pale);
  border-color: var(--blue-info);
  color: #1a3d5c;
}
.callout.warn {
  background: var(--amber-pale);
  border-color: var(--amber);
  color: #6b4000;
}
.callout strong { font-weight: 700; }

.trouble-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin: .5rem 0 1rem;
}
.trouble-table thead { position: sticky; top: 0; }
.trouble-table th {
  background: var(--green-deep);
  color: #fff;
  padding: .5rem .75rem;
  text-align: right;
  font-weight: 600;
}
.trouble-table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.trouble-table tr:nth-child(even) td { background: var(--bg); }

.checklist {
  list-style: none;
  padding: 0;
}
.checklist li {
  padding: .35rem 0;
  border-bottom: 1px dashed var(--border-light);
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.checklist li::before {
  content: "☐";
  font-size: 1.1rem;
  color: var(--green-mid);
  flex-shrink: 0;
  margin-top: .05rem;
}

.plant-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  gap: 1rem;
}
.plant-nav a { color: var(--green-mid); font-size: .9rem; }
.plant-nav .back-btn {
  background: var(--green-deep);
  color: #fff;
  padding: .45rem 1.1rem;
  border-radius: 999px;
  font-size: .88rem;
}
.plant-nav .back-btn:hover { background: var(--green-mid); text-decoration: none; }

.pet-warning {
  background: var(--red-pale);
  border: 1px solid #f5b7b1;
  border-radius: var(--radius-sm);
  padding: .7rem 1rem;
  font-size: .9rem;
  color: var(--red-warn);
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: .75rem 0;
}

.site-footer {
  background: var(--green-deep);
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: 1.2rem;
  font-size: .82rem;
  margin-top: 3rem;
}

@keyframes shimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -40% 0; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 700px) {
  .plant-layout { flex-direction: column; }
  .infobox { width: 100%; order: 0; }
  .infobox-img { aspect-ratio: 16/9; }
  .infobox.img-pending::before { aspect-ratio: 16/9; }
  .plant-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .article-content section { margin-bottom: 1.6rem; }
  .site-header {
    padding: 0 .8rem;
    gap: .5rem;
  }
  .site-header .logo {
    font-size: .95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .site-header .location-badge { font-size: .7rem; }
  .plant-page-wrap { padding: 1rem; }
}
@media (max-width: 480px) {
  .plant-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .home-controls { flex-direction: column; }
  .search-box { width: 100%; }
  .plant-card .card-body { padding: .7rem .75rem; }
  .plant-card .hebrew-name { font-size: .95rem; }
  .plant-card .sci-name { font-size: .72rem; }
  .trouble-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
