/* Root & Leaf — mobile-first адаптація та touch */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* —— Базові токени —— */
@media (max-width: 767px) {
  :root {
    --header-h: 68px;
    --radius-md: 14px;
    --radius-lg: 20px;
  }
}

@media (max-width: 380px) {
  :root {
    --header-h: 64px;
  }
}

/* Safe area (вирізи, home indicator) */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  .site-header {
    padding-top: max(0.65rem, env(safe-area-inset-top));
  }

  .ui-toast-host {
    bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  .cookie-banner.is-visible {
    bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .cart-drawer__foot {
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }
}

/* Touch / mobile: без кастомного курсора, легші ефекти */
body.is-touch,
body.is-mobile {
  cursor: auto;
}

body.is-touch .cursor-leaf,
body.is-touch .cursor-glow {
  display: none !important;
}

body.is-mobile .ambient-vine,
body.is-mobile .ambient-orb--3 {
  display: none;
}

body.is-mobile .floating-leaf {
  opacity: 0.25;
}

body.is-mobile .ambient-orb {
  filter: blur(48px);
  opacity: 0.35;
}

body.nav-open {
  overflow: hidden;
}

/* Tap targets */
@media (max-width: 767px) {
  .chip,
  .btn,
  .icon-btn,
  .nav-mobile__panel a,
  .pagination button {
    min-height: 44px;
  }

  .chip {
    padding: 0.5rem 0.85rem;
  }

}

/* —— Header —— */
@media (max-width: 899px) {
  .site-header {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .site-header.is-morphed .header-shell {
    max-width: 100%;
    border-radius: var(--radius-lg);
    padding: 0.4rem 0.65rem;
  }

  .header-inner {
    height: 52px;
    gap: 0.35rem;
    min-width: 0;
  }

  .logo {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    font-size: clamp(0.82rem, 3.2vw, 1rem);
    gap: 0.45rem;
    overflow: hidden;
  }

  .logo__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .logo__name--short {
    display: none;
    letter-spacing: 0.02em;
  }

  .logo svg {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
  }

  .header-actions {
    flex-shrink: 0;
    gap: 0.3rem;
  }

  .lang-switch button {
    padding: 0.4rem 0.5rem;
    font-size: 0.68rem;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
}

@media (max-width: 520px) {
  .site-header .theme-toggle {
    display: none;
  }

  .logo__name--full {
    display: none;
  }

  .logo__name--short {
    display: inline;
  }
}

@media (max-width: 380px) {
  .logo {
    flex: 0 0 auto;
    gap: 0;
  }

  .logo__name--full,
  .logo__name--short {
    display: none !important;
  }

  .logo svg {
    width: 30px;
    height: 30px;
  }

  .lang-switch button {
    padding: 0.38rem 0.45rem;
    font-size: 0.65rem;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }
}

/* —— Типографіка —— */
@media (max-width: 767px) {
  .hero-title {
    font-size: clamp(1.85rem, 8vw, 2.5rem);
    line-height: 1.12;
  }

  .hero-subtitle {
    font-size: 1rem;
    max-width: none;
  }

  .section-title {
    font-size: clamp(1.35rem, 5.5vw, 1.75rem);
  }

  .page-title h1 {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }

  .section {
    padding: clamp(2.5rem, 8vw, 4rem) 0;
  }

  .section-divider {
    margin-bottom: 1.5rem;
  }

  .section--scroll::after {
    display: none;
  }
}

/* —— Hero —— */
@media (max-width: 959px) {
  .hero {
    padding-top: clamp(1.5rem, 5vw, 2.5rem);
    padding-bottom: clamp(2rem, 6vw, 3rem);
  }

  .hero-grid {
    gap: 2rem;
  }

  .hero-visual {
    min-height: 260px;
    order: -1;
  }

  .hero-image {
    aspect-ratio: 16/11;
    max-height: 42vh;
    object-position: center;
  }

  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-cta .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1.25rem;
  }

  .hero-stat {
    padding: 0.65rem 0.35rem;
  }

  .hero-stat__value {
    font-size: 1.25rem;
  }

  .hero-stat__label {
    font-size: 0.62rem;
  }
}

@media (max-width: 400px) {
  .hero-stats {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .hero-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 0.75rem 1rem;
  }

  .hero-stat__value {
    font-size: 1.35rem;
  }
}

/* —— Секції та сітки —— */
@media (max-width: 767px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .section-header > a {
    width: 100%;
    text-align: center;
    padding: 0.65rem 1rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
  }

  .plants-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 0.75rem;
  }

  .pot-card__planter-box {
    min-height: 168px;
    aspect-ratio: 10 / 11;
  }

  .pot-card__saucer {
    padding: 0.8rem 0.6rem 1rem;
    border-radius: 0 0 20px 20px;
  }

  .pot-card__plant-figure {
    top: 8%;
  }

  .pot-card__planter-feet {
    gap: 36%;
  }

  .pot-card__excerpt {
    -webkit-line-clamp: 1;
    font-size: 0.65rem;
  }

  .pot-card__zoom-hint {
    display: none;
  }

  .pot-card__title {
    font-size: 0.82rem;
  }

  .pot-card__latin {
    display: none;
  }

  .pot-card__price {
    font-size: 1rem;
  }

  .pot-card__chips .badge {
    font-size: 0.55rem;
    padding: 0.12rem 0.35rem;
  }

  .articles-grid,
  .journal-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .reviews-slider {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .hero-floater {
    font-size: 0.62rem;
    padding: 0.3rem 0.55rem;
  }

  .hero-floater--1 { left: 2%; top: 8%; }
  .hero-floater--2 { right: 2%; top: 38%; }
  .hero-floater--3 { left: 6%; bottom: 12%; }

  .light-quiz {
    padding: 1.25rem;
  }

  .light-quiz__option {
    padding: 0.85rem;
  }

  .delivery-flow__track {
    gap: 0.75rem;
  }

  .fun-facts__bento {
    grid-template-columns: 1fr 1fr;
  }

  .fun-facts__card--wide,
  .fun-facts__card--tall {
    grid-column: span 2;
    grid-row: auto;
  }

  .reviews-rail__track .review-card {
    flex-basis: min(300px, 88vw);
  }

  .usp-grid {
    grid-template-columns: 1fr;
  }

  .team-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .stat-card,
  .team-card {
    padding: 1rem;
  }

  .stat-card__value {
    font-size: 1.35rem;
  }
}

@media (max-width: 359px) {
  .plants-grid {
    grid-template-columns: 1fr;
    max-width: 280px;
    margin: 0 auto;
  }
}

/* —— Newsletter / CTA / promo —— */
@media (max-width: 767px) {
  .newsletter-strip {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 1.5rem !important;
    gap: 1rem;
  }

  .newsletter-form {
    flex-direction: column;
    width: 100%;
  }

  .newsletter-form input {
    min-width: 0;
    width: 100%;
  }

  .newsletter-form .btn {
    width: 100%;
  }

  .cta-block {
    padding: 2rem 1.25rem;
  }

  .cta-block .btn {
    width: 100%;
  }

  .promo-banner {
    padding: 1rem !important;
    text-align: center;
    font-size: 0.88rem;
  }

  .marquee__track span {
    font-size: 0.8rem;
  }
}

/* —— Footer —— */
@media (max-width: 767px) {
  .site-footer {
    margin-top: 2.5rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  .footer-top {
    padding: 1.25rem;
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
  }
}

/* —— Cookie —— */
@media (max-width: 600px) {
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    width: calc(100% - 1.25rem);
    padding: 1rem;
  }

  .cookie-banner .btn {
    width: 100%;
  }
}

/* —— Каталог: фільтри —— */
.filters-wrap {
  display: block;
}

.filters-wrap__summary {
  display: none;
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.filters-wrap__summary::-webkit-details-marker {
  display: none;
}

.filters-wrap__summary::after {
  content: "＋";
  color: var(--accent);
  font-size: 1.1rem;
  transition: transform 0.3s var(--ease-out);
}

.filters-wrap[open] .filters-wrap__summary::after {
  content: "−";
}

@media (max-width: 959px) {
  .filters-wrap__summary {
    display: flex;
  }

  .filters-panel {
    position: static;
    top: auto;
  }

  .catalog-layout {
    padding-top: 1rem;
  }

  .catalog-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input,
  .sort-select {
    width: 100%;
    min-width: 0;
  }

  .page-title {
    padding-top: 0.5rem;
  }

  .page-title p {
    font-size: 0.88rem;
  }
}

@media (min-width: 960px) {
  .filters-wrap {
    display: contents;
  }

  .filters-wrap__summary {
    display: none !important;
  }

  .filters-panel__title {
    display: block;
  }
}

@media (max-width: 959px) {
  .filters-panel__title {
    display: none;
  }
}

/* —— Кошик —— */
@media (max-width: 480px) {
  .cart-drawer__panel {
    width: 100%;
    max-width: 100%;
  }

  .cart-line__thumb {
    width: 56px;
    height: 56px;
  }

  .cart-toast {
    white-space: normal;
    text-align: center;
    max-width: calc(100vw - 2rem);
    font-size: 0.85rem;
  }
}

/* —— Plant detail —— */
@media (max-width: 959px) {
  .plant-hero {
    gap: 1rem;
  }

  .plant-hero__figure img {
    max-height: min(38vh, 16rem);
    aspect-ratio: 4 / 3;
  }

  .plant-hero__specs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plant-hero__care {
    grid-template-columns: 1fr;
  }

  .plant-hero__panel {
    padding: 1rem;
  }

  .plant-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .plant-hero__pricing {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .plant-hero__actions .btn {
    width: 100%;
    min-width: 0;
  }
}

/* —— Checkout —— */
@media (max-width: 767px) {
  .checkout-steps {
    gap: 0.35rem;
  }

  .step-dot {
    font-size: 0.68rem;
    padding: 0.35rem 0.6rem;
  }

  .checkout-grid {
    gap: 1.25rem;
  }
}

/* —— Contact —— */
@media (max-width: 899px) {
  .contact-grid {
    grid-template-columns: 1fr;
    padding-top: 0;
  }

  .contact-form-card,
  .contact-cards {
    padding: 0;
  }

  .contact-form-card {
    padding: 1.25rem;
  }
}

/* —— Journal —— */
@media (max-width: 767px) {
  .journal-hero__stats {
    gap: 0.5rem;
  }

  .journal-toolbar {
    margin-bottom: 1rem;
  }

  .article-hero {
    aspect-ratio: 4 / 3;
  }

  .article-hero__title {
    max-width: none;
  }

  .article-full__body p:first-child::first-letter {
    font-size: 2.5rem;
  }

  .journal-tags {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
}

/* —— Loader —— */
@media (max-width: 767px) {
  .page-loader.is-mobile-fast .grow-loader__plant {
    animation-duration: 0.9s;
  }

  .page-loader.is-mobile-fast.is-bloom .grow-petal-wrap--1 .grow-petal { animation-duration: 0.35s; }
  .page-loader.is-mobile-fast.is-bloom .grow-petal-wrap--2 .grow-petal { animation-duration: 0.35s; }
  .page-loader.is-mobile-fast.is-bloom .grow-petal-wrap--3 .grow-petal { animation-duration: 0.35s; }
  .page-loader.is-mobile-fast.is-bloom .grow-petal-wrap--4 .grow-petal { animation-duration: 0.35s; }
  .page-loader.is-mobile-fast.is-bloom .grow-petal-wrap--5 .grow-petal { animation-duration: 0.35s; }

  .grow-loader__card {
    width: min(176px, 68vw);
  }

  .loader-brand {
    font-size: 1.35rem;
  }

  .flower-spinner--lg {
    width: 92px;
  }

  .route-loader__inner,
  .page-transition__inner {
    transform: scale(0.92);
  }

  .route-loader.is-active .route-loader__inner,
  .page-transition.is-active .page-transition__inner {
    animation: mobileLoaderPop 0.45s var(--ease-out) forwards;
  }

  body.is-loaded main,
  body.is-loaded .site-header,
  body.is-loaded .site-footer {
    animation-duration: 0.65s;
  }
}

@keyframes mobileLoaderPop {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* —— Glass: менше blur на мобільних (продуктивність) —— */
@media (max-width: 767px) {
  .glass-card,
  .site-header.is-morphed .header-shell,
  .cookie-banner {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* Hover тільки з мишею */
@media (hover: none) {
  .usp-card:hover,
  .journal-card:hover,
  .review-card:hover,
  .pot-card:hover {
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
  }

  .zoom-media:hover img {
    transform: none;
  }
}

@media (max-width: 767px) {
  .gallery-section__lead {
    font-size: 0.92rem;
    margin-bottom: 1.25rem;
  }

  .photo-mosaic {
    gap: 0.65rem;
  }

  .photo-mosaic__item:nth-child(1) {
    grid-column: span 2;
    aspect-ratio: 16/10;
  }

  .photo-mosaic__item figcaption {
    font-size: 0.68rem;
    padding: 0.5rem 0.65rem;
  }
}

/* —— Глобальні мобільні правки —— */
@media (max-width: 767px) {
  html {
    -webkit-overflow-scrolling: touch;
  }

  .container {
    padding-left: max(0.85rem, env(safe-area-inset-left));
    padding-right: max(0.85rem, env(safe-area-inset-right));
  }

  input,
  select,
  textarea,
  .search-input,
  .sort-select {
    font-size: max(16px, 1rem);
  }

  .scroll-progress {
    display: none;
  }

  .ambient-bg .ambient-orb--2 {
    display: none;
  }

  .back-to-top {
    bottom: max(1rem, calc(env(safe-area-inset-bottom) + 0.35rem));
    right: max(0.85rem, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
  }

  .pagination button,
  .pagination span {
    min-width: 44px;
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
  }

  .breadcrumb {
    font-size: 0.8rem;
    gap: 0.35rem;
  }

  .checkout-page {
    padding-top: 0.25rem;
  }

  .checkout-panel {
    padding: 1.15rem;
  }

  .checkout-aside {
    position: static;
  }

  .checkout-actions {
    flex-direction: column;
  }

  .checkout-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .checkout-line {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .checkout-line strong {
    margin-left: 0;
    width: 100%;
    text-align: right;
  }

  .journal-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .journal-featured__cta {
    margin-left: 0;
  }

  .journal-featured__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .article-related__grid {
    grid-template-columns: 1fr;
  }

  .plant-preview {
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) 0 env(safe-area-inset-left, 0);
    align-items: flex-end;
  }

  .plant-preview__dialog {
    width: 100%;
    max-height: min(92dvh, 100%);
    border-radius: 22px 22px 0 0;
  }

  .plant-preview__backdrop {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .plant-preview__glow {
    display: none;
  }

  .plant-preview__actions {
    flex-direction: column;
  }

  .plant-preview__detail {
    width: 100%;
  }

  .plant-hero__thumbs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
  }

  .plant-hero__thumbs::-webkit-scrollbar {
    display: none;
  }

  .plant-hero__thumbs button {
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  .contact-form-card input,
  .contact-form-card textarea,
  .contact-form-card select {
    width: 100%;
  }

  .faq-item button {
    font-size: 0.92rem;
    padding: 1rem 1.1rem;
    text-align: left;
  }

  .about-hero {
    padding: 2rem 0 1.5rem;
  }

  .team-card__photo {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 959px) {
  .filters-wrap[open] .filters-panel {
    max-height: min(58vh, 460px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

@media (max-width: 480px) {
  .checkout-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .step-dot {
    text-align: center;
    justify-content: center;
    font-size: 0.62rem;
    padding: 0.35rem 0.5rem;
    line-height: 1.25;
  }
}

@media (max-width: 359px) {
  .hero-cta .btn,
  .section-header > a {
    font-size: 0.85rem;
    padding: 0.85rem 1.25rem;
  }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
  .nav-mobile__panel a {
    min-height: 44px;
    padding: 0.5rem 0.85rem;
    font-size: 1rem;
  }

  .hero-visual {
    min-height: 180px;
  }
}
