/* ============================================================
   ideas-blossom — night archivist
   a night-gallery / zine aesthetic: deep ink blue, cream paper,
   handwritten margin notes, taped polaroids & hand-drawn lines
   ============================================================ */

:root {
  --ink: #0c1220;
  --ink-2: #111a2c;
  --ink-3: #18233a;
  --cream: #ece4d3;
  --cream-dim: #a9a290;
  --paper: #f2ecdf;
  --paper-ink: #221d14;
  --ocean: #83b4d9;
  --ocean-deep: #3d6a92;
  --amber: #d9a441;
  --crimson: #b23a48;
  --hairline: rgba(236, 228, 211, 0.16);
  --serif: "Cormorant Garamond", "Songti SC", serif;
  --read: "Newsreader", Georgia, serif;
  --hand: "Caveat", cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(61, 106, 146, 0.22), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(61, 106, 146, 0.12), transparent 55%),
    var(--ink);
  color: var(--cream);
  font-family: var(--read);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: var(--ocean-deep); color: var(--cream); }

.hand { font-family: var(--hand); }

/* film grain over everything */
.grain {
  position: fixed; inset: -50%;
  pointer-events: none; z-index: 60;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1.5%); }
  50% { transform: translate(1.5%, -1%); }
  75% { transform: translate(-1%, -2%); }
  100% { transform: translate(0, 0); }
}

/* ---------------- nav ---------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 5vw;
  background: linear-gradient(rgba(12, 18, 32, 0.92), rgba(12, 18, 32, 0));
}
.nav-logo {
  font-family: var(--serif);
  font-size: 1.7rem; font-weight: 600; font-style: italic;
  color: var(--cream); text-decoration: none; letter-spacing: 0.02em;
}
.nav-logo .star { color: var(--amber); font-style: normal; font-size: 1rem; margin-left: 4px; }

/* menu button + two-level dropdown */
.menu-wrap { position: relative; }
.menu-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px dashed var(--amber);
  background: rgba(17, 26, 44, 0.95); cursor: pointer;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(217, 164, 65, 0.08);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.menu-btn span {
  display: block; width: 24px; height: 2.5px; border-radius: 2px;
  background: var(--cream);
  transition: transform 0.25s, opacity 0.25s, background 0.2s;
}
.menu-btn:hover { transform: rotate(-6deg) scale(1.06); background: var(--ink-3); }
.menu-btn:hover span { background: var(--amber); }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

.menu-panel {
  position: absolute; top: 68px; right: 0;
  min-width: 230px; padding: 14px 12px;
  background: rgba(17, 26, 44, 0.97);
  border: 1.5px solid var(--hairline);
  /* hand-drawn wobble box, same as poem cards */
  border-radius: 28px 8px 32px 8px / 8px 32px 8px 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: menu-in 0.22s ease;
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-8px) rotate(-1deg); }
  to { opacity: 1; transform: none; }
}
.menu-parent, .menu-link {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; padding: 8px 12px;
  background: none; border: none; cursor: pointer; text-align: left;
  font-family: var(--hand); font-size: 1.35rem; color: var(--cream);
  text-decoration: none; border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.menu-parent:hover, .menu-link:hover { color: var(--ocean); background: rgba(131, 180, 217, 0.07); }
.menu-parent i { font-style: normal; font-size: 1rem; color: var(--amber); transition: transform 0.2s; }
.menu-parent[aria-expanded="true"] i { transform: rotate(90deg); }
.menu-sub {
  display: flex; flex-direction: column;
  margin: 2px 0 6px 16px; padding-left: 12px;
  border-left: 1.5px dashed var(--ocean-deep);
}
.menu-sub a {
  padding: 5px 10px;
  font-family: var(--hand); font-size: 1.2rem;
  color: var(--cream-dim); text-decoration: none; border-radius: 6px;
  transition: color 0.2s, padding-left 0.2s;
}
.menu-sub a:hover { color: var(--ocean); padding-left: 16px; }

/* ---------------- hero ---------------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 120px 5vw 60px;
}
.stars { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.stars i {
  position: absolute; border-radius: 50%;
  background: var(--cream);
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.85; } }

.hero-inner {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 5vw; align-items: center;
  max-width: 1200px; margin: 0 auto; width: 100%;
}
.hero-hey {
  font-family: var(--hand); font-size: 1.5rem; color: var(--ocean);
  transform: rotate(-2deg); display: inline-block;
}
.hero-name {
  font-family: var(--serif); font-weight: 500; font-style: italic;
  font-size: clamp(3rem, 9.5vw, 7.5rem);
  line-height: 0.95; letter-spacing: -0.01em;
  margin-top: 8px;
}
.hero-underline { width: min(320px, 60%); color: var(--amber); margin: 6px 0 18px; }
.hero-tagline {
  font-family: var(--serif); font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  color: var(--cream); letter-spacing: 0.04em;
}
.hero-sub {
  max-width: 46ch; margin-top: 16px; color: var(--cream-dim);
  font-size: 1.05rem;
}
.hero-note {
  margin-top: 22px; font-size: 1.45rem; color: var(--amber);
  transform: rotate(-1.5deg); display: inline-block;
}
.hero-note::before { content: "→ "; color: var(--ocean); }
.hero-cta {
  display: block; width: fit-content; margin-top: 34px;
  font-family: var(--hand); font-size: 1.35rem;
  color: var(--cream); text-decoration: none;
  border-bottom: 1.5px dashed var(--ocean);
  padding-bottom: 2px; transition: color 0.2s, border-color 0.2s;
}
.hero-cta:hover { color: var(--ocean); }

.wave { display: block; width: 100%; color: var(--ocean-deep); margin-top: 40px; }
.wave.flip { transform: scaleY(-1); margin: 0 0 24px; }

/* ---------------- polaroids ---------------- */
.polaroid {
  position: relative;
  background: var(--paper);
  padding: 14px 14px 52px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  width: 100%;
}
.polaroid img { display: block; width: 100%; height: auto; }
.polaroid figcaption {
  position: absolute; left: 0; right: 0; bottom: 10px;
  text-align: center; color: var(--paper-ink);
  font-size: 1.3rem; padding: 0 12px;
}
.tilt-r { transform: rotate(2.6deg); }
.tilt-l { transform: rotate(-2.2deg); }
.polaroid:hover { transform: rotate(0deg) scale(1.02); z-index: 5; }
.polaroid.small { max-width: 300px; margin: 0 auto; }

.tape {
  position: absolute; top: -14px; left: 50%;
  width: 110px; height: 30px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(217, 164, 65, 0.35);
  backdrop-filter: blur(1px);
  border-left: 1px dashed rgba(255, 255, 255, 0.35);
  border-right: 1px dashed rgba(255, 255, 255, 0.35);
  z-index: 2;
}

/* ---------------- marquee ---------------- */
.marquee {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  overflow: hidden; padding: 14px 0;
  margin: 30px 0 0;
}
.marquee-track {
  display: inline-flex; gap: 34px; align-items: center;
  white-space: nowrap;
  animation: marquee 26s linear infinite;
  font-family: var(--serif); font-style: italic;
  font-size: 1.35rem; color: var(--cream-dim);
}
.marquee-track i { color: var(--amber); font-style: normal; font-size: 0.9rem; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------------- sections ---------------- */
.section { padding: 110px 5vw 40px; max-width: 1280px; margin: 0 auto; }
.section-head { margin-bottom: 54px; }
.section-title {
  font-family: var(--serif); font-weight: 500; font-style: italic;
  font-size: clamp(2.8rem, 6vw, 4.6rem); line-height: 1;
}
.section-title::after {
  content: ""; display: block; width: 88px; height: 3px;
  background: var(--crimson); margin-top: 14px;
  border-radius: 2px; transform: rotate(-1deg);
}
.section-note { margin-top: 14px; font-size: 1.35rem; color: var(--ocean); }

/* ---------------- paintings gallery ---------------- */
.gallery {
  display: flex; gap: 44px;
  overflow-x: auto; padding: 30px 8px 40px;
  scroll-snap-type: x proximity;
}
.gallery::-webkit-scrollbar { height: 8px; }
.gallery::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 4px; }
.gallery-empty {
  font-size: 1.4rem; color: var(--cream-dim);
  padding: 30px 8px; transform: rotate(-1deg);
}
.painting {
  flex: 0 0 min(340px, 78vw);
  scroll-snap-align: center;
  position: relative;
}
.painting:nth-child(odd) { transform: rotate(-2deg); margin-top: 14px; }
.painting:nth-child(even) { transform: rotate(1.8deg); }
.painting .polaroid { cursor: zoom-in; }
.painting-meta { margin-top: 16px; text-align: center; }
.painting-title { font-family: var(--serif); font-style: italic; font-size: 1.35rem; }
.painting-medium { color: var(--cream-dim); font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; }

/* ---------------- poems ---------------- */
.poem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 30px;
}
.poem-card {
  position: relative;
  padding: 30px 28px 26px;
  background: var(--ink-2);
  border: 1.5px solid var(--hairline);
  /* hand-drawn wobble box */
  border-radius: 225px 18px 255px 18px / 18px 255px 18px 225px;
  cursor: pointer;
  transition: transform 0.25s, border-color 0.25s, background 0.25s;
}
.poem-card:nth-child(even) { border-radius: 18px 225px 18px 255px / 255px 18px 225px 18px; }
.poem-card:hover {
  transform: translateY(-5px) rotate(-0.6deg);
  border-color: var(--ocean);
  background: var(--ink-3);
}
.poem-num {
  position: absolute; top: 6px; right: 18px;
  font-family: var(--serif); font-style: italic;
  font-size: 3.4rem; color: rgba(131, 180, 217, 0.14);
}
.poem-title { font-family: var(--serif); font-style: italic; font-size: 1.8rem; margin-bottom: 10px; }
.poem-excerpt {
  color: var(--cream-dim); font-size: 0.98rem; font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.poem-open { margin-top: 14px; font-family: var(--hand); font-size: 1.2rem; color: var(--amber); }

/* ---------------- essays ---------------- */
.essay-list { list-style: none; counter-reset: essay; }
.essay-item {
  counter-increment: essay;
  display: grid; grid-template-columns: 90px 1fr auto;
  gap: 22px; align-items: baseline;
  padding: 26px 10px;
  border-top: 1px solid var(--hairline);
  cursor: pointer; position: relative;
  transition: background 0.2s, padding-left 0.2s;
}
.essay-item:last-child { border-bottom: 1px solid var(--hairline); }
.essay-item:hover { background: rgba(131, 180, 217, 0.05); padding-left: 22px; }
.essay-item::before {
  content: counter(essay, decimal-leading-zero);
  font-family: var(--serif); font-style: italic;
  font-size: 2rem; color: var(--ocean-deep);
}
.essay-title { font-family: var(--serif); font-size: 1.55rem; font-weight: 500; }
.essay-excerpt { color: var(--cream-dim); font-size: 0.95rem; margin-top: 4px; font-style: italic; }
.essay-arrow { font-family: var(--hand); font-size: 1.5rem; color: var(--amber); }

/* ---------------- about ---------------- */
.about {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 6vw; align-items: start;
}
.about-body { margin-top: 26px; color: var(--cream-dim); white-space: pre-line; }
.about-body::first-letter {
  font-family: var(--serif); font-style: italic;
  font-size: 3.2em; float: left; line-height: 0.85;
  padding-right: 10px; color: var(--cream);
}
.facts { list-style: none; margin-top: 36px; display: flex; flex-wrap: wrap; gap: 10px; }
.facts li {
  font-family: var(--hand); font-size: 1.2rem;
  border: 1.5px dashed var(--ocean-deep); color: var(--cream);
  padding: 3px 14px; border-radius: 999px;
}
.facts li:nth-child(odd) { transform: rotate(-1.2deg); }
.facts li:nth-child(even) { transform: rotate(1deg); }

/* ---------------- footer ---------------- */
.footer { padding: 60px 5vw 90px; text-align: center; }
.footer-colophon { color: var(--cream-dim); font-size: 0.95rem; max-width: 60ch; margin: 0 auto; }
.footer-sign { margin-top: 18px; font-size: 1.6rem; color: var(--amber); transform: rotate(-2deg); display: inline-block; }

/* ---------------- reader overlay ---------------- */
.reader, .lightbox, .login { position: fixed; inset: 0; z-index: 80; }
.reader-backdrop, .lightbox-backdrop, .login-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(3px);
}
.reader-page {
  position: relative; z-index: 1;
  max-width: 760px; max-height: 88vh; overflow-y: auto;
  margin: 6vh auto; padding: 64px 64px 48px;
  background:
    radial-gradient(900px 300px at 50% -5%, rgba(61, 106, 146, 0.08), transparent),
    var(--paper);
  color: var(--paper-ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  border-radius: 3px;
}
.reader-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: var(--crimson);
}
.reader-kind { color: var(--crimson); font-size: 1.35rem; }
.reader-title {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1;
  margin: 8px 0 26px;
}
.reader-body { white-space: pre-line; font-size: 1.06rem; line-height: 1.85; }
.reader-body.is-poem { font-style: italic; font-size: 1.12rem; }
.reader-end { text-align: center; margin-top: 36px; color: var(--crimson); font-size: 1.3rem; }

/* ---------------- lightbox ---------------- */
.lightbox-figure {
  position: relative; z-index: 1;
  max-width: min(92vw, 1000px); max-height: 92vh;
  margin: 4vh auto; text-align: center;
}
.lightbox-figure img {
  max-width: 100%; max-height: 84vh;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  border: 12px solid var(--paper);
}
.lightbox-figure figcaption { margin-top: 14px; font-size: 1.5rem; color: var(--cream); }

/* ---------------- edit mode: fab / login / toolbar ---------------- */
.fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 70;
  width: 54px; height: 54px; border-radius: 50%;
  border: 1.5px dashed var(--ocean-deep);
  background: var(--ink-2); color: var(--cream);
  font-size: 1.4rem; cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, color 0.2s;
}
.fab:hover { transform: rotate(-8deg) scale(1.06); border-color: var(--amber); color: var(--amber); }

.login-card {
  position: relative; z-index: 1;
  width: min(92vw, 380px); margin: 22vh auto 0;
  background: var(--paper); color: var(--paper-ink);
  padding: 36px 34px 30px;
  border-radius: 4px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column; gap: 16px;
}
.login-title { font-size: 1.9rem; color: var(--crimson); text-align: center; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; }
.login-card input {
  font-family: var(--read); font-size: 1.05rem;
  padding: 9px 12px; border: 1.5px solid #b9b0a0; border-radius: 3px;
  background: #fbf8f1; color: var(--paper-ink);
}
.login-card input:focus { outline: 2px solid var(--ocean-deep); }
.login-card button {
  margin-top: 6px; padding: 11px;
  background: var(--ink); color: var(--cream);
  border: none; border-radius: 3px; cursor: pointer;
  font-family: var(--hand); font-size: 1.35rem;
}
.login-card button:hover { background: var(--ocean-deep); }
.login-error { color: var(--crimson); font-family: var(--hand); font-size: 1.2rem; text-align: center; }
.login-card.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.toolbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 75;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center;
  background: rgba(17, 26, 44, 0.95);
  border: 1.5px dashed var(--amber);
  border-radius: 999px;
  padding: 10px 22px;
  max-width: 94vw;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.toolbar-status { font-family: var(--hand); font-size: 1.25rem; color: var(--amber); display: flex; align-items: center; gap: 8px; }
.toolbar-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--crimson); animation: twinkle 1.6s infinite; }
.toolbar-status em { font-style: normal; color: var(--cream-dim); font-size: 1.05rem; }
.toolbar-actions { display: flex; gap: 8px; }
.toolbar button {
  font-family: var(--hand); font-size: 1.15rem;
  background: none; border: 1.5px solid var(--hairline); border-radius: 999px;
  color: var(--cream); padding: 3px 14px; cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.toolbar button:hover { border-color: var(--ocean); color: var(--ocean); }
.toolbar button.primary { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.toolbar button.primary:hover { background: var(--cream); border-color: var(--cream); color: var(--ink); }

/* editable affordances */
body.editing [data-bind], body.editing [data-field] {
  outline: 1.5px dashed rgba(217, 164, 65, 0.55);
  outline-offset: 4px;
  border-radius: 2px;
  cursor: text;
  transition: outline-color 0.2s, background 0.2s;
}
body.editing [data-bind]:hover, body.editing [data-field]:hover,
body.editing [data-bind]:focus, body.editing [data-field]:focus {
  outline-color: var(--amber);
  background: rgba(217, 164, 65, 0.08);
}
.del-btn {
  position: absolute; top: -12px; right: -12px; z-index: 6;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--crimson); color: var(--cream);
  border: none; cursor: pointer; font-size: 0.95rem;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
body.editing .del-btn { display: flex; }
body.editing .painting .polaroid { cursor: pointer; }
.img-hint {
  display: none;
  position: absolute; inset: 14px 14px 52px; z-index: 3;
  align-items: center; justify-content: center;
  background: rgba(12, 18, 32, 0.55); color: var(--cream);
  font-family: var(--hand); font-size: 1.4rem;
  opacity: 0; transition: opacity 0.2s;
}
body.editing .img-hint { display: flex; }
body.editing .painting .polaroid:hover .img-hint { opacity: 1; }
body.editing .hero-cta, body.editing .menu-panel { pointer-events: none; opacity: 0.55; }

/* ---------------- reveal on scroll ---------------- */
.img-placeholder {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4 / 5; background: #ddd5c4; color: #7a7263;
  font-family: var(--hand); font-size: 1.4rem;
  border: 2px dashed #b9b0a0;
}
body.editing .facts { min-height: 40px; }

/* ---------------- reveal on scroll ---------------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------------- responsive ---------------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; gap: 44px; }
  .hero-art { max-width: 340px; margin: 0 auto; }
  .about { grid-template-columns: 1fr; }
  .essay-item { grid-template-columns: 54px 1fr; }
  .essay-arrow { display: none; }
  .reader-page { padding: 48px 26px 36px; margin: 4vh 12px; }
  .toolbar { gap: 10px; padding: 8px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .stars i, .marquee-track { animation: none; }
  html { scroll-behavior: auto; }
}
