/*
Theme Name: Kdubs.dev
Theme URI: https://kdubs.dev
Author: Kel Weaver
Description: Custom theme for kdubs.dev -- tech and gaming blog.
Version: 1.5
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kdubsdev
*/

:root {
	--color-text: #333333;
	--color-link: #428bca;
	--color-heading-accent: #d4315c;
	--color-banner-2: #484b6d;
	--color-footer-bg: #474c58;
	--color-box-bg: #fafafa;
	--font-body: 'Open Sans', sans-serif;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
}

body {
	font-family: var(--font-body);
	font-size: 14px;
	line-height: 20px;
	color: var(--color-text);
	min-height: 100vh;
	position: relative;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	background-image: url("images/motherboard-bg.jpg");
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	z-index: -1;
}

a {
	color: var(--color-link);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-body);
	color: var(--color-heading-accent);
	line-height: 1.3;
}

/* Everything below -- the wrapper, the color banner, the content
   box, the two-column layout and the footer bar -- share one
   width and sit stacked directly on top of each other, the same
   way they do on the live kdubs.dev site. */

/* kdubs.dev doesn't scale smoothly -- it jumps between fixed
   widths at specific screen sizes (625px, then 808px, then 975px
   once there's enough room), rather than growing continuously.
   Matching that exactly, instead of a smooth max-width, so the
   sidebar doesn't drift to a different size than the live site at
   in-between widths -- this also covers tablet widths like iPad
   Mini (768px) and Surface Pro (912px), which otherwise fell
   between our old two tiers and rendered full-bleed. */
.site-wrap {
	width: 100%;
	margin: 3rem auto;
}

@media (min-width: 768px) {
	.site-wrap {
		width: 625px;
	}
}

@media (min-width: 992px) {
	.site-wrap {
		width: 808px;
	}
}

@media (min-width: 1200px) {
	.site-wrap {
		width: 975px;
	}
}

/* The five-color strip above the content box. Just five boxes
   sitting in a row, each 1/5 of the width, cycling through three
   colors -- copied straight from kdubs.dev's own banner. */
.top-colors {
	display: flex;
}

.top-colors-segment {
	flex: 1 1 0%;
	height: 8px;
}

.top-colors-c1 {
	background-color: var(--color-heading-accent);
}

.top-colors-c2 {
	background-color: var(--color-banner-2);
}

.top-colors-c3 {
	background-color: var(--color-footer-bg);
}

.site-content-box {
	padding: 0 0 60px;
	background-color: var(--color-box-bg);
}

/* The topbar takes over the 60px strip that used to be empty
   padding-top on .site-content-box, so the gradient and the menu
   button both live in the same real element now instead of a
   background-size trick. It sticks to the top of the viewport on
   scroll, and stops sticking once .site-content-box scrolls out
   of view (position: sticky is bounded by its containing block). */
.site-topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	height: 60px;
	display: flex;
	align-items: stretch;
	background-color: var(--color-box-bg);
	background-image: linear-gradient(
		to right,
		rgba(0, 0, 0, 0.09) 0%,
		rgba(0, 0, 0, 0.09) 50%,
		rgba(0, 0, 0, 0) 100%
	);
	background-repeat: no-repeat;
	background-position: top left;
	background-size: 300px 60px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Flush against the topbar's top/left/bottom edges, filling its
   full height -- the gradient (set on .site-topbar itself) starts
   wherever this opaque button's right edge happens to end. */
.site-menu-toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	border: 0;
	background-color: var(--color-footer-bg);
	color: #ffffff;
	font-family: inherit;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	padding: 0 28px;
	cursor: pointer;
}

.site-menu-toggle:hover {
	background-color: #3a3e48;
}

.site-title {
	align-self: center;
	margin: 0 0 0 20px;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.1;
}

.site-title a {
	color: var(--color-heading-accent);
}

.site-title a:hover {
	text-decoration: none;
}

.site-menu-toggle-icon {
	width: 16px;
	height: 16px;
}

/* Sidebar width matches kdubs.dev's actual column math (4/12 of
   the box). kdubs.dev also wastes a blank 1/12 strip on the left
   before the main column starts -- skipped here on purpose so the
   main column fills that space instead, flush with the box's left
   edge. Each column keeps its own 15px left/right padding, same
   as kdubs.dev's. */
.site-layout {
	display: flex;
	align-items: flex-start;
	/* A touch of top margin so the sticky topbar's drop shadow
	   doesn't crowd the content right below it (search box, first
	   post title, etc.). */
	margin-top: 16px;
}

.site-main {
	flex: 0 0 66.6667%;
	box-sizing: border-box;
	/* Extra left padding instead of a separate empty column --
	   same visual margin kdubs.dev gets from its blank 1/12
	   spacer, without needing a leftover unused element for it. */
	padding: 0 15px 0 50px;
	min-width: 0;
}

.site-sidebar {
	flex: 0 0 33.3333%;
	box-sizing: border-box;
	padding: 0 15px;
	min-width: 0;
}

.site-sidebar .widget + .widget {
	margin-top: 2rem;
}

.widget-title {
	font-weight: 500;
	font-size: 30px;
	line-height: 1.1;
	color: var(--color-heading-accent);
	margin: 0 0 10px;
}

.widget-search label {
	display: block;
	font-weight: 700;
	font-size: 13px;
	margin-bottom: 5px;
}

.search-form-row {
	display: flex;
	gap: 0.5rem;
}

.search-field {
	flex: 1 1 auto;
	min-width: 0;
	border: 1px solid #949494;
	padding: 8px;
	font-family: inherit;
	font-size: 14px;
	background-color: #ffffff;
}

.search-submit {
	flex: 0 0 auto;
	background-color: #32373c;
	color: #ffffff;
	border: none;
	padding: 10px 20px;
	font-family: inherit;
	font-size: 14px;
	cursor: pointer;
}

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

.site-sidebar li {
	font-size: 13px;
	line-height: 2;
}

.site-sidebar li a {
	color: var(--color-text);
	text-decoration: none;
}

.site-sidebar li a:hover {
	text-decoration: underline;
}

.site-footer-bar {
	background-color: var(--color-footer-bg);
	color: #ffffff;
	text-align: center;
	padding: 1.25rem 0;
}

.site-footer-bar p {
	margin: 0;
}

/* Blog index -- one of these per post, title + byline + excerpt,
   copied from how kdubs.dev lays out its post entries. */
.post-entry + .post-entry {
	margin-top: 2.5rem;
}

.entry-title-link {
	color: inherit;
}

.entry-title {
	font-weight: 700;
	font-size: 20px;
	line-height: 1.1;
	color: #000000;
	text-transform: uppercase;
	margin: 14px 0 10px;
	padding-bottom: 5px;
	border-bottom: 1px solid #cccccc;
}

.entry-title-link:hover .entry-title {
	color: var(--color-link);
}

.entry-meta {
	display: flex;
	align-items: center;
	gap: 4px;
	font-weight: 700;
	font-size: 14px;
	line-height: 1.1;
	color: #777777;
	margin: 10px 0;
}

.entry-date {
	font-weight: 200;
	font-style: italic;
}

.entry-meta-icon {
	width: 14px;
	height: 14px;
	color: #777777;
}

.entry-body {
	display: flex;
	align-items: flex-start;
	gap: 15px;
}

.entry-thumbnail-link {
	display: block;
	flex: 0 0 auto;
}

.entry-thumbnail-img {
	display: block;
	width: 120px;
	height: 120px;
	object-fit: cover;
}

.entry-excerpt {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 13px;
	line-height: 19px;
}

.entry-excerpt p {
	margin: 0;
}

.entry-thumbnail {
	margin: 20px 0;
}

.entry-thumbnail img {
	display: block;
	max-width: 100%;
	height: auto;
}

.entry-content {
	font-size: 13px;
	line-height: 19px;
	color: #333333;
}

.entry-content p {
	margin: 0 0 10px;
}

.entry-content a {
	color: #428bca;
	text-decoration: none;
}

.entry-content a:hover {
	text-decoration: underline;
}

.entry-content img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 10px 0;
}

.entry-content blockquote {
	margin: 0 0 10px 20px;
	padding-left: 15px;
	border-left: 3px solid #cccccc;
	color: #555555;
}

.entry-content ul,
.entry-content ol {
	margin: 0 0 10px;
	padding-left: 24px;
}

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

.pagination {
	margin-top: 2.5rem;
}

.pagination .nav-links {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	font-weight: 700;
}

@media (max-width: 991px) {
	.site-layout {
		flex-direction: column;
	}

	.site-main,
	.site-sidebar {
		flex-basis: auto;
		padding: 0 15px;
	}
}

@media (max-width: 767px) {
	/* A real outer margin here (not padding) so the fixed background
	   photo shows through on both sides, same as the live site at
	   this width. */
	.site-wrap {
		width: auto;
		margin: 0 10px;
	}

	/* Bottom spacing only -- no top padding, so .site-topbar (a
	   direct child of .site-content-box) stays flush against the
	   color bar above it, same as on desktop. No horizontal padding
	   either, since the topbar needs to stay flush edge-to-edge too
	   -- the main column and sidebar already get their own 15px
	   side padding from the =991px breakpoint above, so text
	   content still has room to breathe. */
	.site-content-box {
		padding: 0 0 1.5rem;
	}
}

/* Slide-out menu panel + backdrop. Hidden off-screen to the left
   by default; js/site-menu.js toggles .is-open on both when the
   topbar's MENU button, the close button, the backdrop, or Escape
   is used. */
.site-menu {
	position: fixed;
	top: 0;
	left: 0;
	height: 100vh;
	width: 250px;
	max-width: 85vw;
	background-color: #111111;
	color: #ffffff;
	transform: translateX(-100%);
	transition: transform 0.25s ease;
	z-index: 200;
	overflow-y: auto;
	padding: 30px 20px 20px;
	box-sizing: border-box;
}

.site-menu.is-open {
	transform: translateX(0);
}

.site-menu-close {
	display: block;
	position: absolute;
	top: 12px;
	right: 14px;
	margin: 0;
	border: 0;
	background: none;
	color: #ffffff;
	padding: 6px;
	cursor: pointer;
}

.site-menu-close svg {
	width: 18px;
	height: 18px;
}

.site-menu-avatar {
	display: block;
	width: 136px;
	height: 136px;
	margin: 0 auto;
	padding: 8px;
	box-sizing: border-box;
	background-color: #ffffff;
	border-radius: 50%;
	overflow: hidden;
}

.site-menu-avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.site-menu-name {
	margin: 1.5rem auto 0;
	padding: 8px 20px;
	border: 2px solid #ffffff;
	max-width: fit-content;
	font-size: 22px;
	font-weight: 200;
	text-transform: uppercase;
	text-align: center;
}

.site-menu-name strong {
	font-weight: 700;
}

.site-menu-job {
	margin: 5px 0 20px;
	font-size: 12px;
	color: #d8d8d8;
	text-align: center;
}

.site-menu-nav {
	margin-top: 1.5rem;
}

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

.site-menu-list li + li {
	margin-top: 0.75rem;
}

.site-menu-list a {
	color: #ffffff;
	font-weight: 700;
}

.site-menu-backdrop {
	position: fixed;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.45);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease;
	z-index: 150;
}

.site-menu-backdrop.is-open {
	opacity: 1;
	visibility: visible;
}

body.site-menu-locked {
	overflow: hidden;
}

/* WordPress's own admin toolbar is supposed to stay position:
   fixed at all widths (that's its own default CSS), but something
   in this environment was leaving it computed as absolute at
   narrow widths, making its real on-screen position move around
   unpredictably. Pin it down ourselves so it's always truly fixed,
   then our own sticky header/menu just need a plain top offset
   matching its height, same approach at every width. */
#wpadminbar {
	position: fixed !important;
	top: 0 !important;
}

@media screen and (min-width: 783px) {
	body.admin-bar .site-topbar {
		top: 32px;
	}

	body.admin-bar .site-menu-backdrop {
		top: 32px;
	}

	body.admin-bar .site-menu {
		top: 32px;
		height: calc(100vh - 32px);
	}
}

@media screen and (max-width: 782px) {
	body.admin-bar .site-topbar {
		top: 46px;
	}

	body.admin-bar .site-menu-backdrop {
		top: 46px;
	}

	body.admin-bar .site-menu {
		top: 46px;
		height: calc(100vh - 46px);
	}
}
