/* ===================================================================
   Tutorials section — extends css/style.css with:
   - a numbered card grid for the index (numbers via CSS counters, so
     they scale automatically: 00, 01 ... 99, 100 ...)
   - a step-by-step "steps" component reusing the timeline visual language
   - a themed code block wrapper + Prism.js token colors
   =================================================================== */

/* ============ SHARED TOPBAR ============ */

.tutorial-topbar {
	padding: 1.5rem 0;
	border-bottom: 1px solid var(--rule);
}

.tutorial-topbar__links {
	display: flex;
	gap: 1.5rem;
	font-family: var(--font-mono);
	font-size: 0.85rem;
}

.tutorial-topbar a {
	color: var(--paper-dim);
	text-decoration: none;
}

.tutorial-topbar a:hover {
	color: var(--paper);
}

/* ============ INDEX ============ */

.tutorials-hero {
	padding: 3rem 0 1rem;
}

.tutorials-hero p {
	max-width: 60ch;
	color: var(--paper-dim);
}

/* ---- search + tag filter bar ---- */

.tutorial-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	align-items: center;
	justify-content: space-between;
	margin-top: 2.5rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--rule);
}

.tutorial-search {
	flex: 1 1 240px;
	max-width: 360px;
}

.tutorial-search input {
	width: 100%;
	background: var(--ink-soft);
	border: 1px solid var(--rule);
	border-radius: 8px;
	padding: 0.6rem 0.9rem;
	color: var(--paper);
	font-family: var(--font-mono);
	font-size: 0.9rem;
}

.tutorial-search input::placeholder {
	color: var(--paper-dim);
}

.tutorial-search input:focus {
	outline: none;
	border-color: var(--amber);
}

.tutorial-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.tutorial-tag-filter {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--teal);
	background: transparent;
	border: 1px solid var(--rule);
	border-radius: 999px;
	padding: 0.3em 0.85em;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.tutorial-tag-filter:hover {
	border-color: var(--teal);
}

.tutorial-tag-filter.is-active {
	background: var(--teal);
	color: var(--ink);
	border-color: var(--teal);
}

/* ---- tile grid ---- */

.tutorial-grid {
	list-style: none;
	margin: 2rem 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.25rem;
}

.tutorial-card[hidden] {
	display: none;
}

.tutorial-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 1.5rem;
	border: 1px solid var(--rule);
	border-radius: 10px;
	background: var(--ink-soft);
	text-decoration: none;
	transition: border-color 0.2s ease, transform 0.2s ease;
}

.tutorial-card__link:hover {
	border-color: var(--amber);
	transform: translateY(-2px);
}

.tutorial-card__title {
	font-size: 1.15rem;
	margin-bottom: 0.5em;
	color: var(--paper);
}

.tutorial-card__summary {
	color: var(--paper-dim);
	font-size: 0.95rem;
	margin-bottom: 1.25em;
	flex: 1;
}

.tutorial-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin-top: auto;
}

.tag {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--teal);
	border: 1px solid var(--rule);
	border-radius: 999px;
	padding: 0.15em 0.65em;
}

.read-time {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--paper-dim);
	margin-left: auto;
}

.tutorial-empty,
.tutorial-empty-state {
	grid-column: 1 / -1;
	color: var(--paper-dim);
	font-family: var(--font-mono);
	text-align: center;
	padding: 2rem 0;
}

/* ============ TUTORIAL ARTICLE ============ */

.tutorial-article {
	padding: 2.5rem 0 4rem;
}

.tutorial-article__intro {
	max-width: 68ch;
	color: var(--paper-dim);
	font-size: 1.05rem;
}

.tutorial-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	align-items: center;
	margin: 1rem 0 2rem;
}

.steps {
	list-style: none;
	margin: 2.5rem 0 0;
	padding: 0;
	border-left: 2px solid var(--rule);
	display: grid;
	gap: 2.5rem;
	counter-reset: step -1;
}

.step {
	counter-increment: step;
	position: relative;
	padding-left: 2.25rem;
}

.step__num {
	position: absolute;
	left: -1.05rem;
	top: -0.1rem;
	width: 2.1rem;
	height: 2.1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--ink-soft);
	border: 2px solid var(--amber);
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--amber);
}

.step__num::before {
	content: counter(step, decimal-leading-zero);
}

.step__title {
	margin-bottom: 0.5em;
	font-size: 1.2rem;
}

.step p {
	color: var(--paper-dim);
}

.step p:last-child {
	margin-bottom: 0;
}

.tutorial-pager {
	display: grid;
	gap: 1rem;
	margin-top: 3.5rem;
	padding-top: 2rem;
	border-top: 1px solid var(--rule);
}

@media (min-width: 640px) {
	.tutorial-pager {
		grid-template-columns: 1fr 1fr;
	}

	.tutorial-pager__link--next {
		text-align: right;
	}
}

.tutorial-pager__link {
	display: block;
	text-decoration: none;
	padding: 1rem;
	border: 1px solid var(--rule);
	border-radius: 8px;
}

.tutorial-pager__link:hover {
	border-color: var(--amber);
}

.tutorial-pager__label {
	display: block;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--paper-dim);
	margin-bottom: 0.3em;
}

.tutorial-pager__title {
	color: var(--paper);
	font-weight: 600;
}

/* reveal (progressive enhancement, mirrors .job/.portfolio__item) */
.step.will-reveal,
.tutorial-card.will-reveal {
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.5s ease, transform 0.5s ease;
}

.step.will-reveal.is-visible,
.tutorial-card.will-reveal.is-visible {
	opacity: 1;
	transform: none;
}

/* ============ CODE BLOCKS ============ */

.code-block {
	margin: 1.5rem 0;
	border: 1px solid var(--rule);
	border-radius: 8px;
	overflow: hidden;
	background: var(--ink-soft);
}

.code-block__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.55rem 0.9rem;
	background: var(--ink-raised);
	border-bottom: 1px solid var(--rule);
}

.code-block__lang {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--paper-dim);
}

.code-block__copy {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--paper-dim);
	background: transparent;
	border: 1px solid var(--rule);
	border-radius: 6px;
	padding: 0.25em 0.7em;
	cursor: pointer;
}

.code-block__copy:hover {
	color: var(--paper);
	border-color: var(--paper-dim);
}

.code-block pre {
	margin: 0;
	padding: 1.1rem 1.25rem;
	overflow-x: auto;
}

.code-block pre,
.code-block code {
	font-family: var(--font-mono);
	font-size: 0.92rem;
	line-height: 1.6;
	color: var(--paper);
}

/* inline code, outside .code-block */
p code,
li code {
	background: var(--ink-raised);
	border: 1px solid var(--rule);
	border-radius: 4px;
	padding: 0.1em 0.4em;
	font-size: 0.88em;
	font-family: var(--font-mono);
	color: var(--amber);
}

/* ============ METHOD TABLE ============ */

.table-scroll {
	overflow-x: auto;
	margin: 1.5rem 0;
}

.method-table {
	width: 100%;
	min-width: 520px;
	border-collapse: collapse;
	font-family: var(--font-mono);
	font-size: 0.85rem;
}

.method-table th,
.method-table td {
	text-align: left;
	padding: 0.6rem 0.9rem;
	border-bottom: 1px solid var(--rule);
	white-space: nowrap;
}

.method-table th {
	color: var(--paper-dim);
	font-weight: 600;
	text-transform: uppercase;
	font-size: 0.72rem;
	letter-spacing: 0.04em;
}

.method-table td {
	color: var(--paper);
}

.method-table__verb {
	color: var(--teal);
	font-weight: 600;
}

.method-table tr:last-child td {
	border-bottom: none;
}

/* Prism.js tokens, remapped to the site's amber/teal palette */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
	color: var(--paper-dim);
	font-style: italic;
}

.token.punctuation,
.token.operator,
.token.entity,
.token.url,
.token.variable {
	color: var(--paper-dim);
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
	color: var(--amber);
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted,
.token.class-name {
	color: var(--teal);
}

.token.atrule,
.token.attr-value,
.token.keyword,
.token.regex,
.token.important {
	color: #f2b968;
}

.token.function {
	color: var(--paper);
	font-weight: 600;
}

.token.important,
.token.bold {
	font-weight: 700;
}

.token.italic {
	font-style: italic;
}
