/*
Theme Name: Kestrel
Description: A classic two-column WordPress theme with a right sidebar, horizontal navigation and a multi-column footer.
Author: Sedno Smaku
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kestrel
*/

/* ---------- Tokens ---------- */
:root {
  --bg: #fdf6e9;
  --surface: #fffdf6;
  --fg: #3d2f23;
  --muted: #8a7459;
  --border: #eadfc8;
  --accent: #a12633;
  --accent-warm: #d9a441;
  --accent-deep: #6f1a26;
  --radius: 4px;
  --shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  --sidebar-w: 280px;
  --media-ratio: 16 / 9;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(122, 91, 63, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--fg);
  font-family: 'Segoe UI', Roboto, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 1.75;
  overflow-wrap: break-word;
  overflow-x: clip;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { color: var(--accent-deep); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--fg);
  margin: 0 0 0.6em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1.1em; }

ul, ol { padding-left: 1.4em; }

blockquote {
  margin: 1.4em 0;
  padding: 0.6em 1.2em;
  border-left: 3px solid var(--accent-warm);
  background: var(--surface);
  color: var(--muted);
}

code, pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9em;
}

pre { padding: 1em; overflow-x: auto; }

.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 20px;
}

.site-logo {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-logo a { color: var(--fg); }
.site-logo a:hover { color: var(--accent); text-decoration: none; }

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

.main-navigation { margin-left: auto; }

.main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-navigation li { position: relative; }

.main-navigation a {
  display: block;
  padding: 10px 14px;
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
}

.main-navigation a:hover,
.main-navigation a:focus {
  color: var(--accent);
  background: rgba(217, 164, 65, 0.12);
  text-decoration: none;
}

.main-navigation .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
}

.main-navigation li:hover > .sub-menu,
.main-navigation li:focus-within > .sub-menu {
  display: flex;
}

.main-navigation .sub-menu a {
  padding: 8px 12px;
  font-weight: 500;
}

.menu-toggle {
  display: none;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 1rem;
  cursor: pointer;
}

.submenu-toggle {
  display: none;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px;
}

/* ---------- Search ---------- */
.search-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  cursor: pointer;
  padding: 8px 11px;
  font-size: 1rem;
  line-height: 1;
}

.search-toggle:hover { border-color: var(--accent-warm); color: var(--accent); }

.search-panel {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 0;
}

.search-panel.is-open { display: block; }

.search-form {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
}

.search-field {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--fg);
  font-size: 1rem;
  font-family: inherit;
}

.search-field:focus {
  outline: 2px solid var(--accent-warm);
  outline-offset: 1px;
  border-color: var(--accent-warm);
}

.search-submit {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.search-submit:hover { background: var(--accent-deep); }

/* ---------- Hero (text-only, centered) ---------- */
.hero {
  text-align: center;
  padding: 64px 20px 48px;
}

.hero-symbol { width: 92px; height: auto; margin-bottom: 18px; }

.hero-title {
  font-size: 2.4rem;
  margin-bottom: 0.35em;
}

.hero-text {
  max-width: 680px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.08rem;
}

/* ---------- Layout ---------- */
.site-content { padding: 40px 0 56px; }

.content-area {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

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

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

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 22px;
}

.breadcrumb .crumb { color: var(--muted); }
.breadcrumb a.crumb:hover { color: var(--accent); }

.breadcrumb .trail::before {
  content: "›";
  margin: 0 8px;
  color: var(--border);
}

/* ---------- Post cards (grid) ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

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

.post-card:hover { border-color: var(--accent-warm); }

.card-thumb { display: block; line-height: 0; }
.card-thumb img {
  width: 100%;
  aspect-ratio: var(--media-ratio);
  object-fit: cover;
}

.card-body { padding: 18px 20px 20px; }

.card-title { font-size: 1.15rem; margin-bottom: 0.4em; }
.card-title a { color: var(--fg); }
.card-title a:hover { color: var(--accent); text-decoration: none; }

.card-meta {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-meta .sep { color: var(--border); }

.card-meta a { color: var(--muted); }
.card-meta a:hover { color: var(--accent); }

.card-excerpt {
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ---------- Pagination ---------- */
.pagination {
  margin-top: 36px;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination .page-numbers {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  font-size: 0.95rem;
}

.pagination .page-numbers.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pagination a.page-numbers:hover {
  border-color: var(--accent-warm);
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Archive headers ---------- */
.archive-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.archive-header p { color: var(--muted); margin: 0; }

/* ---------- Single post ---------- */
.article { min-width: 0; }

.entry-title { margin-bottom: 0.3em; }

.entry-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

.entry-featured { margin-bottom: 26px; }
.entry-featured img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.article-note {
  background: rgba(217, 164, 65, 0.12);
  border: 1px solid var(--accent-warm);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.95rem;
  margin-bottom: 26px;
}

.entry-content { font-size: 1rem; }

.entry-content h2, .entry-content h3 { margin-top: 1.6em; }

.entry-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.entry-tags {
  margin-top: 30px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.entry-tags a {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.entry-tags a:hover {
  border-color: var(--accent-warm);
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Related posts (4 columns) ---------- */
.related-posts { margin-top: 40px; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.related-card:hover { border-color: var(--accent-warm); }

.related-card .card-body { padding: 12px 14px 14px; }
.related-card .card-title { font-size: 0.95rem; margin: 0; }

/* ---------- Author bio ---------- */
.author-bio {
  margin-top: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.author-bio .avatar { border-radius: 50%; }

.author-bio h2 { font-size: 1.05rem; margin-bottom: 0.3em; }

.author-bio p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* ---------- Comments ---------- */
.comments-area { margin-top: 44px; }

.comment-list {
  list-style: none;
  padding: 0;
  margin: 0 0 30px;
}

.comment-list .children { padding-left: 28px; }

.comment-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.comment-meta { font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }

.comment-form label { display: block; font-size: 0.9rem; margin-bottom: 4px; }

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
}

.comment-form .submit {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.comment-form .submit:hover { background: var(--accent-deep); }

/* ---------- Sidebar ---------- */
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 24px;
}

.widget h2 {
  font-size: 1rem;
  margin-bottom: 0.8em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--border);
}

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

.widget li {
  padding: 6px 0;
  font-size: 0.92rem;
  border-bottom: 1px dashed var(--border);
}

.widget li:last-child { border-bottom: 0; }

.widget li a { color: var(--fg); }
.widget li a:hover { color: var(--accent); }

.widget .recent-date { display: block; font-size: 0.78rem; color: var(--muted); }

/* ---------- Footer (multi-column grid) ---------- */
.site-footer {
  background: #f4ead3;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  padding: 44px 0 20px;
}

.footer-site-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
}

.footer-site-name:hover { color: var(--accent); text-decoration: none; }

.footer-group-heading {
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 10px;
  color: var(--fg);
}

.footer-group ul { list-style: none; margin: 0; padding: 0; }

.footer-group li { padding: 4px 0; font-size: 0.9rem; }

.footer-group a { color: var(--muted); }
.footer-group a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-note { margin: 0; }

/* ---------- 404 ---------- */
.error-content { text-align: center; padding: 30px 0; }
.error-content .search-form { margin-top: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .content-area { flex-direction: column; }
  .sidebar-column { flex: none; width: 100%; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-columns { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .menu-toggle { display: inline-block; }

  .main-navigation {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 10px 20px 16px;
    z-index: 50;
  }

  .main-navigation.is-open { display: block; }

  .main-navigation ul { flex-direction: column; align-items: stretch; }

  .main-navigation a { padding: 12px 10px; }

  .main-navigation li { display: flex; flex-wrap: wrap; align-items: center; }
  .main-navigation li > a { flex: 1; }

  .main-navigation .sub-menu {
    position: static;
    display: none;
    width: 100%;
    box-shadow: none;
    border: 0;
    border-left: 2px solid var(--border);
    border-radius: 0;
    margin-left: 14px;
    padding: 0 0 0 10px;
  }

  .main-navigation li:hover > .sub-menu,
  .main-navigation li:focus-within > .sub-menu { display: none; }

  .main-navigation .sub-menu.is-open { display: block; }

  .submenu-toggle { display: inline-block; }

  .header-inner { position: relative; flex-wrap: wrap; }

  .site-header { position: relative; }

  .post-grid { grid-template-columns: 1fr; }

  .author-bio { flex-direction: column; }
}

@media (max-width: 560px) {
  .related-grid { grid-template-columns: 1fr; }
  .footer-columns { grid-template-columns: 1fr; }
  .hero { padding: 44px 20px 34px; }
  .hero-title { font-size: 1.8rem; }
}
