/* Brownstone Newsletter Theme — Light Mode */

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

:root {
  --bg: #ffffff;
  --bg-subtle: #f8f8f6;
  --border: #e8e8e4;
  --border-strong: #d0d0c8;
  --gold: #8b6914;
  --gold-light: #f5efe0;
  --text: #111111;
  --text-muted: #888880;
  --text-light: #aaaaaa;
  --font: 'Georgia', 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --radius: 2px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-left a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-logo {
  height: 28px;
  width: auto;
  display: block;
}

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

/* ── Search ── */
.search-form {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light);
}

.search-input {
  background: transparent;
  border: none;
  outline: none;
  padding: 7px 14px;
  font-size: 0.83rem;
  color: var(--text);
  width: 200px;
  font-family: var(--font-sans);
}

.search-input::placeholder { color: var(--text-light); }

.search-btn {
  background: transparent;
  border: none;
  padding: 7px 12px 7px 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.search-btn:hover { color: var(--gold); }

/* ── Buttons ── */
.btn-login {
  background: var(--text);
  border: none;
  color: #fff;
  padding: 8px 20px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-login:hover { background: var(--gold); }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: var(--font-sans);
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.btn-logout:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

/* ── Main ── */
.site-main {
  flex: 1;
  padding: 56px 48px;
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
}

/* ── Page Header ── */
.page-heading {
  margin-bottom: 32px;
}

.page-heading h1 {
  font-family: var(--font);
  font-size: 1.6rem;
  font-weight: normal;
  color: var(--text);
  margin-bottom: 4px;
}

.page-heading p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Login Gate ── */
.login-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  gap: 20px;
}

.login-gate-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 48px 56px;
  max-width: 400px;
  width: 100%;
}

.login-gate-box h2 {
  font-family: var(--font);
  font-size: 1.3rem;
  font-weight: normal;
  margin-bottom: 8px;
  color: var(--text);
}

.login-gate-box p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ── Search Results Banner ── */
.search-results-header {
  margin-bottom: 24px;
  font-size: 0.83rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-results-header strong { color: var(--text); }

.search-clear {
  color: var(--gold);
  text-decoration: none;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  transition: border-color 0.2s;
}

.search-clear:hover { border-color: var(--gold); }

/* ── Post Table ── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.post-table {
  width: 100%;
  border-collapse: collapse;
}

.post-table thead {
  background: var(--bg-subtle);
}

.post-table th {
  text-align: left;
  padding: 11px 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.post-table th.col-date { text-align: right; width: 150px; }

.post-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.post-table tbody tr:last-child { border-bottom: none; }

.post-table tbody tr:hover { background: var(--gold-light); }

.post-table td { padding: 16px 20px; }

.post-table td.col-title a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 500;
}

.post-table td.col-title a:hover { color: var(--gold); }

.post-table td.col-date {
  text-align: right;
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.no-results {
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

/* ── Post Page ── */
.post-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-family: var(--font);
  font-size: 2.2rem;
  font-weight: normal;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.25;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.83rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-meta-dot {
  width: 3px;
  height: 3px;
  background: var(--text-light);
  border-radius: 50%;
  display: inline-block;
}

.post-content {
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text);
  max-width: 720px;
}

.post-content p { margin-bottom: 1.3em; }
.post-content h2 {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2em 0 0.6em;
  color: var(--text);
}
.post-content h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  margin: 1.6em 0 0.5em;
}
.post-content a { color: var(--gold); text-decoration: underline; }
.post-content ul, .post-content ol { margin: 1em 0 1em 1.5em; }
.post-content li { margin-bottom: 0.5em; }
.post-content blockquote {
  border-left: 2px solid var(--gold);
  padding: 4px 0 4px 20px;
  color: var(--text-muted);
  font-style: italic;
  margin: 1.8em 0;
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  margin: 1.5em 0;
}
.post-content th, .post-content td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}
.post-content thead th {
  background: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 36px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.2s;
}

.back-link:hover { color: var(--gold); }

/* ── Ghost Card Classes (required) ── */
.kg-width-wide {
  margin-left: -80px;
  margin-right: -80px;
}

.kg-width-full {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}

.kg-image { max-width: 100%; height: auto; display: block; border-radius: 3px; }
.kg-image-card { margin: 2em 0; }
.kg-gallery-container { display: flex; flex-direction: column; }
.kg-gallery-row { display: flex; gap: 8px; margin-bottom: 8px; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.kg-embed-card { margin: 2em 0; }
.kg-bookmark-card {
  margin: 2em 0;
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: 4px;
  text-decoration: none;
  display: block;
  transition: border-color 0.2s;
}
.kg-bookmark-card:hover { border-color: var(--gold); }
.kg-bookmark-title { color: var(--text); font-weight: 500; font-family: var(--font-sans); margin-bottom: 4px; }
.kg-bookmark-description { color: var(--text-muted); font-size: 0.85em; font-family: var(--font-sans); }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-light);
  font-size: 0.75rem;
  background: var(--bg-subtle);
}

.footer-dot {
  width: 2px;
  height: 2px;
  background: var(--text-light);
  border-radius: 50%;
  display: inline-block;
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .site-header { padding: 0 20px; }
  .site-main { padding: 32px 20px; }
  .search-input { width: 130px; }
  .post-table th.col-date,
  .post-table td.col-date { display: none; }
  .kg-width-wide { margin-left: 0; margin-right: 0; }
  .login-gate-box { padding: 32px 24px; }
  .site-footer { flex-direction: column; gap: 4px; text-align: center; }
}
