/* 案例詳情面板：桌機從右側滑入，手機從下方滑入。白紙色場，用底色分層，不畫線 */
.sheet {
  --bg: var(--paper);
  --surface: var(--paper-2);
  --ink: var(--ink-dark);
  --soft: var(--ink-dark-soft);
  --accent: var(--blue);
  --accent-ink: #ffffff;
  --accent-text: var(--blue-text);
  --focus: var(--blue);
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sheet {
    --accent-text: var(--blue-bright);
    --focus: var(--blue-bright);
  }
}

:root[data-theme="dark"] .sheet {
  --accent-text: var(--blue-bright);
  --focus: var(--blue-bright);
}

.sheet::backdrop {
  background: rgb(0 0 0 / 0.45);
  animation: scrim-in 420ms var(--ease-out);
}

.sheet[open] {
  display: flex;
  justify-content: flex-end;
}

.sheet__panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(820px, 100%);
  height: 100%;
  background: var(--bg);
  box-shadow: 0 0 48px rgb(0 0 0 / 0.25); /* taste-skill-ignore：對話框浮在內容上 */
  animation: sheet-in-right 420ms var(--ease-expo);
  padding-top: env(safe-area-inset-top, 0px);
}

.sheet.is-closing .sheet__panel {
  animation: sheet-out-right 280ms var(--ease-exit) forwards;
}

.sheet.is-closing::backdrop {
  animation: scrim-out 280ms ease forwards;
}

@keyframes sheet-in-right {
  from {
    transform: translateX(100%);
  }
}

@keyframes sheet-out-right {
  to {
    transform: translateX(100%);
  }
}

@keyframes sheet-in-up {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-out-up {
  to {
    transform: translateY(100%);
  }
}

@keyframes scrim-in {
  from {
    opacity: 0;
  }
}

@keyframes scrim-out {
  to {
    opacity: 0;
  }
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 32px clamp(20px, 4vw, 44px) 20px;
}

.sheet__title {
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.sheet__client {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--soft);
}

.icon-button {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}

.sheet__tabs {
  display: flex;
  gap: 4px;
  padding: 0 clamp(20px, 4vw, 44px);
  overflow-x: auto;
  scrollbar-width: none;
}

.sheet__tabs::-webkit-scrollbar {
  display: none;
}

.sheet__tab {
  flex: none;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--soft);
  font-size: 16px;
  font-weight: 500;
  transition: color var(--t-hover) ease, background-color var(--t-hover) ease;
}

.sheet__tab:hover {
  color: var(--ink);
}

.sheet__tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--bg);
}

.sheet__tab:focus-visible {
  outline-offset: -2px;
}

.sheet__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px clamp(20px, 4vw, 44px) 56px;
}

.sheet__pane {
  display: grid;
  gap: 36px;
  animation: pane-in var(--t-ui) var(--ease-out);
}

@keyframes pane-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.sheet__pane:focus-visible {
  outline-offset: 8px;
}

.sheet__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(20px, 4vw, 44px) calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
}

/* 面板內容 */
.sheet-lead {
  font-size: 20px;
  line-height: 1.7;
}

.facts {
  display: grid;
  gap: 4px;
}

.facts div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
}

.facts dt {
  font-size: 15px;
  color: var(--soft);
}

.facts dd {
  font-size: 16px;
  line-height: 1.6;
}

.sheet-subhead {
  font-size: 18px;
  font-weight: 600;
}

.module-group {
  display: grid;
  gap: 14px;
}

.old-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.old-flow li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.old-flow span {
  padding: 8px 14px;
  background: var(--surface);
}

.old-flow li:not(:last-child)::after {
  content: "→";
  color: var(--soft);
}

.pain-list {
  display: grid;
  gap: 12px;
}

.pain-list li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  font-size: 17px;
  line-height: 1.65;
}

.pain-list li::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 0.55em;
  background: var(--accent);
}

.module-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.module {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 16px 18px;
  background: var(--surface);
}

.module:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.module__name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}

.module__status {
  margin-left: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--soft);
}

.module__status::before {
  content: "（";
}

.module__status::after {
  content: "）";
}

.module__desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--soft);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px 24px;
}

.metric {
  display: grid;
  gap: 4px;
}

.metric__value {
  font-size: clamp(34px, 4.4vw, 48px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metric__label {
  font-size: 16px;
  font-weight: 500;
}

.metric__method {
  font-size: 14px;
  line-height: 1.55;
  color: var(--soft);
}

.caveat {
  padding: 16px 20px;
  background: var(--surface);
  font-size: 15px;
  line-height: 1.65;
  color: var(--soft);
}

.caveat strong {
  color: var(--ink);
  margin-right: 8px;
}

.arch-flow {
  display: grid;
  gap: 0;
}

.arch-node {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
}

.arch-node__tag {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-text);
}

.arch-node__name {
  font-size: 17px;
  font-weight: 600;
}

.arch-node__note {
  font-size: 14px;
  color: var(--soft);
}

.arch-link {
  width: 4px;
  height: 22px;
  margin-left: 40px;
  background: var(--accent);
}

.arch-notes {
  display: grid;
  gap: 12px;
}

.arch-notes li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  font-size: 16px;
  line-height: 1.65;
}

.arch-notes svg {
  width: 18px;
  height: 18px;
  margin-top: 0.3em;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stack li {
  padding: 6px 12px;
  background: var(--surface);
  font-size: 14px;
}

.timeline {
  display: grid;
  gap: 24px;
}

.timeline li {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
}

.timeline time {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.timeline p {
  font-size: 17px;
  line-height: 1.6;
}

@media (max-width: 639px) {
  .sheet[open] {
    align-items: flex-end;
  }

  .sheet__panel {
    width: 100%;
    height: calc(100% - 24px - env(safe-area-inset-top, 0px));
    padding-top: 0;
    animation-name: sheet-in-up;
  }

  .sheet.is-closing .sheet__panel {
    animation-name: sheet-out-up;
  }

  .sheet__head {
    padding-top: 24px;
  }

  .module-list,
  .metric-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet__tabs {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); /* taste-skill-ignore：只用來提示可以橫向滑動 */
    mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); /* taste-skill-ignore */
    padding-right: 40px;
  }

  .facts div,
  .timeline li {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .sheet__foot .button {
    flex: 1;
  }
}

@media (max-width: 379px) {
  .sheet__foot [data-sheet-prev],
  .sheet__foot [data-sheet-next] {
    display: none;
  }
}
