/* Iman Hamid — warm editorial with purple & blue accents */
:root {
  --bg: #f7f5fb;
  --surface: #ffffff;
  --ink: #2a2440;
  --ink-soft: #524a6e;
  --muted: #8b85a3;

  /* Accent palette: purple primary, blue secondary, gold highlight */
  --accent: #8a6fb0;            /* lavender purple */
  --accent-deep: #5a3f8a;       /* plum */
  --accent-soft: #c7b3e0;       /* lilac */
  --blue: #5a7fb8;              /* dusk blue */
  --blue-deep: #3a5890;         /* ink blue */
  --blue-soft: #b5c7e0;         /* sky tint */
  --gold: #c4a47c;              /* antique gold */
  --rose: #c88fa8;              /* dusty rose */

  --rule: #e0d8ec;
  --shadow: 0 1px 2px rgba(90, 63, 138, 0.04), 0 8px 24px rgba(90, 63, 138, 0.10);
  --serif: "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-deep); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s; }
a:hover { border-bottom-color: var(--accent); }

.container { max-width: 780px; margin: 0 auto; padding: 0 1.25rem; }
.container-wide { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ───────────────────────────────────────────── */
header.site-header {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 3rem;
  background: var(--bg);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
.header-top.has-book { justify-content: space-between; flex-wrap: wrap; }
.header-brand { flex: 0 1 auto; text-align: center; }
header.site-header .brand {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  display: block;
  text-align: center;
  border-bottom: none;
}
header.site-header .brand:hover { border-bottom: none; color: var(--accent-deep); }
header.site-header .tagline {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 1rem;
  margin: 0.25rem 0 0;
}
@media (max-width: 720px) {
  .header-top { flex-direction: column; gap: 1rem; }
  .header-top.has-book { justify-content: center; }
}
nav.site-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.75rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
nav.site-nav a {
  color: var(--ink-soft);
  border-bottom: none;
  padding-bottom: 3px;
}
nav.site-nav a:hover, nav.site-nav a.active {
  color: var(--accent-deep);
  border-bottom: 1px solid var(--accent);
}

/* ── Typography ───────────────────────────────────────── */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; color: var(--ink); line-height: 1.25; }
h1 { font-size: 2.6rem; margin: 0 0 .5rem; }
h2 { font-size: 1.9rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.35rem; margin: 1.5rem 0 .5rem; }
p { margin: 0 0 1.1rem; }
.lead { font-size: 1.1rem; color: var(--ink-soft); font-style: italic; }

.meta { font-family: var(--sans); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
hr.ornament { border: none; text-align: center; margin: 2.5rem 0; color: var(--gold); }
hr.ornament::before { content: "❦"; font-size: 1.2rem; }

/* ── Home ─────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}
.hero h1 { font-size: 3rem; margin: 0; font-weight: 400; }
.hero .sub { color: var(--ink-soft); font-style: italic; font-size: 1.15rem; margin-top: .5rem; }

.quote-feature {
  margin: 3rem auto;
  padding: 2rem 2rem;
  max-width: 640px;
  text-align: center;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.quote-feature blockquote {
  font-size: 1.35rem;
  font-style: italic;
  color: var(--ink);
  margin: 0;
  line-height: 1.5;
}
.quote-feature cite {
  display: block;
  margin-top: 1rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-style: normal;
}

/* ── Lists of posts/poems ─────────────────────────────── */
.entry-list { list-style: none; padding: 0; margin: 2rem 0; }
.entry-list li {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.entry-list li:last-child { border-bottom: none; }
.entry-list h3 { margin: 0 0 .25rem; font-size: 1.5rem; }
.entry-list h3 a { color: var(--ink); border-bottom: none; }
.entry-list h3 a:hover { color: var(--accent-deep); }
.entry-excerpt { color: var(--ink-soft); margin-top: .5rem; }

/* ── Open book in header (on /latest) ─────────────────── */
.obook {
  display: flex;
  position: relative;
  width: 300px;
  height: 190px;
  perspective: 2200px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  filter: drop-shadow(0 12px 24px rgba(60, 40, 90, 0.18));
}
.obook-side {
  width: 146px;
  height: 100%;
  padding: 1rem 0.9rem;
  position: relative;
  font-family: var(--serif);
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 20px, rgba(90, 63, 138, 0.09) 20px, rgba(90, 63, 138, 0.09) 21px),
    linear-gradient(135deg, #fefbff 0%, #f0e8fa 100%);
  border: 1px solid rgba(200, 180, 220, 0.6);
  overflow: hidden;
}
.obook-left {
  border-radius: 4px 1px 1px 4px;
  border-right: none;
  box-shadow: inset -14px 0 22px rgba(60, 40, 90, 0.18);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.obook-right {
  border-radius: 1px 4px 4px 1px;
  border-left: none;
  box-shadow: inset 14px 0 22px rgba(60, 40, 90, 0.18);
  padding: 0;
  transform-style: preserve-3d;
  position: relative;
}
.obook-spine {
  width: 4px;
  height: 100%;
  background:
    linear-gradient(to right, rgba(60, 40, 90, 0.5), rgba(60, 40, 90, 0.2) 40%, rgba(60, 40, 90, 0.5));
  box-shadow: 0 0 10px rgba(60, 40, 90, 0.28);
  z-index: 3;
  position: relative;
}
.obook-spine::before, .obook-spine::after {
  content: ""; position: absolute; left: -1px; right: -1px;
  height: 2px; background: var(--gold); opacity: 0.7;
}
.obook-spine::before { top: 14px; }
.obook-spine::after { bottom: 14px; }

.obook-page {
  position: absolute;
  inset: 0;
  padding: 1rem 0.9rem;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 20px, rgba(90, 63, 138, 0.09) 20px, rgba(90, 63, 138, 0.09) 21px),
    linear-gradient(135deg, #fefbff 0%, #f0e8fa 100%);
  border: 1px solid rgba(200, 180, 220, 0.6);
  border-left: none;
  border-radius: 1px 4px 4px 1px;
  box-shadow: inset 14px 0 22px rgba(60, 40, 90, 0.18);
  transform-origin: left center;
  backface-visibility: visible;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.obook-page.flipping {
  animation: obookTurn 0.95s cubic-bezier(.55, 0, .35, 1) forwards;
  box-shadow:
    inset 14px 0 22px rgba(60, 40, 90, 0.18),
    -8px 4px 16px rgba(60, 40, 90, 0.25);
}
@keyframes obookTurn {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(-90deg); box-shadow: inset 14px 0 22px rgba(60,40,90,0.18), 0 8px 24px rgba(60,40,90,0.4); }
  100% { transform: rotateY(-180deg); }
}

.obook-ornament { font-size: 1.6rem; color: var(--gold); margin-bottom: 0.4rem; }
.obook-label { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); letter-spacing: 0.03em; line-height: 1.1; }
.obook-sub { font-family: var(--sans); font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted); margin-top: 0.3rem; }

.obook-quote {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.4;
  padding: 0 0.15rem;
}
.obook-cite { display: block; font-family: var(--sans); font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted); font-style: normal; }
.obook-hint { position: absolute; bottom: 8px; right: 10px; font-family: var(--sans); font-size: 0.52rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); opacity: 0.7; }
.obook:hover .obook-hint, .obook:focus .obook-hint { opacity: 1; }

.obook-corner { position: absolute; width: 10px; height: 10px; border: 1px solid rgba(196, 164, 124, 0.55); pointer-events: none; }
.obook-corner.tl { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.obook-corner.tr { top: 6px; right: 6px; border-left: none; border-bottom: none; }
.obook-corner.bl { bottom: 6px; left: 6px; border-right: none; border-top: none; }
.obook-corner.br { bottom: 6px; right: 6px; border-left: none; border-top: none; }

@media (max-width: 560px) {
  .obook { width: 240px; height: 155px; }
  .obook-side { width: 118px; padding: 0.7rem 0.6rem; }
  .obook-page { padding: 0.7rem 0.6rem; }
  .obook-label { font-size: 1rem; }
  .obook-quote { font-size: 0.75rem; }
}

/* ── Flipbook widget (on /latest) ─────────────────────── */
.flipbook-row {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
  margin: 1rem 0 2.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #f3edfa 100%);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.flipbook {
  width: 100px;
  height: 140px;
  perspective: 900px;
  cursor: pointer;
  flex-shrink: 0;
  outline: none;
}
.flipbook:focus .fb-inner,
.flipbook:hover .fb-inner { transform: rotateY(-18deg) rotateX(4deg); }
.fb-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(.2,.8,.3,1);
  transform: rotateY(-22deg) rotateX(6deg);
}
.flipbook.flipping .fb-inner {
  animation: fbSpin 0.85s cubic-bezier(.65, 0, .35, 1);
}
@keyframes fbSpin {
  0%   { transform: rotateY(-22deg) rotateX(6deg); }
  50%  { transform: rotateY(-202deg) rotateX(6deg) translateZ(10px); }
  100% { transform: rotateY(-382deg) rotateX(6deg); }
}

.fb-cover {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-deep) 0%, var(--blue-deep) 100%);
  border-radius: 2px 4px 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.12),
    inset 6px 0 0 rgba(0,0,0,0.22),
    inset 7px 0 0 rgba(196,164,124,0.55),
    0 10px 24px rgba(60, 40, 90, 0.35);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.fb-band {
  position: absolute;
  left: 14px; right: 10px;
  height: 2px;
  background: rgba(196,164,124,0.6);
}
.fb-band-top { top: 14px; }
.fb-band-bot { bottom: 14px; }
.fb-emblem {
  color: var(--gold);
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
}
.fb-title {
  font-family: var(--serif);
  font-size: 0.88rem;
  color: #f0e6d6;
  text-align: center;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.fb-sub {
  font-family: var(--sans);
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-top: 0.4rem;
  text-align: center;
}
.fb-spine {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 8px;
  background: linear-gradient(to right, rgba(0,0,0,0.4), rgba(0,0,0,0) 70%);
  transform: rotateY(-90deg) translateZ(0);
  transform-origin: left center;
  backface-visibility: hidden;
}
.fb-edge {
  position: absolute;
  top: 3px; bottom: 3px; right: 0;
  width: 5px;
  background: repeating-linear-gradient(to bottom, #f2e7ce 0, #f2e7ce 1px, #dcc89a 1px, #dcc89a 2px);
  transform: translateZ(2px);
  backface-visibility: hidden;
}

.flipquote {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  border-left: 1px solid var(--rule);
  position: relative;
}
.flipquote.swapping { opacity: 0.15; transform: translateX(8px); }
.flipquote { transition: opacity 0.22s, transform 0.22s; }
.fq-label {
  font-family: var(--sans);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.flipquote blockquote {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink);
  line-height: 1.45;
}
.flipquote cite {
  display: block;
  margin-top: 0.7rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-style: normal;
}
.fq-hint {
  position: absolute;
  bottom: 0;
  right: 0;
  font-family: var(--sans);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-soft);
  opacity: 0.7;
}
@media (max-width: 560px) {
  .flipbook-row { flex-direction: column; align-items: center; text-align: center; padding: 1.25rem; }
  .flipquote { border-left: none; border-top: 1px solid var(--rule); padding: 1rem 0 0; text-align: center; }
  .fq-hint { position: static; margin-top: 0.75rem; }
}

/* ── Latest feed ──────────────────────────────────────── */
.feed-list .feed-item { position: relative; padding-left: 0; }
.feed-kind {
  font-family: var(--sans);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 0.35rem;
}
.feed-writing .feed-kind { color: var(--accent-deep); }
.feed-poem .feed-kind { color: var(--blue-deep); }
.feed-image .feed-kind { color: var(--rose); }
.feed-book .feed-kind { color: var(--accent); }
.feed-image-link { display: block; margin: 0.5rem 0 0.75rem; border-bottom: none; }
.feed-image-link img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 3px;
  box-shadow: var(--shadow);
}

/* ── Single entry ─────────────────────────────────────── */
article.entry { margin: 2rem 0 4rem; }
article.entry header { text-align: center; margin-bottom: 2rem; }
article.entry h1 { font-size: 2.4rem; }
article.entry .meta { margin-top: .75rem; }
article.entry .body { font-size: 1.05rem; color: var(--ink); }
article.entry .body p { margin-bottom: 1.3rem; }

article.poem .body {
  white-space: pre-wrap;
  font-style: italic;
  text-align: center;
  font-size: 1.15rem;
  line-height: 1.8;
}

/* ── Gallery ──────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}
.gallery-grid figure {
  margin: 0;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.gallery-grid img { width: 100%; height: 220px; object-fit: cover; display: block; }
.gallery-grid figcaption {
  padding: .75rem 1rem;
  font-size: .9rem;
  color: var(--ink-soft);
  font-style: italic;
}

/* ── Quotes / Books lists ─────────────────────────────── */
.quotes-wall { margin: 2rem 0; }
.quotes-wall blockquote {
  margin: 0 0 2rem;
  padding: 1.25rem 0 1.25rem 1.5rem;
  border-left: 2px solid var(--gold);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink);
}
.quotes-wall blockquote cite {
  display: block;
  margin-top: .5rem;
  font-family: var(--sans);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-style: normal;
}

.book-list { list-style: none; padding: 0; margin: 2rem 0; }
.book-list li {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
}
.book-list .book-title { font-size: 1.25rem; color: var(--ink); }
.book-list .book-author { color: var(--muted); font-style: italic; }
.book-list .book-note { margin-top: .5rem; color: var(--ink-soft); }

/* ── Forms ────────────────────────────────────────────── */
form.stack { display: flex; flex-direction: column; gap: 1rem; margin: 2rem 0; }
label { font-family: var(--sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); display: block; margin-bottom: .35rem; }
input[type=text], input[type=email], input[type=password], input[type=file], textarea {
  width: 100%;
  padding: .7rem .85rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--surface);
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
}
textarea { min-height: 180px; resize: vertical; font-family: var(--serif); line-height: 1.6; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(122,139,111,0.15); }

button, .btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: .7rem 1.4rem;
  background: var(--accent-deep);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  border-bottom: none;
  transition: background .15s;
}
button:hover, .btn:hover { background: var(--accent); border-bottom: none; color: #fff; }
.btn-ghost { background: transparent; color: var(--accent-deep); border: 1px solid var(--accent); }
.btn-ghost:hover { background: var(--accent); color: #fff; }
.btn-danger { background: #a65a4a; }
.btn-danger:hover { background: #c77060; }

/* ── Flash messages ───────────────────────────────────── */
.flash { padding: .85rem 1rem; border-radius: 3px; margin: 1rem 0; font-size: .95rem; }
.flash.success { background: #e8f0e3; color: #3d5432; border: 1px solid #c6d6b9; }
.flash.error { background: #f5e4e0; color: #6e3a2e; border: 1px solid #e0beb4; }

/* ── Footer ───────────────────────────────────────────── */
footer.site-footer {
  margin-top: 5rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  font-family: var(--sans);
}
footer.site-footer a { color: var(--muted); }

/* ── Admin ────────────────────────────────────────────── */
.admin-bar {
  background: var(--ink);
  color: #f5ebd9;
  padding: .6rem 0;
  margin-bottom: 2rem;
  font-family: var(--sans);
  font-size: .8rem;
}
.admin-bar .container-wide { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.admin-bar a { color: #f5ebd9; border-bottom: none; }
.admin-bar a:hover { color: var(--gold); }
.admin-bar .spacer { flex: 1; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.stat-card {
  background: var(--surface);
  padding: 1.25rem;
  border-radius: 4px;
  border: 1px solid var(--rule);
  text-align: center;
}
.stat-card .num { font-size: 2rem; color: var(--accent-deep); display: block; }
.stat-card .label { font-family: var(--sans); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

.admin-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; background: var(--surface); }
.admin-table th, .admin-table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--rule); font-size: .95rem; }
.admin-table th { font-family: var(--sans); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; }
.admin-table .actions { text-align: right; white-space: nowrap; }
.admin-table .actions a, .admin-table .actions button { margin-left: .5rem; font-size: .75rem; padding: .35rem .7rem; }
.inline-form { display: inline; }

.admin-actions { display: flex; gap: .75rem; align-items: center; margin: 1rem 0 2rem; }
.admin-actions .spacer { flex: 1; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin: 1rem 0 1.5rem; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  body { font-size: 17px; }
  header.site-header .brand { font-size: 1.8rem; }
  h1 { font-size: 2rem; }
  .hero h1 { font-size: 2.2rem; }
  nav.site-nav { gap: 1rem; font-size: .72rem; }
  .quote-feature blockquote { font-size: 1.15rem; }
}
