/*
Theme Name: CloudResearch
Template: twentytwentyfour
Description: Tema figlio di Twenty Twenty-Four per cloudresearch.it. Linee guida in DESIGN.md.
Version: 1.0.0
Requires at least: 6.5
Text Domain: cloudresearch
*/

/* --- Struttura -------------------------------------------------------- */
.wp-site-blocks > * + * { margin-block-start: 0; }

/* --- Header ----------------------------------------------------------- */
.cr-header { position: sticky; top: 0; z-index: 100; backdrop-filter: saturate(180%) blur(8px); background: rgba(255,255,255,.92) !important; border-bottom: 1px solid var(--wp--preset--color--line); }
.admin-bar .cr-header { top: 32px; }
.cr-header .wp-block-site-logo img { height: 40px; width: auto; }
.cr-header .wp-block-navigation { font-size: 15px; font-weight: 500; }
.cr-header .wp-block-navigation-item__content:hover { color: var(--wp--preset--color--primary); }
.cr-header .wp-block-navigation__submenu-container { border: 1px solid var(--wp--preset--color--line) !important; border-radius: 10px; padding: 8px !important; box-shadow: 0 12px 32px rgba(15,23,51,.10); min-width: 240px !important; }
.cr-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding: 8px 12px !important; border-radius: 6px; }
.cr-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover { background: var(--wp--preset--color--surface); }
@media (max-width: 600px) {
  .admin-bar .cr-header { top: 0; }
  .cr-header .wp-block-site-logo img { height: 26px; }
  .cr-header .wp-block-site-logo { flex-shrink: 1; min-width: 0; }
  .cr-header .cr-header-cta .wp-block-button__link { white-space: nowrap; }
  .cr-header .cr-header-cta .wp-block-button__link { font-size: 13px !important; padding: 6px 10px !important; min-height: 36px; }
}
@media (max-width: 360px) { .cr-header .cr-header-cta { display: none; } }

/* --- Pulsanti --------------------------------------------------------- */
.wp-element-button, .wp-block-button__link { transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.wp-block-button.is-style-outline > .wp-block-button__link { border: 1.5px solid var(--wp--preset--color--primary); color: var(--wp--preset--color--primary); background: transparent; }
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--wp--preset--color--surface); }
.has-ink-background-color .wp-block-button.is-style-outline > .wp-block-button__link,
.has-primary-background-color .wp-block-button.is-style-outline > .wp-block-button__link { border-color: #fff; color: #fff; }
.has-ink-background-color .wp-block-button.is-style-outline > .wp-block-button__link:hover,
.has-primary-background-color .wp-block-button.is-style-outline > .wp-block-button__link:hover { background: rgba(255,255,255,.1); }

/* --- Card e componenti ------------------------------------------------ */
.cr-card { background: #fff; border: 1px solid var(--wp--preset--color--line); border-radius: 12px; height: 100%; box-sizing: border-box; }
.cr-card.is-link { transition: box-shadow .2s, transform .2s, border-color .2s; position: relative; }
.cr-card.is-link:hover { box-shadow: 0 12px 32px rgba(15,23,51,.08); border-color: #cfd5e6; transform: translateY(-2px); }
.cr-card.is-link a.cr-stretched::after { content: ""; position: absolute; inset: 0; }
.cr-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--wp--preset--color--surface); color: var(--wp--preset--color--primary); display: inline-flex; align-items: center; justify-content: center; }
.cr-icon svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.has-ink-background-color .cr-icon, .has-primary-background-color .cr-icon { background: rgba(255,255,255,.1); color: #fff; }
.cr-eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 13px !important; font-weight: 600; color: var(--wp--preset--color--primary); }
.cr-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; background: #fdecec; color: #b5121a; font-size: 13px; font-weight: 600; }
.cr-check-list { list-style: none; padding-left: 0; }
.cr-check-list li { position: relative; padding-left: 30px; margin-bottom: .6em; }
.cr-check-list li::before { content: ""; position: absolute; left: 0; top: .35em; width: 18px; height: 18px; border-radius: 50%; background: var(--wp--preset--color--primary) 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/12px no-repeat; }
.cr-window { border-radius: 12px; border: 1px solid var(--wp--preset--color--line); box-shadow: 0 24px 60px rgba(15,23,51,.14); overflow: hidden; background: #fff; }
.cr-window::before { content: ""; display: block; height: 28px; background: #eef1f8 radial-gradient(circle, #f26b6b 4px, transparent 5px) 14px 50%/14px 14px no-repeat, radial-gradient(circle, #f5c04a 4px, transparent 5px) 32px 50%/14px 14px no-repeat; background-color: #eef1f8; border-bottom: 1px solid var(--wp--preset--color--line); }
.cr-window img { display: block; width: 100%; height: auto; }
.cr-logos img { filter: grayscale(1); opacity: .7; transition: filter .2s, opacity .2s; max-height: 48px; width: auto; }
.cr-logos img:hover { filter: none; opacity: 1; }

/* --- Testata pagine --------------------------------------------------- */
.cr-page-hero .wp-block-post-title { margin-top: 0; }
.cr-breadcrumb a { color: var(--wp--preset--color--primary); text-decoration: none; font-weight: 600; font-size: 14px; }

/* --- Contenuti importati da Joomla ----------------------------------- */
.cr-prose img { max-width: 100%; height: auto; border-radius: 8px; }
.cr-prose img.alignright, .cr-prose img.alignleft { border: 1px solid var(--wp--preset--color--line); box-shadow: 0 8px 24px rgba(15,23,51,.08); }
.cr-prose code, .cr-prose kbd { font-size: .9em; background: var(--wp--preset--color--surface); padding: 2px 6px; border-radius: 4px; }
.cr-prose table { border-collapse: collapse; width: 100%; }
.cr-prose td, .cr-prose th { border: 1px solid var(--wp--preset--color--line); padding: 8px 12px; }
.cr-prose h2, .cr-prose h3 { clear: both; }
.cr-prose::after { content: ""; display: table; clear: both; }
@media (max-width: 781px) {
  .cr-prose img.alignright, .cr-prose img.alignleft, .cr-prose img[style*="float"] { float: none !important; max-width: 100% !important; margin: 1em 0 !important; display: block; }
}

/* --- Footer ----------------------------------------------------------- */
.cr-footer a:not(.wp-element-button) { color: #fff; text-decoration: none; opacity: .8; }
.cr-footer a:not(.wp-element-button):hover { opacity: 1; text-decoration: underline; }
.cr-footer .wp-block-image { margin: 0 0 1rem; }
.cr-footer h2 { margin-bottom: 1rem !important; }
.cr-footer .wp-block-site-logo img { height: 36px; width: auto; }
.cr-footer h2 { font-size: 14px !important; text-transform: uppercase; letter-spacing: .08em; opacity: .6; }
.cr-footer ul { list-style: none; padding: 0; margin: 0; }
.cr-footer li { margin-bottom: 10px; }

/* --- News ------------------------------------------------------------- */
.cr-post-card .wp-block-post-title a { text-decoration: none; }
.cr-post-card .wp-block-post-title a:hover { color: var(--wp--preset--color--primary); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.cr-subtitle { max-width: 720px; margin-top: var(--wp--preset--spacing--20) !important; }
.cr-breadcrumb:empty, p.cr-breadcrumb:has(> :only-child:empty) { display: none; }
h1, h2, h3, .wp-block-post-title { text-wrap: balance; }
p { text-wrap: pretty; }

/* --- Griglie responsive (il blocco Group "grid" usa un numero fisso di colonne) --- */
@media (max-width: 1023px) { .wp-block-group.is-layout-grid:not(.cr-grid-keep) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 640px)  { .wp-block-group.is-layout-grid:not(.cr-grid-keep), .wp-block-post-template.is-layout-grid { grid-template-columns: 1fr !important; } }

/* Immagini flottanti (blocco Immagine alignleft/alignright) dentro la colonna di testo */
.cr-prose.is-layout-constrained > .wp-block-image.alignright, .cr-prose.is-layout-constrained > .wp-block-image.alignleft { max-width: 45%; }
.cr-prose.is-layout-constrained > .wp-block-image.alignright { margin-right: max(var(--wp--style--root--padding-right, 0px), calc((100% - var(--wp--style--global--content-size)) / 2)) !important; margin-left: 1.5em; }
.cr-prose.is-layout-constrained > .wp-block-image.alignleft { margin-left: max(var(--wp--style--root--padding-left, 0px), calc((100% - var(--wp--style--global--content-size)) / 2)) !important; margin-right: 1.5em; }
@media (max-width: 781px) { .cr-prose figure.wp-block-image.alignright, .cr-prose figure.wp-block-image.alignleft { float: none !important; max-width: 100% !important; margin: 1em 0 !important; } }

/* Link nelle card: stesso stile in tutte le pagine */
.cr-card a:not(.wp-element-button) { font-weight: 600; text-decoration: none; }
.cr-card a:not(.wp-element-button):hover { text-decoration: underline; }
