/* =============================================================================
   marketing-rwd.css — RWD 網頁設計案例頁
   -----------------------------------------------------------------------------
   獨立頁面（原 marketing-content.php 的 RWD 頁籤），只收錄 includes/cases-data.php
   的 rwd 分類案例。版面規格沿用 marketing-content.css／case-detail.css 的容器與
   頁首間距慣例；進場動效沿用 css/aais-home.css 的 [data-reveal] 機制
   （IntersectionObserver＋fail-open，無 JS 時動畫不執行但內容仍可見）。
   色彩、字體、字級、圓角、陰影一律來自 design-system/tokens.css 與
   design-system/components.css，不在此重複定義。
   ============================================================================= */

:root {
  --container-max: 80rem;
  --container-gutter: clamp(16px, 4vw, 24px);
  --header-height: 64px;
}

@media (min-width: 1024px) { :root { --container-gutter: 32px; --header-height: 72px; } }

.rwd-page {
  --ds-font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-family: var(--ds-font-sans);
  background: var(--ds-color-page);
}

.rwd-container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-gutter);
}

/* ---------------------------------------------------------------------------
   進場動效：捲動時淡入（沿用 aais-home.css 的 [data-reveal] 機制）
   --------------------------------------------------------------------------- */
@keyframes rwd-rise {
  from { opacity: 0; transform: translateY(20px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s cubic-bezier(.22, 1, .36, 1),
              transform .7s cubic-bezier(.22, 1, .36, 1);
  transition-delay: calc(var(--reveal-index, 0) * 70ms);
}

[data-reveal].is-revealed { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rwd-page [data-reveal] { transition: none; opacity: 1; transform: none; }
  .rwd-page .rwd-hero__eyebrow,
  .rwd-page .rwd-hero__title,
  .rwd-page .rwd-hero__lead,
  .rwd-page .rwd-hero__stats,
  .rwd-page .rwd-hero__actions { animation: none !important; opacity: 1; transform: none; filter: none; }
  .rwd-page .rwd-stack__item { animation: none !important; }
}

/* =============================================================================
   1. 麵包屑
   ============================================================================= */
.rwd-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ds-space-xs);
  margin-bottom: var(--ds-space-lg);
  color: var(--ds-color-text-muted);
  font-size: var(--ds-text-caption-size);
  line-height: var(--ds-text-caption-line);
}

.rwd-crumbs a { transition: color var(--ds-duration-fast) var(--ds-ease); }
.rwd-crumbs a:hover { color: var(--ds-color-text-primary); }
.rwd-crumbs [aria-current] { color: var(--ds-color-text-primary); font-weight: var(--ds-weight-medium); }

/* =============================================================================
   2. Hero：文字＋瀏覽器視窗堆疊
   ============================================================================= */
/* Banner 從頁面頂端開始、位於透明頁首後方；上方留白另外加上頁首高度，文字位置不變 */
.rwd-hero { padding-block: calc(var(--header-height) + clamp(var(--ds-space-2xl), 6vw, var(--ds-space-4xl))) var(--ds-space-3xl); }

.rwd-hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: var(--ds-space-3xl);
}

@media (min-width: 960px) {
  .rwd-hero__grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
}

.rwd-hero__content { max-width: 620px; }

.rwd-hero__eyebrow { animation: rwd-rise .8s cubic-bezier(.16, 1, .3, 1) .05s both; }

.rwd-hero__title {
  margin-block: var(--ds-space-sm) var(--ds-space-lg);
  color: var(--ds-color-action-ink);
  animation: rwd-rise .9s cubic-bezier(.16, 1, .3, 1) .12s both;
}

.rwd-hero__lead { animation: rwd-rise .9s cubic-bezier(.16, 1, .3, 1) .2s both; }

.rwd-hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-sm) var(--ds-space-xl);
  margin-top: var(--ds-space-lg);
  animation: rwd-rise .9s cubic-bezier(.16, 1, .3, 1) .28s both;
}

.rwd-hero__stats li {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-xs);
  color: var(--ds-color-text-secondary);
  font-size: var(--ds-text-body-sm-size);
  font-weight: var(--ds-weight-medium);
}

.rwd-hero__stats .ds-icon { color: var(--ds-color-primary); }

.rwd-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-lg);
  margin-top: var(--ds-space-xl);
  animation: rwd-rise .9s cubic-bezier(.16, 1, .3, 1) .36s both;
}

/* --- 視覺：三張瀏覽器視窗錯落漂浮 --- */
.rwd-hero__visual {
  position: relative;
  width: min(100%, 440px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
}

.rwd-stack__item {
  position: absolute;
  width: 72%;
  overflow: hidden;
  border-radius: var(--ds-radius-lg);
  background: var(--ds-color-card);
  border: var(--ds-border-width) solid var(--ds-color-hairline);
  box-shadow: var(--ds-shadow-panel);
}

.rwd-stack__item--a { top: 2%; right: 0; z-index: 1; animation: rwd-float-a 7.5s ease-in-out infinite; }
.rwd-stack__item--b { top: 20%; left: 0; z-index: 2; animation: rwd-float-b 8.5s ease-in-out .4s infinite; }
.rwd-stack__item--c {
  bottom: 0; left: 14%; z-index: 3; width: 76%;
  box-shadow: var(--ds-shadow-cyan);
  animation: rwd-float-c 6.5s ease-in-out .9s infinite;
}

@keyframes rwd-float-a { 0%, 100% { transform: translateY(0) rotate(6deg); } 50% { transform: translateY(-10px) rotate(6deg); } }
@keyframes rwd-float-b { 0%, 100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-14px) rotate(-5deg); } }
@keyframes rwd-float-c { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(-2deg); } }

.rwd-stack__chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--ds-color-surface-muted);
  border-bottom: var(--ds-border-width) solid var(--ds-color-hairline);
}

.rwd-stack__chrome span { width: 7px; height: 7px; border-radius: var(--ds-radius-full); background: var(--ds-color-border); }

.rwd-stack__media { aspect-ratio: 16 / 10; overflow: hidden; }
.rwd-stack__media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }

/* =============================================================================
   3. 案例網格
   ============================================================================= */
.rwd-gallery { padding-block: var(--ds-space-2xl) var(--ds-space-3xl); }

.rwd-gallery__head { max-width: 40rem; margin-bottom: var(--ds-space-xl); }
.rwd-gallery__head h2 { margin-top: var(--ds-space-xs); }

.rwd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--ds-space-lg);
}

.rwd-card { display: flex; flex-direction: column; gap: var(--ds-space-sm); }

.rwd-card__frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--ds-radius-lg);
  border: var(--ds-border-width) solid var(--ds-color-hairline);
  background: var(--ds-color-surface-inner);
  box-shadow: var(--ds-shadow-md);
  transition: border-color var(--ds-duration-slow) var(--ds-ease),
              box-shadow var(--ds-duration-slow) var(--ds-ease),
              transform var(--ds-duration-slow) var(--ds-ease);
}

.rwd-card:hover .rwd-card__frame { border-color: var(--ds-color-primary-55); box-shadow: var(--ds-shadow-cyan); transform: translateY(-4px); }
.rwd-card:focus-visible { outline: none; }
.rwd-card:focus-visible .rwd-card__frame { border-color: var(--ds-color-primary-55); box-shadow: var(--ds-shadow-focus); }

.rwd-card__chrome {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  background: var(--ds-color-surface-muted);
  border-bottom: var(--ds-border-width) solid var(--ds-color-hairline);
}

.rwd-card__chrome span { width: 6px; height: 6px; border-radius: var(--ds-radius-full); background: var(--ds-color-border); }

.rwd-card__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; }

.rwd-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform var(--ds-duration-media) var(--ds-ease);
}

.rwd-card:hover .rwd-card__media img { transform: scale(1.06); }

.rwd-card__overlay {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--ds-space-xxs);
  padding: var(--ds-space-md) var(--ds-space-md) var(--ds-space-sm);
  background: linear-gradient(to top, rgba(17, 17, 17, .68), transparent);
  color: var(--ds-color-on-dark);
  font-size: var(--ds-text-label-sm-size);
  font-weight: var(--ds-weight-semibold);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--ds-duration-slow) var(--ds-ease), transform var(--ds-duration-slow) var(--ds-ease);
}

.rwd-card:hover .rwd-card__overlay,
.rwd-card:focus-visible .rwd-card__overlay { opacity: 1; transform: none; }

.rwd-card__title {
  padding-inline: 2px;
  color: var(--ds-color-text-primary);
  font-weight: var(--ds-weight-semibold);
  font-size: var(--ds-text-body-sm-size);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (prefers-reduced-motion: reduce) {
  .rwd-page .rwd-card__media img,
  .rwd-page .rwd-card__frame,
  .rwd-page .rwd-card__overlay { transition: none; }
}

/* =============================================================================
   4. 洽詢 CTA
   ============================================================================= */
.rwd-cta { padding-block: 0 var(--ds-space-3xl); }

.rwd-cta__panel {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-lg);
  align-items: flex-start;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .rwd-cta__panel { flex-direction: row; align-items: center; }
}

.rwd-cta__text { margin-top: var(--ds-space-xs); color: var(--ds-color-text-secondary); }
