/*
	Block editor content for the "Lohkot (Gutenberg)" template (page-blocks.php).
	Loaded on the front end for that template only, and inside the block editor.
	Matches the look of the ACF layouts (block-text, block-accordion).
	Colours come from theme.json presets (--wp--preset--color--*).
*/

@font-face {
	font-family: "Noto Sans";
	src: url("../fonts/noto-sans-latin-wght.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

/* Editor canvas: same base text as the front end */
.editor-styles-wrapper {
	font-family: "Noto Sans", "Segoe UI", Helvetica, Arial, sans-serif;
	font-weight: 300;
	font-size: 17px;
	line-height: 1.5;
	color: rgba(0,0,0,0.87);
}
.editor-styles-wrapper .editor-post-title { font-weight: 500; font-size: clamp(26px, 1.4762rem + 0.6349vw, 32px); color: var(--wp--preset--color--primary); }
.editor-styles-wrapper :is(h2, h3) { color: var(--wp--preset--color--primary); font-weight: 700; line-height: 1.2; }
.editor-styles-wrapper h2 { font-size: clamp(19px, 1.1131rem + 0.3175vw, 22px); margin: 32px 0 12px; }
.editor-styles-wrapper h3 { font-size: clamp(17px, 1.0377rem + 0.1058vw, 18px); margin: 24px 0 4px; }
.editor-styles-wrapper p { margin: 0 0 16px; }
.editor-styles-wrapper a { color: #1F74A9; }
.editor-styles-wrapper strong { font-weight: 600; }


/* Shared: front end (.iggo-blocks) and editor (.editor-styles-wrapper) */
:is(.iggo-blocks, .editor-styles-wrapper) h2 { margin-top: 32px; }
:is(.iggo-blocks, .editor-styles-wrapper) h2:first-child,
.iggo-blocks h1 + h2 { margin-top: 0; }

/* Lists: same as ACF wysiwyg */
.iggo-blocks :is(ul, ol) { margin: 0 0 16px; padding: 0; }
.iggo-blocks :is(ul, ol) li { margin-left: 15px; margin-bottom: 8px; }

/* Font sizes from theme.json (Iso = lead paragraph). Custom sizes are inline styles. */
:is(.iggo-blocks, .editor-styles-wrapper) .has-x-small-font-size { font-size: var(--wp--preset--font-size--x-small); }
:is(.iggo-blocks, .editor-styles-wrapper) .has-small-font-size { font-size: var(--wp--preset--font-size--small); }
:is(.iggo-blocks, .editor-styles-wrapper) .has-normal-font-size { font-size: var(--wp--preset--font-size--normal); }
:is(.iggo-blocks, .editor-styles-wrapper) .has-large-font-size { font-size: var(--wp--preset--font-size--large); }
:is(.iggo-blocks, .editor-styles-wrapper) .has-x-large-font-size { font-size: var(--wp--preset--font-size--x-large); }
:is(.iggo-blocks, .editor-styles-wrapper) .has-xx-large-font-size { font-size: var(--wp--preset--font-size--xx-large); }
:is(.iggo-blocks, .editor-styles-wrapper) .has-huge-font-size { font-size: var(--wp--preset--font-size--huge); }

/* Buttons: same as the TinyMCE "Nappi" (.mce-readmore) */
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 24px; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-button__link {
	display: inline-block;
	padding: 11px 20px;
	line-height: 22px; /* 44px tall on one line, wraps cleanly when the label is long */
	background: var(--wp--preset--color--primary);
	color: #FFF;
	border-radius: 2px;
	text-decoration: none;
	font-size: 18px;
	font-weight: 400;
	transition: 0.16s cubic-bezier(0.4, 0.0, 0.2, 1);
}
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-button__link:hover { background: var(--wp--preset--color--primary-dark); color: #FFF; box-shadow: 0 1px 4px rgba(0,0,0,0.14), 0 3px 3px rgba(0,0,0,0.12); }
:is(.iggo-blocks, .editor-styles-wrapper) .is-style-outline .wp-block-button__link { background: transparent; color: var(--wp--preset--color--primary); box-shadow: inset 0 0 0 2px var(--wp--preset--color--primary); }
:is(.iggo-blocks, .editor-styles-wrapper) .is-style-outline .wp-block-button__link:hover { background: var(--wp--preset--color--primary); color: #FFF; }

/* File block (product card PDF): icon link + button */
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-file { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 24px; }
/* iggo.js gives PDF links the file-type icon (a.iconlink); the button must not get it */
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-file__button { display: inline-block; height: auto; margin: 0; padding: 0 16px; line-height: 36px; background: var(--wp--preset--color--primary); color: #FFF; border-radius: 2px; font-size: 16px; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-file__button:hover { background: var(--wp--preset--color--primary-dark); color: #FFF; }

/* Details: same look as the ACF accordion (Haitari) */
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-details { border-bottom: 1px solid rgba(0,0,0,0.12); margin: 0; }
:is(.iggo-blocks, .editor-styles-wrapper) :not(.wp-block-details) + .wp-block-details { border-top: 1px solid rgba(0,0,0,0.12); margin-top: 16px; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-details + :not(.wp-block-details) { margin-top: 24px; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-details summary {
	cursor: pointer;
	list-style: none;
	display: grid;
	grid-template-columns: 1fr 24px;
	padding: 10px 4px 10px 0;
	font-size: 20px;
	font-weight: 600;
	color: rgba(0,0,0,0.87);
}
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-details summary::-webkit-details-marker { display: none; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-details summary::after { content: "+"; justify-self: end; font-weight: 300; color: rgba(0,0,0,0.38); transition: transform 0.16s; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-details[open] summary::after { transform: rotate(45deg); }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-details > :last-child { margin-bottom: 16px; }

/* Images */
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-image { margin: 0 0 24px; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-image figcaption { margin: 4px 0 0; color: rgba(0,0,0,0.54); font-size: 16px; font-style: italic; }

/* Columns: same gap as the ACF block-text columns */
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-columns { display: flex; flex-wrap: wrap; gap: 32px; margin: 0 0 24px; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-column { flex: 1 1 0; min-width: 0; }
@media (max-width: 781px) {
	.iggo-blocks .wp-block-columns { flex-direction: column; gap: 16px; }
}
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-column > :last-child { margin-bottom: 0; }

/* Group with a background colour: padding like the ACF block styles */
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-group.has-background { padding: 24px 32px; margin: 0 0 24px; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-group.has-background > :last-child { margin-bottom: 0; }
:is(.iggo-blocks, .editor-styles-wrapper) .has-secondary-background-color,
:is(.iggo-blocks, .editor-styles-wrapper) .has-secondary-dark-background-color,
:is(.iggo-blocks, .editor-styles-wrapper) .has-dark-background-color { color: #FFF; }
/* Teaser cards (Sisältölista) have their own background and title colour settings, so they're left out */
:is(.iggo-blocks, .editor-styles-wrapper) :is(.has-secondary-background-color, .has-secondary-dark-background-color, .has-dark-background-color) :is(h2, h3, a):not(.teaser *) { color: #FFF; }

/* Separator, quote, table, embeds */
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-separator { border: none; border-top: 1px solid rgba(0,0,0,0.12); margin: 32px auto; max-width: 280px; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-separator.is-style-wide { max-width: none; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-quote { font-style: italic; margin: 0 0 16px; padding: 16px 24px; background: #F0F0F0; border: none; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-table { overflow-x: auto; margin: 0 0 20px; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-table table { display: table; white-space: normal; width: 100%; border-collapse: collapse; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-table :is(td, th) { border: 1px solid rgba(0,0,0,0.12); padding: 8px 12px; text-align: left; }
:is(.iggo-blocks, .editor-styles-wrapper) .wp-block-embed { margin: 0 0 24px; }

/* Colour helpers from the theme.json palette */
:is(.iggo-blocks, .editor-styles-wrapper) .has-primary-color { color: var(--wp--preset--color--primary); }
:is(.iggo-blocks, .editor-styles-wrapper) .has-secondary-color { color: var(--wp--preset--color--secondary); }

/* Footer template parts (parts/footer-*.html) in the Site Editor: same look as the front end.
   Background colours come from the groups, so the client can change them in the editor. */
.editor-styles-wrapper .iggo-footer-top { font-size: 16px; }
.editor-styles-wrapper .iggo-footer-top :is(h2, h3) { color: inherit; margin-top: 0; }
.editor-styles-wrapper .iggo-footer-top a { color: #E9992A; text-decoration: none; }
.editor-styles-wrapper .iggo-footer-columns { margin: 0; }
.editor-styles-wrapper .iggo-footer-columns p { margin: 0 0 16px; }
.editor-styles-wrapper .iggo-footer-columns .wp-block-column > :last-child { margin-bottom: 0; }
.editor-styles-wrapper .copyright { margin: 0; font-size: 14px; color: rgba(255,255,255,0.5); }
.editor-styles-wrapper .is-root-container:has(> .iggo-footer-top) { max-width: none; }
.editor-styles-wrapper .is-root-container > .iggo-footer-bottom { margin-block-start: 0 !important; }

/* Default template (page.php): blocks own the layout, no .container/.content-centered */
.iggo-blocks.is-layout-constrained { width: 100%; color: var(--black-primary); }
.iggo-blocks.is-layout-constrained:has(> .alignfull:first-child) { padding-top: 0; }
.iggo-blocks.is-layout-constrained:has(> .alignfull:last-child) { padding-bottom: 0; }

/* Block style "Max 1920 px" (iggo_register_max_width_style()): full width up to 1920 px, centred.
   !important beats core's ".is-layout-constrained > .alignfull { max-width: none; margin: … }". */
.is-style-max-1920 {
	width: 100%;
	max-width: 1920px !important;
	margin-left: auto !important;
	margin-right: auto !important;
}
