/* ==========================================================================
   Nuggets of Chaos — illustrated nature-journal theme
   Reference: painted night-forest hero, torn-paper transition, editorial
   cards with category labels. Palette stays purple / blue / green.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --purple-deep: #2f2350;
  --purple: #6a4fae;
  --purple-soft: #b9a9de;
  --blue: #4d6a8f;
  --blue-soft: #a9c0d6;
  --green: #3f6350;
  --green-soft: #a9c9b1;
  --forest: #2f4a3a;
  --olive: #7c8a6a;
  --gold: #d9a85c;
  --ink: #241a35;
  --ink-soft: #6b5f80;
  --paper: #f4ecd8;
  --paper-alt: #ece1c8;
  --cream: #f6f1e2;
  --moon: #efe6f7;
  --line: #ddd0b0;
  --line-ink: rgba(36, 26, 53, 0.18);
  --void-1: #150e26;
  --void-2: #372c50;
  --void-3: #3f5468;
  --void-4: #5c7864;
  --shadow: 0 16px 34px -16px rgba(18, 12, 32, 0.4);
  --shadow-sm: 0 6px 16px -8px rgba(18, 12, 32, 0.3);
  --radius: 6px;
  --radius-sm: 4px;
  --font-head: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Cormorant Garamond', Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: linear-gradient(180deg, var(--void-1) 0%, var(--void-2) 32%, var(--void-3) 62%, var(--void-4) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

p { margin: 0 0 1em; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green-soft);
  font-weight: 600;
  margin-bottom: 10px;
}

/* ---------------- Decorative botanical flourishes (fixed, ambient) ---------------- */
.decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.decor svg {
  position: absolute;
  opacity: 0.5;
}
.decor .flourish-tl { top: 60px; left: -30px; width: 130px; }
.decor .flourish-br { bottom: 20px; right: -30px; width: 150px; }

/* ---------------------------- Header / Nav ------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(21, 14, 38, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(239, 230, 247, 0.14);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 1080px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--cream);
}
.brand svg { width: 28px; height: 28px; }
.brand .tag {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--purple-soft);
  font-weight: 500;
  display: block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a {
  color: var(--moon);
  opacity: 0.82;
  padding: 6px 2px;
  border-bottom: 1px solid transparent;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}
.nav-links a:hover,
.nav-links a.active {
  opacity: 1;
  border-color: var(--gold);
}
.nav-cta {
  background: var(--forest);
  color: var(--cream) !important;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 230, 247, 0.25);
  letter-spacing: 0.04em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.nav-cta:hover { transform: translateY(-1px); background: #3a5c48; box-shadow: var(--shadow-sm); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle svg { width: 26px; height: 26px; color: var(--cream); }

/* ------------------------------- Hero ----------------------------------- */
.hero {
  position: relative;
  padding: 0;
  overflow: hidden;
}
.hero-scene {
  position: relative;
  width: 100%;
  min-height: 640px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-scene svg.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-scene .scene-bg-img { width: 100%; height: 100%; object-fit: cover; }
.hero-text {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px 24px;
  max-width: 720px;
}
.hero-text .eyebrow { color: var(--moon); opacity: 0.85; justify-content: center; width: 100%; }
.hero-text h1 {
  font-size: clamp(2.4rem, 5vw, 3.7rem);
  color: var(--cream);
  margin: 0 auto 22px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
.hero-text p.lead {
  max-width: 520px;
  margin: 0 auto 30px;
  font-family: var(--font-sans);
  color: var(--paper);
  opacity: 0.85;
  font-size: 1rem;
}
.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Torn paper edge under the hero illustration */
.hero-tear { position: relative; z-index: 2; margin-top: -1px; }
.hero-tear svg { display: block; width: 100%; height: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn-primary {
  background: var(--forest);
  color: var(--cream);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(-2px); background: #3a5c48; }
.btn-ghost {
  background: rgba(244, 236, 216, 0.12);
  color: var(--cream);
  border: 1px solid rgba(244, 236, 216, 0.5);
}
.btn-ghost:hover { background: rgba(244, 236, 216, 0.2); }
.btn-sm { padding: 8px 16px; font-size: 0.72rem; }

/* ---------------------------- Section divider ---------------------------- */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 44px;
  color: var(--olive);
}
.divider svg { width: 120px; height: 20px; }

/* ------------------------------ Post grid -------------------------------- */
.feed-panel {
  background: var(--paper-alt);
  padding: 56px 0 8px;
}
.section-title {
  text-align: center;
  margin-bottom: 8px;
}
.section-title h2 { margin: 0 0 4px; font-size: 2rem; color: var(--cream); }
.section-title .muted { font-family: var(--font-sans); color: var(--purple-soft); font-size: 0.86rem; }
.feed-panel .section-title h2 { color: var(--ink); }
.feed-panel .section-title .muted { color: var(--ink-soft); }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 26px;
  margin-bottom: 64px;
}

.post-card {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-ink);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.post-cover {
  aspect-ratio: 4 / 3;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--void-1);
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-cover.placeholder svg { width: 100%; height: 100%; }

.post-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.post-meta {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 600;
}
.post-body h3 { font-size: 1.4rem; margin: 2px 0 6px; }
.post-excerpt { font-family: var(--font-sans); color: var(--ink-soft); font-size: 0.92rem; flex: 1; line-height: 1.55; }
.post-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.post-readmore {
  color: var(--purple);
  display: inline-flex;
  align-items: center;
}
.post-card:hover .post-readmore { color: var(--purple-deep); }
.post-readmore svg { width: 15px; height: 15px; flex-shrink: 0; }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--ink-soft);
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line-ink);
  box-shadow: var(--shadow);
  margin-bottom: 60px;
}
.empty-state svg { width: 76px; height: 76px; margin: 0 auto 16px; opacity: 0.85; color: var(--purple); }
.empty-state h3 { color: var(--purple-deep); }
.empty-state p { font-family: var(--font-sans); }

/* ------------------------------ Single post ------------------------------ */
.post-article { padding: 20px 24px 80px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  color: var(--purple-soft);
  font-size: 0.86rem;
  font-weight: 500;
  margin-bottom: 24px;
}
.back-link:hover { color: var(--cream); }
.back-link svg { width: 16px; height: 16px; }

.post-article header.article-head { max-width: 760px; margin: 0 auto 28px; text-align: center; }
.post-article .post-meta { display: block; margin-bottom: 10px; color: var(--green-soft); }
.post-article h1 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); color: var(--cream); }

.article-cover {
  max-width: 900px;
  margin: 0 auto 36px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(239, 230, 247, 0.18);
  background: var(--void-1);
}
.article-cover img { width: 100%; }
.article-cover.placeholder {
  aspect-ratio: 21/9;
}
.article-cover.placeholder svg { width: 100%; height: 100%; }

.article-content {
  max-width: 680px;
  margin: 0 auto;
  font-family: var(--font-sans);
  font-size: 1.04rem;
  color: var(--ink);
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line-ink);
  box-shadow: var(--shadow);
  padding: 40px 44px;
}
.article-content p { margin-bottom: 1.3em; }

.article-gallery {
  max-width: 900px;
  margin: 44px auto 0;
}
.article-gallery h4 { text-align: center; margin-bottom: 18px; color: var(--purple-soft); font-family: var(--font-sans); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.photo-grid img, .photo-grid .ph-item {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(239, 230, 247, 0.18);
  transition: transform 0.2s ease;
}
.photo-grid img:hover { transform: scale(1.03); }

/* -------------------------------- Forms ---------------------------------- */
.write-wrap {
  max-width: 720px;
  margin: 24px auto 60px;
  padding: 40px 44px 44px;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line-ink);
  box-shadow: var(--shadow);
}
.write-wrap h1 { color: var(--ink); }
.write-wrap .eyebrow { color: var(--green); }
.write-wrap p { font-family: var(--font-sans); }
.field { margin-bottom: 26px; }
.field label {
  display: block;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--purple-deep);
  margin-bottom: 8px;
}
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: 0.8rem; margin-left: 6px; }

.input, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper-alt);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--purple-soft);
  box-shadow: 0 0 0 4px rgba(106, 79, 174, 0.14);
}
.textarea { resize: vertical; min-height: 90px; }
.textarea.body { min-height: 220px; }

.dropzone {
  border: 2px dashed var(--purple-soft);
  border-radius: var(--radius);
  background: rgba(106, 79, 174, 0.06);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  color: var(--ink-soft);
  font-family: var(--font-sans);
}
.dropzone:hover, .dropzone.dragover {
  background: var(--paper);
  border-color: var(--green);
}
.dropzone svg { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--purple); }
.dropzone strong { color: var(--purple-deep); }
.dropzone input[type="file"] { display: none; }

.cover-preview {
  margin-top: 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  display: none;
}
.cover-preview.show { display: block; }
.cover-preview img { width: 100%; max-height: 280px; object-fit: cover; }
.cover-preview .remove-btn { position: absolute; top: 10px; right: 10px; }

.photo-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.photo-previews .thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.photo-previews .thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
}

.remove-btn {
  background: rgba(36, 26, 53, 0.78);
  color: var(--cream);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 40px;
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--forest);
  color: var(--cream);
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------- Gallery page ----------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 60px;
}
.gallery-grid .g-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(239, 230, 247, 0.18);
}
.gallery-grid .g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.gallery-grid .g-item:hover img { transform: scale(1.06); }
.gallery-grid .g-caption {
  position: absolute;
  inset: auto 0 0 0;
  background: linear-gradient(0deg, rgba(21,14,38,0.85), transparent);
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  padding: 18px 10px 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.gallery-grid .g-item:hover .g-caption { opacity: 1; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 24, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 80vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.lightbox .lb-caption { color: var(--cream); font-family: var(--font-sans); text-align: center; margin-top: 14px; font-size: 0.92rem; }
.lightbox .lb-close {
  position: absolute;
  top: 24px;
  right: 28px;
  background: rgba(239,230,247,0.15);
  border: none;
  color: var(--cream);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
}
.lightbox .lb-inner { display: flex; flex-direction: column; align-items: center; max-width: 100%; }

/* -------------------------------- Footer ---------------------------------- */
.site-footer {
  border-top: 1px solid rgba(239, 230, 247, 0.14);
  padding: 40px 24px 32px;
  text-align: center;
  color: var(--purple-soft);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  position: relative;
  background: rgba(15, 10, 24, 0.4);
}
.site-footer .foot-brand {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--cream);
  font-size: 1.15rem;
  margin-bottom: 6px;
}
.site-footer svg { width: 60px; height: 26px; margin: 0 auto 14px; color: var(--olive); }

/* -------------------------------- Utility ---------------------------------- */
.fade-in { animation: fadeIn 0.6s ease both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

main { position: relative; z-index: 1; }

/* -------------------------------- Responsive -------------------------------- */
@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(21, 14, 38, 0.97);
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 24px;
    gap: 16px;
    border-bottom: 1px solid rgba(239, 230, 247, 0.14);
    box-shadow: var(--shadow-sm);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .hero-scene { min-height: 480px; }
  .write-wrap, .article-content { padding: 28px 22px; }
  .decor .flourish-br { width: 100px; }
  .decor .flourish-tl { width: 90px; }
}
