/*
Theme Name:        Snowscoot World
Theme URI:         https://www.snowscootworld.com
Author:            Teodoro Piccinni
Author URI:        https://www.teodoropiccinni.com
Description:       Block theme for Snowscoot World, the snowscoot portal: a guide (story, the tool, how to ride, gear) with a side menu per section, map pages built on the Sconfina map block, and a home made of editable patterns. Classic menus per language (TP WP Tools Languages or Polylang). No JavaScript, no third-party requests: fonts are bundled.
Version:           0.1.15
Requires at least: 6.6
Tested up to:      7.1
Requires PHP:      7.4
License:           GPL-2.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       tp_snowscoot
Tags:              block-theme, full-site-editing, one-column, two-columns, custom-menu, custom-logo
*/

/* ---------------------------------------------------------------------------
   Basics. Colours, fonts and sizes are theme.json presets (--wp--preset--*).
--------------------------------------------------------------------------- */
:root {
	--tpsw-ink: var(--wp--preset--color--ink, #0e1116);
	--tpsw-snow: var(--wp--preset--color--snow, #f3f5f8);
	--tpsw-line: var(--wp--preset--color--line, #d5dce4);
	--tpsw-muted: var(--wp--preset--color--muted, #4a5563);
	--tpsw-sky: var(--wp--preset--color--sky, #0b2e78);
	--tpsw-lime: var(--wp--preset--color--lime, #c8f03c);
	--tpsw-display: var(--wp--preset--font-family--display);
	--tpsw-wide: 1240px;
	--tpsw-gutter: clamp(1.25rem, 4vw, 2rem);
}

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; }
.tpsw-main { min-height: 50vh; }

.tpsw-skip {
	position: absolute; left: 1rem; top: -4rem; z-index: 100;
	background: var(--tpsw-lime); color: var(--tpsw-ink); padding: .75rem 1rem; border-radius: 6px; font-weight: 600;
}
.tpsw-skip:focus { top: 1rem; }

/* ---------------------------------------------------------------------------
   Header
--------------------------------------------------------------------------- */
.tpsw-site-header { background: var(--tpsw-ink); color: #fff; position: relative; z-index: 20; }
.tpsw-header {
	max-width: var(--tpsw-wide); margin: 0 auto; padding: .75rem var(--tpsw-gutter);
	display: flex; align-items: center; gap: 2rem;
}
.tpsw-header__brand { display: flex; flex: none; }
.tpsw-header__brand img { height: 48px; width: auto; display: block; }
.tpsw-header__end { display: flex; align-items: center; gap: 1rem; margin-left: auto; }

.tpsw-nav ul { list-style: none; margin: 0; padding: 0; }
.tpsw-nav a {
	color: #fff; text-decoration: none;
	font-family: var(--tpsw-display); font-weight: 700; font-size: 1.1875rem; letter-spacing: .04em; text-transform: uppercase;
}
.tpsw-nav a:hover, .tpsw-nav a:focus-visible { color: var(--tpsw-lime); }
.tpsw-nav .current-menu-item > a, .tpsw-nav .current-menu-ancestor > a, .tpsw-nav .current-page-ancestor > a { color: var(--tpsw-lime); }
/* Polylang's "Languages" menu item: the header has its own switcher. */
.tpsw-nav .lang-item, .tpsw-nav .pll-parent-menu-item { display: none; }

.tpsw-nav--wide { flex: 1 1 auto; }
.tpsw-nav--wide > ul { display: flex; gap: 1.75rem; flex-wrap: wrap; }
.tpsw-nav--wide li { position: relative; }
.tpsw-nav--wide > ul > li > a { display: block; padding: .5rem 0; }
.tpsw-nav--wide .sub-menu {
	display: none; position: absolute; left: -1rem; top: 100%; min-width: 15rem;
	background: var(--tpsw-ink); padding: .5rem 0 .75rem; border-radius: 0 0 8px 8px;
	box-shadow: 0 12px 24px rgba(14, 17, 22, .25);
}
.tpsw-nav--wide li:hover > .sub-menu, .tpsw-nav--wide li:focus-within > .sub-menu { display: block; }
.tpsw-nav--wide .sub-menu a { display: block; padding: .45rem 1rem; font-size: 1.0625rem; }

.tpsw-lang ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; }
.tpsw-lang a {
	display: block; padding: .375rem .5625rem; border-radius: 4px;
	color: #c9d1db; text-decoration: none; font-size: .8125rem; font-weight: 600; text-transform: uppercase;
}
.tpsw-lang a:hover { color: #fff; }
.tpsw-lang .current-lang a, .tpsw-lang .tpwtl-current a, .tpsw-lang [aria-current] { background: #fff; color: var(--tpsw-ink); }

.tpsw-cta {
	background: var(--tpsw-lime); color: var(--tpsw-ink); text-decoration: none; white-space: nowrap;
	font-weight: 600; font-size: .9375rem; padding: .75rem 1.125rem; border-radius: 6px;
}
.tpsw-cta:hover, .tpsw-cta:focus-visible { background: #fff; color: var(--tpsw-ink); }

.tpsw-burger { display: none; }
.tpsw-burger summary {
	list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem;
	min-height: 44px; padding: 0 .75rem; border: 1px solid #3a4250; border-radius: 6px; font-weight: 600;
}
.tpsw-burger summary::-webkit-details-marker { display: none; }
.tpsw-panel {
	position: absolute; left: 0; right: 0; top: 100%;
	background: var(--tpsw-ink); padding: .5rem var(--tpsw-gutter) 1.5rem; border-top: 1px solid #2a313b;
}
.tpsw-lang--panel { display: none; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #2a313b; }
.tpsw-lang--panel ul { flex-wrap: wrap; }
.tpsw-lang--panel a { font-size: .9375rem; padding: .5rem .75rem; }
@media (max-width: 700px) {
	.tpsw-header__end > .tpsw-lang { display: none; } /* In the Menu panel instead. */
	.tpsw-lang--panel { display: block; }
}
.tpsw-nav--panel a { display: block; padding: .6rem 0; font-size: 1.375rem; }
.tpsw-nav--panel .sub-menu { padding-left: 1rem; }
.tpsw-nav--panel .sub-menu a { font-size: 1.125rem; color: #c9d1db; }

@media (max-width: 960px) {
	.tpsw-nav--wide { display: none; }
	.tpsw-burger { display: block; }
	.tpsw-header { gap: 1rem; }
}
@media (max-width: 560px) {
	.tpsw-cta { display: none; } /* The menu has the same links. */
	.tpsw-header__brand img { height: 40px; }
}

/* ---------------------------------------------------------------------------
   Page head and breadcrumb
--------------------------------------------------------------------------- */
.tpsw-breadcrumb { font-size: .875rem; color: var(--tpsw-muted); margin-bottom: 1rem; }
.tpsw-breadcrumb a { color: var(--tpsw-muted); }
.tpsw-breadcrumb a:hover { color: var(--tpsw-ink); }
.tpsw-pagehead .wp-block-post-title { max-width: 18em; }

/* ---------------------------------------------------------------------------
   Guide page: side menu of the section + content
--------------------------------------------------------------------------- */
.tpsw-guide {
	max-width: var(--tpsw-wide); margin: 0 auto; box-sizing: border-box;
	padding: var(--wp--preset--spacing--50) var(--tpsw-gutter) var(--wp--preset--spacing--60);
	display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start;
}
.tpsw-guide__aside:not(:has(.tpsw-section)) { display: none; }
.tpsw-guide:not(:has(.tpsw-section)) { grid-template-columns: minmax(0, 1fr); }
.tpsw-guide__content { max-width: 48rem; min-width: 0; }
.tpsw-guide__content > :first-child { margin-top: 0; }
@media (max-width: 860px) {
	.tpsw-guide { grid-template-columns: minmax(0, 1fr); }
}

.tpsw-section__head {
	margin: 0 0 .75rem; font-family: var(--tpsw-display); font-weight: 700; font-size: 1rem;
	letter-spacing: .12em; text-transform: uppercase; color: var(--tpsw-muted);
}
.tpsw-section__head a { color: inherit; }
.tpsw-section ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tpsw-section li a {
	display: block; padding: .625rem .75rem; border-radius: 6px; color: var(--tpsw-ink); text-decoration: none; line-height: 1.35;
}
.tpsw-section li a:hover { background: var(--tpsw-snow); }
.tpsw-section .current_page_item > a { background: var(--tpsw-ink); color: #fff; font-weight: 600; }
@media (max-width: 860px) {
	.tpsw-section ul { flex-direction: row; flex-wrap: wrap; gap: .5rem; }
	.tpsw-section li a { border: 1px solid var(--tpsw-line); border-radius: 999px; padding: .5rem 1rem; }
}

/* ---------------------------------------------------------------------------
   Block styles used by the patterns
--------------------------------------------------------------------------- */
.is-style-eyebrow {
	font-family: var(--tpsw-display); font-weight: 700; font-size: 1.125rem; letter-spacing: .12em; text-transform: uppercase;
	color: var(--tpsw-sky); margin-bottom: .25rem;
}
.has-sky-background-color .is-style-eyebrow, .wp-block-cover .is-style-eyebrow { color: var(--tpsw-lime); }

/* Numbered steps: 01, 02, … in front of each item. */
ol.is-style-steps { list-style: none; padding: 0; margin: 1.5rem 0 0; counter-reset: tpsw-step; }
ol.is-style-steps > li {
	counter-increment: tpsw-step; position: relative; padding: 1.25rem 0 1.25rem 4.5rem;
	border-top: 1px solid var(--tpsw-line); color: var(--tpsw-muted); line-height: 1.5;
}
ol.is-style-steps > li:last-child { border-bottom: 1px solid var(--tpsw-line); }
ol.is-style-steps > li::before {
	content: counter(tpsw-step, decimal-leading-zero); position: absolute; left: 0; top: .9rem;
	font-family: var(--tpsw-display); font-weight: 800; font-size: 2.5rem; line-height: 1; color: var(--tpsw-sky);
}
ol.is-style-steps > li > a:first-child { display: block; text-decoration: none; color: var(--tpsw-ink); margin-bottom: .25rem; }
ol.is-style-steps > li > a:first-child strong {
	font-family: var(--tpsw-display); font-weight: 700; font-size: 1.75rem; text-transform: uppercase; letter-spacing: .01em;
}
ol.is-style-steps > li > a:first-child:hover strong { color: var(--tpsw-sky); }

/* Pills: a row of small rounded buttons. */
.is-style-pills { gap: .625rem; }
.is-style-pills .wp-block-button__link { border-radius: 999px; padding: .625rem 1rem; font-size: .9375rem; }
.has-sky-background-color .is-style-pills .is-style-outline .wp-block-button__link { border: 1px solid #7f96c4; }

/* Figures: big number + label. */
.is-style-stats { gap: 2rem; margin-top: 2.5rem; }
.is-style-stats p { margin: 0; font-size: .875rem; line-height: 1.3; color: inherit; opacity: .9; }
.is-style-stats strong { display: block; font-family: var(--tpsw-display); font-weight: 800; font-size: 3rem; line-height: 1; opacity: 1; }

/* Outline buttons on dark bands and the hero. */
.wp-block-cover .is-style-outline .wp-block-button__link,
.has-sky-background-color .is-style-outline .wp-block-button__link { color: #fff; border-color: currentColor; }
.wp-block-cover .is-style-outline .wp-block-button__link:hover,
.has-sky-background-color .is-style-outline .wp-block-button__link:hover { background: #fff; color: var(--tpsw-ink); }
.tpsw-on-lime .wp-block-button:not(.is-style-outline) .wp-block-button__link { background: var(--tpsw-ink); color: #fff; }
.tpsw-on-lime .wp-block-button:not(.is-style-outline) .wp-block-button__link:hover { background: #fff; color: var(--tpsw-ink); }
.tpsw-on-lime .is-style-outline .wp-block-button__link:hover { background: var(--tpsw-ink); color: #fff; }

/* Hero: content on the same 1240px column as the header (the cover's
   "content position" would otherwise drop the constrained width). */
.tpsw-hero.wp-block-cover { padding-inline: var(--tpsw-gutter); }
.tpsw-hero .wp-block-cover__inner-container {
	color: #fff; width: 100%; max-width: calc(var(--tpsw-wide) - 2 * var(--tpsw-gutter)); margin-inline: auto !important;
}
.tpsw-hero .wp-block-cover__inner-container > * { margin-left: 0 !important; margin-right: auto !important; }
.tpsw-hero h1 { max-width: 9em; line-height: .92; margin: .25rem 0 1.5rem; }
.tpsw-hero .has-large-font-size { max-width: 30em; line-height: 1.45; color: #e8edf3; }
.tpsw-hero .wp-block-buttons { margin-top: 2rem; }

/* Images */
.tpsw-framed img { border: 4px solid #fff; border-radius: 10px; }
.tpsw-cards h3 { margin: 1rem 0 .375rem; }
.tpsw-cards h3 a { color: var(--tpsw-ink); text-decoration: none; }
.tpsw-cards h3 a:hover { color: var(--tpsw-sky); }
.tpsw-cards p { margin-top: 0; }
.wp-block-post-template.tpsw-cards .wp-block-post-title a { color: var(--tpsw-ink); text-decoration: none; }

/* ---------------------------------------------------------------------------
   Map pages: legend + the Sconfina map block
--------------------------------------------------------------------------- */
.tpsw-legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.tpsw-legend li {
	display: inline-flex; align-items: center; gap: .5rem; font-size: .9375rem;
	border: 1px solid var(--tpsw-line); border-radius: 999px; padding: .375rem .875rem .375rem .375rem;
}
.tpsw-legend li::before {
	content: ""; width: 22px; height: 22px; border-radius: 50%; flex: none;
	background-position: center; background-repeat: no-repeat; background-size: 13px;
}
.tpsw-legend__allowed::before { background-color: #2f8f2f; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E"); }
.tpsw-legend__restricted::before { background-color: #d9731a; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E"); }
.tpsw-legend__forbidden::before { background-color: #c22b2b; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }

.wp-block-sconfina-map { margin-block: 1.5rem 2.5rem; }
.wp-block-sconfina-map iframe.sconfina-map { border-radius: 10px; border: 1px solid var(--tpsw-line); }
.wp-block-sconfina-map.alignfull iframe.sconfina-map { border-radius: 0; border-width: 1px 0; }
.tpsw-callout { border-radius: 10px; gap: 1.5rem; }
.tpsw-callout h2 { margin-bottom: .25rem; }
.tpsw-callout p { margin: 0; }

/* ---------------------------------------------------------------------------
   Content written for the old theme: columns of images with captions
--------------------------------------------------------------------------- */
.tpsw-guide__content .wp-block-columns { gap: 1.5rem; }
.tpsw-guide__content figure.wp-block-image { margin-bottom: 1rem; }
.tpsw-guide__content .wp-block-image figcaption { text-align: left; }
.tpsw-guide__content h2 { margin-top: 2.5rem; }
.tpsw-guide__content .wp-block-embed { margin-block: 1.5rem; }

/* ---------------------------------------------------------------------------
   Footer
--------------------------------------------------------------------------- */
.tpsw-site-footer { background: var(--tpsw-ink); color: #c9d1db; margin-top: 0; }
.tpsw-footer { max-width: var(--tpsw-wide); margin: 0 auto; padding: 4.5rem var(--tpsw-gutter) 2rem; box-sizing: border-box; }
.tpsw-footer a { color: #c9d1db; }
.tpsw-footer a:hover { color: #fff; }
.tpsw-footer__top { display: flex; flex-wrap: wrap; gap: 3rem; }
.tpsw-footer__about { flex: 2 1 20rem; }
.tpsw-footer__about img { height: 64px; width: auto; display: block; }
.tpsw-footer__about p { font-size: .9375rem; line-height: 1.6; max-width: 28em; margin: 1.25rem 0 0; }
.tpsw-footer__col { flex: 1 1 10rem; }
.tpsw-footer__col h2 {
	margin: 0 0 .875rem; font-size: 1.125rem; letter-spacing: .1em; color: #fff;
}
.tpsw-footer__links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .625rem; font-size: .9375rem; }
.tpsw-footer__legal {
	margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid #2a313b;
	display: flex; flex-wrap: wrap; gap: 1.5rem; font-size: .8125rem;
}
.tpsw-footer__legal-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 1.5rem; }

/* No gap between the last band of a page and the footer. */
.wp-site-blocks > .tpsw-site-footer { margin-block-start: 0; }
.wp-site-blocks > .tpsw-main { margin-block-start: 0; }
.tpsw-main > .tpsw-bare > .alignfull:first-child { margin-top: 0; }
.tpsw-main > .tpsw-bare > .alignfull:last-child { margin-bottom: 0; }
.tpsw-bare > .alignfull + .alignfull { margin-top: 0; }

/* ---------------------------------------------------------------------------
   TP WP Tools → Related topics: the cards in the site's colours
--------------------------------------------------------------------------- */
.tpwt-related {
	--tpwt-related-bg: var(--tpsw-sky);
	--tpwt-related-chip-bg: var(--tpsw-lime);
	--tpwt-related-chip-fg: var(--tpsw-ink);
	--tpwt-related-radius: 10px;
	border-top: 1px solid var(--tpsw-line);
	padding-top: 2rem;
}
.tpwt-related__title {
	font-family: var(--tpsw-display); font-weight: 700; font-size: 1.5rem; line-height: 1; text-transform: uppercase; letter-spacing: .01em;
}
.tpwt-related__nav button:hover:not(:disabled) { background: var(--tpsw-ink); color: #fff; }

/* ---------------------------------------------------------------------------
   Language switcher with flags (TP WP Tools → Languages): flag only in the
   header, flag + name in the Menu panel; the name is always there for
   screen readers.
--------------------------------------------------------------------------- */
.tpsw-lang .tpsw-lang__item a { display: inline-flex; align-items: center; gap: .5rem; padding: .375rem; border-radius: 4px; }
.tpsw-lang__flag { display: block; width: 24px; height: 16px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); opacity: .75; transition: opacity 120ms ease-out; }
.tpsw-lang .tpsw-lang__item a:hover .tpsw-lang__flag, .tpsw-lang .tpsw-lang__item a:focus-visible .tpsw-lang__flag { opacity: 1; }
.tpsw-lang .tpsw-lang__item.tpwtl-current a { background: transparent; box-shadow: inset 0 -3px 0 var(--tpsw-lime); border-radius: 0; }
.tpsw-lang .tpsw-lang__item.tpwtl-current .tpsw-lang__flag { opacity: 1; }
.tpsw-lang__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tpsw-lang--panel .tpsw-lang__name { position: static; width: auto; height: auto; overflow: visible; clip: auto; color: #fff; text-transform: none; font-size: .9375rem; }
.tpsw-lang--panel ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .25rem; }
.tpsw-lang--panel .tpsw-lang__item a { padding: .5rem; }

/* ---------------------------------------------------------------------------
   Community band (lime): photo | text, takes the rest | buttons, as wide as
   the widest one. Core gives vertically aligned columns width:100%, which a
   flex-basis:auto column turns into its whole size: hence width:auto.
--------------------------------------------------------------------------- */
.tpsw-band-lime > .wp-block-columns > .wp-block-column:nth-child(2) { flex: 1 1 20rem; min-width: 0; }
.tpsw-band-lime > .wp-block-columns > .wp-block-column:last-child { flex: 0 0 auto; width: auto; max-width: 100%; }
.tpsw-on-lime { flex-direction: column; align-items: stretch; width: max-content; max-width: 100%; }
.tpsw-on-lime .wp-block-button { width: 100%; }
.tpsw-on-lime .wp-block-button__link { width: 100%; text-align: center; box-sizing: border-box; }
.tpsw-follow { margin: 1rem 0 .25rem; font-size: .875rem; letter-spacing: .08em; text-transform: uppercase; }
.tpsw-social.wp-block-social-links { gap: .75rem; margin-top: 0; }
.tpsw-social .wp-social-link a { padding: 4px; }
