/* ── Tokens ───────────────────────────────────────────── */
:root {
  --bg:         #0c0b09;
  --surface:    #131210;
  --surface-hi: #1b1916;
  --ink:        #ece7d8;
  --ink-soft:   #b8b0a0;
  --muted:      #5e5750;
  --accent:     #c8a55e;
  --error:      #d05a5a;
  --ok:         #4fa676;
  --border:     #242018;
  --border-hi:  #332e26;
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ── Base ─────────────────────────────────────────────── */
body {
  font-family: "Outfit", "Avenir Next", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 900px 500px at 50% -60px, rgba(200, 165, 94, 0.06) 0, transparent 70%),
    radial-gradient(ellipse 600px 400px at 100% 80%, rgba(140, 110, 50, 0.04) 0, transparent 70%);
  min-height: 100vh;
}

/* Subtle grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: 0.022;
  pointer-events: none;
  z-index: 9999;
}

/* ── Page shell ───────────────────────────────────────── */
.page {
  width: min(600px, 94vw);
  margin: 0 auto;
  padding-bottom: 6rem;
}

/* ── Divider rule ─────────────────────────────────────── */
.rule {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

/* ── Site header ──────────────────────────────────────── */
.site-header {
  padding-top: 3.5rem;
  text-align: center;
}

.wordmark {
  font-family: "Cormorant", "Georgia", serif;
  font-size: clamp(3.8rem, 14vw, 6.5rem);
  font-weight: 400;
  font-style: italic;
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 1;
}

.tagline {
  margin-top: 0.55rem;
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ── Account nav ──────────────────────────────────────── */
.account-nav {
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.user-identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(200, 165, 94, 0.12);
  border: 1px solid rgba(200, 165, 94, 0.25);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0;
}

.user-email {
  font-size: 0.76rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-shrink: 0;
}

.nav-link {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: color 0.15s;
  line-height: 1;
}

.nav-link:hover { color: var(--ink-soft); }

.nav-link.admin {
  color: var(--accent);
  opacity: 0.8;
}

.nav-link.admin:hover { opacity: 1; color: var(--accent); }

.nav-link.back::before {
  content: '← ';
  opacity: 0.6;
}

/* kept for backwards compat with any existing markup */
.text-link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
}

.ghost-btn {
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  font-size: 0.74rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  font-family: inherit;
}

.ghost-btn:hover { border-color: var(--accent); color: var(--ink); }

.inline-form {
  display: inline;
}

/* ── Import section ───────────────────────────────────── */
.import-section {
  margin-bottom: 2.75rem;
}

.quota-line {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.quota-reset {
  margin-left: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.import-form {
  display: grid;
  gap: 0.5rem;
}

.import-form-row {
  display: flex;
  gap: 0.5rem;
}

.import-form input,
.import-form textarea,
.verify-form input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.import-form input:focus,
.import-form textarea:focus,
.verify-form input:focus {
  border-color: rgba(200, 165, 94, 0.4);
}

.import-form input::placeholder,
.import-form textarea::placeholder,
.verify-form input::placeholder {
  color: var(--muted);
}

.import-form textarea {
  resize: none;
  overflow-y: hidden;
  min-height: 4.8rem;
  line-height: 1.45;
}

.char-count {
  margin-top: -0.15rem;
  text-align: right;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.import-form button,
.verify-form button {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 0.8rem 1.1rem;
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  color: #0c0b09;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.import-form button:hover,
.verify-form button:hover { opacity: 0.82; }

.btn-arrow { font-size: 1.05rem; line-height: 1; }

/* ── Notices ──────────────────────────────────────────── */
.notice {
  margin-top: 0.7rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.45;
  background: var(--surface-hi);
  color: var(--ink-soft);
  border: 1px solid var(--border-hi);
}

.notice.ok {
  background: rgba(79, 166, 118, 0.08);
  color: var(--ok);
  border-color: rgba(79, 166, 118, 0.18);
}

.notice.error {
  background: rgba(208, 90, 90, 0.08);
  color: var(--error);
  border-color: rgba(208, 90, 90, 0.18);
}

/* ── Feed ─────────────────────────────────────────────── */
.feed {
  display: grid;
  gap: 1.1rem;
}

/* ── Card ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
  border-color: var(--border-hi);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.empty-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.empty-glyph {
  font-family: "Cormorant", serif;
  font-size: 3rem;
  font-style: italic;
  color: var(--border-hi);
  margin-bottom: 0.75rem;
}

.empty-card h2 {
  font-family: "Cormorant", serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.empty-card p {
  font-size: 0.88rem;
}

/* ── Card header ──────────────────────────────────────── */
.card-head {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 1rem 1rem 0.8rem;
}

.card-num {
  font-family: "Cormorant", serif;
  font-size: 1.1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--accent);
  opacity: 0.65;
  flex-shrink: 0;
  padding-top: 0.05rem;
  line-height: 1;
}

.card-meta-wrap {
  flex: 1;
  min-width: 0;
}

.card-meta-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.meta-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timestamp {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.card-title {
  font-family: "Cormorant", serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
  margin-top: 0.3rem;
}

.owner-line {
  margin-top: 0.18rem;
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-line i {
  font-family: "Cormorant", serif;
  font-style: italic;
  font-size: 0.88rem;
  color: var(--muted);
  opacity: 0.8;
}

/* ── Card body (for notices + caption) ───────────────── */
.card-body {
  padding: 0 1rem;
}

/* ── Media ────────────────────────────────────────────── */
.media-block { /* full-bleed within card */ }

video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

/* ── Carousel ─────────────────────────────────────────── */
.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  align-items: start;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.carousel::-webkit-scrollbar { display: none; }

.carousel-slide {
  margin: 0;
  scroll-snap-align: start;
}

.carousel img {
  display: block;
  width: 100%;
  height: auto;
}

.carousel video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 0 0.2rem;
}

.carousel-dots a {
  display: inline-block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--border-hi);
  transition: background 0.2s;
}

.carousel-dots a:hover { background: var(--accent); }

/* ── Caption ──────────────────────────────────────────── */
.caption {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-soft);
  padding: 0.85rem 1rem 0;
}

.why-note {
  margin: 0.9rem 1rem 0;
  padding: 0.65rem 0.8rem;
  border-left: 2px solid rgba(200, 165, 94, 0.45);
  border-radius: 8px;
  background: rgba(200, 165, 94, 0.08);
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-style: italic;
  line-height: 1.5;
}

.why-note-text {
  white-space: pre-wrap;
}

.why-note-signature {
  margin-top: 0.4rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-style: normal;
}

/* ── Card footer ──────────────────────────────────────── */
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.card-foot a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: opacity 0.15s;
}

.card-foot a:hover { opacity: 0.65; }

.author {
  font-size: 0.8rem;
  color: var(--muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.admin-row:last-child {
  border-bottom: 0;
}

.danger-link {
  border: 1px solid rgba(208, 90, 90, 0.35);
  background: rgba(208, 90, 90, 0.08);
  color: var(--error);
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}

.danger-link:hover {
  background: rgba(208, 90, 90, 0.18);
}

/* ── Site footer ──────────────────────────────────────── */
.site-foot {
  margin-top: 3rem;
}

.site-foot p {
  text-align: center;
  font-size: 0.73rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1.25rem 0;
}

/* ── Code ─────────────────────────────────────────────── */
code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  background: var(--surface-hi);
  border: 1px solid var(--border-hi);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.82em;
  color: var(--ink-soft);
}

/* ── Login step cards ─────────────────────────────────── */
.step-list {
  display: grid;
  gap: 0.75rem;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.step-header {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  margin-bottom: 0.85rem;
}

.step-num {
  font-family: "Cormorant", serif;
  font-size: 1.1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--accent);
  opacity: 0.65;
  flex-shrink: 0;
  line-height: 1;
}

.step-label {
  font-family: "Cormorant", serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}

.verify-form {
  display: grid;
  gap: 0.5rem;
}

.verify-form-row {
  display: flex;
  gap: 0.5rem;
}

/* ── Admin settings ───────────────────────────────────── */
.settings-body {
  padding: 0 1rem 0.25rem;
}

.settings-block {
  padding: 0.85rem 0;
}

.settings-block-header {
  margin-bottom: 0.6rem;
}

.settings-block-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

.settings-block-desc {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.4;
}

.settings-sep {
  height: 1px;
  background: var(--border);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
  .site-header { padding-top: 2.5rem; }

  .card-foot { flex-direction: column; align-items: flex-start; }
}
