/*
Theme Name: Tero Kankaanperä
Theme URI: https://terokankaanpera.fi
Author: Tero Kankaanperä
Author URI: https://terokankaanpera.fi
Description: Henkilökohtainen block-teema yhdelle kirjoittajalle. Yksinkertainen rakenne, luettavuus ensin.
Version: 1.0.0
Requires at least: 6.9
Tested up to: 6.9
Requires PHP: 8.3
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ttk
*/

/* =============================================================
   Peruselementit
   ============================================================= */

html {
	hyphens: auto;
}

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

body {
	margin: 0;
}

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

/* =============================================================
   Linkit — WCAG 1.4.1: värin lisäksi alleviivaus aina
   ============================================================= */

a {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

a:hover,
a:focus {
	text-decoration-thickness: 2px;
}

/* =============================================================
   Sivuston peruslayout
   ============================================================= */

/* WordPress lisää is-layout-flex → display:flex automaattisesti */
.page-layout {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	max-width: 1300px;
	margin-inline: auto;
	align-items: flex-start !important;
	gap: 0 !important;
}

/* =============================================================
   Sivupalkki
   ============================================================= */

.site-sidebar {
	width: min(480px, 35vw);
	flex: 0 0 min(480px, 35vw);
	align-self: flex-start;
	order: -1;
	height: 100vh;
	position: sticky;
	top: 0;
	top: var(--wp-admin--admin-bar--height, 0px);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	padding: 2rem 1.75rem;
	font-family: var(--wp--preset--font-family--raleway);
	background-color: var(--wp--preset--color--surface);
	border-right: 1px solid color-mix(in srgb, var(--wp--preset--color--green) 20%, transparent);
}

.sidebar-author-photo {
	text-align: center;
	margin-bottom: 1rem;
}

.sidebar-author-photo figure,
.site-sidebar figure.wp-block-image {
	border-radius: 0 !important;
	width: fit-content;
	margin: 0 auto;
}

.sidebar-author-photo img,
.site-sidebar .wp-block-image img {
	object-fit: cover;
	display: block;
}

.sidebar-author-name {
	text-align: center;
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 24px;
	font-weight: 400;
	color: var(--wp--preset--color--text);
	margin: 0 0 1.25rem;
	line-height: 1.2;
	text-decoration: none;
}

.sidebar-tagline {
	text-align: center;
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 13px;
	font-weight: 300;
	color: var(--wp--preset--color--text-soft);
	margin: 0 0 1.25rem;
}

.sidebar-social {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: center;
	margin-bottom: 1.5rem;
}

.sidebar-social a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	color: var(--wp--preset--color--text);
	text-decoration: none;
	border-radius: 4px;
	transition: color 0.15s, background-color 0.15s;
}

.sidebar-social a:hover,
.sidebar-social a:focus {
	color: var(--wp--preset--color--accent);
	background-color: color-mix(in srgb, var(--wp--preset--color--accent) 10%, transparent);
	text-decoration: none;
}

.sidebar-social svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}


.sidebar-logo {
	margin-top: auto;
	text-align: center;
}

.sidebar-logo img {
	height: auto;
	opacity: 0.85;
}

/* =============================================================
   Pääsisältöalue
   ============================================================= */

.site-main {
	padding: 2.5rem 2.5rem 2.5rem 3rem;
	flex: 1 1 0;
}

/* =============================================================
   Kategoriasivun otsikko + kuvaus
   ============================================================= */

.wp-block-term-description {
	font-family: var(--wp--preset--font-family--raleway);
	font-weight: 300;
	font-size: 17px;
	margin-bottom: 2.5rem;
}

/* =============================================================
   Artikkelilistaus
   ============================================================= */

.article-card {
	margin-bottom: 3rem;
	padding-bottom: 3rem;
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 12%, transparent);
}

.article-card:last-child {
	border-bottom: none;
}

/* Kuva artikkelikortissa — piilotetaan kun ei kuvaa */
.article-card-image:not(:has(img)) {
	display: none;
}

.article-card-image img {
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	border-radius: 4px;
	margin-bottom: 0.75rem;
	display: block;
}

.article-card .wp-block-post-title {
	margin-bottom: 0.25rem;
}

.article-card .wp-block-post-title a {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.article-card .wp-block-post-title a:hover {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

/* =============================================================
   Post meta (päiväys, kategoria, lukuaika)
   ============================================================= */

.post-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: center;
	margin-bottom: 0.75rem;
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-soft);
}

.post-meta a {
	color: var(--wp--preset--color--accent);
	text-decoration: none;
}

.post-meta a:hover {
	text-decoration: underline;
}

/* =============================================================
   Avainsanat (post-terms, tagit) — artikkelin lopussa
   ============================================================= */

.single-article .wp-block-post-terms {
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 14px;
	font-weight: 600;
	color: var(--wp--preset--color--text-soft);
}

.single-article .wp-block-post-terms a {
	color: var(--wp--preset--color--accent);
	text-decoration: none;
}

.single-article .wp-block-post-terms a:hover {
	text-decoration: underline;
}

/* =============================================================
   Lue lisää -linkki
   ============================================================= */

.wp-block-post-excerpt__more-link {
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.wp-block-post-excerpt__more-link:hover {
	text-decoration-thickness: 2px;
}

/* =============================================================
   Sivutus
   ============================================================= */

.wp-block-query-pagination {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 3rem;
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 14px;
	font-weight: 600;
}

.wp-block-query-pagination a,
.wp-block-query-pagination-numbers a {
	padding: 0.4rem 0.75rem;
	color: var(--wp--preset--color--accent);
	text-decoration: none;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--accent) 40%, transparent);
	border-radius: 3px;
}

.wp-block-query-pagination a:hover,
.wp-block-query-pagination-numbers a:hover {
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--background);
	text-decoration: none;
}

.wp-block-query-pagination-numbers .current {
	padding: 0.4rem 0.75rem;
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--background);
	border-radius: 3px;
}

/* =============================================================
   Yksittäinen artikkeli
   ============================================================= */

.single-article {
	max-width: 650px;
}

.single-article .wp-block-post-featured-image {
	margin-bottom: 2rem;
}

.single-article .wp-block-post-featured-image img {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: 4px;
}

/* Artikkelin prev/next navigaatio */
.article-nav {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 12%, transparent);
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 14px;
	font-weight: 600;
}

/* Ingressi */
.wp-block-post-content .is-style-lede,
.article-lede {
	font-size: 21px;
	font-style: italic;
	border-left: 3px solid var(--wp--preset--color--green);
	padding-left: 1rem;
	margin-bottom: 1.5rem;
	color: var(--wp--preset--color--text);
}

/* Pullquote */
.wp-block-pullquote {
	font-size: 24px;
	font-style: italic;
	border-left: 4px solid var(--wp--preset--color--green);
	border-top: none;
	border-bottom: none;
	padding: 1rem 1.5rem;
	margin: 2rem 0;
}

/* H4 — small caps erottuvuus ilman raskasta painoa */
h4,
.wp-block-heading[class*="h4"],
.entry-content h4 {
	font-variant-caps: small-caps;
	letter-spacing: 0.04em;
}

ul:not([class]) li::marker,
.wp-block-list li::marker {
	color: var(--wp--preset--color--accent);
}

/* Lainauslohko */
.wp-block-quote {
	background-color: var(--wp--preset--color--surface);
	border-left: 4px solid var(--wp--preset--color--green);
	padding: 1rem 1.5rem;
	margin: 1.5rem 0;
}

/* YouTube / iframe responsiivisuus */
.wp-block-embed__wrapper {
	position: relative;
	aspect-ratio: 16 / 9;
}

.wp-block-embed__wrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/* =============================================================
   Footer
   ============================================================= */

.site-footer {
	background-color: var(--wp--preset--color--surface);
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--green) 30%, transparent);
	padding: 2.5rem 1.5rem;
	width: 100%;
	max-width: none;
	box-sizing: border-box;
	font-family: var(--wp--preset--font-family--raleway);
}

.footer-federation {
	margin-bottom: 1.5rem;
}

.footer-meta {
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 13px;
	color: var(--wp--preset--color--text-soft);
}

/* =============================================================
   Header
   ============================================================= */

.site-header {
	background-color: var(--wp--preset--color--background);
	padding: 0.5rem 1.5rem;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	min-height: 44px;
	width: 100%;
	max-width: none;
	box-sizing: border-box;
	font-family: var(--wp--preset--font-family--raleway);
}


/* =============================================================
   Header — hakukenttä
   ============================================================= */

.header-search .wp-block-search__inside-wrapper {
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 25%, transparent);
	border-radius: 3px;
	background: transparent;
	transition: border-color 0.15s;
}

.header-search .wp-block-search__inside-wrapper:focus-within {
	border-color: var(--wp--preset--color--accent);
}

.header-search input[type="search"] {
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 14px;
	background: transparent;
	color: var(--wp--preset--color--text);
	padding: 0.3rem 0.5rem;
	width: 180px;
	border: none;
	outline: none;
}

.header-search button[type="submit"] {
	background: transparent;
	border: none;
	padding: 0.3rem 0.5rem;
	color: var(--wp--preset--color--text);
	cursor: pointer;
}

.header-search button[type="submit"]:hover {
	color: var(--wp--preset--color--accent);
}

/* VALIKKO-teksti hampurilaisen edessä */
.wp-block-navigation__responsive-container-open::before {
	content: "valikko";
	font-family: var(--wp--preset--font-family--raleway);
	font-variant-caps: small-caps;
	font-size: 16px;
	letter-spacing: 0.08em;
	margin-right: 0.35rem;
	color: var(--wp--preset--color--text);
	vertical-align: middle;
}

/* =============================================================
   Content-wrap — header + sisältö + footer yhdessä sarakkeessa
   ============================================================= */

.content-wrap {
	display: flex !important;
	flex-direction: column !important;
	flex: 1 1 0;
	min-width: 0;
}

/* =============================================================
   Mobiili — alle 900 px
   ============================================================= */

.site-sidebar-mobile {
	display: none;
}

@media (max-width: 900px) {
	.site-sidebar {
		display: none;
	}

	.site-sidebar-mobile {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		gap: 1rem;
		padding: 1rem 1rem 1.25rem;
		background-color: var(--wp--preset--color--surface);
		border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--green) 20%, transparent);
	}

	.site-sidebar-mobile .sidebar-author-photo {
		margin-bottom: 0;
		flex: 0 0 auto;
	}

	.site-sidebar-mobile .sidebar-author-photo img {
		width: 56px;
		height: 56px;
	}

	.site-sidebar-mobile .sidebar-author-name {
		font-size: 18px;
		margin: 0;
		text-align: left;
	}

	.site-sidebar-mobile .sidebar-tagline {
		margin: 0;
		text-align: left;
	}

	.site-sidebar-mobile .sidebar-social {
		margin-bottom: 0;
		justify-content: flex-start;
	}

	.site-sidebar-mobile .sidebar-logo {
		display: none;
	}

	.site-main {
		padding: 1.5rem 1rem 2rem;
	}
}

/* =============================================================
   Blokilistan leveys — varmistetaan ettei WP kavenna post-template-elementtiä
   ============================================================= */

.site-main .wp-block-post-template,
.site-main .wp-block-query {
	width: 100%;
	max-width: none;
}

/* =============================================================
   Navigaation overlay — käyttää teeman värejä eikä WP-oletuksia
   ============================================================= */

.wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--background) !important;
	color: var(--wp--preset--color--text) !important;
	z-index: 400;
}

.wp-block-navigation:not(.has-text-color) .wp-block-navigation__responsive-container.is-menu-open {
	color: var(--wp--preset--color--text) !important;
}

.wp-block-navigation .wp-block-navigation-item__content,
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open a {
	color: var(--wp--preset--color--text);
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 18px;
	font-weight: 600;
}

.wp-block-navigation .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--accent);
}

.wp-block-navigation__submenu-container {
	margin-top: 0 !important;
	padding-top: 0 !important;
}

.wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	font-size: 16px !important;
	font-weight: 300 !important;
	padding-top: 0.25rem !important;
	padding-bottom: 0.25rem !important;
	padding-left: 0.5rem !important;
	color: var(--wp--preset--color--text-soft) !important;
}

/* =============================================================
   Kouluarvosanat — tähdet post-metassa
   ============================================================= */

.post-meta-arvosana {
	color: var(--wp--preset--color--accent);
	font-size: 15px;
	letter-spacing: 0.05em;
	margin: 0;
}

.post-meta-arvosana:empty {
	display: none;
}

/* =============================================================
   Kommenttikenttä — tumma moodi ei häikäise
   ============================================================= */

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	background: transparent;
	color: var(--wp--preset--color--text);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 25%, transparent);
	border-radius: 3px;
	padding: 0.4rem 0.6rem;
	font-family: var(--wp--preset--font-family--lora);
	font-size: 1rem;
	width: 100%;
	transition: border-color 0.15s;
}

.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form input[type="url"]:focus,
.comment-form textarea:focus {
	border-color: var(--wp--preset--color--accent);
	outline: none;
}

/* =============================================================
   TOC — Ultimate Addons (uagb/table-of-contents)
   ============================================================= */

.uag-toc__wrap {
	background-color: var(--wp--preset--color--surface);
	border-left: 3px solid var(--wp--preset--color--green);
	padding: 1.25rem 1.5rem;
	margin-bottom: 2rem;
	border-radius: 2px;
}

.uag-toc__title {
	font-family: var(--wp--preset--font-family--raleway);
	font-weight: 600;
	font-variant-caps: small-caps;
	letter-spacing: 0.04em;
	margin: 0 0 0.75rem;
}

.uag-toc__collapsible-wrap {
	display: none;
}

.uag-toc__list-wrap,
.uag-toc__list {
	margin: 0;
	padding-left: 1.25rem;
}

.uag-toc__list li {
	margin: 0.2em 0;
}

.uag-toc__list a {
	text-decoration: none;
	color: var(--wp--preset--color--text);
}

.uag-toc__list a:hover {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	color: var(--wp--preset--color--accent);
}

/* =============================================================
   Kommentit
   ============================================================= */

.comment-list {
	list-style: none;
	padding: 0;
	margin: 2rem 0;
}

.comment-list .comment {
	padding: 1.25rem 0;
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 12%, transparent);
}

.comment-author {
	font-family: var(--wp--preset--font-family--raleway);
	font-weight: 600;
	font-size: 15px;
	margin-bottom: 0.2rem;
}

.comment-author a {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.comment-metadata {
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-soft);
	margin-bottom: 0.75rem;
}

.comment-metadata a {
	color: var(--wp--preset--color--text-soft);
	text-decoration: none;
}

.comment-content {
	font-size: 17px;
}

.comment-reply-link {
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

#respond {
	margin-top: 2rem;
	padding-top: 2rem;
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 12%, transparent);
}

/* =============================================================
   ActivityPub-reaktiot
   ============================================================= */

.wp-block-activitypub-reactions {
	margin: 2rem 0;
	padding-top: 1.5rem;
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 12%, transparent);
}

.wp-block-activitypub-reactions .reaction-label,
.wp-block-activitypub-reactions .reaction-action-button,
.wp-block-activitypub-reactions .reactions-list .reaction-name {
	font-family: var(--wp--preset--font-family--raleway) !important;
	font-size: 15px !important;
}

.wp-block-activitypub-reactions .reaction-action-button {
	border-color: color-mix(in srgb, var(--wp--preset--color--accent) 40%, transparent);
	color: var(--wp--preset--color--accent);
	font-weight: 600;
}

.wp-block-activitypub-reactions .reaction-action-button:hover {
	background-color: color-mix(in srgb, var(--wp--preset--color--accent) 8%, transparent);
}

/* =============================================================
   Marvel-sarjakuvatietokanta
   ============================================================= */

.site-main:has(.marvel-list) .wp-block-post-content {
	max-width: 780px;
}

.marvel-story {
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 12%, transparent);
	border-radius: 3px;
	padding: 1.5rem;
}

.marvel-story-issues {
	display: flex;
	gap: 2rem;
	flex-wrap: wrap;
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 12%, transparent);
}

.marvel-orig,
.marvel-fi {
	flex: 1 1 200px;
	background: transparent !important;
}

.marvel-orig h3,
.marvel-fi h3 {
	font-size: 13px;
	font-family: var(--wp--preset--font-family--raleway);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-soft);
	margin: 0 0 0.5rem;
}

.marvel-creators {
	margin: 0.75rem 0 0;
}

.marvel-creators dt {
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-soft);
	margin-top: 0.4rem;
}

.marvel-creators dd {
	margin: 0;
}

.marvel-cover {
	max-width: 120px;
	height: auto;
	display: block;
	margin-bottom: 0.75rem;
	border-radius: 2px;
}

.marvel-list {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.marvel-list table {
	min-width: 560px;
	border-collapse: collapse;
	font-size: 15px;
	width: 100%;
}

.marvel-list th,
.marvel-list td {
	padding: 0.35rem 0.6rem;
	text-align: left;
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--text) 12%, transparent);
	vertical-align: top;
}

.marvel-list th {
	font-family: var(--wp--preset--font-family--raleway);
	font-weight: 600;
	font-size: 13px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-soft);
	background-color: var(--wp--preset--color--surface);
	border-bottom: 2px solid color-mix(in srgb, var(--wp--preset--color--green) 30%, transparent);
}

/* =============================================================
   Elokuva-arviot arvosanan mukaan — navigaatio
   ============================================================= */

.arvosana-navigaatio {
	list-style: none;
	padding: 0;
	margin: 0 0 2.5rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.arvosana-navigaatio a {
	display: block;
	padding: 0.4rem 0.75rem;
	color: var(--wp--preset--color--accent);
	text-decoration: none;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--accent) 40%, transparent);
	border-radius: 3px;
	font-family: var(--wp--preset--font-family--raleway);
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

.arvosana-navigaatio a:hover,
.arvosana-navigaatio a.aktiivinen {
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--background);
	text-decoration: none;
}

@media (prefers-color-scheme: dark) {
	:root {
		--wp--preset--color--background: #1f2a2c;
		--wp--preset--color--surface:    #2d383a;
		--wp--preset--color--text:       #ecebce;
		--wp--preset--color--text-soft:  #c8c8b0;
		--wp--preset--color--accent:     #ffb200;
		--wp--preset--color--green:      #b0d6bc;
		--wp--preset--color--brand-name: #ecebce;
	}

	/* ActivityPub / Fediverse -napin korjaus: vaalea pohja → tumma */
	.site-footer .wp-block-button__link,
	.site-footer input[type="submit"],
	.site-footer button:not(.wp-block-navigation__responsive-container-open) {
		background-color: var(--wp--preset--color--accent);
		color: var(--wp--preset--color--background);
		border-color: var(--wp--preset--color--accent);
	}
}
