
:root {
  --bg: #f9f8f6;
  --bg-soft: #f0efeb;
  --text: #1a1918;
  --text-soft: #4a4845;
  --muted: #8b8882;
  --border: #e6e4df;
  --border-strong: #d3d1cb;
  --accent: #1a1918;
  --error: #b53b2c;
  --success: #3b7b4a;
  
  --radius: 0px;
  --max: 1200px;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-sans: "Outfit", "Inter", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
a:hover { opacity: 0.6; }

button, input, select, textarea {
  font: inherit;
  background: none;
  border: none;
  color: inherit;
}

/* Typography */
h1, h2, h3, .serif-text {
  font-family: var(--font-serif);
  font-weight: 400;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero-title { font-size: clamp(3rem, 10vw, 8rem); font-style: italic; }
.section-title { font-size: clamp(2rem, 5vw, 4.5rem); }
.detail-title { font-size: clamp(2.5rem, 6vw, 5rem); }

.uppercase-label, .eyebrow, .micro-label, .admin-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  color: var(--muted);
}

.text-muted, .small-copy { color: var(--muted); font-size: 0.85rem; }
.lead { font-size: 1.15rem; color: var(--text-soft); }

/* Layout */
.site-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header-inner, .site-footer-inner, .container, .page, .hero, .detail-layout, .submit-layout, .admin-layout, .policy-layout, .strip {
  width: min(calc(100% - 48px), var(--max));
  margin: 0 auto;
}

/* Header */
.site-header {
  padding: 32px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(var(--bg) 80%, transparent);
}

.site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 24px;
  height: 24px;
  background: var(--text);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: 2px;
}
.brand-copy strong { font-weight: 400; display: inline-block;}
.brand-copy span { display: none; }

.nav {
  display: flex;
  gap: 32px;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.nav a[aria-current="page"] {
  border-bottom: 1px solid var(--text);
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 80px 0 48px;
}
.site-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}
.footer-links {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
}

/* Sections */
.hero {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  padding: 80px 0;
}

.hero-intro { max-width: 600px; font-size: 1.15rem; color: var(--text-soft); }

.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

/* Buttons */
.button, .button-ghost, .button-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--text);
}

.button {
  background: var(--text);
  color: var(--bg);
}
.button:hover {
  background: transparent;
  color: var(--text);
}

.button-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.button-ghost:hover {
  border-color: var(--text);
}

.button-danger {
  border-color: var(--error);
  color: var(--error);
}
.button-danger:hover {
  background: var(--error);
  color: var(--bg);
}

/* Grids */
.page, .admin-layout, .submit-layout, .detail-layout, .policy-layout { padding: 48px 0 80px; }

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

.home-grid, .feed-grid, .admin-grid {
  display: grid;
  gap: 64px;
}

.section-head, .feed-toolbar, .detail-header, .submit-header, .admin-header, .policy-header {
  margin-bottom: 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

/* Post Card */
.post-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--border);
  background: #fff;
  transition: transform 0.4s ease, border-color 0.4s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.post-body {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
}

.post-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.85rem;
  color: var(--muted);
}
.subtle-link { text-decoration: underline; text-underline-offset: 4px; color: var(--text-soft); }
.subtle-link:hover { color: var(--text); }

/* Detail View */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 64px;
  align-items: start;
}
.detail-card, .admin-card, .submit-card, .policy-card, .content-card, .feed-panel {
  /* Minimal removes card borders in some contexts, but let's keep them clean */
}
.detail-body {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.2;
  margin: 32px 0;
  white-space: pre-wrap;
}
.detail-subtitle { font-family: var(--font-serif); font-size: 1.5rem; font-style: italic; color: var(--text-soft); }

/* Forms */
.submit-form, .filter-form, .report-form, .auth-form, .admin-action-form {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.filter-form {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field input[type="text"],
.field input[type="search"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 16px 20px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 0;
  transition: border-color 0.2s ease;
  font-family: var(--font-sans);
  font-size: 1rem;
}

.field textarea {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  min-height: 200px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--text);
}

.form-help { font-size: 0.85rem; color: var(--muted); margin: 0; }
.hidden-field { position: absolute; left: -9999px; }

/* Emotion Selection */
.emotion-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.emotion-option {
  position: relative;
}
.emotion-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.emotion-option label {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  background: #fff;
  transition: all 0.2s ease;
  height: 100%;
}
.emotion-option input:checked + label {
  border-color: var(--text);
  box-shadow: inset 0 0 0 1px var(--text);
}

.emotion-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.emotion-option label strong { font-weight: 600; font-size: 0.9rem; }
.emotion-option label .small-copy { font-family: var(--font-serif); font-style: italic; }

.emotion-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.emotion-chip::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--chip-color);
}

/* Pills & Badges */
.pill, .status-pill {
  display: inline-flex;
  padding: 4px 10px;
  border: 1px solid var(--border);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #fff;
  font-weight: 600;
}
.status-pill.published { border-color: var(--success); color: var(--success); }
.status-pill.pending_review { border-color: #d35400; color: #d35400; }
.status-pill.hidden, .status-pill.rejected { border-color: var(--error); color: var(--error); }

/* Banners */
.notice, .error-banner, .success-banner {
  padding: 16px 20px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  background: #fff;
  margin-bottom: 24px;
}
.error-banner { border-color: var(--error); color: var(--error); }
.success-banner { border-color: var(--success); color: var(--success); }

/* Checkbox */
.checkbox-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--text-soft);
  cursor: pointer;
}
.checkbox-row input { margin-top: 4px; }

/* Admin Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}
.admin-stat {
  padding: 32px;
  border: 1px solid var(--border);
  background: #fff;
}
.stat-number {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  margin-top: 16px;
  line-height: 1;
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th, .admin-table td {
  padding: 24px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.admin-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.table-body {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  line-height: 1.2;
  max-width: 60ch;
}

/* Empty State */
.empty-card {
  padding: 64px 0;
  text-align: left;
}

/* Utils */
.inline-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.meta-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.divider { width: 1px; height: 16px; background: var(--border-strong); }

@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav { display: none; }
  .site-header-inner, .site-footer-inner, .section-head, .feed-toolbar, .detail-header, .submit-header, .admin-header, .policy-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .filter-form { flex-direction: column; align-items: stretch; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .post-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .button, .hero-actions .button-ghost { width: 100%; }
}
