/**
 * @file theme.css
 * adesso design tokens – overrides Byte theme variables.
 * Based on adesso style guide DE 2025-06 (brand colors, color system).
 *
 * Changes here take effect after cache clear (drush cr) without a CSS rebuild.
 */

:root {
  /* Brand typeface: Klavika (adesso CI, self-hosted) */
  --font-sans: "Klavika", "Helvetica Neue", Arial, Helvetica, sans-serif;
  --font-heading: "Klavika", "Helvetica Neue", Arial, Helvetica, sans-serif;
  --font-body: "Klavika", "Helvetica Neue", Arial, Helvetica, sans-serif;

  /* Background: white */
  --background: #ffffff;

  /* Body copy: black, Regular (400) */
  --foreground: #1a1a1a;
  --color-text: #1a1a1a;

  /* adesso-Blau (#006ec7) has no official shade scale. Variants are project-defined. */
  --color-primary: #006ec7;
  --color-brand-blue: #006ec7;

  /* adesso-Grau (#887d75) on white = 4.01:1, below AA 4.5:1. Styleguide-compliant. */
  --color-secondary: #887d75;
  --color-brand-gray: #887d75;

  /* adesso gray palette – base #887d75 = 100%, mixed with white; lower % = lighter */
  --color-adesso-gray-100: #887d75; /* = secondary */
  --color-adesso-gray-90: #938a82;
  --color-adesso-gray-80: #9f9790;
  --color-adesso-gray-70: #aba49e;
  --color-adesso-gray-60: #b7b1ac;
  --color-adesso-gray-50: #c3beba;
  --color-adesso-gray-40: #cfcbc7;
  --color-adesso-gray-30: #dbd8d5;
  --color-adesso-gray-20: #e7e5e3;
  --color-adesso-gray-10: #f3f2f1;
  --color-white: #ffffff;
  --primary: var(--color-primary);
  --primary-foreground: #ffffff;
  --secondary: var(--color-secondary);
  --secondary-foreground: #ffffff;

  /* Accent colors (adesso color system) */
  --color-secondary-mustard: #c8b600;
  --color-highlight: var(--color-secondary-mustard);
  --color-accent-button: #c8b600;
  --color-accent-yellow: #ffff00;
  --color-accent-orange: #ff9868;
  --color-accent-pink: #f566ba;
  --color-accent-violet: #461ebe;
  --color-accent-turquoise: #28dcaa;
  --color-accent-green: #76c800;

  /* Gradient tokens (adesso blue + accent colors) */
  --gradient-blue-turquoise: linear-gradient(135deg, #006ec7 0%, #28dcaa 100%);
  --gradient-blue-green: linear-gradient(135deg, #006ec7 0%, #76c800 100%);
  --gradient-blue-yellow: linear-gradient(135deg, #006ec7 0%, #ffff00 100%);
  --gradient-blue-orange: linear-gradient(135deg, #006ec7 0%, #ff9868 100%);
  --gradient-blue-pink: linear-gradient(135deg, #006ec7 0%, #f566ba 100%);
  --gradient-blue-violet: linear-gradient(135deg, #006ec7 0%, #461ebe 100%);

  /* Light theme adjustments */
  --card: #ffffff;
  --card-foreground: var(--color-text);
  --muted: #f3f4f6;
  --muted-foreground: #6b7280;
  --accent: #eff6ff;
  --accent-foreground: var(--color-primary);
  --border: #e5e7eb;
  --input: #e5e7eb;

  /* Focus ring: adesso Blue for visible focus indicators (WCAG 2.4.7, 2.4.11). */
  --ring: var(--color-primary);

  /* Navbar height override (Byte sets 18 * spacing ≥768px; we fix it to 15 everywhere). */
  --navbar-height: calc(15 * 4px);

  /* Shadows: same as byte_theme (theme.css :root), options 2xs, xs, sm, md, lg, xl, 2xl */
  --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
  --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
  --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
  --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.1);
  --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 4px 6px -1px hsl(0 0% 0% / 0.1);
  --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.1), 0 8px 10px -1px hsl(0 0% 0% / 0.1);
  --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
}

@media (min-width: 768px) {
  :root {
    --navbar-height: calc(15 * 4px);
  }
}

/* Global focus style for ALL interactive elements (WCAG 2.4.7). */

:where(
  a[href],
  button,
  [role="button"],
  input:not([type="hidden"]),
  select,
  textarea,
  summary
) {
  outline-color: transparent;
}

:where(
  a[href],
  button,
  [role="button"],
  input:not([type="hidden"]),
  select,
  textarea,
  summary
):focus-visible {
  outline: 2px solid #006ec7;
  outline-offset: 1px;
}

/* Footer: white focus ring on blue/dark background. */
footer[role="contentinfo"] :where(
  a[href]
):focus-visible,
.region-footer :where(
  a[href]
):focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: 1px;
}

/* Headings: color is inherited (e.g. from CTA section), Klavika Medium */
h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
}

/* Header: adesso gray 10% (rgba 243, 242, 241) */
header[role="banner"] {
  background-color: #F3F2F1;
}

/* Main navigation: links primary by default, hover adesso gray (rgb 136, 125, 117) */
.adesso-main-nav-link {
  color: var(--primary);
}

/* Mega menu open: prevent background page scroll (navbar mobile uses :root.navbar-modal-open) */
body.adesso-mega-menu-open {
  overflow: hidden;
}

/* Main navigation: mega menu (desktop = full-width panel below header; mobile = accordion) */
.menu-item-has-children {
  position: relative;
}

/* Mega panel: mobile = in-flow below trigger; desktop = fixed below header */
.adesso-mega-panel {
  position: relative;
  width: 100%;
  background-color: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

@media (min-width: 48rem) {
  .adesso-mega-panel {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--adesso-mega-top, 4rem);
    z-index: 490;
    max-height: min(70vh, 32rem);
    overflow: auto;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  }
}

.adesso-mega-panel__close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 !important;
  margin: 0;
  border: 0;
  border-radius: 2px !important;
  background: transparent !important;
  gap: 0 !important;
  color: var(--primary);
  cursor: pointer;
}

@media (min-width: 64rem) {
  .adesso-mega-panel__close {
    display: flex;
  }
}

.adesso-mega-panel__close:hover {
  opacity: 0.88;
}

.adesso-mega-panel__close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.adesso-mega-panel__links {
  display: flex;
  flex-direction: column;
}

.adesso-mega-panel__color-bar {
  display: none;
  width: 100%;
  height: 30px;
}

@media (min-width: 64rem) {
  .adesso-mega-panel__color-bar {
    display: block;
  }
}

/* Level-1-Einträge im Panel: größere Schrift (Fallback zu Tailwind text-lg) */
/*.adesso-mega-panel__links .adesso-main-nav-link,*/
/*.adesso-mega-panel__links .adesso-mega-row-toggle {*/
/*  font-size: 1.125rem;*/
/*  line-height: 1.5rem;*/
/*}*/

.is-nested-expanded .adesso-mega-row {
  border-bottom: 1px solid var(--color-adesso-gray-30);
}

.adesso-mega-panel__links li {
  border-bottom: 1px solid var(--color-adesso-gray-30);
}

.adesso-mega-panel__links li:last-child {
  border-bottom: 0;
}

/* Nested lists (accordion inside mega panel) */
.adesso-mega-nested {
  list-style: none;
  padding: 0;
}

.adesso-mega-nested a {
  padding-left: .75rem;
}

.adesso-mega-nested svg {
  width: 24px;
  height: 24px;
  margin-right: 1rem;
}

/* Nested submenu links:
 * Default: Icon = accent (secondary mustard), Text remains default/inherited
 * Hover: <a> background + Text = adesso gray; Icon = primary
 *
 * Note: SVGs may include inline `style="color: #000000"` so we override `color`
 * on the SVG with !important.
 */
.adesso-mega-panel .adesso-mega-nested a.adesso-main-nav-link {
  background-color: transparent;
}

/* Default icon color (mustard/accent) */
.adesso-mega-panel .adesso-mega-nested a.adesso-main-nav-link svg {
  color: var(--color-secondary-mustard) !important;
}

.adesso-mega-panel .adesso-mega-nested a.adesso-main-nav-link:hover {
  background-color: rgb(232, 228, 225);
}

/* Hover text color (only the text span) */
.adesso-mega-panel .adesso-mega-nested a.adesso-main-nav-link:hover .ui-icons-menu-text {
  color: var(--color-secondary) !important;
}

/* Hover icon color */
.adesso-mega-panel .adesso-mega-nested a.adesso-main-nav-link:hover svg {
  color: var(--primary) !important;
}

.adesso-mega-nested .adesso-mega-nested {
  margin-top: 0.35rem;
}

.adesso-mega-trigger:focus-visible,
.adesso-mega-panel a:focus-visible,
.adesso-mega-nested-toggle:focus-visible,
.adesso-mega-row-toggle:focus-visible {
  outline: 2px solid var(--primary, #003366);
  outline-offset: 2px;
}

/* Submenu arrow: right of text; rotates when expanded */
.menu-submenu-arrow {
  margin-left: auto;
  flex-shrink: 0;
}

#adesso-main-navigation .menu-submenu-arrow svg {
  /*width: 1rem;*/
  /*height: 1rem;*/
  transition: transform 0.2s ease;
}

/* Pfeile: Primary (SVG nutzt currentColor) */
.adesso-mega-panel .menu-submenu-arrow,
.menu-item-has-children .adesso-mega-trigger .menu-submenu-arrow {
  color: var(--primary);
}

.adesso-mega-panel .adesso-mega-nested-toggle {
  color: var(--primary);
}

.menu-item-has-children.is-expanded > .adesso-mega-trigger .menu-submenu-arrow svg {
  transform: rotate(180deg);
}

.adesso-mega-branch-item.is-nested-expanded .menu-submenu-arrow svg {
  transform: rotate(180deg);
}

/* Tailwind scan does not see adesso_theme components, so define utilities here */

.text-white {
  color: #ffffff;
}

/* Body text: Klavika Regular */
body, p, .text-foreground {
  font-weight: 400;
}

/* Buttons: Klavika Medium (font-weight 500), 16px */
button,
input[type="submit"],
input[type="button"],
.button,
.form-submit {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 16px;
}

/* Form inputs: adesso gray 10%, no border */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="time"],
textarea,
select {
  background-color: var(--color-adesso-gray-10);
  border: none;
  padding: 0.5rem 1.32rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
textarea:focus,
select:focus {
  background-color: var(--color-adesso-gray-10);
  border: none;
}

.form-item--error input,
.form-item--error textarea,
.form-item--error select {
  border: none;
}

/* Text component: white on primary/secondary with box-decoration-break, Klavika Medium */
.text-primary-bg {
  font-family: var(--font-sans);
  font-weight: 500;
  color: #ffffff;
  background-color: var(--primary);
  padding: .2em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  word-break: break-word;
}

.text-primary-bg p,
.text-primary-bg span,
.text-primary-bg a,
.text-primary-bg strong,
.text-primary-bg em {
  font-family: var(--font-sans);
  font-weight: 500;
}

.text-secondary-bg {
  font-family: var(--font-sans);
  font-weight: 500;
  color: #ffffff;
  background-color: var(--secondary);
  padding: .2em .43em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  word-break: break-word;
}

.text-secondary-bg p,
.text-secondary-bg span,
.text-secondary-bg a,
.text-secondary-bg strong,
.text-secondary-bg em {
  font-family: var(--font-sans);
  font-weight: 500;
}

/* Override: foreground background uses primary blue for inverted cards etc. */
.bg-foreground {
  background-color: var(--primary);
}

/* Heading component: adesso primary / adesso secondary (text with background) */
.heading-adesso-primary {
  background-color: var(--color-primary);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  color: #ffffff;
  padding: .2em;
  word-break: break-word;
}

.heading-adesso-secondary {
  background-color: var(--color-secondary);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  color: #ffffff;
  padding: .2em;
  word-break: break-word;
}


/* Footer: background #003d69, white text */
footer[role="contentinfo"] {
  --color-bg: #003d69;
  background-color: var(--color-bg);
  color: #ffffff;
}

footer[role="contentinfo"] a,
footer[role="contentinfo"] p,
footer[role="contentinfo"] h1,
footer[role="contentinfo"] h2,
footer[role="contentinfo"] h3,
footer[role="contentinfo"] h4,
footer[role="contentinfo"] h5,
footer[role="contentinfo"] h6,
footer[role="contentinfo"] .text-foreground,
footer[role="contentinfo"] li {
  color: #ffffff;
}

footer[role="contentinfo"] a {
  text-decoration: none;
  opacity: 1;
}

footer[role="contentinfo"] a:hover {
  --color-highlight: var(--color-secondary-mustard);
  color: var(--color-highlight);
  text-decoration: none;
  opacity: 1;
}

/* Footer logo: rendered in white */
footer[role="contentinfo"] .branding img {
  filter: brightness(0) invert(1);
}

/* Accordion: title slightly larger (text-3xl instead of text-2xl) */
.accordion--title {
  font-size: 1.5rem;
  line-height: 1.3125;
}

/* Accordion: inset outline so it is not clipped by overflow-hidden (WCAG 2.4.7) */
.accordion :where(a[href], button, [role="button"], input:not([type="hidden"]), select, textarea, summary):focus-visible {
  outline-offset: -2px;
}

.view-blog .views-exposed-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.view-blog .views-exposed-form .form-item {
  margin: 0;
}

.view-blog .views-exposed-form select {
  height: 40px;
}

.view-blog .views-exposed-form .form-submit {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
