/* ==========================================================================
   Zypheral — main stylesheet (all views)
   Tokens mirror www.zypheral.com (styles.css) so blog/tutorials feel native.
   ========================================================================== */

/* Fonts (self-hosted, variable, latin subset) -------------------------------- */
@font-face {
	font-family: "Geist";
	src: url("../fonts/geist-var.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Sora";
	src: url("../fonts/sora-var.woff2") format("woff2");
	font-weight: 100 800;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Geist Mono";
	src: url("../fonts/geist-mono-var.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

/* Tokens --------------------------------------------------------------------- */
:root {
	/* Brand (www.zypheral.com) */
	--accent: #14E08A;
	--accent-2: #0EAE69;
	--accent-ink: #0A3B25;
	--accent-soft: #D9FBE8;
	--accent-glow: rgba(20, 224, 138, 0.35);

	--bg: #F6F5F1;
	--surface: #FFFFFF;
	--surface-2: #FAF9F5;
	--ink: #0B0E12;
	--ink-2: #1A1F26;
	--ink-3: #2A3038;
	--muted: #5B6470;
	--muted-2: #8A929D;
	--line: rgba(11, 14, 18, 0.10);
	--line-soft: rgba(11, 14, 18, 0.06);

	--dark-bg: #0B0E12;
	--dark-surface: #12161C;
	--dark-line: rgba(255, 255, 255, 0.10);
	--dark-muted: #9AA3AE;

	/* Status (dash.zypheral.com, light) */
	--warn: #b7791f;
	--warn-soft: rgba(183, 121, 31, 0.10);
	--danger: #e0314f;
	--danger-soft: rgba(224, 49, 79, 0.08);
	--info: #0d80c9;
	--info-soft: rgba(13, 128, 201, 0.08);

	/* Links: accent green fails AA on white as text, so links use the deep brand green. */
	--link: #0A7A4B;
	--link-hover: var(--accent-ink);

	--font-body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-display: "Sora", "Geist", system-ui, sans-serif;
	--font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

	--radius-sm: 10px;
	--radius: 16px;
	--radius-lg: 24px;
	--radius-pill: 999px;

	--shadow-sm: 0 1px 0 rgba(11, 14, 18, 0.04), 0 1px 2px rgba(11, 14, 18, 0.04);
	--shadow-md: 0 1px 2px rgba(11, 14, 18, 0.06), 0 10px 30px -8px rgba(11, 14, 18, 0.10);
	--shadow-lg: 0 1px 2px rgba(11, 14, 18, 0.06), 0 20px 50px -10px rgba(11, 14, 18, 0.16);

	--container: 1240px;
	--gutter: clamp(16px, 4vw, 32px);
	--header-h: 68px;
	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: calc(var(--header-h) + 16px);
}
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

body {
	margin: 0;
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.6;
	color: var(--ink);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: clip;
}

img,
svg,
video { max-width: 100%; height: auto; }
img { display: block; }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-display);
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.2;
	color: var(--ink);
	margin: 0;
}
p { margin: 0; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }

:focus-visible {
	outline: 2px solid var(--accent-2);
	outline-offset: 2px;
	border-radius: 4px;
}

::selection { background: var(--accent-soft); color: var(--accent-ink); }

button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}
.skip-link:focus {
	position: fixed !important;
	top: 12px; left: 12px; z-index: 1000;
	width: auto; height: auto; clip: auto;
	padding: 10px 16px;
	background: var(--ink); color: #fff;
	border-radius: var(--radius-sm);
	text-decoration: none;
}
.site-main:focus { outline: none; }

/* Layout --------------------------------------------------------------------- */
.container {
	width: 100%;
	max-width: calc(var(--container) + var(--gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--gutter);
}
.container--narrow { max-width: calc(760px + var(--gutter) * 2); }

.section { padding-block: clamp(24px, 4vw, 48px) clamp(48px, 8vw, 96px); }
.section__block + .section__block { margin-top: clamp(40px, 6vw, 72px); }
.section__block:first-child { margin-top: 0; }
.section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	margin-bottom: 20px;
}
.section__title { font-size: clamp(20px, 2.2vw, 26px); }

.grid { display: grid; gap: clamp(16px, 2.4vw, 28px); }
.grid--cards { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .grid--cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Small type helpers ----------------------------------------------------------- */
.eyebrow {
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 10px;
}
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow--accent { color: var(--accent-2); }

.meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	font-family: var(--font-mono);
	font-size: 12.5px;
	color: var(--muted);
}
.meta__sep { color: var(--muted-2); }

/* Buttons, chips, pills, badges ---------------------------------------------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 20px;
	border: 1px solid transparent;
	border-radius: var(--radius-pill);
	font-weight: 500;
	font-size: 15px;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.btn--sm { min-height: 40px; padding: 0 16px; font-size: 14px; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--ink-3); color: #fff; }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { background: #3be9a0; color: var(--accent-ink); box-shadow: 0 8px 24px -8px var(--accent-glow); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }

.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--radius-pill);
	background: transparent;
	color: var(--ink);
	cursor: pointer;
	text-decoration: none;
	transition: background-color .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn--outline { border: 1px solid var(--line); background: var(--surface); }
.icon-btn--outline:hover { border-color: var(--ink); background: var(--surface); }

.chip {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius-pill);
	background: var(--surface);
	color: var(--ink-2);
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
	text-decoration: none;
	transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip--sm { min-height: 32px; padding: 0 12px; font-size: 13px; }

.pill {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	border-radius: var(--radius-pill);
	background: var(--accent-soft);
	color: var(--accent-ink);
	font-family: var(--font-mono);
	font-size: 11.5px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	position: relative;
	z-index: 2;
}
.pill:hover { background: var(--accent); color: var(--accent-ink); }
.pill--tutorial_topic { background: var(--ink); color: var(--accent); }
.pill--tutorial_topic:hover { background: var(--ink-3); color: var(--accent); }

.badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 9px;
	border: 1px solid var(--line);
	border-radius: var(--radius-pill);
	font-family: var(--font-mono);
	font-size: 11.5px;
	color: var(--ink-2);
	background: var(--surface);
}
.badge--beginner .icon { color: var(--accent-2); }
.badge--intermediate .icon { color: var(--warn); }
.badge--advanced .icon { color: var(--danger); }

/* Header ----------------------------------------------------------------------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(246, 245, 241, 0.86);
	-webkit-backdrop-filter: saturate(160%) blur(12px);
	backdrop-filter: saturate(160%) blur(12px);
	border-bottom: 1px solid var(--line-soft);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header { top: 0; } }

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 24px;
	height: var(--header-h);
}
.site-header__actions {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-left: auto;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--ink);
	text-decoration: none;
	flex-shrink: 0;
}
.brand:hover { color: var(--ink); }
.brand__mark { height: 34px; width: auto; }
.brand__word {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 20px;
	letter-spacing: -0.02em;
}
.brand--white, .brand--white:hover { color: #fff; }

.nav__list {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.nav__list a {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 14px;
	border-radius: var(--radius-pill);
	color: var(--ink-2);
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
}
.nav__list a:hover { background: var(--line-soft); color: var(--ink); }
.nav__list .current-menu-item > a,
.nav__list .current_page_item > a,
.nav__list a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }

.nav-toggle { display: none; }

@media (max-width: 859px) {
	.nav-toggle { display: inline-grid; }
	.site-header__cta { display: none; }
	.nav {
		position: fixed;
		inset: var(--header-h) 0 0 0;
		z-index: 49;
		padding: 16px var(--gutter) 32px;
		background: var(--bg);
		border-top: 1px solid var(--line-soft);
		overflow-y: auto;
		visibility: hidden;
		opacity: 0;
		transform: translateY(-8px);
		transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s linear .2s;
	}
	.admin-bar .nav { top: calc(var(--header-h) + 46px); }
	.nav.is-open {
		visibility: visible;
		opacity: 1;
		transform: none;
		transition: opacity .2s var(--ease), transform .2s var(--ease);
	}
	.nav__list { flex-direction: column; align-items: stretch; gap: 4px; }
	.nav__list a { min-height: 52px; font-size: 18px; padding: 0 16px; }
	body.nav-open { overflow: hidden; }
}

.site-search {
	border-top: 1px solid var(--line-soft);
	padding-block: 16px;
	background: var(--bg);
}

/* Search form ------------------------------------------------------------------ */
.search-form {
	display: flex;
	align-items: center;
	gap: 8px;
	max-width: 640px;
	padding: 6px 6px 6px 16px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-pill);
	box-shadow: var(--shadow-sm);
	transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.search-form:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-form > .icon { color: var(--muted); flex-shrink: 0; }
.search-form__input {
	flex: 1;
	min-width: 0;
	min-height: 40px;
	border: 0;
	background: transparent;
	color: var(--ink);
	font-size: 16px;
}
.search-form__input:focus { outline: none; }
.search-form__input::placeholder { color: var(--muted-2); }

/* Category/topic chip bar -------------------------------------------------------- */
.chipbar {
	border-bottom: 1px solid var(--line-soft);
	background: var(--bg);
}
.chipbar__inner {
	display: flex;
	gap: 8px;
	padding-block: 12px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
	mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
}
.chipbar__inner::-webkit-scrollbar { display: none; }

/* Page head (listings) ------------------------------------------------------------- */
.page-head { padding-block: clamp(28px, 5vw, 56px) 8px; }
.page-head__title {
	font-size: clamp(30px, 4.2vw, 52px);
	line-height: 1.08;
	letter-spacing: -0.03em;
	max-width: 22ch;
}
.page-head__lead {
	margin-top: 14px;
	max-width: 60ch;
	font-size: clamp(16px, 1.4vw, 18px);
	color: var(--muted);
}
.page-head__search { margin-top: 24px; }
.page-head .level-filter { margin-top: 18px; }

.author-head { display: flex; gap: 20px; align-items: flex-start; }
.author-head__avatar { border-radius: 50%; flex-shrink: 0; }

/* Breadcrumbs -------------------------------------------------------------------- */
.breadcrumbs { margin-bottom: 18px; font-size: 13.5px; }
.breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.breadcrumbs li { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumbs .icon { color: var(--muted-2); }
.breadcrumbs [aria-current] {
	color: var(--ink-2);
	max-width: 40ch;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Cards ------------------------------------------------------------------------- */
.card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--surface);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow-sm);
	transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--line); }
@media (prefers-reduced-motion: reduce) { .card:hover { transform: none; } }

.thumb {
	display: block;
	text-decoration: none;
	aspect-ratio: 16 / 9;
	background: var(--surface-2);
	overflow: hidden;
}
.thumb__img { width: 100%; height: 100%; object-fit: cover; }
.thumb__placeholder {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	background:
		radial-gradient(120% 120% at 100% 0%, rgba(20, 224, 138, 0.28), transparent 55%),
		linear-gradient(135deg, var(--dark-bg), var(--dark-surface));
	color: var(--accent);
	font-family: var(--font-mono);
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.card__body {
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex: 1;
	padding: 18px 20px 20px;
}
.card__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.card__title { font-size: 19px; line-height: 1.3; letter-spacing: -0.015em; }
.card__title a { color: var(--ink); text-decoration: none; }
/* Whole card clickable via the title link. */
.card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card__title a:hover { color: var(--ink); }
.card:hover .card__title a { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.card__excerpt {
	color: var(--muted);
	font-size: 15px;
	line-height: 1.55;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.card .meta { margin-top: auto; padding-top: 4px; }

/* Featured card */
.card--featured { margin-bottom: clamp(32px, 5vw, 56px); border-radius: var(--radius-lg); }
.card--featured .card__body { padding: clamp(20px, 3vw, 40px); gap: 14px; justify-content: center; }
.card--featured .eyebrow { margin-bottom: 0; }
.card--featured .card__title { font-size: clamp(24px, 3vw, 36px); line-height: 1.15; letter-spacing: -0.025em; }
.card--featured .card__excerpt { font-size: 16.5px; -webkit-line-clamp: 3; }
@media (min-width: 960px) {
	.card--featured { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
	.card--featured .thumb { aspect-ratio: auto; min-height: 100%; }
}

.byline { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.byline__avatar { border-radius: 50%; }
.byline__name { display: block; font-weight: 600; font-size: 14.5px; }

/* Topics ------------------------------------------------------------------------ */
.grid--topics {
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}
.topic {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 4px;
	height: 100%;
	padding: 20px 52px 20px 20px;
	background: var(--surface);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	color: var(--ink);
	text-decoration: none;
	box-shadow: var(--shadow-sm);
	transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.topic:hover { color: var(--ink); border-color: var(--accent-2); box-shadow: var(--shadow-md); }
.topic__name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.topic__count { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.topic__desc { font-size: 14px; color: var(--muted); margin-top: 4px; }
.topic .icon { position: absolute; top: 20px; right: 18px; color: var(--accent-2); transition: transform .2s var(--ease); }
.topic:hover .icon { transform: translateX(3px); }

.level-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.level-filter > .icon { color: var(--muted); margin-right: 2px; }

/* Pagination ------------------------------------------------------------------ */
.pagination { margin-top: clamp(32px, 5vw, 56px); }
.pagination ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.pagination li > .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 44px;
	height: 44px;
	padding: 0 10px;
	border: 1px solid var(--line);
	border-radius: var(--radius-pill);
	background: var(--surface);
	color: var(--ink-2);
	font-family: var(--font-mono);
	font-size: 14px;
	text-decoration: none;
}
.pagination a.page-numbers:hover { border-color: var(--ink); color: var(--ink); }
.pagination li > .page-numbers.current { background: var(--ink); border-color: var(--ink); color: #fff; }
.pagination li > .page-numbers.dots { border: 0; background: none; }

/* Empty / 404 ------------------------------------------------------------------ */
.empty {
	padding: clamp(32px, 6vw, 64px);
	background: var(--surface);
	border: 1px dashed var(--line);
	border-radius: var(--radius-lg);
	text-align: center;
}
.empty h2 { font-size: 22px; margin-bottom: 8px; }
.empty p { color: var(--muted); margin-bottom: 20px; }
.empty .search-form { margin-inline: auto; }

.notfound { padding-block: clamp(48px, 10vw, 120px); }
.notfound .search-form { margin-top: 28px; }
.notfound__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* Footer ------------------------------------------------------------------------- */
.site-footer {
	background: var(--dark-bg);
	color: var(--dark-muted);
	padding-top: clamp(48px, 7vw, 80px);
	font-size: 15px;
}
.site-footer a { color: #fff; text-decoration: none; opacity: .86; }
.site-footer a:hover { color: var(--accent); opacity: 1; }
.site-footer__grid {
	display: grid;
	gap: 36px;
	grid-template-columns: 1fr;
}
@media (min-width: 640px) { .site-footer__grid { grid-template-columns: repeat(3, 1fr); } .site-footer__brand { grid-column: 1 / -1; } }
@media (min-width: 960px) { .site-footer__grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } .site-footer__brand { grid-column: auto; } }
.site-footer__brand .brand { opacity: 1; }
.site-footer__brand p { margin-top: 16px; max-width: 34ch; line-height: 1.55; }
.site-footer .eyebrow { color: var(--dark-muted); }
.site-footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.site-footer__bottom {
	margin-top: clamp(40px, 6vw, 64px);
	padding-block: 24px;
	border-top: 1px solid var(--dark-line);
	font-family: var(--font-mono);
	font-size: 12.5px;
}
