/* Homepage refinement: limestone, Adriatic blue, warm Apulian accents. */
@media (max-width: 639px) {
  :root {
    --oh-mobile-paper: #fffdf4;
    --oh-mobile-paper-deep: #f7eedb;
    --oh-mobile-ink: #073f59;
    --oh-mobile-sea: #0f6f83;
    --oh-mobile-clay: #d9663d;
    --oh-mobile-sun: #f2c14e;
    --oh-mobile-olive: #71805d;
    --oh-mobile-line: rgba(7, 63, 89, 0.22);
    --oh-mobile-mono: "Fragment Mono", monospace;
  }

  html,
  body {
    background: var(--oh-mobile-paper-deep);
  }

  body {
    color: var(--oh-mobile-ink);
    font-family: "Alegreya Sans", sans-serif !important;
  }

  #homepageBackground picture img {
    opacity: 0.23;
    filter: saturate(0.78) contrast(0.92) sepia(0.08);
    transform: scale(1.025);
  }

  #homepageBackground > div:last-child {
    background:
      radial-gradient(circle at 84% 13%, rgba(242, 193, 78, 0.3) 0 8%, transparent 27%),
      radial-gradient(circle at 3% 74%, rgba(15, 111, 131, 0.13), transparent 34%),
      linear-gradient(165deg, rgba(255, 253, 244, 0.72), rgba(247, 238, 219, 0.9));
  }

  #homepage-desktop-wrapper::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    background-image:
      linear-gradient(rgba(7, 63, 89, 0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(7, 63, 89, 0.035) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(to bottom, black, transparent 78%);
  }

  #mainChatContainer {
    padding: 4.75rem 0.75rem 0.65rem !important;
  }

  #mainChatContainer > h1.custom-logo {
    position: relative;
    z-index: 1;
    margin: 0 0 0.5rem !important;
    color: var(--oh-mobile-ink);
    font-size: 38px !important;
    line-height: 0.94 !important;
    letter-spacing: -0.035em;
    text-shadow: 0 2px 0 rgba(255, 253, 244, 0.92);
    filter: none;
    animation: oh-mobile-logo-in 0.65s cubic-bezier(0.2, 0.78, 0.2, 1) both;
  }

  #desktopChatCard.glass-card {
    position: relative;
    border: 1px solid transparent;
    border-radius: 27px;
    background:
      linear-gradient(rgba(255, 253, 244, 0.96), rgba(255, 251, 240, 0.96)) padding-box,
      linear-gradient(145deg, rgba(7, 63, 89, 0.38), rgba(217, 102, 61, 0.34), rgba(242, 193, 78, 0.42)) border-box;
    box-shadow:
      0 19px 45px rgba(7, 63, 89, 0.14),
      0 5px 0 rgba(217, 102, 61, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(18px) saturate(1.08);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
    animation: oh-mobile-card-in 0.72s 0.08s cubic-bezier(0.2, 0.78, 0.2, 1) both;
  }

  #desktopChatCard.glass-card::before {
    display: none;
  }

  #chat {
    padding: 0.95rem 0.85rem 0.75rem !important;
    scrollbar-color: rgba(7, 63, 89, 0.25) transparent;
  }

  #chat > div:first-child:not(#category-container) {
    width: 100% !important;
    max-width: none !important;
    padding: 0.78rem 0.9rem !important;
    border: 1px solid rgba(7, 63, 89, 0.11);
    border-radius: 17px 17px 17px 5px !important;
    color: var(--oh-mobile-ink) !important;
    background:
      linear-gradient(115deg, rgba(15, 111, 131, 0.08), transparent 62%),
      rgba(255, 255, 255, 0.75) !important;
    box-shadow: none !important;
  }

  #chat > div:first-child:not(#category-container) .text-xs {
    color: var(--oh-mobile-clay) !important;
    font: 9px/1.2 var(--oh-mobile-mono) !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  #chat > div:first-child:not(#category-container) .text-sm {
    color: var(--oh-mobile-ink) !important;
    font-size: 14px !important;
    line-height: 1.32;
  }

  #chat > div:first-child:not(#category-container) .text-\[10px\] {
    color: rgba(7, 63, 89, 0.48) !important;
    font: 8px/1 var(--oh-mobile-mono) !important;
  }

  #category-container {
    gap: 0.47rem !important;
    margin-top: 0.72rem !important;
    margin-bottom: 0.5rem !important;
    padding: 0 !important;
  }

  #category-container .chat-option-btn {
    position: relative;
    min-height: 39px;
    justify-content: flex-start;
    gap: 0.52rem;
    overflow: hidden;
    padding: 0.5rem 0.62rem;
    border: 1px solid var(--oh-mobile-line);
    border-radius: 14px;
    color: var(--oh-mobile-ink);
    background: rgba(255, 255, 255, 0.66);
    box-shadow: 0 2px 0 rgba(7, 63, 89, 0.08);
    font-size: 12px;
    font-weight: 400 !important;
    line-height: 1.05;
    text-align: left;
    animation: oh-mobile-option-in 0.42s cubic-bezier(0.2, 0.78, 0.2, 1) both;
  }

  #category-container .chat-option-btn:nth-child(n) { animation-delay: 0.12s; }
  #category-container .chat-option-btn:nth-child(n + 5) { animation-delay: 0.17s; }
  #category-container .chat-option-btn:nth-child(n + 11) { animation-delay: 0.22s; }
  #category-container .chat-option-btn:nth-child(n + 17) { animation-delay: 0.27s; }

  #category-container .chat-option-btn img {
    width: 19px !important;
    height: 19px !important;
    flex: 0 0 auto;
    opacity: 0.88;
  }

  #category-container .chat-option-btn:active {
    border-color: var(--oh-mobile-clay);
    background: rgba(242, 193, 78, 0.13);
    box-shadow: none;
    transform: translateY(1px);
  }

  #chat .oh-chat-message {
    position: relative;
    max-width: min(86%, 19rem) !important;
    padding: 0.72rem 0.82rem !important;
    border-radius: 16px 16px 16px 4px !important;
    box-shadow: none !important;
  }

  #chat .oh-chat-ai {
    color: var(--oh-mobile-ink) !important;
    border: 1px solid rgba(7, 63, 89, 0.17) !important;
    background:
      linear-gradient(120deg, rgba(15, 111, 131, 0.09), transparent 66%),
      rgba(255, 253, 244, 0.97) !important;
    box-shadow: 4px 4px 0 rgba(15, 111, 131, 0.1) !important;
  }

  #chat .oh-chat-ai::before {
    position: absolute;
    top: 0.7rem;
    left: -1px;
    width: 3px;
    height: 1.55rem;
    content: "";
    background: var(--oh-mobile-clay);
  }

  #chat .oh-chat-user {
    margin-left: auto;
    color: var(--oh-mobile-paper) !important;
    border: 1px solid var(--oh-mobile-sea) !important;
    border-radius: 16px 16px 4px 16px !important;
    background: var(--oh-mobile-sea) !important;
    box-shadow: 3px 3px 0 rgba(7, 63, 89, 0.13) !important;
  }

  #chat .oh-chat-sender {
    color: var(--oh-mobile-clay) !important;
    font: 8px/1.2 var(--oh-mobile-mono) !important;
    font-weight: 400 !important;
    letter-spacing: 0.085em;
    text-transform: uppercase;
  }

  #chat .oh-chat-copy {
    color: inherit !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.3;
  }

  #chat .oh-chat-ai .oh-chat-copy {
    font-family: "Alegreya Sans", sans-serif !important;
  }

  #chat .oh-chat-time {
    color: rgba(7, 63, 89, 0.43) !important;
    font: 7px/1 var(--oh-mobile-mono) !important;
  }

  #chat .oh-chat-user .oh-chat-sender,
  #chat .oh-chat-user .oh-chat-time {
    color: rgba(255, 253, 244, 0.68) !important;
  }

  #chat > .flex.gap-2.mt-2.flex-wrap {
    width: 100%;
    gap: 0.45rem !important;
    margin-top: 0.72rem !important;
    padding-bottom: 0.08rem;
  }

  #chat > .flex.gap-2.mt-2.flex-wrap .chat-option-btn {
    min-height: 38px;
    gap: 0.42rem;
    padding: 0.48rem 0.62rem;
    border: 1px solid var(--oh-mobile-line);
    border-radius: 12px;
    color: var(--oh-mobile-ink);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 2px 0 rgba(7, 63, 89, 0.08);
    font-size: 12px;
    font-weight: 400 !important;
  }

  #chat > .flex.gap-2.mt-2.flex-wrap .chat-option-btn:active {
    color: var(--oh-mobile-paper);
    border-color: var(--oh-mobile-sea);
    background: var(--oh-mobile-sea);
    box-shadow: none;
    transform: translateY(1px);
  }

  #chat .snap-center {
    border-color: rgba(7, 63, 89, 0.18) !important;
    border-radius: 18px !important;
    background: rgba(255, 253, 244, 0.98) !important;
    box-shadow: 0 8px 20px rgba(7, 63, 89, 0.09) !important;
  }

  #chat .more-info-btn,
  #chat .chat-menu-btn,
  #chat .chat-yes-btn,
  #chat .chat-no-btn {
    min-height: 39px;
    border-color: rgba(7, 63, 89, 0.2) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.76) !important;
    box-shadow: 0 2px 0 rgba(7, 63, 89, 0.08) !important;
    font-size: 13px;
    font-weight: 400 !important;
  }

  #chat .chat-yes-btn { color: var(--oh-mobile-olive) !important; }
  #chat .chat-no-btn { color: var(--oh-mobile-clay) !important; }
  #chat #reset-to-menu-btn .chat-menu-btn { color: var(--oh-mobile-ink); }

  #chat-input-container {
    border-color: rgba(7, 63, 89, 0.12) !important;
    background: rgba(255, 253, 244, 0.94) !important;
  }

  #chat-input-container #input {
    border-color: rgba(7, 63, 89, 0.35) !important;
    border-radius: 14px;
    background: white;
  }

  #chat-input-container #sendButton {
    color: var(--oh-mobile-paper);
    border-color: var(--oh-mobile-sea);
    background: var(--oh-mobile-sea);
  }

  body > div.fixed.top-4.left-4,
  body > div.fixed.top-4.right-4 {
    top: calc(env(safe-area-inset-top, 0px) + 0.72rem) !important;
    gap: 0.42rem !important;
    animation: oh-mobile-tools-in 0.58s cubic-bezier(0.2, 0.78, 0.2, 1) both;
  }

  body > div.fixed.top-4.left-4 { left: 0.72rem !important; }
  body > div.fixed.top-4.right-4 { right: 0.72rem !important; }

  .mobile-header-btn {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    color: var(--oh-mobile-ink) !important;
    border: 1px solid rgba(7, 63, 89, 0.27) !important;
    background: rgba(255, 253, 244, 0.9) !important;
    box-shadow: 0 3px 0 rgba(7, 63, 89, 0.09) !important;
    backdrop-filter: blur(15px) saturate(1.1);
    -webkit-backdrop-filter: blur(15px) saturate(1.1);
  }

  #ostuniAiBtnMobile.mobile-header-btn {
    width: auto !important;
    min-width: 91px;
    padding: 0 0.82rem !important;
    color: var(--oh-mobile-paper) !important;
    border-color: var(--oh-mobile-clay) !important;
    background: var(--oh-mobile-clay) !important;
    box-shadow: 0 3px 0 rgba(7, 63, 89, 0.13) !important;
    font: 11px/1 var(--oh-mobile-mono) !important;
  }

  .mobile-header-btn img {
    width: 18px !important;
    height: 18px !important;
  }

  #ostuniAiBtnMobile img {
    filter: brightness(0) invert(1);
  }

  #mobileMainMenu,
  #langDropdown {
    margin-top: 0.55rem !important;
    border: 1px solid var(--oh-mobile-line) !important;
    border-radius: 16px !important;
    color: var(--oh-mobile-ink);
    background: rgba(255, 253, 244, 0.98) !important;
    box-shadow: 7px 7px 0 rgba(217, 102, 61, 0.18) !important;
  }

  #mobileMainMenu a,
  #mobileMainMenu button,
  #langDropdown button {
    min-height: 42px;
    border-bottom: 1px solid rgba(7, 63, 89, 0.09);
    font-size: 13px;
    font-weight: 400 !important;
  }

  #brandBarMount {
    width: calc(100% - 1.5rem) !important;
    opacity: 0.9;
  }

  .brand-bar {
    height: 54px !important;
    max-height: 54px !important;
    border-color: rgba(7, 63, 89, 0.12) !important;
    border-radius: 18px 18px 0 0 !important;
    background: rgba(255, 253, 244, 0.72) !important;
    box-shadow: 0 -8px 24px rgba(7, 63, 89, 0.06) !important;
  }

  .brand-bar-container {
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
  }

  #mobileFooter > div {
    color: rgba(7, 63, 89, 0.75) !important;
    border-color: rgba(7, 63, 89, 0.14) !important;
    background: rgba(255, 253, 244, 0.88) !important;
    box-shadow: 0 5px 18px rgba(7, 63, 89, 0.09) !important;
    font-family: var(--oh-mobile-mono) !important;
  }

  @keyframes oh-mobile-logo-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  }

  @keyframes oh-mobile-card-in {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
  }

  @keyframes oh-mobile-option-in {
    from { opacity: 0; transform: translateY(7px); }
  }

  @keyframes oh-mobile-tools-in {
    from { opacity: 0; transform: translateY(-10px); }
  }

  @media (max-width: 370px) {
    #mainChatContainer { padding-inline: 0.55rem !important; }
    .mobile-header-btn { width: 37px !important; height: 37px !important; }
    #ostuniAiBtnMobile.mobile-header-btn { min-width: 82px; padding-inline: 0.65rem !important; }
    #category-container .chat-option-btn { padding-inline: 0.48rem; font-size: 11px; }
  }

  @media (prefers-reduced-motion: reduce) {
    #mainChatContainer > h1.custom-logo,
    #desktopChatCard.glass-card,
    #category-container .chat-option-btn,
    body > div.fixed.top-4.left-4,
    body > div.fixed.top-4.right-4 {
      animation: none !important;
    }
  }
}

@media (min-width: 640px) {
  :root {
    --oh-desktop-paper: #fffdf4;
    --oh-desktop-paper-deep: #f7eedb;
    --oh-desktop-ink: #073f59;
    --oh-desktop-sea: #0f6f83;
    --oh-desktop-clay: #d9663d;
    --oh-desktop-sun: #f2c14e;
    --oh-desktop-line: rgba(7, 63, 89, 0.24);
    --oh-desktop-mono: "Fragment Mono", monospace;
  }

  html,
  body {
    background: var(--oh-desktop-paper-deep);
  }

  body {
    color: var(--oh-desktop-ink);
    font-family: "Alegreya Sans", sans-serif !important;
  }

  #homepageBackground picture img {
    opacity: 0.34;
    filter: saturate(0.76) contrast(0.94) sepia(0.06);
    transform: scale(1.015);
  }

  #homepageBackground > div:last-child {
    background:
      radial-gradient(circle at 88% 20%, rgba(242, 193, 78, 0.25), transparent 28rem),
      radial-gradient(circle at 7% 75%, rgba(15, 111, 131, 0.13), transparent 31rem),
      linear-gradient(160deg, rgba(255, 253, 244, 0.7), rgba(247, 238, 219, 0.83));
  }

  #homepage-desktop-wrapper::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    background-image:
      linear-gradient(rgba(7, 63, 89, 0.03) 1px, transparent 1px),
      linear-gradient(90deg, rgba(7, 63, 89, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, black, transparent 82%);
  }

  #mainChatContainer {
    padding-top: clamp(3rem, 7vh, 5rem) !important;
    padding-bottom: 1.5rem !important;
  }

  #desktopChatCard.glass-card {
    position: relative;
    width: min(92%, 78rem) !important;
    max-width: 78rem !important;
    min-height: 238px !important;
    overflow: visible;
    border: 1px solid var(--oh-desktop-ink);
    border-radius: 5px;
    background: rgba(255, 253, 244, 0.93);
    box-shadow: 9px 9px 0 rgba(158, 216, 209, 0.47);
    backdrop-filter: blur(16px) saturate(1.04);
    -webkit-backdrop-filter: blur(16px) saturate(1.04);
    animation: oh-desktop-card-in 0.68s cubic-bezier(0.2, 0.78, 0.2, 1) both;
  }

  #desktopChatCard.glass-card::before {
    position: absolute;
    top: -1px;
    left: 1.4rem;
    padding: 0.32rem 0.55rem;
    color: var(--oh-desktop-paper);
    background: var(--oh-desktop-clay);
    content: "SCOPRI OSTUNI";
    font: 8px/1 var(--oh-desktop-mono);
    letter-spacing: 0.09em;
    transform: translateY(-50%);
  }

  #desktopChatCard #chat {
    min-height: 236px;
    max-height: calc(100dvh - 16rem) !important;
    padding: 1.65rem 1.75rem 1.35rem !important;
  }

  #chat .oh-chat-message {
    position: relative;
    max-width: min(38%, 27rem) !important;
    padding: 0.72rem 0.85rem !important;
    border-radius: 4px !important;
    box-shadow: none !important;
  }

  #chat .oh-chat-ai {
    color: var(--oh-desktop-ink) !important;
    border: 1px solid rgba(7, 63, 89, 0.17) !important;
    background:
      linear-gradient(115deg, rgba(15, 111, 131, 0.09), transparent 64%),
      rgba(255, 255, 255, 0.68) !important;
  }

  #chat .oh-chat-user {
    margin-left: auto;
    color: var(--oh-desktop-paper) !important;
    border: 1px solid var(--oh-desktop-sea) !important;
    background: var(--oh-desktop-sea) !important;
    box-shadow: 3px 3px 0 rgba(7, 63, 89, 0.12) !important;
  }

  #chat .oh-chat-sender {
    color: var(--oh-desktop-clay) !important;
    font: 8px/1.2 var(--oh-desktop-mono) !important;
    font-weight: 400 !important;
    letter-spacing: 0.075em;
    text-transform: uppercase;
  }

  #chat .oh-chat-copy {
    color: inherit !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.35;
  }

  #chat .oh-chat-time {
    color: rgba(7, 63, 89, 0.42) !important;
    font: 7px/1 var(--oh-desktop-mono) !important;
  }

  #chat .oh-chat-user .oh-chat-sender,
  #chat .oh-chat-user .oh-chat-time {
    color: rgba(255, 253, 244, 0.7) !important;
  }

  #desktopChatCard #category-container {
    gap: 0.58rem !important;
    margin-top: 0.85rem !important;
  }

  #desktopChatCard #category-container .chat-option-btn,
  #chat > .flex.gap-2.mt-2.flex-wrap .chat-option-btn {
    min-height: 41px;
    gap: 0.46rem;
    padding: 0.55rem 0.72rem;
    border: 1px solid var(--oh-desktop-line);
    border-radius: 3px;
    color: var(--oh-desktop-ink);
    background: rgba(255, 253, 244, 0.88);
    box-shadow: 0 2px 0 rgba(7, 63, 89, 0.08);
    font-size: 13px;
    font-weight: 400 !important;
    line-height: 1.05;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  }

  #desktopChatCard #category-container .chat-option-btn:hover,
  #desktopChatCard #category-container .chat-option-btn:focus-visible,
  #chat > .flex.gap-2.mt-2.flex-wrap .chat-option-btn:hover,
  #chat > .flex.gap-2.mt-2.flex-wrap .chat-option-btn:focus-visible {
    border-color: var(--oh-desktop-ink);
    color: var(--oh-desktop-ink);
    background: var(--oh-desktop-sun);
    box-shadow: 4px 4px 0 rgba(217, 102, 61, 0.22);
    outline: none;
    transform: translateY(-1px);
  }

  #desktopChatCard #category-container .chat-option-btn img {
    width: 18px !important;
    height: 18px !important;
    opacity: 0.9;
  }

  #chat > .flex.gap-2.mt-2.flex-wrap {
    width: 100%;
    gap: 0.5rem !important;
    margin-top: 0.72rem !important;
  }

  #chat #reset-to-menu-btn .chat-menu-btn {
    min-height: 37px;
    border: 1px solid var(--oh-desktop-line);
    border-radius: 3px;
    color: var(--oh-desktop-ink);
    background: rgba(255, 253, 244, 0.88);
    box-shadow: none;
    font: 9px/1 var(--oh-desktop-mono) !important;
    font-weight: 400 !important;
    letter-spacing: 0.035em;
  }

  #chat #reset-to-menu-btn .chat-menu-btn:hover,
  #chat #reset-to-menu-btn .chat-menu-btn:focus-visible {
    border-color: var(--oh-desktop-ink);
    color: var(--oh-desktop-ink);
    background: rgba(242, 193, 78, 0.28);
    outline: none;
  }

  #categoryMenuBarDesktop {
    width: min(92%, 78rem) !important;
    max-width: 78rem !important;
    margin-top: 0.85rem !important;
  }

  #categoryMenuBarDesktop .menu-wrapper {
    width: auto;
    min-height: 3rem;
    margin: 0 auto;
    padding: 0.38rem;
    border: 1px solid var(--oh-desktop-ink);
    border-radius: 4px;
    background: rgba(255, 253, 244, 0.94);
    box-shadow: 5px 5px 0 rgba(217, 102, 61, 0.18);
    backdrop-filter: blur(12px);
  }

  #categoryMenuBarDesktop .chat-menu-btn {
    min-height: 37px;
    padding: 0.5rem 0.72rem;
    border: 0;
    border-right: 1px solid var(--oh-desktop-line);
    border-radius: 0;
    color: var(--oh-desktop-ink);
    background: transparent;
    box-shadow: none;
    font: 9px/1 var(--oh-desktop-mono) !important;
    font-weight: 400 !important;
    letter-spacing: 0.035em;
  }

  #categoryMenuBarDesktop .chat-menu-btn:last-child {
    border-right: 0;
  }

  #categoryMenuBarDesktop .chat-menu-btn:hover,
  #categoryMenuBarDesktop .chat-menu-btn:focus-visible {
    color: var(--oh-desktop-ink);
    background: rgba(242, 193, 78, 0.28);
    outline: none;
    transform: none;
  }

  #brandBarMount {
    width: min(46rem, 74%) !important;
    margin-top: 0.82rem;
    align-self: center !important;
  }

  #brandBarMount .brand-bar,
  #brandBarMount .brand-bar-container {
    border-color: var(--oh-desktop-line) !important;
    border-radius: 4px !important;
    background: rgba(255, 253, 244, 0.82) !important;
    box-shadow: 4px 4px 0 rgba(7, 63, 89, 0.07) !important;
  }

  #brandBarMount .brand-logo {
    border-radius: 3px !important;
    background: rgba(255, 255, 255, 0.62) !important;
    box-shadow: none !important;
  }

  #mobileFooter > div {
    border-color: var(--oh-desktop-line) !important;
    border-radius: 3px !important;
    color: rgba(7, 63, 89, 0.7) !important;
    background: rgba(255, 253, 244, 0.9) !important;
    box-shadow: none !important;
    font-family: var(--oh-desktop-mono) !important;
  }

  @keyframes oh-desktop-card-in {
    from { opacity: 0; transform: translateY(14px); }
  }

  @media (prefers-reduced-motion: reduce) {
    #desktopChatCard.glass-card { animation: none !important; }
  }
}
