/* ===== Sally's Ink — moody literary theme ===== */

:root {
  --ink: #0f0e0d;
  --ink-soft: #171513;
  --panel: #1c1a18;
  --panel-border: #2e2b27;
  --paper: #f4ede3;
  --paper-dim: #cfc6b8;
  --paper-faint: #948b7d;
  --accent-blue: #2c3e50;
  --accent-blue-light: #3d5a75;
  --accent-red: #7a1f1f;
  --accent-red-light: #a53434;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 3px;
  --max-width: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  position: relative;
}

.ink-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(61, 90, 117, 0.12), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 10%, rgba(122, 31, 31, 0.08), transparent 60%);
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--paper);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

p { color: var(--paper-dim); }

/* ===== Header ===== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 14, 13, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--panel-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border: 1px solid var(--paper-faint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  transition: border-color 0.25s, color 0.25s;
}

.brand:hover .brand__mark {
  border-color: var(--accent-red-light);
  color: var(--accent-red-light);
}

.brand__name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.92rem;
}

.site-nav a {
  position: relative;
  color: var(--paper-dim);
  padding: 4px 0;
  transition: color 0.2s;
}

.site-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--accent-red-light);
  transition: width 0.25s ease;
}

.site-nav a:hover {
  color: var(--paper);
}

.site-nav a:hover::after {
  width: 100%;
}

.site-nav .nav-auth,
.site-nav .nav-admin {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 7px 16px;
}

.site-nav .nav-auth:hover,
.site-nav .nav-admin:hover {
  border-color: var(--accent-red-light);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  width: 22px;
  height: 1.5px;
  background: var(--paper);
}

/* ===== Hero ===== */

.hero {
  padding: 110px 0 90px;
  position: relative;
  z-index: 1;
}

.hero__eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.75rem;
  color: var(--accent-red-light);
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.05;
  max-width: 900px;
}

.hero h1 em {
  font-style: italic;
  color: var(--paper-dim);
}

.hero__lede {
  max-width: 560px;
  font-size: 1.1rem;
  margin-top: 24px;
}

.hero__actions {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid var(--panel-border);
  transition: all 0.2s ease;
  cursor: pointer;
  background: transparent;
  color: var(--paper);
}

.btn:hover {
  border-color: var(--accent-red-light);
  color: var(--accent-red-light);
}

.btn-solid {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

.btn-solid:hover {
  background: var(--accent-red-light);
  border-color: var(--accent-red-light);
  color: var(--paper);
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* ===== Section headings ===== */

.section {
  padding: 70px 0;
  position: relative;
  z-index: 1;
}

.section--tight { padding: 40px 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-head h2 {
  font-size: 1.9rem;
}

.section-head .see-all {
  font-size: 0.88rem;
  color: var(--paper-faint);
  border-bottom: 1px solid transparent;
}

.section-head .see-all:hover {
  color: var(--accent-red-light);
  border-color: var(--accent-red-light);
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: var(--accent-red-light);
}

/* ===== Magazine-style content grid ===== */

.piece-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
}

.piece-card {
  grid-column: span 3;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s, transform 0.25s;
  position: relative;
  overflow: hidden;
}

.piece-card:hover {
  border-color: var(--accent-blue-light);
  transform: translateY(-3px);
}

.piece-card--feature { grid-column: span 6; }

.piece-grid--thirds .piece-card { grid-column: span 2; }

.piece-card__tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--paper-faint);
  margin-bottom: 14px;
}

.piece-card__tag--gated::before {
  content: '🔒 ';
}

.piece-card h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.piece-card p {
  font-size: 0.95rem;
  flex: 1;
}

.piece-card__meta {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--paper-faint);
}

.piece-card__link {
  display: block;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--accent-red-light);
}

/* ===== Story / detail page ===== */

.story-detail {
  padding: 70px 0 100px;
  position: relative;
  z-index: 1;
}

.story-detail__header {
  max-width: 760px;
  margin: 0 auto 50px;
  text-align: center;
}

.story-detail__header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.story-detail__tags {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

.tag-chip {
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.75rem;
  color: var(--paper-faint);
}

.story-body {
  max-width: 700px;
  margin: 0 auto;
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.8;
  color: var(--paper);
}

.story-body p { color: inherit; margin: 0 0 1.4em; }

.story-body p:first-of-type::first-letter {
  font-size: 3.4em;
  float: left;
  line-height: 0.8;
  padding: 0.05em 0.08em 0 0;
  font-style: italic;
  color: var(--accent-red-light);
}

.gate {
  max-width: 700px;
  margin: 40px auto 0;
  padding: 40px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  text-align: center;
  position: relative;
}

.gate::before {
  content: '';
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(to bottom, rgba(15,14,13,0), var(--panel));
  transform: translateY(-100%);
}

.gate h3 { margin-bottom: 10px; }
.gate p { max-width: 440px; margin: 0 auto 24px; }
.gate .btn-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ===== Reactions & comments ===== */

.engagement {
  max-width: 700px;
  margin: 60px auto 0;
  padding-top: 40px;
  border-top: 1px solid var(--panel-border);
}

.reaction-form { display: flex; align-items: center; gap: 14px; margin-bottom: 50px; }

.reaction-btn {
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.reaction-btn:hover { border-color: var(--accent-red-light); color: var(--accent-red-light); }
.reaction-btn.reacted { border-color: var(--accent-red-light); color: var(--accent-red-light); }

.comment-list { list-style: none; margin: 0 0 40px; padding: 0; }

.comment-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--panel-border);
}

.comment-item__meta {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 6px;
}

.comment-item__name { font-weight: 600; font-family: var(--font-display); }
.comment-item__date { font-size: 0.78rem; color: var(--paper-faint); }
.comment-item__body { color: var(--paper-dim); font-size: 0.96rem; }

.comment-form label {
  display: block;
  font-size: 0.82rem;
  color: var(--paper-faint);
  margin-bottom: 6px;
}

.comment-form input,
.comment-form textarea,
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  margin-bottom: 18px;
}

.comment-form input:focus,
.comment-form textarea:focus,
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent-blue-light);
}

.hp-field { position: absolute; left: -9999px; top: -9999px; }

/* ===== Gallery ===== */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}

.gallery-item:hover img { transform: scale(1.06); }

.gallery-item__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(15,14,13,0.92), transparent);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.25s;
}

.gallery-item:hover .gallery-item__caption { opacity: 1; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 8, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 40px;
}

.lightbox.is-open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 85vh; border-radius: var(--radius); }
.lightbox__close {
  position: absolute;
  top: 24px; right: 32px;
  color: var(--paper);
  font-size: 2rem;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ===== Video grid ===== */

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

.video-card__frame {
  position: relative;
  padding-top: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--panel-border);
}

.video-card__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-card h3 { margin-top: 14px; font-size: 1.1rem; }

/* ===== About page ===== */

.about-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 60px;
  align-items: start;
}

.about-portrait {
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--panel-border);
  background: var(--panel);
}

.about-body { font-size: 1.05rem; }
.about-body p { color: var(--paper-dim); }

/* ===== Auth forms ===== */

.auth-panel {
  max-width: 460px;
  margin: 80px auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 44px;
}

.auth-panel h1 { font-size: 1.8rem; margin-bottom: 6px; }
.auth-panel .sub { color: var(--paper-faint); margin-bottom: 30px; font-size: 0.9rem; }

.form-field { margin-bottom: 0; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.minor-fields {
  border-left: 2px solid var(--accent-red-light);
  padding-left: 18px;
  margin: 6px 0 20px;
  display: none;
}

.minor-fields.is-visible { display: block; }

.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 22px;
}

.alert-error { background: rgba(122, 31, 31, 0.16); border: 1px solid var(--accent-red); color: #f0c8c8; }
.alert-success { background: rgba(61, 90, 117, 0.16); border: 1px solid var(--accent-blue-light); color: #cfe0ef; }
.alert-info { background: var(--panel); border: 1px solid var(--panel-border); color: var(--paper-dim); }

.auth-links { margin-top: 20px; font-size: 0.88rem; color: var(--paper-faint); }
.auth-links a { color: var(--paper); border-bottom: 1px solid var(--panel-border); }

/* ===== Footer ===== */

.site-footer {
  border-top: 1px solid var(--panel-border);
  padding: 50px 0;
  position: relative;
  z-index: 1;
}

.site-footer__quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--paper-dim);
}

.site-footer__meta {
  font-size: 0.82rem;
  color: var(--paper-faint);
}

/* ===== Admin ===== */

.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.admin-sidebar {
  background: var(--ink-soft);
  border-right: 1px solid var(--panel-border);
  padding: 32px 20px;
}

.admin-sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--paper-dim);
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
  background: var(--panel);
  color: var(--paper);
}

.admin-main { padding: 40px 44px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 40px; }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 22px;
}

.stat-card__value { font-family: var(--font-display); font-size: 2.2rem; }
.stat-card__label { font-size: 0.8rem; color: var(--paper-faint); text-transform: uppercase; letter-spacing: 0.08em; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--panel-border);
}

.admin-table th {
  color: var(--paper-faint);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid var(--panel-border);
}

.badge-public { color: #a9d4b5; border-color: #3a5c42; }
.badge-gated { color: #e0c17a; border-color: #6b551f; }
.badge-pending { color: #e0c17a; border-color: #6b551f; }
.badge-approved { color: #a9d4b5; border-color: #3a5c42; }
.badge-spam { color: #e29b9b; border-color: var(--accent-red); }

.admin-form { max-width: 720px; }
.admin-form textarea { min-height: 220px; font-family: var(--font-body); }

.inline-actions { display: flex; gap: 10px; }
.inline-actions form { margin: 0; }

.link-danger { color: var(--accent-red-light); }

/* ===== Empty state ===== */

.empty-state {
  padding: 60px 0;
  text-align: center;
  color: var(--paper-faint);
}

/* ===== Responsive ===== */

@media (max-width: 900px) {
  .site-nav {
    position: absolute;
    top: 76px; left: 0; right: 0;
    background: var(--ink);
    border-bottom: 1px solid var(--panel-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 28px 30px;
    gap: 16px;
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .nav-toggle { display: flex; }
  .piece-card, .piece-card--feature, .piece-grid--thirds .piece-card { grid-column: span 6; }
  .about-layout { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--panel-border); padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}
