/* Collections (Nov 13, Jay): two tabs, a device preview, and the looks as
   words. See js/collections-swipe.js.
   Phone: one column, the words are a row you swipe.
   Computer (Nov 14, Jay's mockup A): preview on the left, the words as a list
   you click on the right. The Look tab of a gallery reuses the phone parts. */

.cs-tabs, .cs-panel { display: none; }

/* The old cards, the old preview and the old gallery cards stay on the page
   for the saving code, but are hidden (phone and computer). */
body.collections-swipe .collection-browser,
body.collections-swipe .gallery-styles,
body.collections-swipe .mobile-preview-sheet { display: none !important; }

/* Tabs */
body.collections-swipe .cs-tabs {
  display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 14px;
  border-radius: 12px; background: rgba(42, 31, 22, .06);
}
.cs-tabs button {
  border: 0; background: none; padding: 11px 6px; border-radius: 9px; cursor: pointer;
  font: inherit; font-size: 14px; letter-spacing: .02em; color: var(--muted);
}
.cs-tabs button[aria-selected="true"] { background: var(--cream); color: var(--ink); box-shadow: 0 1px 3px rgba(23, 17, 13, .12); }

/* One tab at a time */
body.collections-swipe[data-cs-tab="gallery"] .collections-top { display: none; }
body.collections-swipe:not([data-cs-tab="gallery"]) .cs-panel--invitation,
body.collections-swipe[data-cs-tab="gallery"] .cs-panel--gallery { display: block; }

/* Only on a computer */
.cs-label--list, .cs-open, .cs-keys { display: none; }

@media (max-width: 760px) {
  /* minmax(0, 1fr): the page column stays as wide as the screen (it grew to
     its widest content before, which cut the old cards off too). */
  body.collections-swipe .collections-main { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 14px; }
  body.collections-swipe .collections-title { display: none; }

  /* The two computer columns are one column here, in the same order. */
  .cs-main, .cs-side { display: contents; }

  .cs-panel { padding-bottom: 28px; }
  .cs-intro { margin: 0 0 4px; text-align: center; font-size: 13px; color: var(--muted); }

  /* Phone / Computer */
  .cs-device { display: flex; justify-content: center; gap: 22px; margin: 16px 0 6px; }
  .cs-device button {
    border: 0; border-bottom: 1px solid transparent; background: none; padding: 6px 2px; cursor: pointer;
    font: inherit; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  }
  .cs-device button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }

  /* Device frames */
  .cs-stage { display: flex; justify-content: center; align-items: center; min-height: 280px; padding: 10px 0 4px; overflow: hidden; }
  .cs-phone {
    position: relative; width: min(60vw, 250px); padding: 9px; border-radius: 42px; background: #1b1a1c;
    box-shadow: 0 30px 60px -20px rgba(23, 17, 13, .45), inset 0 0 0 1.5px #3a383c;
  }
  .cs-phone__island { position: absolute; z-index: 2; top: 2.4%; left: 50%; width: 30%; height: 3.2%; border-radius: 99px; background: #000; transform: translateX(-50%); }
  .cs-screen { position: relative; overflow: hidden; background: #e9e2d9; }
  .cs-screen--phone { aspect-ratio: 390 / 844; border-radius: 33px; }
  .cs-laptop { width: min(84vw, 420px); }
  .cs-laptop__lid { padding: 7px 7px 9px; border-radius: 14px 14px 4px 4px; background: #1b1a1c; box-shadow: inset 0 0 0 1.5px #3a383c; }
  .cs-screen--computer { aspect-ratio: 16 / 10; border-radius: 4px; }
  .cs-laptop__base {
    height: 12px; margin: 0 -5%; border-radius: 0 0 14px 14px;
    background: linear-gradient(#cfcac4, #a9a39d); box-shadow: 0 18px 30px -12px rgba(23, 17, 13, .45);
  }
  .cs-laptop__base::before { content: ""; display: block; width: 18%; height: 5px; margin: 0 auto; border-radius: 0 0 6px 6px; background: #8f8983; }
  .cs-screen iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; background: #fff; }
  .cs-loading {
    position: absolute; inset: 0; z-index: 1; pointer-events: none; transition: opacity .4s;
    background: linear-gradient(110deg, #e9e2d9 30%, #f5efe7 50%, #e9e2d9 70%); background-size: 200% 100%;
    animation: cs-shine 1.2s linear infinite;
  }
  .cs-screen.is-ready .cs-loading { opacity: 0; }
  @keyframes cs-shine { to { background-position: -200% 0; } }

  .cs-tagline {
    min-height: 2.6em; margin: 12px 8px 0; text-align: center;
    font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-size: 17px; color: var(--muted);
  }

  /* Word wheel. The page has side padding; the row goes edge to edge. */
  .cs-wheel { margin: 6px calc(50% - 50vw) 0; }
  .cs-wheel__track {
    --item: 34vw;
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    padding: 6px calc(50vw - var(--item) / 2);
  }
  .cs-wheel__track::-webkit-scrollbar { display: none; }
  .cs-wheel__item {
    flex: 0 0 var(--item); scroll-snap-align: center; border: 0; background: none; padding: 8px 4px 10px; cursor: pointer;
    text-align: center; white-space: nowrap; color: var(--ink);
    font-family: "Cormorant Garamond", Georgia, serif; font-size: 27px; line-height: 1.05;
    will-change: filter, opacity, transform;
  }
  .cs-wheel__item small {
    display: block; margin-top: 5px; font-family: "Jost", "Helvetica Neue", Arial, sans-serif;
    font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted);
  }
  .cs-wheel__item:focus-visible { outline: 1px solid var(--ink); outline-offset: -2px; border-radius: 8px; }
  .cs-wheel--small .cs-wheel__track { --item: 32vw; }
  .cs-wheel--small .cs-wheel__item { font-size: 18px; }
  .cs-label { margin: 16px 0 0; text-align: center; font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
  .cs-panel--invitation:not(.has-editions) .cs-label--edition { display: none; }
  .cs-dots { display: flex; justify-content: center; gap: 6px; margin-top: 4px; }
  .cs-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(42, 31, 22, .18); transition: background .2s, transform .2s; }
  .cs-dots i.is-on { background: var(--ink); transform: scale(1.25); }

  /* Swipe hint under the words: fades away after the first swipe. */
  .cs-hint {
    display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 8px;
    font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
    transition: opacity .5s;
  }
  .cs-hint svg { animation: cs-nudge 1.6s ease-in-out infinite; }
  .cs-hint svg:first-child { animation-direction: reverse; }
  .cs-hint.is-done { opacity: 0; }
  @keyframes cs-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }

  /* "Saved to your account" moved to the bottom of the page (Jay, Nov 13). */
  .cs-panel [data-sync-status] { margin: 22px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

  .cs-start {
    display: block; margin: 20px 0 8px; padding: 15px; border-radius: 8px; text-align: center; text-decoration: none;
    background: var(--ink); color: var(--cream); font-size: 14px; letter-spacing: .06em;
  }
  /* "Use this look" sits right under the Edition words (Nov 13, Jay): no
     floating bar over the words. Shown only while a look is not saved yet. */
  body.collections-swipe .collections-main { padding-bottom: 32px; }
  .cs-panel .collections-use-bar {
    position: static; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    margin: 22px 0 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  }
  .cs-panel .collections-use-bar[hidden] { display: none; }
  .cs-panel .collections-use-bar__prompt { order: 0; flex: none; text-align: center; white-space: normal; font-size: 12px; }
  .cs-panel .collections-use {
    order: 1; min-height: 50px; padding: 0 16px; border-radius: 8px;
    background: var(--ink); color: var(--cream); font-size: 14px; letter-spacing: .06em;
  }
  .cs-panel .collections-cancel { order: 2; align-self: center; min-height: 36px; }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .cs-loading, .cs-hint svg { animation: none; }
}

/* ---------- Computer (Nov 14, Jay's mockup A) ---------- */
@media (min-width: 761px) {
  body.collections-swipe .collections-main { max-width: 1240px; }
  /* Title and event first, then the tabs, then the looks. */
  body.collections-swipe .collections-top { order: -1; }
  body.collections-swipe .collections-title p { display: none; }
  body.collections-swipe .cs-tabs { justify-self: start; width: 340px; margin-bottom: 0; }

  body.collections-swipe:not([data-cs-tab="gallery"]) .cs-panel--invitation,
  body.collections-swipe[data-cs-tab="gallery"] .cs-panel--gallery {
    display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(240px, 1fr);
    column-gap: clamp(32px, 4.5vw, 64px); align-items: start; padding-bottom: 40px;
  }
  .cs-intro { grid-column: 1 / -1; margin: 0 0 6px; font-size: 14px; color: var(--muted); }

  /* Left: the preview */
  .cs-main { display: flex; flex-direction: column; align-items: center; min-width: 0; }
  .cs-device { display: flex; justify-content: center; gap: 26px; margin: 4px 0 14px; }
  .cs-device button {
    border: 0; border-bottom: 1px solid transparent; background: none; padding: 6px 2px; cursor: pointer;
    font: inherit; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  }
  .cs-device button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
  .cs-stage { display: flex; justify-content: center; align-items: center; width: 100%; min-height: 360px; padding: 4px 0; }
  .cs-phone {
    position: relative; width: 280px; padding: 10px; border-radius: 46px; background: #1b1a1c;
    box-shadow: 0 30px 60px -20px rgba(23, 17, 13, .45), inset 0 0 0 1.5px #3a383c;
  }
  .cs-phone__island { position: absolute; z-index: 2; top: 2.4%; left: 50%; width: 30%; height: 3.2%; border-radius: 99px; background: #000; transform: translateX(-50%); }
  .cs-screen { position: relative; overflow: hidden; background: #e9e2d9; }
  .cs-screen--phone { aspect-ratio: 390 / 844; border-radius: 36px; }
  .cs-laptop { width: min(100%, 680px); }
  .cs-laptop__lid { padding: 9px 9px 11px; border-radius: 16px 16px 5px 5px; background: #1b1a1c; box-shadow: inset 0 0 0 1.5px #3a383c; }
  .cs-screen--computer { aspect-ratio: 16 / 10; border-radius: 4px; }
  .cs-laptop__base {
    height: 14px; margin: 0 -5%; border-radius: 0 0 16px 16px;
    background: linear-gradient(#cfcac4, #a9a39d); box-shadow: 0 22px 34px -14px rgba(23, 17, 13, .45);
  }
  .cs-laptop__base::before { content: ""; display: block; width: 18%; height: 5px; margin: 0 auto; border-radius: 0 0 6px 6px; background: #8f8983; }
  .cs-screen iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; background: #fff; }
  .cs-loading {
    position: absolute; inset: 0; z-index: 1; pointer-events: none; transition: opacity .4s;
    background: linear-gradient(110deg, #e9e2d9 30%, #f5efe7 50%, #e9e2d9 70%); background-size: 200% 100%;
    animation: cs-shine 1.2s linear infinite;
  }
  .cs-screen.is-ready .cs-loading { opacity: 0; }
  @keyframes cs-shine { to { background-position: -200% 0; } }
  .cs-tagline {
    min-height: 1.4em; margin: 18px 0 0; text-align: center;
    font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-size: 19px; color: var(--muted);
  }

  /* Right: the names, a list you click */
  .cs-side { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding-top: 44px; }
  .cs-label { margin: 0 0 8px; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
  .cs-label--list { display: block; }
  .cs-label--edition { margin-top: 28px; }
  /* One Edition only: nothing to choose, so no Edition list. */
  .cs-panel--invitation:not(.has-editions) .cs-label--edition,
  .cs-panel--invitation:not(.has-editions) .cs-wheel--small { display: none; }
  .cs-wheel__track { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
  .cs-wheel__item {
    display: flex; align-items: baseline; gap: 12px; border: 0; background: none; padding: 3px 0; cursor: pointer;
    text-align: left; white-space: nowrap; color: #8a8077;
    font-family: "Cormorant Garamond", Georgia, serif; font-size: 24px; line-height: 1.15;
    transition: color .2s ease, font-size .25s ease;
  }
  .cs-wheel__item::before { content: ""; width: 0; height: 1px; background: var(--ink); align-self: center; transition: width .25s ease; }
  .cs-wheel__item:hover { color: var(--ink); }
  .cs-wheel__item[aria-selected="true"] { color: var(--ink); font-size: 40px; font-weight: 600; }
  .cs-wheel__item[aria-selected="true"]::before { width: 22px; }
  .cs-wheel__item small { font-family: "Jost", "Helvetica Neue", Arial, sans-serif; font-size: 10px; font-weight: 400; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
  .cs-wheel__item:not([aria-selected="true"]) small { display: none; }
  .cs-wheel__item:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; border-radius: 4px; }
  /* Editions: a short row of words */
  .cs-wheel--small .cs-wheel__track { flex-direction: column; }
  .cs-wheel--small .cs-wheel__item { font-size: 20px; }
  .cs-wheel--small .cs-wheel__item[aria-selected="true"] { font-size: 26px; }
  .cs-dots, .cs-hint { display: none; }

  .cs-panel .collections-use-bar {
    position: static; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin: 28px 0 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  }
  .cs-panel .collections-use-bar[hidden] { display: none; }
  .cs-panel .collections-use-bar__prompt { flex: 0 0 100%; margin: 0; font-size: 12px; color: var(--muted); }
  .cs-panel .collections-use {
    min-height: 46px; padding: 0 22px; border-radius: 8px; background: var(--ink); color: var(--cream); font-size: 15px;
  }
  .cs-panel .collections-cancel { min-height: 46px; }
  .cs-open, .cs-start {
    display: inline-flex; align-items: center; min-height: 44px; margin-top: 22px; padding: 0 18px; border-radius: 8px;
    text-decoration: none; font-size: 14px;
  }
  .cs-open { border: 1px solid rgba(23, 17, 13, .2); color: var(--ink); }
  .cs-start { background: var(--ink); color: var(--cream); letter-spacing: .02em; }
  .cs-keys { display: block; margin: 14px 0 0; font-size: 12px; color: var(--muted); }
  .cs-panel [data-sync-status] { margin: 18px 0 0; font-size: 12px; color: var(--muted); }
}

/* Big screens (Nov 14, Jay: "parang nasa taas, lakihan"): the preview grows
   with the window, both by width and by height, so the page fills the screen
   instead of sitting small at the top. The names sit level with the preview. */
@media (min-width: 761px) {
  body.collections-swipe .collections-main { max-width: min(1680px, 100%); }
  body.collections-swipe:not([data-cs-tab="gallery"]) .cs-panel--invitation,
  body.collections-swipe[data-cs-tab="gallery"] .cs-panel--gallery { align-items: center; }
  .cs-side { padding-top: 0; }
  .cs-laptop { width: min(100%, 1040px, calc((100vh - 330px) * 1.5)); min-width: min(100%, 480px); }
  .cs-phone { width: clamp(260px, calc((100vh - 340px) * .46), 400px); }
}
@media (min-width: 1500px) {
  .cs-wheel__item { font-size: 28px; }
  .cs-wheel__item[aria-selected="true"] { font-size: 50px; }
  .cs-wheel--small .cs-wheel__item { font-size: 22px; }
  .cs-wheel--small .cs-wheel__item[aria-selected="true"] { font-size: 30px; }
  .cs-tagline { font-size: 21px; }
}

@media (min-width: 761px) and (prefers-reduced-motion: reduce) {
  .cs-loading { animation: none; }
  .cs-wheel__item, .cs-wheel__item::before { transition: none; }
}
