/*
Theme Name: Hadberg Knowledge Base
Theme URI: https://hadberg.eu/
Author: Lucas Hadberg
Author URI: https://hadberg.eu/
Description: A clean, modern WordPress theme for a Microsoft 365, Intune and Modern Workplace knowledge base. Includes responsive card layouts, featured images, accessible navigation and branded header/footer styling.
Version: 1.0.14
Requires at least: 6.4
Tested up to: 6.5
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: hadberg-kb
Tags: blog, custom-logo, featured-images, one-column, two-columns, right-sidebar, custom-menu, responsive-layout, accessibility-ready
*/

:root {
  --hb-bg: #f4f7fb;
  --hb-surface: #ffffff;
  --hb-surface-2: #eef4fb;
  --hb-text: #162033;
  --hb-muted: #657386;
  --hb-navy: #031633;
  --hb-navy-2: #08224a;
  --hb-blue: #00a9ff;
  --hb-blue-dark: #0878c9;
  --hb-border: #dce5ef;
  --hb-shadow: 0 18px 44px rgba(3, 22, 51, 0.10);
  --hb-radius: 8px;
  --hb-radius-sm: 8px;
  --hb-container: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--hb-text);
  background: var(--hb-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; }
a { color: var(--hb-blue-dark); text-decoration-thickness: 0.08em; text-underline-offset: 0.2em; }
a:hover { color: var(--hb-navy); }
.screen-reader-text { border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important; }
.skip-link:focus { clip: auto; clip-path: none; height: auto; width: auto; left: 16px; top: 16px; z-index: 100000; background: #fff; color: #000; padding: 10px 14px; border-radius: 8px; }

.hb-container { width: min(var(--hb-container), calc(100% - 40px)); margin-inline: auto; }

.site-header { background: linear-gradient(135deg, var(--hb-navy), var(--hb-navy-2)); color: #fff; position: relative; overflow: hidden; }
.site-header::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 15%, rgba(0,169,255,.26), transparent 24%), radial-gradient(circle at 12% 90%, rgba(0,169,255,.16), transparent 28%); pointer-events: none; }
.header-inner { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 28px; min-height: 148px; padding: 28px 0; }
.branding { display: flex; align-items: center; gap: 16px; min-width: 0; color: #fff; border-radius: 16px; text-decoration: none; }
.branding:hover,
.branding:focus-visible { color: #fff; text-decoration: none; }
.branding:focus-visible { outline: 2px solid rgba(0,169,255,.72); outline-offset: 6px; }
.branding:hover .site-logo-frame,
.branding:focus-visible .site-logo-frame { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(0,0,0,.24), 0 0 0 1px rgba(0,169,255,.32); }
.branding:hover .site-title,
.branding:focus-visible .site-title { color: #fff; text-shadow: 0 0 18px rgba(0,169,255,.24); }
.branding:hover .site-description,
.branding:focus-visible .site-description { color: rgba(255,255,255,.9); }
.branding > span:last-child { min-width: 0; }
.site-logo-frame { width: 64px; height: 64px; flex: 0 0 64px; overflow: hidden; border-radius: 14px; background: var(--hb-navy); box-shadow: 0 12px 32px rgba(0,0,0,.18); transition: transform .18s ease, box-shadow .18s ease; }
.site-logo { width: 100%; height: 100%; max-width: none; object-fit: contain; display: block; }
.site-title { display: block; margin: 0; font-size: 2.05rem; line-height: 1.05; font-weight: 850; letter-spacing: 0; }
.site-description { margin: 5px 0 0; color: rgba(255,255,255,.78); font-size: .97rem; line-height: 1.35; }

.site-nav { background: #111827; color: #fff; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.menu { display: flex; flex-wrap: wrap; align-items: center; gap: 0; list-style: none; padding: 0; margin: 0; }
.menu a { display: block; color: #fff; text-decoration: none; padding: 16px 18px; font-weight: 650; font-size: .95rem; }
.menu a:hover, .menu .current-menu-item > a, .menu .current_page_item > a { background: rgba(255,255,255,.08); color: #fff; }
.nav-cta { color: #fff; text-decoration: none; background: var(--hb-blue-dark); padding: 9px 14px; border-radius: 999px; font-weight: 750; font-size: .9rem; white-space: nowrap; }

.hero { padding: 34px 0 18px; }
.hero-card { background: var(--hb-surface); border: 1px solid var(--hb-border); border-radius: var(--hb-radius); box-shadow: var(--hb-shadow); padding: clamp(24px, 4vw, 42px); }
.hero h1 { margin: 0 0 8px; font-size: 3rem; line-height: 1; letter-spacing: 0; }
.hero p { margin: 0; color: var(--hb-muted); font-size: 1.12rem; max-width: 850px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; padding: 24px 0 52px; }
.layout--home { padding-top: 36px; }
.content-area { min-width: 0; }
.section-header { margin: 0 0 18px; }
.section-header h1 { margin: 0; font-size: 1.65rem; line-height: 1.15; letter-spacing: 0; }
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.card { display: flex; flex-direction: column; background: var(--hb-surface); border: 1px solid var(--hb-border); border-radius: var(--hb-radius); overflow: hidden; box-shadow: 0 10px 28px rgba(3,22,51,.07); transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-3px); box-shadow: var(--hb-shadow); }
.card-media { display: block; aspect-ratio: 3 / 2; background: var(--hb-navy); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { display: flex; flex: 1; flex-direction: column; padding: 20px; }
.card--text-only { border-top: 4px solid var(--hb-blue-dark); }
.card--text-only .card-body { padding-top: 20px; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--hb-muted); font-size: .9rem; margin-bottom: 10px; }
.entry-meta a { color: var(--hb-muted); text-decoration: none; }
.entry-title { margin: 0 0 12px; font-size: 1.65rem; line-height: 1.15; letter-spacing: 0; }
.card .entry-title { font-size: 1.16rem; }
.entry-title a { color: var(--hb-text); text-decoration: none; }
.entry-title a:hover { color: var(--hb-blue-dark); }
.entry-summary, .entry-content { color: #344055; }
.read-more { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; color: var(--hb-blue-dark); font-weight: 750; text-decoration: none; }
.post-categories { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 12px; padding: 0; }
.post-categories a { background: rgba(0,169,255,.12); color: var(--hb-blue-dark); text-decoration: none; font-weight: 750; font-size: .78rem; padding: 5px 10px; border-radius: 999px; }

.single-article { background: var(--hb-surface); border: 1px solid var(--hb-border); border-radius: var(--hb-radius); box-shadow: var(--hb-shadow); overflow: hidden; }
.single-body { padding: clamp(24px, 4vw, 48px); }
.single-body .entry-title { font-size: 3rem; }
.entry-content h2 { margin-top: 2.1em; line-height: 1.2; letter-spacing: 0; }
.entry-content h3 { margin-top: 1.8em; line-height: 1.25; }
.entry-content pre { overflow-x: auto; background: #0b1220; color: #f8fafc; padding: 18px; border-radius: var(--hb-radius-sm); }
.entry-content code { background: var(--hb-surface-2); padding: 2px 6px; border-radius: 6px; }
.entry-content pre code { background: transparent; padding: 0; }
.entry-content blockquote { border-left: 4px solid var(--hb-blue); margin-left: 0; padding-left: 18px; color: #344055; }

.sidebar { display: flex; flex-direction: column; gap: 20px; }
.profile-card,
.certifications-card { background: var(--hb-surface); border: 1px solid var(--hb-border); border-radius: var(--hb-radius); box-shadow: 0 8px 22px rgba(3,22,51,.06); }
.profile-card { display: grid; grid-template-columns: var(--profile-photo-size, 76px) minmax(0,1fr); align-items: center; gap: 14px; padding: 16px; background: linear-gradient(135deg, #ffffff 0%, #f1f6ff 100%); }
.profile-photo-wrap { width: var(--profile-photo-size, 76px); height: var(--profile-photo-size, 76px); border: 3px solid #d7e7ff; border-radius: 999px; overflow: hidden; background: #fff; box-shadow: 0 10px 24px rgba(8,120,201,.12); }
.profile-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-copy { min-width: 0; align-self: center; }
.profile-copy h2 { margin: 0 0 4px; font-size: 1.12rem; line-height: 1.2; letter-spacing: 0; }
.profile-copy p { margin: 0; color: var(--hb-muted); font-size: .88rem; line-height: 1.38; }
.certifications-card { padding: 18px; background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); }
.certifications-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--hb-border); }
.certifications-header h2 { margin: 0; font-size: 1.05rem; line-height: 1.2; letter-spacing: 0; }
.certifications-header a { flex: 0 0 auto; border: 1px solid var(--hb-border); border-radius: 999px; padding: 6px 10px; color: var(--hb-muted); font-size: .82rem; line-height: 1; text-decoration: none; }
.certifications-header a:hover { border-color: var(--hb-blue-dark); color: var(--hb-blue-dark); }
.certification-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.certification-badge { min-width: 0; min-height: 116px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 12px 10px; background: rgba(255,255,255,.9); border: 1px solid #d8e4f0; border-radius: 8px; box-shadow: inset 0 1px 0 rgba(255,255,255,.7); text-align: center; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.certification-badge:first-child { grid-column: 1 / -1; min-height: 140px; padding: 16px; background: #fff; }
.certification-badge:hover { transform: translateY(-2px); border-color: rgba(8,120,201,.38); box-shadow: 0 10px 22px rgba(3,22,51,.08); }
.certification-badge a { color: var(--hb-text); text-decoration: none; }
.certification-badge a:hover { color: var(--hb-blue-dark); }
.certification-badge figure,
.certification-badge .wp-block-image { margin: 0; }
.certification-badge img { max-width: 98px; max-height: 86px; width: auto; margin: 0 auto; object-fit: contain; filter: drop-shadow(0 8px 12px rgba(3,22,51,.10)); }
.certification-badge:first-child img { max-width: 138px; max-height: 104px; }
.certification-badge figcaption,
.certification-badge-title { margin: 4px 0 0; color: var(--hb-muted); font-size: .82rem; line-height: 1.25; font-weight: 650; }
.widget { background: var(--hb-surface); border: 1px solid var(--hb-border); border-radius: var(--hb-radius); padding: 22px; box-shadow: 0 8px 22px rgba(3,22,51,.06); }
.widget:empty { display: none; }
.widget-title { margin: 0 0 12px; font-size: 1.1rem; letter-spacing: 0; }
.widget > :first-child { margin-top: 0; }
.widget > :last-child { margin-bottom: 0; }
.widget p { color: var(--hb-muted); }
.widget ul, .widget ol { padding-left: 1.2rem; }
.widget img { display: block; max-width: 100%; height: auto; }
.widget .wp-block-image { margin: 0 0 18px; }
.widget .wp-block-image img { width: 100%; }
.widget form[role="search"],
.widget .search-form,
.widget .wp-block-search__inside-wrapper { display: grid; gap: 10px; }
.widget .search-form label { display: block; }
.widget .search-field,
.widget .wp-block-search__input { min-width: 0; height: 48px; }
.widget .search-submit,
.widget .wp-block-search__button { width: 100%; min-height: 46px; margin-left: 0; border-radius: 8px; }
@supports selector(:has(*)) {
  .widget:has(> .wp-block-spacer:only-child),
  .widget:has(> p:empty:only-child),
  .widget:has(.wp-block-spacer):not(:has(img, input, textarea, select, button, a, svg, canvas, iframe, video, audio, form, h1, h2, h3, h4, h5, h6, p:not(:empty), li:not(:empty))) { display: none; }
}

.pagination, .posts-navigation, .post-navigation { margin-top: 30px; }
.nav-links { display: flex; gap: 18px; }
.pagination .nav-links { justify-content: center; flex-wrap: wrap; gap: 10px; }
.page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 42px; padding: 0 14px; background: #fff; border: 1px solid var(--hb-border); border-radius: 999px; box-shadow: 0 8px 22px rgba(3,22,51,.05); text-decoration: none; font-weight: 800; line-height: 1; }
.page-numbers.current { background: var(--hb-navy); border-color: var(--hb-navy); color: #fff; box-shadow: 0 12px 26px rgba(3,22,51,.16); }
.page-numbers.dots { min-width: auto; border: 0; background: transparent; box-shadow: none; color: var(--hb-muted); }
.posts-navigation .nav-links,
.post-navigation .nav-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; justify-content: initial; }
.posts-navigation .nav-previous,
.posts-navigation .nav-next,
.post-navigation .nav-previous,
.post-navigation .nav-next { min-width: 0; }
.posts-navigation .nav-previous,
.post-navigation .nav-previous { grid-column: 1; }
.posts-navigation .nav-next,
.post-navigation .nav-next { grid-column: 2; text-align: right; }
.posts-navigation .nav-links a,
.post-navigation .nav-links a { display: block; height: 100%; background: #fff; border: 1px solid var(--hb-border); border-radius: var(--hb-radius); padding: 16px 18px; box-shadow: 0 8px 22px rgba(3,22,51,.05); text-decoration: none; font-weight: 750; line-height: 1.35; overflow-wrap: anywhere; }
.posts-navigation .nav-links a:hover,
.post-navigation .nav-links a:hover { border-color: var(--hb-blue-dark); box-shadow: 0 12px 26px rgba(3,22,51,.09); }
.post-navigation .nav-subtitle { display: block; margin-bottom: 7px; color: var(--hb-muted); font-size: .78rem; font-weight: 850; line-height: 1.2; text-transform: uppercase; }
.post-navigation .nav-title { display: block; color: var(--hb-blue-dark); font-size: 1.05rem; line-height: 1.3; }
.comment-respond,
.comments-area { margin-top: 24px; background: var(--hb-surface); border: 1px solid var(--hb-border); border-radius: var(--hb-radius); box-shadow: 0 10px 28px rgba(3,22,51,.07); padding: clamp(22px, 4vw, 32px); }
.comments-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 18px; }
.comment-reply-title,
.comments-title { margin: 0; font-size: 1.3rem; line-height: 1.2; letter-spacing: 0; }
.comment-reply-title { margin-bottom: 16px; }
.comments-count { margin: 0; color: var(--hb-muted); font-size: .92rem; font-weight: 650; }
.comment-list,
.comment-list .children { list-style: none; margin: 0; padding: 0; }
.comment-list { display: grid; gap: 16px; }
.comment-list .children { display: grid; gap: 16px; margin-top: 16px; margin-left: 28px; padding-left: 20px; border-left: 2px solid var(--hb-border); }
.comment-list .comment,
.comment-list .pingback,
.comment-list .trackback { margin: 0; }
.comment-body { padding: 18px; background: #fff; border: 1px solid var(--hb-border); border-radius: var(--hb-radius); box-shadow: 0 8px 20px rgba(3,22,51,.05); }
.bypostauthor > .comment-body { border-color: rgba(0,169,255,.42); box-shadow: 0 10px 24px rgba(8,120,201,.09); }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 12px; min-width: 0; }
.comment-author { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.comment-author .avatar { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 999px; object-fit: cover; background: var(--hb-surface-2); }
.comment-author .fn { font-weight: 800; overflow-wrap: anywhere; }
.comment-author .says { color: var(--hb-muted); font-size: .9rem; }
.comment-metadata { flex-basis: 100%; margin-left: 60px; margin-top: -10px; color: var(--hb-muted); font-size: .82rem; line-height: 1.35; }
.comment-metadata a,
.comment-edit-link { color: var(--hb-muted); text-decoration: none; }
.comment-metadata a:hover,
.comment-edit-link:hover { color: var(--hb-blue-dark); text-decoration: underline; }
.comment-awaiting-moderation { flex-basis: 100%; margin: 8px 0 0 60px; color: var(--hb-blue-dark); font-weight: 700; }
.comment-content { color: #344055; overflow-wrap: anywhere; }
.comment-content > :first-child { margin-top: 0; }
.comment-content > :last-child { margin-bottom: 0; }
.comment-content pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; background: #0b1220; color: #f8fafc; padding: 14px; border-radius: var(--hb-radius-sm); font-size: .92rem; line-height: 1.55; }
.comment-content code { background: var(--hb-surface-2); padding: 2px 6px; border-radius: 6px; }
.comment-content pre code { background: transparent; padding: 0; }
.comment-content blockquote { border-left: 4px solid var(--hb-blue); margin-left: 0; padding-left: 16px; color: #344055; }
.comment-content img { display: block; border-radius: var(--hb-radius-sm); }
.reply { margin-top: 14px; }
.comment-reply-link { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 11px; border: 1px solid var(--hb-border); border-radius: 999px; color: var(--hb-blue-dark); font-size: .9rem; font-weight: 750; line-height: 1; text-decoration: none; }
.comment-reply-link:hover { border-color: var(--hb-blue-dark); background: rgba(0,169,255,.08); color: var(--hb-blue-dark); }
.comment-navigation { margin: 0 0 18px; }
.comment-list + .comment-navigation { margin: 18px 0 0; }
.comment-navigation .nav-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.comment-navigation a { display: inline-flex; align-items: center; min-height: 38px; padding: 8px 12px; border: 1px solid var(--hb-border); border-radius: 999px; text-decoration: none; font-weight: 750; }
.no-comments { margin: 18px 0 0; color: var(--hb-muted); font-weight: 650; }
.comment-form { display: grid; gap: 14px; }
.comment-form p { margin: 0; }
.comment-form label { display: block; margin-bottom: 6px; font-weight: 650; }
.comment-form textarea { display: block; min-height: 180px; resize: vertical; }
.logged-in-as,
.comment-notes { color: var(--hb-muted); }
.comment-form-cookies-consent { display: flex; align-items: flex-start; gap: 10px; }
.comment-form-cookies-consent input { width: auto; flex: 0 0 auto; margin: .35em 0 0; }
.comment-form-cookies-consent label { margin: 0; color: var(--hb-muted); font-weight: 500; line-height: 1.45; }
.comment-form input[type="submit"] { justify-self: start; min-height: 46px; }
.comment .comment-respond { margin-top: 16px; border-color: var(--hb-border); box-shadow: none; }

.site-footer { background: var(--hb-navy); color: rgba(255,255,255,.72); padding: 30px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer-inner a { color: #fff; }

button, input, textarea, select { font: inherit; }
input[type="search"], input[type="text"], input[type="email"], input[type="url"], textarea { width: 100%; border: 1px solid var(--hb-border); border-radius: 10px; padding: 10px 12px; }
input[type="submit"], button { border: 0; background: var(--hb-blue-dark); color: #fff; border-radius: 10px; padding: 10px 14px; font-weight: 750; cursor: pointer; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .header-inner { align-items: flex-start; flex-direction: column; }
  .site-logo-frame { width: 52px; height: 52px; flex-basis: 52px; }
  .site-title { font-size: 1.55rem; }
  .hero h1 { font-size: 2.1rem; }
  .hero p { font-size: 1rem; }
  .entry-title,
  .single-body .entry-title { font-size: 2rem; }
  .card .entry-title { font-size: 1.16rem; }
  .nav-inner { align-items: stretch; flex-direction: column; gap: 0; }
  .menu { overflow-x: auto; flex-wrap: nowrap; }
  .menu a { padding: 14px 13px; }
  .nav-cta { display: none; }
  .post-grid { grid-template-columns: 1fr; }
  .posts-navigation .nav-links,
  .post-navigation .nav-links { grid-template-columns: 1fr; }
  .posts-navigation .nav-previous,
  .posts-navigation .nav-next,
  .post-navigation .nav-previous,
  .post-navigation .nav-next { grid-column: auto; text-align: left; }
  .comment-list .children { margin-left: 0; padding-left: 12px; }
  .comment-body { padding: 15px; }
  .comment-metadata,
  .comment-awaiting-moderation { margin-left: 0; margin-top: 0; }
  .sidebar { grid-template-columns: 1fr; }
  .hb-container { width: min(var(--hb-container), calc(100% - 28px)); }
}
