/* ===================================================================
   Palavria — tema editorial
   =================================================================== */

:root,
[data-theme="dark"] {
  --bg: #14161a;
  --bg-soft: #191c21;
  --surface: #1d2025;
  --surface-2: #23262c;
  --ink: #e9e6df;
  --ink-soft: #c2beb4;
  --muted: #8b8880;
  --border: #2e3138;
  --border-strong: #40444c;
  --accent: #c1943f;
  --accent-strong: #dcae57;
  --accent-tint: #2c2515;
  --line: #ce6b4a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 14px 34px rgba(0, 0, 0, 0.5);
  --radius: 8px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eeece6;
  --bg-soft: #e5e2d9;
  --surface: #f8f7f3;
  --surface-2: #efece4;
  --ink: #1c1c1a;
  --ink-soft: #3d3b35;
  --muted: #6b6860;
  --border: #d8d4c8;
  --border-strong: #bcb6a2;
  --accent: #8a5a1e;
  --accent-strong: #6e4717;
  --accent-tint: #ece1cb;
  --line: #a8442b;
  --shadow: 0 1px 2px rgba(30, 25, 15, 0.06), 0 8px 24px rgba(30, 25, 15, 0.08);
  --shadow-lift: 0 10px 30px rgba(30, 25, 15, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.65;
  transition: background .25s ease, color .25s ease;
  position: relative;
}

.page-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .6;
  background-image: radial-gradient(circle at 50% 0%, rgba(193, 148, 63, .05), transparent 55%);
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 .5em;
  font-weight: 700;
  letter-spacing: -.01em;
}

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

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------- Header ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Playfair Display', serif;
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  margin-right: auto;
  letter-spacing: -.01em;
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: var(--bg);
  font-size: 15px;
  font-weight: 700;
  font-family: 'Playfair Display', serif;
  border-radius: 4px;
}

.main-nav {
  display: flex;
  gap: 28px;
}

.main-nav a {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  position: relative;
  padding: 4px 0;
  transition: color .2s;
}

.main-nav a:hover,
.main-nav a.is-active {
  color: var(--accent);
}

.main-nav a.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 2px;
  background: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.user-menu { position: relative; }
.user-menu__trigger {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  padding: 6px 10px 6px 6px; border-radius: 4px;
  color: var(--ink);
  font-family: inherit; font-size: 14px;
  transition: background .2s;
}
.user-menu__trigger:hover { background: var(--surface-2); }
.user-avatar { width: 28px; height: 28px; border-radius: 3px; object-fit: cover; border: 1px solid var(--border); }

.user-menu__dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: var(--shadow-lift);
  min-width: 190px; padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 60;
}
.user-menu__dropdown.is-open { display: flex; }
.user-menu__dropdown a {
  padding: 9px 12px; border-radius: 4px; font-size: 14.5px; color: var(--ink-soft);
}
.user-menu__dropdown a:hover { background: var(--surface-2); color: var(--accent); }
.user-menu__dropdown a.danger:hover { color: #e0685a; background: rgba(224, 104, 90, .1); }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-family: 'Source Serif 4', serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.btn--primary { background: var(--accent); color: #17130d; }
.btn--primary:hover { background: var(--accent-strong); box-shadow: var(--shadow); }
.btn--outline { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.btn--ghost { background: transparent; color: var(--muted); }
.btn--ghost:hover { color: var(--accent); }
.btn--small { padding: 8px 16px; font-size: 13.5px; }
.btn--danger { color: #e0685a; }
.btn--danger:hover { background: rgba(224, 104, 90, .1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- Hero ---------------- */

.hero {
  position: relative; z-index: 1;
  padding: 76px 0 48px;
  text-align: center;
}
.hero__eyebrow {
  font-size: 12.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent); font-family: 'Source Serif 4', serif; font-weight: 600;
  margin-bottom: 18px; display: block;
}
.hero h1 {
  font-size: clamp(34px, 5vw, 54px);
  max-width: 760px; margin: 0 auto 20px;
}
.hero h1 em {
  color: var(--accent); font-style: normal;
}
.hero p {
  max-width: 540px; margin: 0 auto 30px;
  color: var(--muted); font-size: 17.5px;
}
.hero__actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.hero-divider {
  width: 44px; height: 2px; background: var(--accent);
  margin: 44px auto 0; border: none;
}

/* ---------------- Filters ---------------- */

.filters {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  margin: 8px 0 48px; position: relative; z-index: 1;
}
.filters a {
  padding: 8px 18px; border-radius: 6px; border: 1px solid var(--border);
  font-size: 13.5px; color: var(--muted); background: var(--surface);
  text-transform: uppercase; letter-spacing: .04em;
  transition: all .15s;
}
.filters a:hover { border-color: var(--accent); color: var(--accent); }
.filters a.is-active { background: var(--accent); border-color: var(--accent); color: #17130d; }

/* ---------------- Post grid & cards ---------------- */

.feed {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding-bottom: 80px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 26px;
  display: flex; flex-direction: column;
  transition: border-color .2s ease, transform .2s ease;
  position: relative;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.card--frase {
  border-left: 3px solid var(--accent);
}
.card--frase blockquote {
  margin: 0 0 18px;
  font-family: 'Playfair Display', serif;
  font-style: normal;
  font-weight: 600;
  font-size: 21px;
  line-height: 1.45;
  color: var(--ink);
}

.card .kicker {
  display: inline-block;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); font-weight: 600; margin-bottom: 10px;
}
.card--conto h3 { font-size: 21px; margin-bottom: 10px; }
.card--conto p.excerpt { color: var(--ink-soft); font-size: 15.5px; margin: 0 0 18px; }

.card__footer {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.card__author { display: flex; align-items: center; gap: 8px; }
.card__author img { width: 24px; height: 24px; border-radius: 3px; object-fit: cover; }
.card__meta-actions { display: flex; align-items: center; gap: 12px; }

.like-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 13px; font-family: inherit;
  padding: 4px 6px; border-radius: 4px; transition: color .2s;
}
.like-btn:hover { color: var(--accent); }
.like-btn.is-liked { color: var(--accent); }
.like-btn svg { width: 16px; height: 16px; }

.empty-state {
  text-align: center; padding: 70px 20px; color: var(--muted);
  grid-column: 1 / -1;
}
.empty-state h3 { color: var(--ink-soft); margin-bottom: 8px; }

/* ---------------- Auth / Login ---------------- */

.auth-shell {
  min-height: calc(100vh - 250px);
  display: flex; align-items: center; justify-content: center;
  padding: 60px 20px; position: relative; z-index: 1;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lift);
  padding: 48px 40px;
  max-width: 400px; width: 100%;
  text-align: center;
}
.auth-card .brand__mark { width: 40px; height: 40px; font-size: 20px; margin: 0 auto; }
.auth-card h1 { font-size: 24px; margin: 20px 0 10px; }
.auth-card p { color: var(--muted); margin-bottom: 30px; font-size: 15px; }
#googleSignInDiv { display: flex; justify-content: center; }
.auth-divider { color: var(--muted); font-size: 12.5px; margin: 24px 0; }

/* ---------------- Dashboard ---------------- */

.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  padding: 44px 0 26px; position: relative; z-index: 1;
}
.dash-header h1 { margin: 0; font-size: 30px; }
.dash-header p { color: var(--muted); margin: 6px 0 0; }

.dash-list { position: relative; z-index: 1; padding-bottom: 80px; display: flex; flex-direction: column; gap: 10px; }

.dash-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 18px 22px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  transition: border-color .2s;
}
.dash-row:hover { border-color: var(--border-strong); }
.dash-row__main { flex: 1; min-width: 220px; }
.dash-row__type {
  display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 9px; border-radius: 4px; margin-bottom: 8px; font-weight: 700;
}
.dash-row__type--frase { background: var(--accent-tint); color: var(--accent); }
.dash-row__type--conto { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--border-strong); }
.dash-row__title { font-family: 'Playfair Display', serif; font-size: 18px; margin: 0 0 4px; }
.dash-row__excerpt { color: var(--muted); font-size: 14px; margin: 0; }
.dash-row__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.switch {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13px; color: var(--muted);
}
.switch input { display: none; }
.switch__track {
  width: 38px; height: 21px; border-radius: 999px; background: var(--border-strong);
  position: relative; transition: background .2s;
}
.switch__track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%; background: var(--bg);
  transition: transform .2s;
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(17px); }

/* ---------------- Editor ---------------- */

.editor-shell { position: relative; z-index: 1; padding: 44px 0 90px; }
.editor-shell .wrap { max-width: 760px; }

.type-toggle {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px; margin-bottom: 28px;
}
.type-toggle label {
  padding: 8px 20px; border-radius: 4px; font-size: 13.5px; cursor: pointer; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  transition: all .15s;
}
.type-toggle input { display: none; }
.type-toggle label:has(input:checked) {
  background: var(--accent); color: #17130d;
}
.type-toggle label { display: block; }

.field { margin-bottom: 22px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; letter-spacing: .02em; text-transform: uppercase; }

.input-title {
  width: 100%; border: none; border-bottom: 2px solid var(--border);
  background: transparent; font-family: 'Playfair Display', serif;
  font-size: 26px; padding: 8px 0; color: var(--ink); outline: none;
  transition: border-color .2s;
}
.input-title:focus { border-color: var(--accent); }

.input-content {
  width: 100%; min-height: 320px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--ink); font-family: 'Source Serif 4', serif;
  font-size: 17px; line-height: 1.75; padding: 20px; resize: vertical; outline: none;
  transition: border-color .2s;
}
.input-content:focus { border-color: var(--accent); }
.input-content.is-frase { font-family: 'Playfair Display', serif; font-size: 21px; font-weight: 600; min-height: 160px; }

.visibility-box {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 16px 20px; margin: 30px 0;
}
.visibility-box strong { display: block; font-size: 15px; margin-bottom: 3px; }
.visibility-box span { font-size: 13.5px; color: var(--muted); }

.editor-actions { display: flex; gap: 14px; justify-content: flex-end; }

/* ---------------- Single post ---------------- */

.post-shell { position: relative; z-index: 1; padding: 52px 0 100px; }
.post-shell .wrap { max-width: 700px; }
.post-header { text-align: center; margin-bottom: 40px; }
.post-header .kicker {
  font-size: 12px; text-transform: uppercase; letter-spacing: .16em; color: var(--accent); font-weight: 600;
}
.post-header h1 { font-size: clamp(28px, 4vw, 40px); margin: 14px 0 18px; }
.post-author { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.post-author img { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; border: 1px solid var(--border); }

.post-body {
  font-size: 19px; line-height: 1.85; color: var(--ink-soft);
  white-space: pre-wrap;
}
.post-body.is-frase {
  font-family: 'Playfair Display', serif; font-weight: 600; font-size: 28px; text-align: center;
  color: var(--ink); line-height: 1.5;
}
.post-body.is-frase::before,
.post-body.is-frase::after { content: '"'; color: var(--accent); }

.post-footer {
  margin-top: 50px; padding-top: 24px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}

/* ---------------- Misc ---------------- */

.section-title {
  text-align: center; margin: 0 0 8px; position: relative; z-index: 1;
}
.section-sub { text-align: center; color: var(--muted); margin-bottom: 40px; position: relative; z-index: 1; }

.alert {
  border-radius: 6px; padding: 13px 18px; font-size: 14.5px; margin-bottom: 20px;
  position: relative; z-index: 1; border: 1px solid;
}
.alert--error { background: rgba(224, 104, 90, .1); color: #e0685a; border-color: rgba(224, 104, 90, .3); }
.alert--success { background: rgba(122, 174, 110, .1); color: #7aae6e; border-color: rgba(122, 174, 110, .3); }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
  text-align: center;
  position: relative; z-index: 1;
}
.site-footer__quote {
  font-family: 'Playfair Display', serif; font-weight: 600; font-size: 16px;
  color: var(--muted); margin: 0 0 10px;
}
.site-footer__meta { font-size: 13px; color: var(--muted); opacity: .8; margin: 0; }

@media (max-width: 760px) {
  .main-nav { display: none; }
  .hero { padding: 52px 0 32px; }
  .card { padding: 22px 20px; }
  .dash-header { padding-top: 26px; }
}
