:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --border: #e3e1da;
  --text: #16161a;
  --muted: #6b6a66;
  --accent: #c0392b;
  --accent-soft: #f3ddd9;
  --link: #a93226;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.05);
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0b0b0f;
  --surface: #15151b;
  --surface-2: #1d1d25;
  --border: #2a2a34;
  --text: #ece9e3;
  --muted: #9b9a94;
  --accent: #ff6b5b;
  --accent-soft: #35211d;
  --link: #ff8575;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  font-size: 16px;
}
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-mark { font-size: 1.35rem; }
.brand-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; letter-spacing: -.01em; }
.brand-name b { color: var(--accent); font-weight: 700; }
.theme-toggle {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 1.05rem;
  display: grid; place-items: center;
}
.theme-toggle:focus-visible, button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.cats { display: flex; gap: 8px; padding-bottom: 10px; overflow-x: auto; }
.cat {
  flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 7px 14px; border-radius: 999px; font-size: .9rem;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.cat-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-off { color: var(--muted); cursor: not-allowed; opacity: .75; }
.soon {
  font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--accent-soft); color: var(--accent); padding: 2px 6px; border-radius: 6px; margin-left: 5px;
}

/* Main */
.main { padding: 18px 16px 60px; }

/* Deep search (fase 2) */
.deep-search {
  background: var(--surface-2); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 16px;
}
.deep-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: .95rem; }
.soon-inline { margin: 0; }
.deep-row { display: flex; gap: 8px; margin-top: 10px; }
.deep-row input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .92rem;
}
.deep-row button {
  padding: 10px 16px; border-radius: 10px; border: none; background: var(--muted);
  color: var(--surface); font-weight: 600; opacity: .55; cursor: not-allowed;
}
.deep-note { margin: 9px 0 0; font-size: .78rem; color: var(--muted); }

/* Archive search */
.archive-search { margin-bottom: 18px; }
#searchInput {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1rem;
  box-shadow: var(--shadow);
}

/* Status */
.status { color: var(--muted); font-size: .92rem; padding: 8px 0; }
.status.err { color: var(--accent); font-weight: 500; }

/* Featured */
.featured {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 26px; box-shadow: var(--shadow);
  border-top: 3px solid var(--accent);
}
.featured .tag {
  display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent); margin-bottom: 8px;
}
.featured .date { color: var(--muted); font-size: .82rem; }

/* Archive list */
.archive-title {
  font-family: var(--serif); font-size: 1.15rem; margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.archive-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; cursor: pointer; transition: transform .12s, border-color .12s;
  display: flex; flex-direction: column; gap: 4px;
}
.card:hover { transform: translateY(-1px); border-color: var(--accent); }
.card .c-date { font-size: .78rem; color: var(--muted); }
.card .c-title { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; color: var(--text); }
.empty { color: var(--muted); font-size: .9rem; padding: 10px 0; }

/* Reader */
.reader { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.back-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; cursor: pointer; margin-bottom: 18px; font-size: .9rem;
}

/* Prose (markdown render) */
.prose { font-size: 1.04rem; }
.prose h1 { font-family: var(--serif); font-size: 1.7rem; line-height: 1.2; margin: 0 0 14px; letter-spacing: -.02em; }
.prose h2 { font-family: var(--serif); font-size: 1.3rem; margin: 26px 0 10px; }
.prose h3 { font-size: 1.08rem; margin: 20px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.prose strong { font-weight: 700; }
.prose em { color: var(--accent); font-style: normal; font-weight: 600; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.prose .arrow {
  margin: 0 0 14px; padding: 10px 14px; background: var(--surface-2);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; font-size: .97rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border); padding: 22px 0; margin-top: 30px;
  color: var(--muted); font-size: .85rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-footer a { color: var(--accent); text-decoration: none; font-weight: 600; }

@media (min-width: 640px) {
  body { font-size: 17px; }
  .prose h1 { font-size: 2rem; }
}
