:root {
  --text: #1a1a1a;
  --muted: #555;
  --link: #0b5cab;
  --link-hover: #083d73;
  --accent: #c41e3a;
  --accent-dark: #9a1830;
  --gold: #e8c547;
  --gold-dark: #d4a82a;
  --bg: #fff;
  --bg-soft: #f7f7f7;
  --surface: #fff;
  --border: #e0e0e0;
  --nav-bg: #1a1a1a;
  --nav-text: #fff;
  --max: 44rem;
  --wide: 72rem;
  --sidebar: 17.5rem;
  --radius: 4px;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.wrap {
  max-width: var(--wide);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  box-sizing: border-box;
}

#content {
  padding: 1.5rem 0 3rem;
}

.layout-with-sidebar.wrap {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* —— Header (WP-like) —— */
.site-header {
  background: var(--bg);
  margin-bottom: 0;
}

.header-banner {
  width: 100%;
  max-height: 220px;
  overflow: hidden;
  background: #111;
}

.header-banner img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: center 40%;
}

.header-brand {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.header-brand__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.header-brand .logo {
  flex: 0 0 auto;
  text-decoration: none;
  line-height: 0;
}

.header-brand .logo img {
  display: block;
  width: auto;
  max-width: min(100%, 480px);
  height: auto;
}

.header-brand__text {
  flex: 1 1 12rem;
  min-width: 0;
}

.lang-switch {
  flex: 0 0 auto;
  margin-left: auto;
}

.lang-switch a {
  margin-left: 0.5rem;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.lang-switch a.is-active { color: var(--text); }

.site-tagline {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.site-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--muted);
}

.header-nav {
  background: var(--nav-bg);
  color: var(--nav-text);
}

.header-nav__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.header-nav__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  margin-left: auto;
}

/* Category pills */
.category-nav { flex: 1 1 auto; min-width: 0; }

.category-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

.category-nav a {
  display: block;
  padding: 0.35rem 0.65rem;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  white-space: nowrap;
}

.category-nav a:hover,
.category-nav a.is-active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Search */
.search-form {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.search-form input[type="search"] {
  width: 8.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #444;
  border-radius: var(--radius) 0 0 var(--radius);
  background: #333;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
}

.search-form input::placeholder { color: #aaa; }

.search-results__list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.search-hit {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e8e8e8;
}

.search-hit:last-child {
  border-bottom: 0;
}

.search-hit a {
  font-weight: 600;
  font-size: 1.05rem;
}

.search-hit p {
  margin: 0.35rem 0 0;
  color: #555;
  font-size: 0.95rem;
}

.search-results__none {
  margin-top: 1rem;
  color: #555;
}

.search-form button {
  padding: 0.35rem 0.6rem;
  border: 1px solid #444;
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #333;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}

.header-pages .menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.75rem;
}

.header-pages .menu a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.header-pages .menu a:hover { color: #fff; }

@media (max-width: 900px) {
  .header-brand__inner { flex-direction: column; align-items: flex-start; }
  .lang-switch { margin-left: 0; }
  .header-nav__inner { flex-direction: column; align-items: stretch; }
  .header-nav__tools { margin-left: 0; width: 100%; justify-content: space-between; }
  .search-form input[type="search"] { width: 100%; flex: 1; }
  .search-form { flex: 1; }
}

/* —— Two-column layout —— */
.layout-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.main-column {
  flex: 1;
  min-width: 0;
  padding: 0 1rem 0 1.25rem;
}

/* Single post / page inside sidebar layout — use column width, not narrow max */
.layout-with-sidebar .single-page header,
.layout-with-sidebar .single-page .meta,
.layout-with-sidebar .single-page .featured,
.layout-with-sidebar .single-page .toc,
.layout-with-sidebar .single-page .content,
.layout-with-sidebar .single-page .taxa,
.layout-with-sidebar .single-page .contact-form-block {
  max-width: none;
}

.layout-with-sidebar .single-page .content {
  padding: 0 0.5rem 0 0;
}

.layout-with-sidebar .single-page header,
.layout-with-sidebar .single-page .featured {
  padding-left: 0;
}

.sidebar {
  flex: 0 0 var(--sidebar);
  width: var(--sidebar);
}

@media (max-width: 960px) {
  .layout-with-sidebar { flex-direction: column; }
  .sidebar { width: 100%; flex: none; }
}

/* —— Post cards (archive) —— */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

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

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--gold);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.post-card__image {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #eee;
}

.post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-card__placeholder {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 140px;
  background: linear-gradient(135deg, #e8e8e8, #f5f5f5);
}

.post-card__body {
  padding: 1rem 1.1rem 1.15rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card__title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  line-height: 1.3;
}

.post-card__title a {
  color: var(--text);
  text-decoration: none;
}

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

.post-card__excerpt {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--muted);
  flex: 1;
}

.post-card__more {
  align-self: flex-start;
  font-size: 0.9rem;
  padding: 0.45rem 1rem;
}

.archive-more { margin-top: 1.5rem; }

.archive-header h1 {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
}

.archive-intro {
  margin-bottom: 1.5rem;
  max-width: var(--max);
}

/* —— Sidebar widgets —— */
.widget {
  margin-bottom: 2rem;
  padding: 1rem 1.1rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.widget-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--gold);
}

.widget-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.widget-list li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.35;
}

.widget-list a { text-decoration: none; }
.widget-list a:hover { text-decoration: underline; }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  line-height: 1.4;
}

.tag-cloud__link {
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--link);
}

.tag-cloud__link:hover { text-decoration: underline; }

/* —— Buttons —— */
.button,
.contact-form button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  background: var(--nav-bg);
  color: #fff !important;
  text-decoration: none;
  border: 0;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.button:hover,
.contact-form button:hover {
  background: #333;
}

/* —— Single page / article —— */
.single-page header h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 0.5rem;
  max-width: var(--max);
}

.single-page .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

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

.featured img {
  max-width: 100%;
  height: auto;
  margin-bottom: 1em;
  border-radius: var(--radius);
}

/* Article typography */
.content h2, .content h3, .content h4 {
  margin-top: 1.75em;
  margin-bottom: 0.6em;
  line-height: 1.25;
}

.content h2 { font-size: 1.5rem; }
.content h3 { font-size: 1.25rem; }
.content h4 { font-size: 1.1rem; }
.content p { margin: 0 0 1em; }
.content ul, .content ol { margin: 0 0 1em; padding-left: 1.5em; }
.content li { margin-bottom: 0.35em; }
.content hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.content img, .content figure img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em auto;
}

.content blockquote {
  margin: 1.5em 0;
  padding: 0.5em 1em;
  border-left: 4px solid var(--gold);
  background: var(--bg-soft);
  color: var(--muted);
}

.content pre {
  overflow-x: auto;
  padding: 1rem;
  background: #eee;
  border-radius: var(--radius);
}

.content iframe { max-width: 100%; margin: 1em 0; }

.h5p-embed-wrapper {
  margin: 1.5em 0;
  min-height: 500px;
}

.h5p-embed-wrapper .h5p-embed {
  width: 100%;
  min-height: 500px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.video-embed iframe,
.odysee-embed iframe {
  width: 100%;
  max-width: 640px;
  min-height: 360px;
  border: 0;
  border-radius: var(--radius);
}

.odysee-episode {
  margin: 2em 0;
  padding-bottom: 1.5em;
  border-bottom: 1px solid var(--border);
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.95rem;
}

.content th, .content td {
  border: 1px solid var(--border);
  padding: 0.5em 0.75em;
}

/* Contact */
.contact-form-block {
  margin-top: 2rem;
  max-width: var(--max);
  padding: 1.5rem;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.contact-form {
  display: grid;
  gap: 1rem;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
}

.contact-form input,
.contact-form textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.contact-form .hp {
  position: absolute;
  left: -9999px;
  height: 0;
  overflow: hidden;
}

.form-notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.form-notice--success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
}

.form-notice--error {
  background: #ffebee;
  border: 1px solid #ef9a9a;
}

.taxa {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 1.5rem;
  max-width: var(--max);
}

.toc {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 1rem;
  margin-bottom: 1.5rem;
  max-width: var(--max);
  font-size: 0.95rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2rem;
}

.site-footer .wrap {
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.portfolio-list .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.portfolio-list .card {
  border: 1px solid var(--border);
  padding: 0.5rem;
  text-decoration: none;
  color: inherit;
}

.members-only {
  border: 1px dashed var(--border);
  padding: 1rem;
  margin: 1rem 0;
}

/* Pagination */
.pagination { margin-top: 2rem; }
.pagination a { margin-right: 0.75rem; }
