/*
Theme Name:   Daslumo (Kadence Child)
Theme URI:    https://example.com
Description:  Accessible bilingual (English and Finnish) child theme for Kadence, built for the Daslumo website. Brand colours, focus styles, form styles, block styles, an accessible language switcher and a language suggestion banner for Polylang. Designed to meet WCAG 2.2 AA contrast and target-size requirements.
Author:       Daslumo
Template:     kadence
Version:      1.1.8
License:      GNU General Public License v2 or later
License URI:  https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  daslumo-kadence-child
*/

/* ==========================================================================
   1. Design tokens
   Contrast ratios (WCAG 2.2): see the Setup Guide, Appendix A.
   Never use Amber or Pine as TEXT on dark backgrounds other than Amber on Night.
   ========================================================================== */
:root {
  --dl-night: #12304F;   /* headings, dark sections    */
  --dl-pine:  #187A6B;   /* links, default buttons     */
  --dl-amber: #F2B84B;   /* primary call to action     */
  --dl-paper: #FBF7EE;   /* warm light background      */
  --dl-mist:  #EEF4F7;   /* cool light background      */
  --dl-surface: #FFFCF5; /* cards, notes, tables, inputs (warm, never pure white) */
  --dl-slate: #5A6672;   /* muted text, form borders   */
  --dl-body:  #2B3640;   /* body text                  */
  --dl-error: #B42318;   /* error text                 */
  --dl-radius: 8px;

  /* Fonts are set in Customizer > General > Typography (not here), so the chosen font is never overridden. */
}

/* ==========================================================================
   2. Readable text
   ========================================================================== */
body { color: var(--dl-body); line-height: 1.6; }
.entry-content p, .entry-content li { max-width: 70ch; }
.entry-content .has-text-align-center, .dl-hero p, .dl-card p, .dl-card li { max-width: none; }
h1, h2, h3, h4 { color: var(--dl-night); line-height: 1.25; }
.entry-content h2 { margin-top: 2.5rem; }
.dl-muted { color: var(--dl-slate); }

/* Links are underlined so they never rely on colour alone (WCAG 1.4.1). */
.entry-content a:not(.wp-block-button__link),
.site-footer a,
.dl-card a { color: var(--dl-pine); text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: .09em; }
.entry-content a:not(.wp-block-button__link):hover,
.site-footer a:hover,
.dl-card a:hover { color: var(--dl-night); text-decoration-thickness: .16em; }

/* ==========================================================================
   3. Focus indicators (WCAG 2.4.7, 2.4.11, 1.4.11)
   A white gap sits between the element and the ring, so the ring keeps
   enough contrast on any background, including the Pine and Amber buttons.
   ========================================================================== */
:focus-visible {
  outline: 3px solid var(--dl-night);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--dl-paper);
  border-radius: 2px;
}
.dl-on-dark :focus-visible, .dl-hero :focus-visible, .site-footer :focus-visible {
  outline-color: var(--dl-amber);
  box-shadow: 0 0 0 3px var(--dl-night);
}
/* Keep the focused element from hiding under a sticky header. */
html { scroll-padding-top: 5rem; }

/* ==========================================================================
   4. Buttons and touch targets (WCAG 2.5.8: at least 24px, we use 44px)
   ========================================================================== */
.wp-block-button__link, button, input[type="submit"], .button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 600; }
.wp-block-button .wp-block-button__link { background: var(--dl-pine); color: var(--dl-paper); border-radius: var(--dl-radius); padding: .7rem 1.4rem; }
.wp-block-button .wp-block-button__link:hover { background: var(--dl-night); color: var(--dl-paper); }

.wp-block-button.dl-cta .wp-block-button__link { background: var(--dl-amber); color: var(--dl-night); border: 2px solid var(--dl-night); } /* Night edge: amber alone is only 1.8:1 against white */
.wp-block-button.dl-cta .wp-block-button__link:hover { background: var(--dl-surface); color: var(--dl-night); box-shadow: inset 0 0 0 2px var(--dl-night); }

.wp-block-button.is-style-outline .wp-block-button__link { background: transparent; color: var(--dl-night); border: 2px solid var(--dl-night); }
.wp-block-button.is-style-outline .wp-block-button__link:hover { background: var(--dl-night); color: var(--dl-paper); }
.dl-hero .wp-block-button.is-style-outline .wp-block-button__link { color: var(--dl-paper); border-color: var(--dl-paper); }
.dl-hero .wp-block-button.is-style-outline .wp-block-button__link:hover { background: var(--dl-surface); color: var(--dl-night); }
/* Kadence colours outline buttons with the accent colour using :not(.has-text-color), which wins over the rules above.
   Repeat the rules with the same :not() so the text stays white on Night (Pine on Night is only 2.6:1). */
.wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color) { color: var(--dl-night); }
.wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color):hover { color: var(--dl-paper); }
.dl-hero .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color) { color: var(--dl-paper); }
.dl-hero .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color):hover { color: var(--dl-night); }

/* ==========================================================================
   5. Sections, hero, cards, pricing
   ========================================================================== */
.dl-hero { background: var(--dl-night); color: var(--dl-paper); padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem); border-radius: var(--dl-radius); }
.dl-hero h1, .dl-hero h2, .dl-hero h3 { color: var(--dl-paper); }
.dl-hero a:not(.wp-block-button__link) { color: var(--dl-amber); }
.dl-hero .dl-eyebrow { color: var(--dl-amber); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .875rem; }

.dl-section { padding: clamp(1.5rem, 4vw, 3rem) 0; }
.dl-section--alt { background: var(--dl-mist); padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem); border-radius: var(--dl-radius); }

.dl-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1.5rem; align-items: stretch; }
.dl-card { background: var(--dl-surface); border: 2px solid var(--dl-night); border-radius: var(--dl-radius); padding: 1.5rem; display: flex; flex-direction: column; }
.dl-card--featured { border-color: var(--dl-pine); box-shadow: 0 0 0 4px var(--dl-mist); }
.dl-card h2, .dl-card h3 { margin-top: 0; }
.dl-card .wp-block-buttons { margin-top: auto; padding-top: 1rem; }
.dl-badge { display: inline-block; align-self: flex-start; background: var(--dl-night); color: var(--dl-paper); font-weight: 700; font-size: .875rem; padding: .25rem .75rem; border-radius: 999px; margin: 0 0 .75rem; }
.dl-price { font-size: 2.25rem; font-weight: 700; color: var(--dl-night); margin: .25rem 0; line-height: 1.1; }
.dl-price span { font-size: 1rem; font-weight: 400; color: var(--dl-slate); }

.dl-note { background: var(--dl-surface); border-left: 6px solid var(--dl-night); padding: 1rem 1.25rem; border-radius: 0 var(--dl-radius) var(--dl-radius) 0; }
.dl-note p:last-child { margin-bottom: 0; }

/* Details (FAQ accordion): native element, keyboard and screen reader friendly */
.wp-block-details { border: 2px solid var(--dl-night); border-radius: var(--dl-radius); padding: 0; margin: 0 0 .75rem; background: var(--dl-surface); }
.wp-block-details summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 600; color: var(--dl-night); min-height: 44px; }
.wp-block-details > :not(summary) { padding: 0 1.1rem; }
.wp-block-details[open] summary { border-bottom: 1px solid var(--dl-mist); margin-bottom: .75rem; }

/* ==========================================================================
   6. Tables (comparison table sits in a keyboard-scrollable region)
   ========================================================================== */
.dl-table-scroll { overflow-x: auto; max-width: 100%; }
.dl-table { border-collapse: collapse; width: 100%; min-width: 560px; background: var(--dl-surface); }
.dl-table caption { text-align: left; font-weight: 700; padding: .5rem 0; color: var(--dl-night); }
.dl-table th, .dl-table td { border: 1px solid var(--dl-slate); padding: .65rem .75rem; text-align: left; vertical-align: top; }
.dl-table thead th { background: var(--dl-night); color: var(--dl-paper); }
.dl-table tbody th { background: var(--dl-mist); color: var(--dl-night); font-weight: 600; }

/* ==========================================================================
   7. Forms (WCAG 1.3.1, 3.3.1, 3.3.2, 1.4.11)
   ========================================================================== */
.dl-form { max-width: 34rem; }
.dl-form .dl-field { margin-bottom: 1.25rem; }
.dl-form label { display: block; font-weight: 600; margin-bottom: .35rem; color: var(--dl-night); }
.dl-form .dl-hint { color: var(--dl-slate); font-size: .95rem; margin: 0 0 .35rem; }
.dl-form input[type="email"], .dl-form input[type="text"], .dl-form select, .dl-form textarea {
  width: 100%; min-height: 44px; padding: .55rem .75rem; font: inherit; color: var(--dl-body);
  background: var(--dl-surface); border: 2px solid var(--dl-slate); border-radius: 6px;
}
.dl-form .dl-check { display: flex; gap: .75rem; align-items: flex-start; }
.dl-form .dl-check input { width: 1.5rem; height: 1.5rem; margin-top: .15rem; flex: none; accent-color: var(--dl-pine); }
.dl-form .dl-check label { font-weight: 400; margin: 0; }
.dl-form [aria-invalid="true"] { border-color: var(--dl-error); }
.dl-form .dl-error { color: var(--dl-error); font-weight: 600; margin: .35rem 0 0; }
.dl-form button[type="submit"] { background: var(--dl-amber); color: var(--dl-night); border: 2px solid var(--dl-night); border-radius: var(--dl-radius); padding: .7rem 1.6rem; cursor: pointer; font-size: 1rem; }
.dl-form button[type="submit"]:hover { background: var(--dl-surface); box-shadow: inset 0 0 0 2px var(--dl-night); }

/* ==========================================================================
   8. Motion and user preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .wp-block-button__link, .dl-form button[type="submit"] { border: 2px solid ButtonText; }
  .dl-card, .wp-block-details { border-color: CanvasText; }
}
@media print {
  .dl-hero { background: none; color: #000; }
  .dl-hero h1, .dl-hero h2 { color: #000; }
}

/* ==========================================================================
   9. Bilingual site: language switcher, suggestion banner, Finnish text
   ========================================================================== */

/* Long button labels (common in Finnish) wrap instead of overflowing. */
.wp-block-button__link, .dl-form button[type="submit"] { white-space: normal; text-align: center; overflow-wrap: break-word; }

/* Finnish compound words: let the browser hyphenate (needs the html lang attribute, set by Polylang). */
html:lang(fi) .entry-content p,
html:lang(fi) .entry-content li,
html:lang(fi) .dl-card h3,
html:lang(fi) .dl-card p,
html:lang(fi) .wp-block-button__link,
html:lang(fi) .dl-table td,
html:lang(fi) .dl-table th {
  -webkit-hyphens: auto; hyphens: auto; overflow-wrap: break-word;
}

/* Language switcher (header menu item, shortcode or widget area) */
/* Switcher in the headers (mobile HTML element and primary menu): compact pill, 36px tall (WCAG 2.2 minimum is 24px) */
.mobile-html .dl-langswitch, .header-html .dl-langswitch { margin: 0; }
.mobile-html .dl-langswitch ul, .main-navigation .dl-langswitch ul { gap: .125rem; }
.mobile-html .dl-langswitch a, .mobile-html .dl-langswitch__current,
.main-navigation .dl-langswitch a, .main-navigation .dl-langswitch__current {
  min-height: 36px; min-width: 40px; padding: .1rem .5rem; font-size: .9375rem; border-radius: 6px;
}
@media (max-width: 380px) { .mobile-html .dl-langswitch--globe .dl-globe { display: none; } }
.dl-langswitch ul { display: flex; flex-wrap: wrap; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.dl-langswitch li { margin: 0; padding: 0; }
.dl-langswitch a, .dl-langswitch__current {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; padding: .25rem .75rem; border-radius: var(--dl-radius); font-weight: 600;
}
.dl-langswitch a { color: var(--dl-pine); text-decoration: underline; text-underline-offset: .18em; }
.dl-langswitch a:hover { color: var(--dl-night); }
.dl-langswitch__current { background: var(--dl-night); color: var(--dl-paper); }
/* Mobile drawer: current page in Amber (Pine on this dark background is only about 3.9:1). */
#mobile-drawer .mobile-navigation .current-menu-item > a,
#mobile-drawer .mobile-navigation .current_page_item > a,
.popup-drawer .mobile-navigation .current-menu-item > a { color: var(--dl-amber, #F2B84B); }
/* Mobile drawer is dark: keep the switcher readable (Amber on Night 8:1, white links). */
.popup-drawer .dl-langswitch a, #mobile-drawer .dl-langswitch a { color: var(--dl-paper); }
.popup-drawer .dl-langswitch a:hover, #mobile-drawer .dl-langswitch a:hover { color: var(--dl-amber, #F2B84B); }
.popup-drawer .dl-langswitch__current, #mobile-drawer .dl-langswitch__current { background: var(--dl-amber, #F2B84B); color: var(--dl-night); }
.dl-menu-langswitch { display: flex; align-items: center; }
/* Globe + short codes (default) */
.dl-langswitch--globe { display: inline-flex; align-items: center; gap: .25rem; }
.dl-langswitch--globe .dl-globe { flex: none; color: var(--dl-night); }
.dl-langswitch--globe a, .dl-langswitch--globe .dl-langswitch__current { letter-spacing: .04em; }
.popup-drawer .dl-langswitch--globe .dl-globe, #mobile-drawer .dl-langswitch--globe .dl-globe { color: var(--dl-paper); }
/* Flag-only switcher: the name is visually hidden text; flags are decorative. */
.dl-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.dl-langswitch--flags ul { gap: .5rem; }
.dl-langswitch--flags a, .dl-langswitch--flags .dl-langswitch__current { background: transparent; padding: .25rem; text-decoration: none; }
.dl-langswitch--flags .dl-flag { display: block; width: 28px; height: 18px; border: 1px solid rgba(18, 48, 79, .35); border-radius: 3px; }
.dl-langswitch--flags a:hover .dl-flag { border-color: var(--dl-night); }
/* Current language: Night ring around the flag (not colour alone: the link to the other language is the only link). */
.dl-langswitch--flags .dl-langswitch__current { box-shadow: 0 0 0 2px var(--dl-night); border-radius: 4px; }
.popup-drawer .dl-langswitch--flags .dl-langswitch__current, #mobile-drawer .dl-langswitch--flags .dl-langswitch__current { background: transparent; box-shadow: 0 0 0 2px var(--dl-amber, #F2B84B); }
.popup-drawer .dl-langswitch--flags .dl-flag, #mobile-drawer .dl-langswitch--flags .dl-flag { border-color: rgba(255, 255, 255, .6); }

/* Language suggestion banner: hidden unless the head script sets data-dl-suggest on <html>.
   It sits in the normal page flow (not fixed), so it never covers content or focused elements. */
.dl-langbanner { display: none; background: var(--dl-mist); color: var(--dl-night); border-bottom: 3px solid var(--dl-night); }
.dl-langbanner__inner { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; max-width: 1200px; margin: 0 auto; padding: .5rem 1rem; }
.dl-langbanner__text { margin: 0; flex: 1 1 16rem; font-weight: 600; }
.dl-langbanner__link {
  display: inline-flex; align-items: center; min-height: 44px; padding: .35rem 1rem;
  background: var(--dl-pine); color: var(--dl-paper); font-weight: 600; text-decoration: none; border-radius: var(--dl-radius);
}
.dl-langbanner__link:hover { background: var(--dl-night); color: var(--dl-paper); }
.dl-langbanner__close {
  min-height: 44px; min-width: 44px; padding: .35rem 1rem; cursor: pointer; font: inherit; font-weight: 600;
  background: transparent; color: var(--dl-night); border: 2px solid var(--dl-night); border-radius: var(--dl-radius);
}
.dl-langbanner__close:hover { background: var(--dl-night); color: var(--dl-paper); }

@media (forced-colors: active) {
  .dl-langswitch__current, .dl-langbanner__link, .dl-langbanner__close { border: 2px solid ButtonText; }
  .dl-langbanner { border-bottom-color: CanvasText; }
}
@media print { .dl-langbanner, .dl-langswitch { display: none !important; } }

/* Free quick check downloads */
.dl-downloads ul { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.dl-downloads li { margin: 0; }
.dl-downloads li a { display: inline-block; padding: .5rem 0; font-weight: 600; }
.dl-downloads h3 { margin-top: 1.5rem; }

/* Product screenshots (1.1.21) */
.dl-shot { margin: 0; }
.dl-shot img { display: block; width: 100%; height: auto; border-radius: var(--dl-radius); }
.dl-shot figcaption { margin-top: .6rem; text-align: center; font-size: .9rem; color: var(--dl-slate); }
