/* ScratchPaper v4.4 Dedicated Product Page — Tactile Paper Atelier & Live Drafting Canvas */

.sp-hero,
.sp-chapter {
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

.sp-chapter {
  padding: clamp(60px, 6vw, 96px) 0;
}

.sp-chapter--subtle {
  background: var(--bg-subtle);
}

.sp-head {
  max-width: min(820px, 100%);
  margin: 0 auto clamp(32px, 4vw, 48px);
  text-align: center;
}

.sp-head h1,
.sp-head h2 {
  margin: 0 0 14px;
  font-size: var(--size-title);
  font-weight: var(--weight-semibold);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.sp-head p {
  margin: 0;
  color: var(--fg-secondary);
}

/* Hero */
.sp-hero {
  padding: clamp(52px, 5.5vw, 84px) 0 clamp(56px, 6vw, 88px);
  text-align: center;
}

.sp-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.sp-hero-badge img {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-control);
}

.sp-hero-badge span {
  font-size: var(--size-body);
  font-weight: var(--weight-semibold);
}

.sp-hero h1 {
  margin: 0 auto 16px;
  max-width: min(820px, 100%);
  font-size: var(--size-display);
  font-weight: var(--weight-semibold);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.sp-hero-lead {
  margin: 0 auto 32px;
  max-width: min(680px, 100%);
  color: var(--fg-secondary);
}

.sp-hero-banner {
  margin: clamp(36px, 4.5vw, 48px) auto 0;
  width: 100%;
  max-width: none;
  border-radius: var(--radius-panel);
  overflow: hidden;
  background: #f7f6f2;
  text-align: left;
}

.sp-hero-banner img {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  display: block;
  cursor: zoom-in;
  transition: transform var(--dur-base) var(--ease-apple);
}

.sp-hero-banner img:hover {
  transform: scale(1.006);
}

.sp-stage-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--bg-subtle);
  border-top: 1px solid var(--line-hairline);
}

.sp-stage-item {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sp-stage-item + .sp-stage-item {
  border-left: 1px solid var(--line-hairline);
}

.sp-stage-item strong {
  font-size: var(--size-body);
  font-weight: var(--weight-semibold);
  color: var(--fg-primary);
  line-height: 1.3;
}

.sp-stage-item span {
  font-size: var(--size-meta);
  color: var(--fg-secondary);
}

/* Interactive 1: Live HTML5 Drafting Workbench */
.workbench {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workbench-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workbench-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pad-action-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line-hairline);
  background: var(--bg-canvas);
  color: var(--fg-primary);
  font-size: var(--size-meta);
  font-weight: var(--weight-semibold);
  transition: border-color var(--dur-fast) var(--ease-standard), opacity var(--dur-fast) var(--ease-standard);
}

.pad-action-btn:hover:not(:disabled) {
  border-color: var(--fg-primary);
}

.pad-action-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.workbench-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  max-height: 74vh;
  border-radius: var(--radius-panel);
  overflow: hidden;
  border: 1px solid var(--line-hairline);
  background: var(--bg-canvas);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

.workbench-bg {
  position: absolute;
  inset: 0;
  background-color: #ffffff;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  transition: background-color var(--dur-base) var(--ease-standard);
}

.workbench-bg.is-grid-mode::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(29, 29, 31, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(29, 29, 31, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
}

.workbench-bg[data-paper-dark="true"].is-grid-mode::before {
  background-image:
    linear-gradient(to right, rgba(245, 245, 247, 0.09) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(245, 245, 247, 0.09) 1px, transparent 1px);
}

.workbench-bg.is-a4-mode::after {
  content: "";
  position: absolute;
  inset: 22px 12%;
  border: 1px dashed rgba(29, 29, 31, 0.18);
  border-radius: 4px;
}

.workbench-bg[data-paper-dark="true"].is-a4-mode::after {
  border-color: rgba(245, 245, 247, 0.24);
}

.workbench-canvas {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.workbench-hud {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  padding: 6px 12px;
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.9);
  color: var(--fg-primary);
  font-size: var(--size-meta);
  font-weight: var(--weight-semibold);
  pointer-events: none;
}

.workbench-stage[data-paper-dark="true"] .workbench-hud {
  background: rgba(22, 22, 23, 0.9);
  color: var(--dark-fg);
}

.workbench-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-subtle);
  border-radius: var(--radius-panel);
}

.pad-control-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.pad-group-label {
  font-size: var(--size-meta);
  font-weight: var(--weight-semibold);
  color: var(--fg-secondary);
  margin-right: 4px;
}

.paper-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line-hairline);
  background: var(--bg-canvas);
  font-size: var(--size-meta);
  font-weight: var(--weight-semibold);
  color: var(--fg-primary);
  transition: border-color var(--dur-fast) var(--ease-standard), background-color var(--dur-fast) var(--ease-standard);
}

.paper-chip.is-active {
  border-color: var(--accent-scratchpaper);
  background: var(--bg-subtle);
}

.paper-chip-swatch {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.ink-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--line-hairline);
  transition: transform var(--dur-fast) var(--ease-apple), border-color var(--dur-fast) var(--ease-standard);
}

.ink-swatch.is-active {
  transform: scale(1.14);
  border-color: var(--fg-primary);
}

.workbench-hint {
  margin: 0;
  text-align: center;
  font-size: var(--size-meta);
  color: var(--fg-secondary);
}

/* Interactive 2: 8-Frame Bilingual Real-Device Screen Inspector */
.sp-screen-shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

.sp-screen-shell:focus-visible {
  outline: 2px solid var(--accent-scratchpaper);
  outline-offset: 8px;
  border-radius: var(--radius-panel);
}

.sp-screen-monitor {
  padding: 18px;
  background: var(--bg-canvas);
  border-radius: var(--radius-panel);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

.sp-screen-viewport {
  position: relative;
  border-radius: var(--radius-control);
  overflow: hidden;
  background: var(--bg-subtle);
  aspect-ratio: 552 / 1200;
  max-height: 580px;
  margin: 0 auto;
}

.sp-screen-viewport img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  transition: opacity 150ms var(--ease-standard);
}

.sp-screen-viewport img.is-swapping {
  opacity: 0.32;
}

.sp-screen-telemetry {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: var(--size-meta);
  color: var(--fg-secondary);
}

.sp-telemetry-tag {
  color: var(--accent-scratchpaper);
  font-weight: var(--weight-semibold);
}

.sp-screen-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.sp-screen-index {
  margin: 0;
  font-size: var(--size-meta);
  font-weight: var(--weight-semibold);
  color: var(--accent-scratchpaper);
}

.sp-screen-info h3 {
  margin: 0;
  font-size: var(--size-title);
  font-weight: var(--weight-semibold);
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.sp-screen-desc {
  margin: 0;
  color: var(--fg-secondary);
}

.sp-screen-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--size-meta);
  color: var(--fg-primary);
}

.sp-screen-points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sp-dot {
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent-scratchpaper);
  flex-shrink: 0;
}

.sp-screen-metric {
  margin: 0;
  padding: 11px 14px;
  border-radius: var(--radius-control);
  background: var(--bg-canvas);
  font-size: var(--size-meta);
  font-weight: var(--weight-semibold);
  color: var(--fg-primary);
}

.sp-thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.sp-thumb {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: var(--radius-control);
  background: var(--bg-canvas);
  text-align: left;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-apple);
}

.sp-thumb:hover {
  opacity: 0.94;
}

.sp-thumb.is-active {
  opacity: 1;
  border-color: var(--accent-scratchpaper);
  transform: translateY(-2px);
}

.sp-thumb img {
  width: 100%;
  aspect-ratio: 552 / 1200;
  object-fit: cover;
  object-position: top center;
  border-radius: 6px;
  display: block;
}

.sp-thumb-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  min-width: 0;
  font-size: var(--size-meta);
  line-height: 1.25;
}

.sp-thumb-num {
  color: var(--fg-secondary);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
}

.sp-thumb.is-active .sp-thumb-num {
  color: var(--accent-scratchpaper);
}

.sp-thumb-lbl {
  color: var(--fg-primary);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Horizontal Paper Texture Gallery Carousel */
.paper-slide {
  flex: 0 0 clamp(220px, 19vw, 320px);
  scroll-snap-align: start;
  margin: 0;
  padding: 14px;
  background: var(--bg-canvas);
  border-radius: var(--radius-panel);
}

.paper-slide img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-control);
  cursor: zoom-in;
  border: 1px solid var(--line-hairline);
  transition: transform var(--dur-base) var(--ease-apple);
}

.paper-slide:hover img {
  transform: scale(1.015);
}

.paper-slide figcaption {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: var(--size-meta);
}

.paper-slide strong {
  font-weight: var(--weight-semibold);
}

.paper-slide span {
  color: var(--fg-secondary);
}

/* Specs Grid & Compliance Strip (Parity with drawart.css) */
.specs-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 24px);
}

.spec-tile {
  padding: 28px 24px;
  background: var(--bg-subtle);
  border-radius: var(--radius-panel);
}

.spec-tile-val {
  display: block;
  margin-bottom: 6px;
  font-size: var(--size-title);
  font-weight: var(--weight-semibold);
  color: var(--fg-primary);
  line-height: 1.15;
}

.spec-tile h3 {
  margin: 0 0 8px;
  font-size: var(--size-body);
  font-weight: var(--weight-semibold);
}

.spec-tile p {
  margin: 0;
  font-size: var(--size-meta);
  color: var(--fg-secondary);
}

.page-legal-strip {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line-hairline);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 28px;
  font-size: var(--size-meta);
  color: var(--fg-secondary);
}

.page-legal-strip a:hover {
  color: var(--fg-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 960px) {
  .sp-stage-bar,
  .sp-screen-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .sp-stage-bar {
    gap: 0;
  }

  .sp-stage-item {
    padding: 16px 20px;
  }

  .sp-stage-item + .sp-stage-item {
    border-left: 0;
    border-top: 1px solid var(--line-hairline);
  }

  .specs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .sp-chapter {
    padding: 64px 0;
  }

  .sp-hero {
    padding: 52px 0 56px;
  }

  .sp-screen-viewport {
    max-height: 460px;
  }

  .sp-thumb-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .sp-thumb {
    padding: 4px;
  }

  .sp-thumb-meta {
    flex-direction: column;
    gap: 1px;
  }

  .workbench-top .segmented {
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: visible;
  }

  .workbench-top .segmented-btn {
    padding: 0 12px;
  }

  .workbench-stage {
    aspect-ratio: 4 / 5;
    min-height: 340px;
    max-height: none;
  }

  .workbench-bottom {
    padding: 14px;
  }

  .paper-slide {
    flex-basis: 220px;
  }
}

@media (max-width: 560px) {
  .specs-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
