/* ═════════════════════════════════════════════════════════════════════════
   CREATE MENU  ·  the side-rail + button popup, SITE-WIDE.
   ─────────────────────────────────────────────────────────────────────────
   De-scoped from refine-home.css (was body.rf-home-only) so the same 建立
   popup opens from the rail's + on every desktop page — behaviour lives in
   assets/ds.js (DS.register 'create-menu'), markup is per-page chrome.
   KEPT IN assets/ ON PURPOSE: the glyph url('icons/…') in --icon is a
   relative url resolved against the stylesheet that CONSUMES it (mask:
   var(--icon)). Sitting in assets/ makes it resolve to assets/icons/… —
   move this file to the root and every glyph 404s. (See memory:
   feedback_css_var_url_relative_to_stylesheet.)
   The DEV-ONLY .create-demo-switch rules ride along but are inert on pages
   without that markup (home only).
   ═════════════════════════════════════════════════════════════════════════ */

.create-menu {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms;
}
.create-menu.is-open {
  opacity: 1;
  visibility: visible;
}

/* Blurred backdrop — dims + frosts the page behind the panel. */
.create-menu__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* The 560px centered panel. */
.create-menu__panel {
  position: relative;
  width: 560px;
  max-width: 100%;
  /* Extra top padding reserves a band for the close button so the first
     item's full-width hover fill never collides with it (mirrors 1.0).
     Bottom padding bumped to balance that top band visually. */
  padding: 64px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(19, 19, 19, 0.92);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 32px 80px -16px rgba(0, 0, 0, 0.7);
  transform: translateY(10px) scale(0.98);
  transition: transform 220ms cubic-bezier(0.23, 1, 0.32, 1);
}
.create-menu.is-open .create-menu__panel { transform: none; }

/* Close button — identical treatment to the 觀看歷史 (watch-drawer) modal:
   persistent soft-grey pill circle, text-tertiary glyph, same hover. */
.create-menu__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  transition: background 200ms ease;
}
.create-menu__close:hover { background: rgba(255, 255, 255, 0.14); }
.create-menu__close-icon {
  width: 16px;
  height: 16px;
  background-color: var(--text-tertiary);
  -webkit-mask: url('icons/close.svg') center / contain no-repeat;
          mask: url('icons/close.svg') center / contain no-repeat;
}

.create-menu__item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 8px;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color 140ms ease;
}
.create-menu__item:hover { background: rgba(255, 255, 255, 0.05); }
.create-menu__item:focus-visible {
  outline: 2px solid var(--yellow-500);
  outline-offset: -2px;
}

.create-menu__icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Icon glyph — CSS mask so the SVG file's own colour is ignored and the glyph
   inherits the circle's currentColor (greyscale). Swap the file via --icon. */
.create-menu__glyph {
  display: block;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
}
.create-menu__icon svg,
.create-menu__icon .create-menu__glyph { width: 40px; height: 40px; display: block; }
.create-menu__icon--neutral { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }

.create-menu__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.create-menu__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  /* Display tier = LINE Seed TW for CJK (Latin/numbers stay Proxima). */
  font-family: var(--font-cjk-display);
  font-weight: var(--fw-bold);
  font-size: 24px;
  line-height: 38px;
  color: var(--text-primary);
}
.create-menu__desc {
  font-family: var(--font-cjk-text);
  font-size: 16px;
  line-height: 29px;
  color: var(--text-tertiary);
}
.create-menu__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error-500);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .create-menu__panel {
    transition: none;
    transform: none;
  }
  .create-menu.is-open .create-menu__panel { transform: none; }
}

/* ── Identity variants ─────────────────────────────────────────────────────
   The popup content differs by account role; data-identity on the modal
   picks which variant shows. 一般用戶 = vertical list (560px); Ztor 官方 =
   grid of cards + quick-links (wider panel). */
.create-menu__variant { display: none; flex-direction: column; gap: 4px; width: 100%; }
.create-menu__variant[data-variant="user"] { gap: 24px; }
.create-menu__variant[data-variant="official"] { gap: 24px; }
.create-menu[data-identity="user"]     .create-menu__variant[data-variant="user"]     { display: flex; }
.create-menu[data-identity="official"] .create-menu__variant[data-variant="official"] { display: flex; }
.create-menu[data-identity="official"] .create-menu__panel { width: 640px; padding: 64px 16px 32px; }

/* Official variant — centered cards in 2-up then 3-up grids. Spacing + type
   per Figma node 4415:10334 (greyscale circles + LINE Seed titles kept). */
.create-menu__grid { display: grid; gap: 8px; }
.create-menu__grid--2 { grid-template-columns: repeat(2, 1fr); }
.create-menu__grid--3 { grid-template-columns: repeat(3, 1fr); }

.create-menu__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 16px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease;
}
.create-menu__card:hover { background: rgba(255, 255, 255, 0.05); }
.create-menu__card:focus-visible { outline: 2px solid var(--yellow-500); outline-offset: -2px; }
.create-menu__card .create-menu__icon { width: 64px; height: 64px; }
.create-menu__card .create-menu__icon svg,
.create-menu__card .create-menu__icon .create-menu__glyph { width: 40px; height: 40px; }
.create-menu__card-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-cjk-display);
  font-weight: var(--fw-bold);
  font-size: 24px;
  line-height: 38px;
  color: var(--text-primary);
}
.create-menu__card-desc {
  font-family: var(--font-cjk-text);
  font-size: 14px;
  line-height: 25px;
  color: var(--text-tertiary);
}

.create-menu__divider {
  width: auto;
  height: 1px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 32px;
}

/* Official variant — small horizontal quick-links (manage / mine). */
.create-menu__quicklist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.create-menu__quick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease;
}
.create-menu__quick:hover { background: rgba(255, 255, 255, 0.05); }
.create-menu__quick:focus-visible { outline: 2px solid var(--yellow-500); outline-offset: -2px; }
.create-menu__quick-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}
.create-menu__quick-icon svg,
.create-menu__quick-icon .create-menu__glyph { width: 20px; height: 20px; }
.create-menu__quick-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-cjk-display);
  font-weight: var(--fw-bold);
  font-size: 20px;
  line-height: 36px;
  color: var(--text-primary);
}

/* ── DEV-ONLY · role switcher (remove before production) ───────────────────
   Compact pill stacked just above the auth (未登入/已登入) .dev-toggle so the
   two form one bottom-right dev cluster. Matches the .dev-toggle glass. */
.create-demo-switch {
  position: fixed;
  z-index: 9999;               /* same layer as .dev-toggle, above the modal */
  right: 24px;
  bottom: 76px;                /* sits above the 40px auth pill (bottom:24) */
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 3px 3px 10px;
  border-radius: var(--radius-pill);
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  /* Only shown while the create popup is open (JS toggles .is-shown). */
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
}
.create-demo-switch.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.create-demo-switch__label {
  font-family: var(--font-cjk-text);
  font-size: 12px;
  color: var(--text-tertiary);
  margin-right: 3px;
}
.create-demo-switch__btn {
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-cjk-text);
  font-weight: var(--fw-medium);
  font-size: 12px;
  transition: background-color 140ms ease, color 140ms ease;
}
.create-demo-switch__btn.is-active { background: var(--brand-500); color: var(--brand-ink); }
