/*
Theme Name: Digiopisto Course Child
Description: Child theme for the Sensei "Course" block theme, customized for digiopisto.com
Author: Jari
Template: course
Version: 1.0.0
*/

/* ==========================================================
   IMPORTANT: Verify the folder name of the installed parent 
   Course theme matches "Template: course" exactly on your server.
   ========================================================== */

/* ==========================================================================
   1. GLOBAL TYPOGRAPHY PRESETS (Safe FSE Fallbacks)
   ========================================================================== */
html, body, p {
    font-size: 1rem; /* 16px Base */
    line-height: 1.6;
}

/* Base structural assignments — values should preferably be mapped via theme.json */
h1, .has-h-1-font-size { font-size: 3rem; font-weight: 800; line-height: 1.2; }
h2, .has-h-2-font-size { font-size: 2.25rem; font-weight: 700; line-height: 1.3; }
h3, .has-h-3-font-size { font-size: 1.875rem; font-weight: 700; line-height: 1.3; }
h4, .has-h-4-font-size { font-size: 1.5rem; font-weight: 600; line-height: 1.4; }
h5, .has-h-5-font-size { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
h6, .has-h-6-font-size { font-size: 1.125rem; font-weight: 600; text-transform: uppercase; }

h1, h2, h3, h4, h5, h6 {
    color: #1E2446;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

/* ==========================================================================
   2. WOOCOMMERCE ECOSYSTEM LAYOUT BALANCING
   ========================================================================== */
body.woocommerce-page main .alignwide {
    max-width: 1000px;
}

/* ==========================================================================
   3. CUSTOM ACCOUNT DASHBOARD GRID SYSTEM
   ========================================================================== */
.digi-account-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}

.digi-account-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 2rem 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.digi-account-card:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.digi-account-icon svg {
    width: 48px;
    height: 48px;
    color: var(--wp--preset--color--primary, currentColor);
}

.digi-account-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.digi-account-text {
    font-size: 0.9rem;
    opacity: 0.75;
}

.digi-account-welcome-title {
    margin-top: 0;
    padding-top: 0;
    margin-bottom: 0.5rem;
}

.digi-account-welcome-text {
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

/* VIP Dashboard Sections */
.digi-vip-section {
    margin-top: 2.5rem;
}

.digi-vip-heading {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.digi-vip-text {
    margin-bottom: 1.5rem;
    opacity: 0.85;
}

.digi-vip-card {
    max-width: 280px;
}

.digi-vip-icon svg {
    color: #f0b429;
}

@media (max-width: 600px) {
    .digi-account-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   4. SENSEI NOTIFICATION MECHANICS OVERRIDES (Keep Layout Hacks via !important)
   ========================================================================== */
body.theme-course {
    position: relative !important;
}

/* Root level absolute layout repositioning alerts */
body.theme-course > .sensei-message.info {
    position: absolute !important;
    top: 100px !important; 
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100% !important;
    max-width: 1000px !important;
    z-index: 99 !important;
    box-sizing: border-box !important;
}

/* Inner block child alerts spacing correction */
body.theme-course :not(body) > .sensei-message.info {
    position: relative !important;
    margin-top: 10px !important; 
    margin-bottom: 25px !important; 
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
    max-width: 1000px !important;
    box-sizing: border-box !important;
}

/* Global Alert Aesthetics Injection */
body.theme-course .sensei-message.info {
    background-color: #1E2446 !important;
    border: none !important; 
    border-radius: 6px !important;
    padding: 16px 24px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Target clear typographic nodes inside notice wrappers safely without * selector */
body.theme-course .sensei-message.info,
body.theme-course .sensei-message.info p,
body.theme-course .sensei-message.info span {
    color: #ffffff !important;
}

body.theme-course .sensei-message.info a {
    color: #ffffff !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    transition: color 0.2s ease-in-out !important;
}

body.theme-course .sensei-message.info a:hover,
body.theme-course .sensei-message.info a:focus {
    color: #FCD556 !important;
    text-decoration: underline !important;
}

/* ==========================================================================
   5. COOKIE COMPLIANCE BANNER FIXED RULES
   ========================================================================== */
#cmplz-cookiebanner-container {
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 999999 !important;
    pointer-events: auto !important; 
}

#cmplz-cookiebanner-container .cmplz-cookiebanner,
#cmplz-cookiebanner-container .cmplz-buttons,
#cmplz-cookiebanner-container a,
#cmplz-cookiebanner-container button {
    pointer-events: auto !important;
    cursor: pointer !important;
}

body #cmplz-cookiebanner-container.cmplz-hidden {
    display: none !important;
    pointer-events: none !important;
}

/* ==========================================================================
   6. OPTIMIZED BLOG ARCHIVE & SINGLE POST LAYOUT
   ========================================================================== 
   OHJE ARKISTOON: Jotta arkistosivun artikkelit muuttuvat valkoisiksi korteiksi,
   klikkaa Sivustoeditorissa 'Kyselysilmukka' (Query Loop) -lohkoa, laajenna 
   oikealta 'Lisäasetukset' (Advanced) ja lisää Lisä-CSS-luokka -kenttään: 
   digi-blog-grid
   ========================================================================== */

/* --- 1. ARTIKKELIKORTIT (Vain arkistosivun Query Loopissa) --- */
.digi-blog-grid .wp-block-post.type-post {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-bottom: 24px;
}

.digi-blog-grid .wp-block-post.type-post:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(30, 36, 70, 0.06);
}

.digi-blog-grid .wp-block-post.type-post {
    margin-left: 0 !important;
}

@media (max-width: 600px) {
    .digi-blog-grid .wp-block-post.type-post {
        padding: 0px;
        border: none;
        box-shadow: none;
    }
}

/* --- 2. KATEGORIAT (Toimii arkistossa ja yksittäisellä sivulla) --- */
.wp-block-post-terms.taxonomy-category a,
.digi-blog-grid .wp-block-post-terms.taxonomy-category a {
    background-color: #1E2446 !important;
    color: #ffffff !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    display: inline-block !important;
    margin-right: 8px !important;
    margin-bottom: 12px !important;
    border: none !important;
    transition: background-color 0.2s ease !important;
}

.wp-block-post-terms.taxonomy-category a:hover,
.digi-blog-grid .wp-block-post-terms.taxonomy-category a:hover {
    background-color: #FCD556 !important;
    color: #1E2446 !important;
}

/* --- 3. AVAINSANAT / TAGIT (Toimii arkistossa ja yksittäisellä sivulla) --- */
.wp-block-post-terms.taxonomy-post_tag a,
.digi-blog-grid .wp-block-post-terms.taxonomy-post_tag a {
    background-color: #f1f5f9 !important;
    color: #4a5568 !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    text-transform: none !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    display: inline-block !important;
    margin-right: 8px !important;
    margin-bottom: 12px !important;
    border: 1px solid #e2e8f0 !important;
    transition: all 0.2s ease !important;
}

.wp-block-post-terms.taxonomy-post_tag a:hover,
.digi-blog-grid .wp-block-post-terms.taxonomy-post_tag a:hover {
    background-color: #1E2446 !important;
    color: #ffffff !important;
    border-color: #1E2446 !important;
}

/* --- 4. VIRHEIDEN KORJAUKSET (Välimerkit ja listat) --- */
/* Piilotetaan WordPressin automaattisesti lisäämät pilkut/erottimet taustalta */
.wp-block-post-terms .wp-block-post-terms__separator,
.digi-blog-grid .wp-block-post-terms__separator {
    display: none !important;
    visibility: hidden !important;
    speak: none !important;
}

/* Poistetaan linkkilistojen oletuspisteet termirakenteista */
.wp-block-post-terms ul, 
.wp-block-post-terms li {
    display: inline !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* --- 5. ARTIKKELIEN OTSIKOT (Toimii arkistossa ja yksittäisellä sivulla) --- */
.wp-block-post-title,
.wp-block-post-title a,
.digi-blog-grid .wp-block-post-title,
.digi-blog-grid .wp-block-post-title a {
    color: #1E2446;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    margin-top: 5px;
    margin-bottom: 12px;
}

.wp-block-post-title a:hover,
.digi-blog-grid .wp-block-post-title a:hover {
    text-decoration: underline;
}

/* --- 6. TEKSTIKATKELMAT JA PAINIKKEET (Arkistonäkymä) --- */
.digi-blog-grid .wp-block-post-excerpt__excerpt {
    color: #4a5568;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.digi-blog-grid .wp-block-post-excerpt__more-link,
.digi-blog-grid .wp-block-post a.wp-block-button__link {
    margin-top: auto;
    color: #1E2446;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
}

.digi-blog-grid .wp-block-post-excerpt__more-link:hover,
.digi-blog-grid .wp-block-post a.wp-block-button__link:hover {
    color: #FCD556;
    text-decoration: underline;
}

/* --- 7. SIVUPALKIN LINKIT (Sivuston vanhat widgetit / palstat) --- */
main .wp-block-columns .wp-block-column:last-child a {
    color: #1E2446;
    text-decoration: none;
}

.wp-block-columns .wp-block-column:last-child a:hover {
    color: #FCD556;
    text-decoration: underline;
}

/* --- 9. YKSITTÄISEN SIVUN MOBIILIMARGINAALI (Asia 2) --- */
/* Kun ruutu on kapea (mobiili), poistetaan sivupalkkia varten jätetty iso 70px väli */
@media (max-width: 768px) {
    /* Kohdistuu yksittäisen artikkelin pääsisältöalueeseen */
    .single-post .wp-block-columns .wp-block-column:first-child,
    .single-post main .wp-block-column {
        margin-right: 0 !important;
        padding-right: 0 !important;
    }
    
    /* Lisätään pieni hienovaraispiiri (esim. 15px-20px) sivujen reunoihin, 
       jotta teksti ei osu aivan puhelimen lasin reunaan */
    .single-post main {
        /*padding-left: 16px !important;*/
        padding-right: 16px !important;
    }
}

/* --- 10. ARTIKKELIKUVAN OPTIMOINTI (Asia 3) --- */
/* Yksittäisen artikkelin ja arkiston kuvalaatikko */
.wp-block-post-featured-image,
.wp-block-post-featured-image img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

/* Isommilla ruuduilla rajataan kuvan korkeutta kevyesti, jotta se ei täytä koko ruutua pystysuunnassa */
@media (min-width: 769px) {
    .single-post .wp-block-post-featured-image img {
        max-height: 500px !important;
        object-fit: cover !important; /* Pitää kuvasuhteen siistinä rajaamalla ylimääräiset */
        object-position: center !important;
    }
}
	
/* ==========================================================================
   7. SENSEI LMS PURCHASE PRICING GRID SYSTEM
   ========================================================================== */
.wp-block-sensei-lms-purchase-course ul,
div[class*="purchase-course"] ul {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 0;
    margin: 40px 0;
    list-style: none;
    justify-content: center;
}

.wp-block-sensei-lms-purchase-course ul li,
div[class*="purchase-course"] ul li {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 32px 24px;
    flex: 1 1 300px;
    max-width: 360px;
    box-shadow: 0 4px 6px rgba(30, 36, 70, 0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wp-block-sensei-lms-purchase-course ul li:hover,
div[class*="purchase-course"] ul li:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(30, 36, 70, 0.06);
}

/* Native Radio Element Hiding with Flexible Layout Spanning */
.wp-block-sensei-lms-purchase-course ul li input[type="radio"],div[class*="purchase-course"] ul li input[type="radio"] {display: none;}.wp-block-sensei-lms-purchase-course ul li label,div[class*="purchase-course"] ul li label {display: flex;flex-direction: column;height: 100%;width: 100%;cursor: pointer;}/* Course Wrapper Titles /.wp-block-sensei-lms-purchase-course ul li strong,div[class="purchase-course"] ul li strong {font-size: 1.35rem;color: #1E2446;font-weight: 700;margin-bottom: 12px;display: block;}/* Course Metadata Subtitles /.wp-block-sensei-lms-purchase-course ul li span[class="description"],div[class*="purchase-course"] ul li span[class*="description"] {font-size: 0.95rem;color: #64748b;line-height: 1.5;margin-bottom: 24px;flex-grow: 1;display: block;}/* Layout Pricing Tags /.wp-block-sensei-lms-purchase-course ul li span[class="price"],div[class*="purchase-course"] ul li span[class*="price"] {font-size: 1.65rem;font-weight: 800;color: #1E2446;margin-top: auto;margin-bottom: 8px;display: block;}/* VAT/Tax Label Details /.wp-block-sensei-lms-purchase-course ul li small,div[class="purchase-course"] ul li small {font-size: 0.85rem;color: #94a3b8;font-weight: 600;}/* Global CTA Module Triggers */.wp-block-sensei-lms-purchase-course .wp-block-button__link {width: 100%;background-color: #1E2446;color: #ffffff;font-weight: 700;padding: 14px 28px;border-radius: 6px;text-transform: uppercase;letter-spacing: 0.5px;margin-top: 20px;}.wp-block-sensei-lms-purchase-course .wp-block-button__link:hover {background-color: #FCD556;color: #1E2446;}

/* Card look: all query loop grids (blog page included) */
.wp-block-post-template.is-layout-grid > li {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid color-mix(in srgb, #1E2446 12%, transparent);
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wp-block-post-template.is-layout-grid > li:hover {
  border-color: color-mix(in srgb, #1E2446 30%, transparent);
  box-shadow: 0 6px 20px color-mix(in srgb, #1E2446 8%, transparent);
}

/* Equal-height alignment: only Query Loops with the equal-cards class */
.equal-cards .wp-block-post-template.is-layout-grid > li {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 6;
  row-gap: 1rem;
}

.equal-cards .wp-block-post-template.is-layout-grid > li > * {
  margin-block: 0;
}

/* Equal-height alignment: only Query Loops with the equal-cards class */
.equal-cards-4 .wp-block-post-template.is-layout-grid > li {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 1;
  row-gap: 1rem;
}

.equal-cards-4 .wp-block-post-template.is-layout-grid > li > * {
  margin-block: 0;
}

/*Lisätään divider osion loppuun*/
.has-divider::after {
  content: "";
  display: block;
  height: 1px;
  background: var(--wp--preset--color--cyan-bluish-gray);
  opacity: 0.7;
  margin-top: var(--wp--preset--spacing--60, 3rem);
}

/*Korttien reunaviivatehoste*/
.wp-block-post-template.is-layout-grid > li {
  /* existing subgrid rules stay as they are */
  padding: 1.5rem;
  background: #fff;
  border: 1px solid color-mix(in srgb, #1E2446 12%, transparent);
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Gentle lift on hover */
.wp-block-post-template.is-layout-grid > li:hover {
  border-color: color-mix(in srgb, #1E2446 30%, transparent);
  box-shadow: 0 6px 20px color-mix(in srgb, #1E2446 8%, transparent);
}

/* Soften the featured image corners to match */
.wp-block-post-template.is-layout-grid .wp-block-post-featured-image img {
  border-radius: 4px;
}

/*Sensei-opiskelunäkymän sivupalkin valikon otsikoiden asetukset*/
.h3.sensei-lms-course-navigation-module__title {
    flex: 1;
    color: var(--sensei-primary-color);
    font-weight: 400;
    font-size: 0.875rem;
    line-height: 1.1rem;
    text-align: left;
    word-break: break-word;
    white-space: break-spaces;
    margin: 0;
}
