/* Mobile browsing: compact chrome, artwork first, and five persistent destinations.
   Keep desktop presentation in kolkol.css; load this file after page styles. */
.mobile-search-trigger,
.mobile-profile-slot { display: none; }

@media (min-width: 768px) and (max-width: 1023px) {
  .bottom-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  body {
    --mobile-header-height: calc(56px + env(safe-area-inset-top, 0px));
    --mobile-nav-height: calc(68px + env(safe-area-inset-bottom, 0px));
    --mobile-gutter-left: max(12px, env(safe-area-inset-left, 0px));
    --mobile-gutter-right: max(12px, env(safe-area-inset-right, 0px));
    background: var(--surface);
    padding-bottom: 0;
  }

  .app-header {
    height: var(--mobile-header-height);
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 0;
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .app-header .header-inner,
  html[data-sidebar="collapsed"] .app-header .header-inner {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    height: 56px;
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
  }
  .app-header .header-brand { gap: 7px; min-height: 44px; }
  .app-header .header-brand .logo-mark { width: 28px; height: 28px; }
  .app-header .header-brand .logo-mark img { width: 28px; height: 28px; }
  .app-header .header-brand .logo-text,
  html[data-sidebar="collapsed"] .app-header .header-brand .logo-text { display: flex; }
  .app-header .header-brand .logo-text img { width: 89px; height: auto; }
  .app-header .header-actions { gap: 0; }
  .app-header .header-account-slot,
  .app-header .header-publish { display: none; }
  .app-header .mobile-search-trigger,
  .app-header .mobile-profile-slot,
  .app-header .mobile-profile-link { display: grid; place-items: center; }
  .app-header .icon-button { width: 44px; height: 44px; flex-basis: 44px; color: var(--fg); }
  .app-header .icon-button > .icon { width: 24px; height: 24px; stroke-width: 1.8; }
  .app-header .mobile-profile-link > .icon { width: 22px; height: 22px; }
  .app-header .mobile-profile-link[aria-current="page"] { background: var(--surface-soft); }
  .app-header .notification-count { right: 2px; top: 3px; box-shadow: 0 0 0 2px var(--surface); }

  /* Search expands below the top row, preserving the three main actions. */
  .app-header .header-inner > .search-control { display: none; }
  .app-header .header-inner > .search-control.is-expanded {
    position: absolute;
    inset: 56px 0 auto;
    z-index: var(--z-menu);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    width: auto;
    max-width: none;
    justify-self: stretch;
    height: 60px;
    margin: 0;
    padding: 8px var(--mobile-gutter-right) 8px var(--mobile-gutter-left);
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: var(--surface);
    overflow: visible;
  }
  .app-header .search-control.is-expanded input {
    display: block;
    height: 44px;
    padding-inline: 14px;
    border-radius: 10px 0 0 10px;
    background: var(--surface-soft);
    font-size: 16px;
  }
  .app-header .search-control.is-expanded .search-submit,
  .app-header .search-control.is-expanded .search-dismiss { display: grid; height: 44px; border: 0; }
  .app-header .search-control.is-expanded .search-submit { background: var(--surface-soft); border-radius: 0 10px 10px 0; }
  .app-header .search-control.is-expanded .search-expand { display: none; }
  .app-header .search-control:focus-within { outline: 0; }
  .app-header .search-control.is-expanded input:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

  .side-nav { display: none; }
  .app-main,
  html[data-sidebar="collapsed"] .app-main {
    min-height: 100dvh;
    padding: var(--mobile-header-height) 0 var(--mobile-nav-height);
  }
  .app-main > .content-shell { padding-top: 20px; padding-bottom: 32px; }
  body:has(.app-header .search-control.is-expanded) .app-main { padding-top: calc(var(--mobile-header-height) + 60px); }
  .app-main .page-width { padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .app-main .page-head { gap: 16px; margin-bottom: 24px; align-items: flex-start; }
  .app-main .page-head h1 { font-size: 24px; line-height: 1.35; letter-spacing: -.02em; }
  .app-main .page-head p { margin-top: 8px; font-size: 14px; line-height: 1.65; }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: var(--mobile-nav-height);
    min-height: var(--mobile-nav-height);
    padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom, 0px) max(4px, env(safe-area-inset-left));
    background: var(--surface);
    border-top: 1px solid var(--border);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .bottom-nav .bottom-link {
    min-width: 0;
    min-height: 67px;
    margin: 0;
    padding: 5px 0 4px;
    gap: 4px;
    color: var(--muted);
    font-size: 10px;
    line-height: 15px;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav .bottom-link > .icon { width: 24px; height: 24px; stroke-width: 1.8; }
  .bottom-nav .bottom-link.active { color: var(--fg); font-weight: 650; }
  .bottom-nav .bottom-link.active > .icon { stroke-width: 2.3; }
  .bottom-nav .bottom-link.active[data-nav-route="/discover"] > .icon,
  .bottom-nav .bottom-link.active[data-nav-route="/collections"] > .icon { fill: currentColor; }
  .bottom-nav .bottom-link.publish { gap: 1px; padding-top: 2px; }
  .bottom-nav .bottom-link.publish .publish-circle {
    width: 38px;
    height: 38px;
    border: 0;
    background: var(--surface-soft);
    color: var(--fg);
    box-shadow: none;
  }
  .bottom-nav .publish-circle .icon { width: 27px; height: 27px; stroke-width: 1.8; }
  .bottom-nav .bottom-link:active { background: var(--surface-soft); }
  .bottom-nav .bottom-link:focus-visible { outline-offset: -4px; border-radius: 8px; }
  .toast-stack { bottom: calc(var(--mobile-nav-height) + 12px); }

  /* The same compact feed is used in discovery, collections and creator profiles. */
  .work-grid:has(.glass-work-card),
  body[data-page="home"] .work-grid:has(.glass-work-card) { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  :is(body[data-page="home"] .work-grid, .work-grid) .video-card.glass-work-card {
    --work-glass-ink: var(--fg);
    --work-glass-muted: var(--muted);
    position: relative;
    display: block;
    aspect-ratio: auto;
    width: 100%;
    max-width: none;
    height: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    overflow: visible;
    box-shadow: none;
  }
  :is(body[data-page="home"] .work-grid, .work-grid) .glass-work-card > .cover-button {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    padding: 0;
    border-radius: 12px;
    background: var(--surface-soft);
  }
  :is(body[data-page="home"] .work-grid, .work-grid) .glass-work-card > .cover-button > .cover-art { border-radius: inherit; }
  .glass-work-card .cover-empty { padding: 24px; }
  :is(body[data-page="home"] .work-grid, .work-grid) .glass-work-card > .card-body.glass-work-panel {
    position: relative;
    inset: auto;
    display: grid;
    width: 100%;
    margin: 0;
    padding: 12px 0 0;
    gap: 5px;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    color: var(--fg);
    text-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    overflow: visible;
    box-shadow: none;
  }
  .glass-work-panel .card-work-mark { display: none; }
  :is(body[data-page="home"] .work-grid, .work-grid) .glass-work-card .card-title {
    font-size: 17px;
    line-height: 24px;
    font-weight: 650;
    letter-spacing: 0;
    text-wrap: pretty;
    -webkit-line-clamp: 2;
  }
  :is(body[data-page="home"] .work-grid, .work-grid) .glass-work-card .card-value {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: var(--muted);
    font-size: 14px;
    line-height: 21px;
  }
  .glass-work-panel .card-byline { gap: 6px; min-height: 20px; }
  :is(body[data-page="home"] .work-grid, .work-grid) .glass-work-card .card-author-row {
    flex: 0 1 auto;
    max-width: 65%;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 20px;
    font-weight: 400;
  }
  :is(body[data-page="home"] .work-grid, .work-grid) .glass-work-card .avatar-sm {
    position: absolute;
    left: 0;
    top: 13px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--surface-soft);
    color: var(--fg);
    font-size: 13px;
  }
  .glass-work-panel .card-author-meta { flex: 0 1 auto; max-width: none; color: var(--muted); line-height: 20px; }
  .glass-work-panel .card-author-meta::before { content: "·"; margin-right: 6px; }
  .glass-work-panel .card-original-author { color: var(--fg); }
  .glass-work-panel .card-original-author > span,
  .glass-work-panel .card-attribution-label { color: var(--muted); }
  .glass-work-panel .card-engagement { width: 100%; max-width: 320px; gap: 4px; color: var(--muted); }
  .glass-work-panel .card-engagement .work-metric { height: 44px; gap: 5px; font-size: 12px; border-radius: 8px; }
  .glass-work-panel .card-engagement .work-metric .icon { width: 20px; height: 20px; filter: none; }
  .glass-work-panel .card-engagement .work-metric:last-child { justify-content: flex-end; padding-right: 4px; }
  .glass-work-panel .card-engagement .work-metric[aria-pressed="true"] { color: var(--danger); }
  .glass-work-panel .card-engagement .work-metric.is-saved { color: var(--fg); }
  .glass-work-panel :is(a, button):focus-visible { outline-color: var(--accent); }
  :is(body[data-page="home"] .work-grid, .work-grid) .glass-work-card > .card-body.glass-work-panel:has(.card-author-row:not(a)) { padding-left: 0; }

  body[data-page="home"] .app-main > .discovery-shell { padding-top: 0; padding-inline: var(--mobile-gutter-left) var(--mobile-gutter-right); }
  body[data-page="home"] .sticky-filters.discovery-filters {
    position: sticky;
    top: var(--mobile-header-height);
    z-index: var(--z-sticky);
    margin-inline: calc(-1 * var(--mobile-gutter-left)) calc(-1 * var(--mobile-gutter-right));
    padding: 6px var(--mobile-gutter-right) 10px var(--mobile-gutter-left);
    background: var(--surface);
    border: 0;
  }
  body:has(.app-header .search-control.is-expanded) .sticky-filters.discovery-filters { top: calc(var(--mobile-header-height) + 60px); }
  .discovery-filter-bar { gap: 8px; }
  .discovery-type-select {
    width: 94px;
    min-height: 34px;
    padding: 6px 12px 6px 9px;
    border: 0;
    border-radius: 7px;
    background: var(--surface-soft);
    font-size: 12px;
  }
  .discovery-category-scroll { gap: 6px; padding: 0; scroll-padding-inline: 4px; }
  .discovery-category-chip,
  .discovery-category-all { min-height: 34px; border-radius: 7px; background: var(--surface-soft); }
  .discovery-category-all { padding: 6px 12px; font-size: 13px; }
  .discovery-category-name { min-height: 34px; padding: 6px 2px 6px 10px; border-radius: 7px 0 0 7px; font-size: 13px; }
  .discovery-category-arrow { min-height: 34px; width: 26px; flex-basis: 26px; padding-inline: 6px; border-radius: 0 7px 7px 0; }
  .discovery-category-chip.is-active,
  .discovery-category-all.is-active { background: var(--fg); color: var(--surface); }
  .discovery-search-summary { gap: 8px; padding: 12px 0 0; font-size: 13px; }
  .discovery-search-summary > .btn { min-height: 44px; }
  .discovery-shell .product-load-more { margin-top: 20px; }

  /* Mobile destinations share a quieter, full-width reading surface. */
  .app-main .empty-state { min-height: 240px; align-content: center; gap: 12px; padding: 36px 20px; border: 0; background: transparent; }
  .app-main .empty-state h2 { margin: 0; font-size: 19px; line-height: 1.4; }
  .app-main .empty-state p { margin: 0; font-size: 14px; line-height: 1.7; }
  .app-main .empty-state > .btn { margin-top: 8px; }
  #studio-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
  #studio-filters .chip { flex: 0 0 auto; border-radius: 8px; min-height: 40px; }
  .product-studio-row { padding: 18px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; }
  .settings-nav { scrollbar-width: none; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .settings-nav-link { min-height: 44px; border-radius: 8px; }
  .settings-nav-link.active { background: var(--fg); color: var(--surface); }
  .settings-section { padding: 20px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; }
  .settings-section h2 { font-size: 19px; }
  .product-form-section { padding: 20px 0; margin-bottom: 12px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; }
  .product-form-section h2 { font-size: 19px; margin-bottom: 18px; }
  .collection-shell > .page-head > #new-folder { width: auto; align-self: flex-start; padding-inline: 16px; }
  .collection-browser { gap: 16px; }
  .collection-current-head { margin-bottom: 8px; }
  .collection-visibility { gap: 12px; padding: 12px 0 16px; margin-bottom: 16px; }
  .collection-visibility p { font-size: 13px; line-height: 1.65; }
  .collection-state { min-height: 220px; padding: 32px 12px; }
  .collection-state h2 { font-size: 19px; }
  .collection-state p { font-size: 14px; }
  .profile-hero { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 16px; align-items: start; padding: 4px 0 24px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
  .profile-hero .profile-photo { width: 60px; height: 60px; font-size: 24px; }
  .profile-hero .profile-summary h1 { font-size: 22px; line-height: 30px; }
  .profile-summary .meta { overflow-wrap: anywhere; }
  .profile-signature { font-size: 14px; line-height: 1.65; }
  .profile-own-actions { grid-column: 1 / -1; gap: 10px; }
  .profile-work-tabs { margin-top: 20px; }
  .profile-work-tabs .chip { border-radius: 8px; }
  .review-panel > .review-actions { bottom: var(--mobile-nav-height); }
}
