/* =====================================================================
   v31: luftigere mobil (én ting per rad, sveipbare rader) og myke overganger
   ===================================================================== */
@media (max-width: 760px) {
  main {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  /* front page */
  .atlas-top {
    gap: 36px !important;
    padding-top: 12px !important;
  }
  .atlas-left h1 {
    font-size: 38px !important;
    margin-bottom: 10px !important;
  }
  .atlas-top .home-lede {
    margin-bottom: 20px !important;
  }
  .foodpick {
    display: flex !important;
    gap: 12px !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 -20px 10px !important;
    padding: 4px 20px 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .foodpick::-webkit-scrollbar {
    display: none;
  }
  .foodbtn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 132px;
    min-height: 76px !important;
    padding: 12px 16px !important;
    font-size: 16px !important;
    border-radius: 14px !important;
    text-align: left;
    display: flex;
    align-items: flex-end;
    border-top: 4px solid var(--garnet) !important;
  }
  .foodpick::after {
    content: "";
    flex: 0 0 8px;
  }
  .morefood {
    margin: 6px 0 28px !important;
  }
  .photocard {
    padding: 22px !important;
    gap: 16px !important;
    margin: 0 0 28px !important;
    border-radius: 16px !important;
  }
  .photocard-btns {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .atlas-top .home-sform {
    flex-direction: column;
    gap: 12px !important;
  }
  .atlas-top .home-sform .btn {
    width: 100%;
  }
  .feature {
    display: block !important;
    border-radius: 16px !important;
  }
  .feature-map {
    aspect-ratio: 16/10 !important;
    height: auto !important;
    min-height: 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--rule) !important;
  }
  .feature-text {
    padding: 18px 20px 20px !important;
  }
  .feature-h {
    font-size: 24px !important;
  }

  .home-pop .acards {
    display: flex !important;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 -20px;
    padding: 4px 20px 14px;
    scrollbar-width: none;
  }
  .home-pop .acards::-webkit-scrollbar {
    display: none;
  }
  .home-pop .acard {
    flex: 0 0 84%;
    scroll-snap-align: start;
  }
  .home-h-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .gsteps {
    gap: 14px !important;
  }
  .gsteps li {
    padding: 20px !important;
  }
  .feats {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .feat {
    flex-direction: row !important;
    align-items: center;
    gap: 14px !important;
    padding: 16px !important;
    flex-wrap: wrap;
  }
  .feat-ico {
    margin: 0 !important;
    flex: none;
  }
  .feat-h {
    flex: 1;
  }
  .feat-p,
  .feat-go {
    flex-basis: 100%;
    margin: 0;
  }
  .feat-p {
    order: 3;
  }
  .feat-go {
    order: 4;
  }

  /* Utforsk: one control per row */
  .toolbar {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .toolbar .search,
  .toolbar #filterBtn,
  .toolbar .viewswitch {
    grid-column: 1 / -1 !important;
  }
  .listbar {
    gap: 12px !important;
    margin-bottom: 20px !important;
  }
  .listtools {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .listtools #surpriseBtn {
    align-self: flex-start;
  }
  .pagehead {
    margin-bottom: 22px !important;
  }

  /* lists and cards get room */
  .acards {
    gap: 14px !important;
  }
  .jump {
    gap: 10px !important;
  }
  .somm-groups {
    gap: 28px !important;
  }
  .somm-qbtn + .somm-qbtn {
    margin-top: 4px;
  }
  .stats {
    gap: 14px !important;
  }
}

/* ---------- motion ---------- */
.view-enter {
  animation: viewIn 320ms cubic-bezier(0.2, 0.7, 0.2, 1) backwards !important;
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fadeBg {
  from {
    background-color: rgba(28, 23, 21, 0);
  }
  to {
    background-color: rgba(28, 23, 21, 0.45);
  }
}
@keyframes iconPop {
  0% {
    transform: scale(0.8);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

/* the front page builds up piece by piece the first time */
.home-anim .atlas-left > *,
.home-anim .atlas-right,
.home-anim #homeView > section {
  animation: riseIn 480ms cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}
.home-anim .atlas-left > *:nth-child(2) {
  animation-delay: 60ms;
}
.home-anim .atlas-left > *:nth-child(3) {
  animation-delay: 120ms;
}
.home-anim .atlas-left > *:nth-child(4) {
  animation-delay: 170ms;
}
.home-anim .atlas-left > *:nth-child(5) {
  animation-delay: 220ms;
}
.home-anim .atlas-left > *:nth-child(6) {
  animation-delay: 260ms;
}
.home-anim .atlas-right {
  animation-delay: 200ms;
}
.home-anim #homeView > section {
  animation-delay: 300ms;
}
.foodpick .foodbtn {
  animation: riseIn 420ms cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}
.home-anim .foodbtn:nth-child(2) {
  animation-delay: 40ms;
}
.home-anim .foodbtn:nth-child(3) {
  animation-delay: 80ms;
}
.home-anim .foodbtn:nth-child(4) {
  animation-delay: 120ms;
}
.home-anim .foodbtn:nth-child(5) {
  animation-delay: 160ms;
}
.home-anim .foodbtn:nth-child(6) {
  animation-delay: 200ms;
}
.home-anim .foodbtn:nth-child(7) {
  animation-delay: 240ms;
}
.home-anim .foodbtn:nth-child(8) {
  animation-delay: 280ms;
}

/* press and hover feedback */
.btn,
.foodbtn,
.choose,
.feat,
.acard,
.feature,
.photo-choice,
.photocta,
.photofab,
.tchip,
.jump a,
.somm-qbtn,
.ritem,
.rcmp,
.acard-save,
.savebtn,
.search-cam {
  transition:
    transform 160ms ease,
    background-color 200ms ease,
    border-color 200ms ease,
    box-shadow 220ms ease,
    color 200ms ease;
}
.btn:active,
.foodbtn:active,
.tchip:active,
.jump a:active,
.somm-qbtn:active,
.photo-choice:active,
.acard-save:active,
.savebtn:active,
.search-cam:active,
.photofab:active {
  transform: scale(0.96);
}
.acard:active,
.feat:active,
.feature:active {
  transform: scale(0.985);
}
@media (hover: hover) {
  .acard:hover,
  .feat:hover,
  .feature:hover,
  .photo-choice:hover {
    transform: translateY(-2px);
  }
}
.acard-save[aria-pressed="true"] svg,
.savebtn[aria-pressed="true"] svg {
  animation: iconPop 300ms ease;
}
.rcmp[aria-pressed="true"] svg {
  animation: iconPop 260ms ease;
}

/* windows slide up, the backdrop fades */
.photomodal:not([hidden]),
.cmpmodal:not([hidden]) {
  animation: fadeBg 220ms ease both;
}
.photomodal:not([hidden]) .photobox,
.cmpmodal:not([hidden]) .cmpbox {
  animation: popIn 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
#photoBody > * {
  animation: riseIn 300ms ease backwards;
}
.termpop:not([hidden]) {
  animation: popIn 220ms ease both;
}
.cmpbar:not([hidden]) {
  animation: riseIn 260ms ease both;
}
.photofab {
  animation: popIn 360ms 200ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
.tips ul,
.morefood[open] > *:not(summary),
.more-about[open] > *:not(summary),
.photo-tips[open] ul {
  animation: riseIn 240ms ease both;
}
details summary {
  transition: color 200ms ease;
}

/* the details panel and sheet */
#detail.sheet {
  animation: popIn 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
#detail .wine-name,
#detail .keyline,
#detail .lede {
  animation: riseIn 320ms ease backwards;
}
#detail .keyline {
  animation-delay: 50ms;
}
#detail .lede {
  animation-delay: 90ms;
}

/* bottom menu: the active icon grows in */
@media (max-width: 760px) {
  .top .tabs a .ticon {
    transition:
      background-color 220ms ease,
      color 220ms ease,
      transform 220ms ease;
  }
  .top .tabs a[aria-current="page"] .ticon {
    animation: iconPop 300ms ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.atlas-top > *,
.atlas-left,
.atlas-right,
.home-pop,
.home-pop .acards {
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 760px) {
  .atlas-top {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html,
  body {
    overflow-x: hidden;
  }
}
@media (max-width: 760px) {
  .foodpick,
  .home-pop .acards {
    scroll-padding-inline: 20px;
  }
  .home-pop .acards {
    align-items: stretch;
  }
  .home-pop .acard {
    display: flex;
  }
  .home-pop .acard-main {
    align-items: center;
  }
}
@media (max-width: 760px) {
  .home-pop .acards,
  .foodpick {
    max-width: none !important;
    width: calc(100% + 40px);
  }
}
