/* finpal — Paul Graham-style minimal theme */

:root {
  --text-color: #000;
  --text-secondary: #333;
  --link-color: #000;
  --link-hover: #666;
  --meta-color: #999;
  --border-color: #ddd;
  --bg-color: #fff;
  --nav-color: #1a6b4a;
  --nav-hover: #0d5438;
  --title-color: #2d4a3e;
  --code-bg: #f5f5f5;
  --notification-bg: #e8f5e9;
  --error-color: red;
  --success-color: green;
  --font-body: Verdana, Geneva, sans-serif;
  --max-width: 600px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #d4d4d4;
    --text-secondary: #a0a0a0;
    --link-color: #d4d4d4;
    --link-hover: #999;
    --meta-color: #777;
    --border-color: #333;
    --bg-color: #1a1a1a;
    --nav-color: #4eba8a;
    --nav-hover: #6fd4a6;
    --title-color: #6fb89a;
    --code-bg: #252525;
    --notification-bg: #1a3320;
    --error-color: #e57373;
    --success-color: #66bb6a;
  }
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--bg-color);
  margin: 0;
  padding: 0;
}

/* Two-column layout */
.site-layout {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 2rem;
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.site-sidebar {
  position: sticky;
  top: 2rem;
  align-self: start;
}

.site-content {
  max-width: var(--max-width);
}

a { color: var(--link-color); }
a:hover { color: var(--link-hover); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: bold;
  line-height: 1.2;
}

img { max-width: 100%; height: auto; }
figure { margin: 1.5rem 0; }
figcaption { text-align: center; font-size: 0.85rem; color: var(--meta-color); }
hr { border: none; border-top: 1px solid var(--border-color); margin: 2rem 0; }

/* Sidebar header */
.site-header__title {
  font-size: 1.3rem;
  margin: 0;
  font-variant: small-caps;
  letter-spacing: 0.03em;
  color: var(--title-color);
}
.site-header__title a { text-decoration: none; color: var(--title-color); }
.site-header__title a:hover { color: var(--text-color); }
.site-header__nav { margin-top: 0.75rem; font-size: 0.85rem; }
.site-header__nav ul { list-style: none; padding: 0; margin: 0; }
.site-header__nav li { display: block; }
.site-header__nav a { text-decoration: none; color: var(--nav-color); }
.site-header__nav a:hover { color: var(--nav-hover); text-decoration: underline; }
.site-header__nav > a, .site-header__nav > .member-info { display: block; }
.member-info { margin-top: 1.5em; font-size: 0.8rem; color: var(--meta-color); }
.member-name { color: var(--text-color); }
.member-logout { font-size: 0.75rem; text-decoration: none; filter: grayscale(1); opacity: 0.5; }
.member-logout:hover { opacity: 1; }

/* Homepage post list */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-teaser { margin-bottom: 0.4rem; line-height: 1.4; }
.post-teaser a { text-decoration: none; }
.post-teaser a:hover { text-decoration: underline; }
.post-teaser__date {
  color: var(--meta-color);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

/* Pagination */

/* Post page */
.post__header { margin-bottom: 1.5rem; }
.post__title { font-size: 1.8rem; margin: 0; font-variant: small-caps; color: var(--title-color); }
.post__meta { color: var(--meta-color); font-size: 0.9rem; margin-top: 0.3rem; }
.post__content { line-height: 1.7; }
.post__content p { margin-bottom: 1rem; }
.post__content blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border-color);
  color: var(--text-secondary);
}
.post__content pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.4;
}
.post__content code { font-size: 0.9em; }

/* Page */
.page__header { margin-bottom: 1.5rem; }
.page__title { font-size: 1.8rem; margin: 0; font-variant: small-caps; color: var(--title-color); }

/* Tag page */
.tag-info { margin-bottom: 1.5rem; }
.tag-info__name { font-size: 1.5rem; margin: 0; }
.tag-info__description { color: var(--meta-color); }
.tag-info__meta { font-size: 0.9rem; color: var(--meta-color); }

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--meta-color);
}
.site-footer__nav { margin-bottom: 0.5rem; }
.site-footer__nav a { margin-right: 1rem; }

/* Subscribe widget */
.email-optin-widget { margin: 1.5rem 0; }
.email-optin-widget input[type="email"] {
  padding: 0.4rem;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  font-family: var(--font-body);
}
.email-optin-widget button {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: var(--font-body);
}

/* Signup/signin forms */
#name-form input[type="text"],
[data-members-form="signup"] input[type="text"],
[data-members-form="signin"] input[type="email"],
[data-members-form="signup"] input[type="email"] {
  display: block;
  padding: 0.4rem;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  font-family: var(--font-body);
  margin-bottom: 0.5rem;
  width: 100%;
  max-width: 300px;
}
#name-form button,
[data-members-form="signup"] button,
[data-members-form="signin"] button {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: var(--font-body);
  margin-top: 0.3rem;
}

/* Pseudonym suggestions */
.pseudonym-hint { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.8rem; }
.pseudonym-suggestions { color: var(--color-nav); font-weight: bold; }

/* Member notification area */
.notification-area {
  text-align: center;
  background-color: var(--notification-bg);
  padding: 0.8rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.billing-cancel .notification-area { background-color: var(--code-bg); }

/* Ghost editor card styles */
.kg-width-wide { max-width: var(--max-width); }
.kg-width-full { max-width: 100vw; position: relative; left: 50%; transform: translateX(-50%); }
.kg-width-full:not(.kg-card-hascaption):first-child,
.kg-width-full + .kg-width-full { margin-top: 0; }

/* Subscription form states */
.message-success, .message-error { display: none; }
.message-error, [data-members-error] { color: var(--error-color); }
.message-success { color: var(--success-color); }
.loading button span, .error button span, .success button span { display: none; }
.loading button::after { content: "Loading..."; }
.error button::after { content: "Error"; }
.success button::after { content: "Subscribed!"; }
.success ~ .message-success, .invalid ~ .message-error, .error ~ .message-error { display: block; }

/* Comentario overrides (match PG-minimal theme) */
comentario-comments { font-family: var(--font-body); font-size: 13px; }

/* Mobile: sidebar collapses to horizontal header */
@media (max-width: 768px) {
  .site-layout {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 100%;
    margin: 0;
    padding: 0.8rem;
  }
  .site-sidebar {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
  }
  .site-header__title { font-size: 1.1rem; }
  .site-header__nav { margin-top: 0; display: flex; align-items: baseline; gap: 0.8rem; }
  .site-header__nav ul { display: flex; gap: 0.8rem; margin: 0; }
  .site-header__nav li { display: inline; }
  .member-info { margin-top: 0; white-space: nowrap; }
  .site-content { max-width: 100%; }
  .post__title { font-size: 1.4rem; }
}
