/* ============================================================
   TrollRunner Garden Log — pixel garden stylesheet
   ============================================================ */

:root {
  --green-deep:   #1b5e20;
  --green:        #2e7d32;
  --green-bright: #5fbf3a;
  --green-lawn:   #7cc63f;
  --green-pale:   #bdf08a;
  --yellow:       #ffd23f;
  --yellow-warm:  #f7b733;
  --brown:        #6b4226;
  --brown-soil:   #4a2f1a;
  --brown-light:  #8d5b33;
  --sky:          #6ec6f0;
  --sky-deep:     #3aa6e0;
  --cream:        #fff6da;
  --ink:          #2b1d0e;
  --pink:         #e84d8a;
  --shadow:       #00000033;
  --panel:        #fffdf3;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Press Start 2P', system-ui, monospace;
  color: var(--ink);
  background-color: var(--green-lawn);
  background-image:
    linear-gradient(180deg, rgba(110,198,240,.55), rgba(110,198,240,0) 45%),
    repeating-linear-gradient(0deg,  #82cf45 0 8px, #79c63f 8px 16px),
    repeating-linear-gradient(90deg, #00000008 0 8px, #00000000 8px 16px);
  image-rendering: pixel4x;
  line-height: 1.7;
  font-size: 14px;
  overflow-x: hidden;
}

/* readable body copy uses a friendlier font, headings stay pixel */
p, li, .caption, .notes, .meta, .tip-body, .meme-cap, .entry-body, label, input, select {
  font-family: 'VT323', 'Press Start 2P', monospace;
  font-size: 20px;
  line-height: 1.35;
}

h1, h2, h3, h4, .pixel { font-family: 'Press Start 2P', monospace; }

a { color: var(--green-deep); }

img { image-rendering: auto; }

/* ---------- pixel panel / card shared look ---------- */
.panel {
  background: var(--panel);
  border: 4px solid var(--ink);
  box-shadow: 0 6px 0 var(--ink), 0 6px 0 4px #0000001a;
  border-radius: 2px;
  position: relative;
}

.panel::before {  /* inner highlight bevel */
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid #ffffffaa;
  border-bottom-color: #00000022;
  border-right-color: #00000022;
  pointer-events: none;
}

/* ---------- pixel button ---------- */
.btn {
  display: inline-block;
  cursor: pointer;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: var(--ink);
  background: var(--yellow);
  border: 4px solid var(--ink);
  padding: 12px 18px;
  box-shadow: 0 5px 0 var(--ink);
  text-decoration: none;
  transition: transform .05s, box-shadow .05s, background .15s;
  user-select: none;
}
.btn:hover { background: var(--yellow-warm); }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 var(--ink); }
.btn.green { background: var(--green-bright); color: #fff; }
.btn.green:hover { background: var(--green); }
.btn.small { font-size: 10px; padding: 8px 12px; box-shadow: 0 4px 0 var(--ink); }

/* ============================================================
   START SCREEN
   ============================================================ */
#start-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 22px;
  padding: 20px;
  background:
    linear-gradient(180deg, #7ec9f2 0%, #a7dbf5 38%, #8ccf4a 38%, #6fb83c 100%);
  overflow: hidden;
  transition: opacity .5s ease, visibility .5s;
}
#start-screen.hidden { opacity: 0; visibility: hidden; }

.start-title {
  font-size: clamp(20px, 5vw, 46px);
  color: var(--cream);
  text-shadow: 4px 4px 0 var(--green-deep), 8px 8px 0 #00000033;
  margin: 0;
  letter-spacing: 1px;
  animation: bob 2.4s ease-in-out infinite;
}
.start-sub {
  font-size: clamp(9px, 1.6vw, 13px);
  color: var(--brown-soil);
  background: #ffffffcc;
  border: 3px solid var(--ink);
  padding: 8px 12px;
  max-width: 640px;
}
.press-start {
  font-size: clamp(11px, 2vw, 16px);
  margin-top: 6px;
  animation: blink 1.1s steps(2) infinite;
}

/* clouds + sun on start screen and hero */
.sky-deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.sun {
  position: absolute; top: 6%; right: 8%;
  width: 76px; height: 76px;
  background: var(--yellow);
  border: 4px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 0 0 6px #ffd23f55, 0 0 32px 10px #ffd23f88;
  animation: pulse 3s ease-in-out infinite;
}
.cloud {
  position: absolute;
  width: 90px; height: 26px;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 16px;
  opacity: .9;
}
.cloud::before, .cloud::after {
  content:""; position:absolute; background:#fff; border:4px solid var(--ink); border-radius:50%;
}
.cloud::before { width: 34px; height: 34px; top: -22px; left: 12px; }
.cloud::after  { width: 26px; height: 26px; top: -16px; left: 46px; }
.cloud.c1 { top: 14%; left: -120px; animation: drift 26s linear infinite; }
.cloud.c2 { top: 24%; left: -120px; transform: scale(.7); animation: drift 38s linear infinite 4s; }
.cloud.c3 { top: 9%;  left: -120px; transform: scale(1.2); animation: drift 46s linear infinite 10s; }

/* ============================================================
   MASCOT — pixel troll farmer
   ============================================================ */
.mascot {
  width: 120px; height: 120px;
  animation: bob 1.8s ease-in-out infinite;
  filter: drop-shadow(0 6px 0 #00000022);
}
.mascot.small { width: 64px; height: 64px; }

/* ============================================================
   NAV
   ============================================================ */
#topbar {
  position: sticky; top: 0; z-index: 500;
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--green-deep);
  border-bottom: 4px solid var(--ink);
  box-shadow: 0 4px 0 #00000033;
}
#topbar .brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--cream); font-size: 12px; text-decoration: none;
}
#topbar nav { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.navlink {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--cream);
  background: #ffffff1a;
  border: 2px solid #ffffff44;
  padding: 7px 9px;
  text-decoration: none;
  cursor: pointer;
}
.navlink:hover { background: var(--green-bright); border-color: var(--ink); color: #fff; }
.navlink.active { background: var(--yellow); color: var(--ink); border-color: var(--ink); }

/* ============================================================
   LAYOUT
   ============================================================ */
main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 80px; }
.view { display: none; animation: fadein .35s ease; }
.view.active { display: block; }

.section-head {
  display: flex; align-items: center; gap: 14px;
  margin: 6px 0 22px;
}
.section-head h2 {
  font-size: clamp(15px, 3vw, 24px);
  color: var(--green-deep);
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 #0000001a;
  margin: 0;
}
.section-head .sprite { font-size: 30px; }

.lede {
  background: #ffffffd0;
  border-left: 6px solid var(--green-bright);
  padding: 10px 14px;
  margin: 0 0 22px;
}

/* ---------- HOME / HERO ---------- */
.hero {
  text-align: center;
  padding: 30px 20px 34px;
  margin-bottom: 24px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #8fd0f5 0%, #b6e0f7 50%, #8ccf4a 50%, #74bd3e 100%);
}
.hero h1 {
  font-size: clamp(18px, 4.4vw, 38px);
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--green-deep), 6px 6px 0 #00000033;
  margin: 8px 0 14px;
}
.hero .tag {
  max-width: 680px; margin: 0 auto 18px;
  background: #fffef6; border: 3px solid var(--ink); padding: 12px 14px;
}
.quick-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.dash-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.dash-card { padding: 16px; text-align: center; }
.dash-card .big { font-size: 26px; color: var(--green-deep); display:block; margin: 6px 0; }
.dash-card .sprite { font-size: 28px; }

/* ---------- GALLERY ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card { overflow: hidden; display: flex; flex-direction: column; }
.card .ph { position: relative; cursor: pointer; aspect-ratio: 3/4; overflow: hidden; background: var(--brown-soil); }
.card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.card .ph:hover img { transform: scale(1.06); }
.card .badge {
  position: absolute; top: 8px; left: 8px;
  font-family: 'Press Start 2P', monospace; font-size: 8px;
  background: var(--yellow); color: var(--ink);
  border: 2px solid var(--ink); padding: 4px 6px;
}
.card .stage {
  position: absolute; bottom: 8px; right: 8px;
  font-family: 'Press Start 2P', monospace; font-size: 8px;
  background: var(--green-deep); color: #fff;
  border: 2px solid var(--ink); padding: 4px 6px;
}
.card .body { padding: 10px 12px 14px; }
.card .body h3 { margin: 4px 0 6px; font-size: 12px; color: var(--green-deep); }
.card .caption { margin: 0 0 6px; }
.card .notes { margin: 0; color: #5a4632; }
.tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-family: 'Press Start 2P', monospace; font-size: 7px;
  background: var(--green-pale); color: var(--green-deep);
  border: 2px solid var(--green-deep); padding: 3px 5px;
}
.meta { color: #6b573f; font-size: 16px; }

/* ---------- TIMELINES ---------- */
.timeline { padding: 16px; margin-bottom: 22px; }
.timeline > h3 { margin: 0 0 4px; font-size: 14px; color: var(--green-deep); }
.timeline .sub { margin: 0 0 14px; color: #6b573f; }
.track { display: flex; gap: 0; overflow-x: auto; padding: 6px 2px 14px; }
.node {
  flex: 0 0 auto; width: 150px; text-align: center; position: relative;
  padding-top: 26px;
}
.node:not(:last-child)::after {
  content: ""; position: absolute; top: 12px; left: 50%; width: 100%; height: 4px;
  background: repeating-linear-gradient(90deg, var(--green) 0 8px, transparent 8px 14px);
}
.node .dot {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 18px; background: var(--yellow);
  border: 3px solid var(--ink); border-radius: 50%; z-index: 2;
}
.node.done .dot { background: var(--green-bright); }
.node.now .dot { background: var(--pink); animation: pulse 1.4s infinite; }
.node .thumb {
  width: 120px; height: 92px; object-fit: cover; margin: 6px auto 6px;
  border: 3px solid var(--ink); display: block; cursor: pointer;
}
.node .placeholder {
  width: 120px; height: 92px; margin: 6px auto; display: flex;
  align-items: center; justify-content: center; font-size: 26px;
  background: #e9f5d6; border: 3px dashed var(--green); color: var(--green-deep);
}
.node .wk { font-family:'Press Start 2P',monospace; font-size: 8px; color: var(--green-deep); }
.node .lbl { font-size: 15px; display: block; margin-top: 2px; }

/* ---------- TIPS ---------- */
.tip-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); }
.tip { padding: 14px 16px; }
.tip h3 { margin: 2px 0 6px; font-size: 11px; color: var(--green-deep); display:flex; gap:8px; align-items:center;}
.tip .topic {
  font-family:'Press Start 2P',monospace; font-size:7px; background: var(--sky);
  border:2px solid var(--ink); padding:3px 5px; color: var(--ink);
}
.tip-body { margin: 6px 0 0; }

/* ---------- MEMES ---------- */
.meme-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); }
.meme { padding: 0; overflow: hidden; text-align:center; }
.meme .pic {
  background: repeating-linear-gradient(45deg, #d7f0b0 0 12px, #c9e89a 12px 24px);
  padding: 18px 10px; display:flex; align-items:center; justify-content:center; flex-direction: column; gap: 6px;
}
.meme .pic .face { font-size: 54px; line-height: 1; }
.meme .pic .cat {
  font-family:'Press Start 2P',monospace; font-size:7px; color: var(--green-deep);
}
.meme .meme-cap {
  padding: 12px 12px 14px; margin:0; font-size: 19px; background: var(--cream);
  border-top: 3px solid var(--ink);
}

.mascot-tip {
  display:flex; align-items:center; gap:16px; padding:14px 16px; margin: 0 0 22px;
  background: #fffdf0;
}
.mascot-tip .bubble {
  position: relative; flex: 1; background:#fff; border:3px solid var(--ink); padding:10px 14px;
}
.mascot-tip .bubble::before {
  content:""; position:absolute; left:-14px; top:50%; transform: translateY(-50%);
  border:8px solid transparent; border-right-color: var(--ink);
}

/* ---------- MAP ---------- */
.map-wrap { padding: 16px; }
.garden-map {
  display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr);
  background: repeating-linear-gradient(0deg,#5a3a1f 0 10px,#4a2f1a 10px 20px);
  padding: 12px; border: 4px solid var(--ink);
}
.plot {
  aspect-ratio: 1/1; border: 3px solid var(--ink); cursor: pointer;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px;
  font-family:'Press Start 2P',monospace; font-size:8px; text-align:center; color: var(--ink);
  background: var(--green-lawn);
  transition: transform .08s, filter .15s;
  padding: 6px;
}
.plot .ico { font-size: 26px; }
.plot:hover { transform: translateY(-3px) scale(1.03); filter: brightness(1.08); }
.plot:active { transform: translateY(0); }
.plot.soil { background: #7a5230; color: var(--cream); }
.plot.water { background: var(--sky); }
.plot.flower { background: #f6b6d2; }

/* ---------- SEASONS ---------- */
.season-tabs { display:flex; flex-wrap:wrap; gap:8px; margin-bottom: 18px; }
.season-panel { padding: 16px 18px; }
.season-panel h3 { margin:0 0 6px; color: var(--green-deep); font-size: 14px; }
.season-panel ul { margin: 8px 0 0; padding-left: 22px; }

/* ---------- HARVEST ---------- */
.stats-screen {
  padding: 22px; background: #0d1f10;
  border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--ink);
  color: #9be86a;
}
.stats-screen h3 { color: var(--yellow); text-align:center; margin:0 0 16px; font-size: 15px; }
.stat-row {
  display:flex; justify-content:space-between; gap: 10px;
  border-bottom: 2px dashed #2e5b2a; padding: 9px 4px;
  font-family:'Press Start 2P', monospace; font-size: 10px;
}
.stat-row .val { color: var(--yellow); }
.stat-row.boss { color: #ff6b6b; border-bottom: none; margin-top: 8px; }
.stat-row.boss .val { color:#ff6b6b; }
.hp-wrap { margin-top: 14px; }
.hp-label { font-family:'Press Start 2P',monospace; font-size:9px; color:#ff9b9b; margin-bottom:6px;}
.hp-bar { height: 18px; background:#2a0e0e; border:3px solid #000; overflow:hidden; }
.hp-fill { height:100%; width:62%; background: repeating-linear-gradient(90deg,#ff5252 0 10px,#ff7b7b 10px 20px); }

/* ---------- JOURNAL ---------- */
.entry { padding: 16px 18px; margin-bottom: 20px; }
.entry .head { display:flex; flex-wrap:wrap; gap:10px; align-items:baseline; }
.entry h3 { margin: 0; font-size: 13px; color: var(--green-deep); }
.entry .date {
  font-family:'Press Start 2P',monospace; font-size:8px;
  background: var(--brown); color: var(--cream); border:2px solid var(--ink); padding:4px 6px;
}
.entry .pcat {
  font-family:'Press Start 2P',monospace; font-size:8px;
  background: var(--green-pale); color: var(--green-deep); border:2px solid var(--green-deep); padding:4px 6px;
}
.entry .ph { float: right; width: 200px; max-width: 42%; margin: 0 0 10px 16px; }
.entry .ph img { width: 100%; border: 3px solid var(--ink); cursor: pointer; display:block; }
.entry .entry-body { margin: 10px 0; }
.entry .lesson {
  clear: both; background:#fff7d6; border-left: 6px solid var(--yellow-warm);
  padding: 8px 12px; margin-top: 10px;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
#lightbox {
  position: fixed; inset: 0; z-index: 1200; display: none;
  background: #000000dd; align-items: center; justify-content: center; padding: 20px;
}
#lightbox.open { display: flex; }
#lightbox .lb-inner { max-width: 760px; width: 100%; text-align:center; }
#lightbox img { max-width: 100%; max-height: 74vh; border: 4px solid var(--cream); }
#lightbox .lb-cap { color: var(--cream); margin-top: 12px; font-size: 18px; font-family:'VT323',monospace; }
#lightbox .lb-close {
  position: absolute; top: 16px; right: 20px;
}

/* ============================================================
   FOOTER + bugs
   ============================================================ */
footer {
  text-align: center; padding: 26px 16px 40px; color: var(--brown-soil);
  background: var(--brown); color: var(--cream);
  border-top: 4px solid var(--ink);
}
footer a { color: var(--yellow); }

.bug {
  position: fixed; z-index: 400; font-size: 22px; pointer-events: none;
  animation: fly 18s linear infinite;
}
.bug.b2 { animation-duration: 26s; animation-delay: 6s; font-size: 18px; }
.bug.b3 { animation-duration: 32s; animation-delay: 12s; font-size: 16px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes blink { 50% { opacity: .25; } }
@keyframes bob   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(110vw); } }
@keyframes fadein{ from { opacity: 0; transform: translateY(8px);} to {opacity:1; transform:none;} }
@keyframes fly {
  0%   { transform: translate(-5vw, 30vh) rotate(8deg); }
  25%  { transform: translate(30vw, 12vh) rotate(-6deg); }
  50%  { transform: translate(60vw, 50vh) rotate(10deg); }
  75%  { transform: translate(85vw, 20vh) rotate(-8deg); }
  100% { transform: translate(110vw, 40vh) rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  body { font-size: 13px; }
  p, li, .caption, .notes, .tip-body, .meme-cap, .entry-body { font-size: 18px; }
  #topbar nav { margin-left: 0; width: 100%; }
  .garden-map { grid-template-columns: repeat(2, 1fr); }
  .entry .ph { float: none; width: 100%; max-width: 100%; margin: 0 0 12px; }
}
