/* ============================================================
   MaShowMagic — Photos gallery + post composer
   photos.ana.sh-style: masonry feed, post composer, detail lightbox.
   Posts persist in localStorage. Builds on colors_and_type tokens.
   ============================================================ */

html { background: var(--bg); }
body { min-height: 100vh; }

.g-wrap { max-width: 1180px; margin: 0 auto; padding: 26px 28px 100px; }

/* ---------------- Header ---------------- */
.g-head { display: flex; align-items: center; gap: 16px; padding: 4px 0 0; }
.g-back {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
  letter-spacing: -0.04em; color: var(--fg); text-decoration: none;
}
.g-back .mk {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 15px; overflow: hidden;
  background: linear-gradient(140deg, var(--blurple-400), var(--blurple-600));
  box-shadow: 0 4px 12px rgba(88,101,242,0.35);
  transition: transform var(--dur) var(--ease-spring);
}
.g-back .mk img { width: 100%; height: 100%; object-fit: cover; }
.g-back:hover .mk { transform: translateX(-3px); }
.g-back em { color: var(--accent); font-style: normal; }

.g-nav { display: flex; gap: 2px; margin: 0 auto; }
.g-nav a {
  font-family: var(--font-sans); font-weight: 600; font-size: 14px;
  color: var(--fg-muted); text-decoration: none; padding: 8px 16px; border-radius: var(--radius-pill);
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.g-nav a:hover { color: var(--fg); background: var(--surface-2); }
.g-nav a.active { color: var(--fg); background: var(--surface); box-shadow: var(--shadow-card); }

.toggle {
  width: 60px; height: 32px; border-radius: 999px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border);
  position: relative; cursor: pointer;
}
.toggle .thumb {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 999px;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-card); transition: transform var(--dur) var(--ease-spring);
}
.toggle .thumb svg { width: 13px; height: 13px; }
body[data-theme="dark"] .toggle .thumb { transform: translateX(28px); }

/* ---------------- Intro + toolbar ---------------- */
.g-intro { margin: 40px 0 30px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.g-intro h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.6rem, 6vw, 4.2rem); letter-spacing: -0.045em; line-height: 0.98;
  color: var(--fg); margin: 0;
}
.g-intro p { margin: 16px 0 0; font-size: 16px; color: var(--fg-muted); max-width: 46ch; line-height: 1.6; }
.g-intro .count { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-subtle); margin-top: 18px; display: block; }

.btn {
  font-family: var(--font-sans); font-weight: 600; font-size: 14px;
  border: 0; cursor: pointer; border-radius: var(--radius-pill);
  padding: 11px 20px; display: inline-flex; align-items: center; gap: 8px;
  transition: background var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out), border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--status-dnd); border: 1px solid var(--border-strong); }
.btn-danger:hover { background: color-mix(in srgb, var(--status-dnd) 12%, transparent); border-color: var(--status-dnd); }

/* view toggle (Full Frame / Grid) */
.view-toggle { display: inline-flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px; }
.view-toggle button { width: 36px; height: 30px; border: 0; background: transparent; border-radius: 999px; cursor: pointer; display: grid; place-items: center; color: var(--fg-muted); transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out); }
.view-toggle button.active { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-card); }
.view-toggle button svg { width: 16px; height: 16px; }

/* sticky header so the toggle stays + meta clears it */
.g-head { position: sticky; top: 0; z-index: 30; background: var(--bg); padding: 14px 0 12px; }

/* ============================================================
   Full Frame feed — big image left, sticky meta hugging its right edge
   ============================================================ */
.frame-feed { display: flex; flex-direction: column; gap: 6px; }
.ff-item { display: grid; grid-template-columns: 56% 1fr; align-items: start; }
.ff-img { cursor: zoom-in; overflow: hidden; }
.ff-img img { width: 100%; height: auto; display: block; transition: opacity var(--dur) var(--ease-out); }
.ff-img:hover img { opacity: .94; }
.ff-meta {
  position: sticky; top: 84px; align-self: start;
  padding: 2px 0 0 30px; display: flex; flex-direction: column; gap: 11px;
}
.ff-meta h3 { font-family: var(--font-mono); font-weight: 700; font-size: 13px; letter-spacing: .09em; text-transform: uppercase; color: var(--fg); margin: 0; }
.ff-row { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.ff-row svg { width: 14px; height: 14px; flex: none; color: var(--fg-subtle); }
.ff-row.tag { cursor: pointer; transition: color var(--dur) var(--ease-out); width: fit-content; }
.ff-row.tag:hover { color: var(--accent); }
.ff-exif { font-family: var(--font-mono); font-size: 12px; line-height: 1.75; color: var(--fg-muted); margin-top: 2px; }
.ff-date { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; color: var(--fg-subtle); text-transform: uppercase; }
@media (max-width: 760px) {
  .ff-item { grid-template-columns: 1fr; }
  .ff-meta { position: static; padding: 14px 0 6px; }
}

/* EXIF block shared with lightbox */
.lb-exif { font-family: var(--font-mono); font-size: 12px; line-height: 1.75; color: var(--fg-muted); }

/* ---------------- Masonry feed ---------------- */
.masonry { column-count: 3; column-gap: 16px; }
@media (max-width: 860px) { .masonry { column-count: 2; } }
@media (max-width: 520px) { .masonry { column-count: 1; } }

.ph {
  break-inside: avoid; margin: 0 0 16px; position: relative;
  border-radius: var(--radius-card); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card);
  cursor: zoom-in;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
  animation: ph-rise var(--dur-slow) var(--ease-out) backwards;
}
@keyframes ph-rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.ph:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.ph img { display: block; width: 100%; height: auto; }

.ph figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: 34px 16px 14px;
  background: linear-gradient(to top, rgba(0,0,0,.66), transparent);
  opacity: 0; transition: opacity var(--dur) var(--ease-out); pointer-events: none;
}
.ph:hover figcaption { opacity: 1; }
.ph figcaption b { color: #fff; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.ph figcaption span { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.78); }

/* ---------------- Empty state ---------------- */
.g-empty {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-card);
  padding: 64px 24px; text-align: center; color: var(--fg-subtle);
}
.g-empty svg { width: 40px; height: 40px; opacity: .4; }
.g-empty b { display: block; font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--fg-muted); margin: 14px 0 6px; letter-spacing: -0.02em; }
.g-empty p { margin: 0; font-size: 14px; }

/* ============================================================
   Composer modal
   ============================================================ */
.modal {
  position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center; padding: 5vh 20px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(6px);
}
.modal.open { display: flex; animation: lb-in .22s var(--ease-out); }
.composer {
  width: 100%; max-width: 760px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-pop);
  padding: 26px; animation: pop-in .28s var(--ease-spring);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
.composer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.composer-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; color: var(--fg); margin: 0; }
.composer-grid { display: grid; grid-template-columns: 280px 1fr; gap: 22px; }
@media (max-width: 640px) { .composer-grid { grid-template-columns: 1fr; } }

/* drop zone */
.drop {
  position: relative; border-radius: var(--radius-inner); overflow: hidden;
  border: 1.5px dashed var(--border-strong); background: var(--surface-2);
  aspect-ratio: 4/5; display: grid; place-items: center; cursor: pointer; text-align: center;
  color: var(--fg-subtle); transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 34px; height: 34px; opacity: .5; }
.drop .dz-txt { font-size: 13px; margin-top: 10px; padding: 0 16px; }
.drop .dz-txt u { text-underline-offset: 2px; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop .dz-empty { display: flex; flex-direction: column; align-items: center; }
.drop.filled .dz-empty { display: none; }
.drop .dz-change {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); z-index: 2;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: rgba(0,0,0,.55); padding: 5px 11px; border-radius: 999px;
  opacity: 0; transition: opacity var(--dur) var(--ease-out); backdrop-filter: blur(4px);
}
.drop.filled:hover .dz-change { opacity: 1; }

/* form fields */
.fields { display: flex; flex-direction: column; gap: 15px; }
.field label { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-subtle); margin-bottom: 7px; }
.field input {
  width: 100%; box-sizing: border-box; font-family: var(--font-sans); font-size: 15px; color: var(--fg);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-inner);
  padding: 11px 13px; transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.field input::placeholder { color: var(--fg-subtle); }
.field input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .03em; cursor: pointer;
  color: var(--fg-muted); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 5px 11px; transition: all var(--dur) var(--ease-out);
}
.chip:hover { border-color: var(--border-strong); color: var(--fg); }
.composer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.composer-foot .hint { margin-right: auto; font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; color: var(--fg-subtle); }

/* ============================================================
   Lightbox — image + detail panel (ana.sh-style)
   ============================================================ */
.lb {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(0,0,0,.9); backdrop-filter: blur(10px);
}
.lb.open { display: grid; grid-template-columns: 1fr 340px; animation: lb-in .25s var(--ease-out); }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lb-stage { position: relative; display: grid; place-items: center; padding: 4vh 3vw; min-width: 0; }
.lb-stage img { max-width: 100%; max-height: 92vh; object-fit: contain; box-shadow: 0 24px 80px rgba(0,0,0,.5); }

.lb-panel {
  background: var(--surface); border-left: 1px solid var(--border);
  padding: 40px 30px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
}
.lb-panel h3 { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; color: var(--fg); margin: 0; text-transform: uppercase; }
.lb-meta { display: flex; flex-direction: column; gap: 10px; }
.lb-row { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.lb-row svg { width: 15px; height: 15px; flex: none; color: var(--fg-subtle); }
.lb-date { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; color: var(--fg-subtle); text-transform: uppercase; margin-top: 2px; }
.lb-actions { margin-top: auto; display: flex; gap: 8px; padding-top: 20px; }
.lb-actions .btn { font-size: 12px; padding: 9px 14px; }

.lb-x { position: fixed; top: 18px; right: 18px; z-index: 102; width: 44px; height: 44px; border-radius: 999px; border: 0; cursor: pointer; background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center; }
.lb-x:hover { background: rgba(255,255,255,.26); }
.lb-x svg { width: 20px; height: 20px; }
.lb-nav { position: fixed; top: 50%; transform: translateY(-50%); z-index: 101; width: 48px; height: 48px; border-radius: 999px; border: 0; cursor: pointer; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; }
.lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-nav svg { width: 22px; height: 22px; }
.lb-prev { left: 2vw; } .lb-next { left: calc(100% - 340px - 2vw - 48px); }

@media (max-width: 760px) {
  .lb.open { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .lb-panel { border-left: 0; border-top: 1px solid var(--border); padding: 22px; max-height: 40vh; }
  .lb-stage { padding: 5vh 4vw 2vh; }
  .lb-next { left: auto; right: 2vw; }
}
