/*
  Component — Shortcuts (常用功能)
  ──────────────────────────────────
  Horizontally scrollable glossy square cards.
  Follows the same scroll structure and responsive width formula
  as the index ticker and other horizontal sections.
*/

.shortcuts {
  padding: var(--space-4) 0 0;
}

/* ── Section header ─────────────────────────────── */
.shortcuts__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.shortcuts__title {
  font-size: 16px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

/* ── Effective scroll padding ───────────────────────
   Matches the .container's left edge at every viewport:
   - Narrow screens : equals --container-px (viewport-relative)
   - Wide screens   : equals (100vw - container-max) / 2 (centering offset)
   Using this for both padding AND card-width keeps shortcuts
   pixel-aligned with every other section at any window size.
*/
.shortcuts {
  /*
    centering offset  : max(0, (100vw − container-max) / 2)
    + container padding: var(--container-px)
    = the exact left edge that .container content uses.
  */
  --scroll-pad: calc(
    max(0px, (100vw - var(--container-max)) / 2) + var(--container-px)
  );
}

/* ── Scroll track ───────────────────────────────────
   Full viewport width. Inner div uses --scroll-pad so
   the first card's left edge aligns with .container content.
*/
.shortcuts__scroll {
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  padding-bottom: var(--space-3);
  /* Prevent rubber-band overscroll to the left on iOS/Android */
  overscroll-behavior-x: contain;
}
.shortcuts__scroll::-webkit-scrollbar { display: none; }

.shortcuts__inner {
  display: inline-flex;
  gap: var(--space-3);
  padding: 4px var(--scroll-pad);
}

/* ── Shortcut card ──────────────────────────────────
   Width formula uses --scroll-pad (not --container-px)
   so the 3.5-card rule stays correct across all widths.
   Capped at 120px. Square via aspect-ratio.
*/
.shortcut-card {
  flex-shrink: 0;

  width: min(
    calc((100vw - var(--scroll-pad) - 2.5 * var(--space-3)) / 3.5),
    120px
  );
  aspect-ratio: 1;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  border-radius: var(--radius-md);
  cursor: pointer;

  /* Glossy frosted glass */
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);

  transition: opacity 0.12s, transform 0.12s;
}

.shortcut-card:active {
  opacity: 0.72;
  transform: scale(0.96);
}

/* ── Icon — scales with card width ─────────────────── */
.shortcut-card__icon {
  width: 44%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shortcut-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Label ──────────────────────────────────────────── */
.shortcut-card__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}
