/*
  織物製造所 · 編織誌
  網站像一本印刷的鉤織書：米色紙張、墨色字、藏青單色點綴；照片加裁切線與圖號。
  藏青只用在編號、圖號與「目前狀態」，其餘保持黑白，讓照片和線的顏色說話。
*/

:root {
  --paper: #f4f0e8;
  --card: #fbf9f4;
  --ink: #16140f;
  --muted: #5e584e;
  --hair: rgba(22, 20, 15, 0.22);
  --blue: #1f3c8e;

  --font-serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --font-latin: "Instrument Serif", "Noto Serif TC", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --wrap: 77.5rem;
  --gutter: clamp(1rem, 4vw, 3.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

/* 紙張顆粒只在底色上；不疊在照片上，照片顏色才準 */
body {
  margin: 0;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .40 0 0 0 0 .32 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.9;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
p,
figure,
dl,
dd,
ol,
ul {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.wrap {
  width: min(var(--wrap), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 換頁轉場：作品卡片的照片會平滑放大成商品頁大圖；不支援的瀏覽器就是一般換頁 */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

::view-transition-group(*) {
  animation-duration: 380ms;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: -100vw;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
}

.skip-link:focus {
  left: 0.5rem;
}

/* ---------- 刊頭 ---------- */

.masthead {
  /* 換頁時刊頭保持不動，只有內容轉場 */
  view-transition-name: site-header;
}

.masthead-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding-block: 0.6rem 0.4rem;
  border-bottom: 3px double var(--ink);
}

.masthead-issue {
  display: none;
  color: var(--muted);
}

.masthead-logo {
  display: inline-block;
  padding-block: 0.65rem;
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.masthead-nav {
  display: flex;
  gap: 0.25rem;
}

.masthead-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 0.5rem;
  font-size: 0.92rem;
  text-decoration: none;
}

.masthead-nav a::after {
  content: "";
  position: absolute;
  right: 0.5rem;
  bottom: 0.6rem;
  left: 0.5rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms ease;
}

.masthead-nav a:hover::after,
.masthead-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* 印刷色條：22 色線材，一排固定 22 格，跟著寬度縮放 */
.colorbar {
  display: grid;
  grid-template-columns: repeat(22, minmax(0, 1fr));
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.colorbar li {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1;
  text-align: center;
}

.colorbar li::before {
  content: "";
  display: block;
  height: 12px;
  margin-bottom: 5px;
  background: var(--c);
}

/* 色條像油墨一格格印上去：只在首頁播放；作品頁、商品頁每次換頁都重播會像在等開場，也會讓刊頭閃一下 */
@media (prefers-reduced-motion: no-preference) {
  .is-home .colorbar li::before {
    transform-origin: left;
    animation: ink-in 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i) * 15ms + 100ms);
  }
}

@keyframes ink-in {
  from {
    transform: scaleX(0);
  }
}

@media (min-width: 52rem) {
  .masthead-top {
    grid-template-columns: 1fr auto 1fr;
  }

  .masthead-issue {
    display: block;
  }

  .masthead-nav {
    justify-self: end;
    gap: 1rem;
  }

  .colorbar li {
    font-size: 9px;
  }
}

/* ---------- 印刷語彙：裁切線、圖號、章節 ---------- */

/* 照片四角的裁切線 */
.frame {
  position: relative;
  display: block;
}

.frame::before {
  content: "";
  position: absolute;
  inset: -14px;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(var(--ink) 0 0) 0 14px / 9px 1px,
    linear-gradient(var(--ink) 0 0) 14px 0 / 1px 9px,
    linear-gradient(var(--ink) 0 0) 100% 14px / 9px 1px,
    linear-gradient(var(--ink) 0 0) calc(100% - 14px) 0 / 1px 9px,
    linear-gradient(var(--ink) 0 0) 0 calc(100% - 14px) / 9px 1px,
    linear-gradient(var(--ink) 0 0) 14px 100% / 1px 9px,
    linear-gradient(var(--ink) 0 0) 100% calc(100% - 14px) / 9px 1px,
    linear-gradient(var(--ink) 0 0) calc(100% - 14px) 100% / 1px 9px;
  background-repeat: no-repeat;
}

figcaption {
  display: flex;
  gap: 0.9em;
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.fig {
  flex: none;
  padding-top: 0.15em;
  color: var(--blue);
}

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  margin-bottom: clamp(2rem, 4.5vw, 4rem);
  padding-top: 1.1rem;
  border-top: 3px double var(--ink);
}

.sec-no {
  color: var(--blue);
  font-family: var(--font-latin);
  font-size: clamp(3.4rem, 7vw, 6.2rem);
  line-height: 0.8;
}

.sec-head h1,
.sec-head h2 {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1.3;
}

.sec-en {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-latin);
  font-size: clamp(1.1rem, 1.6vw, 1.5rem);
  font-style: italic;
}

.chapter {
  margin-bottom: clamp(4.5rem, 10vw, 8.75rem);
}

/* ---------- 按鈕與連結 ---------- */

.cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.9rem;
  min-height: 48px;
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: background 250ms, color 250ms;
}

.cta:hover {
  background: var(--ink);
  color: var(--paper);
}

.cta span {
  transition: transform 250ms;
}

.cta:hover span {
  transform: translateX(5px);
}

.more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.45em;
}

.more:hover {
  color: var(--blue);
}

/* 購買按鈕：可點的是實心墨色；還不能買的是斜線底的「即將開賣」 */
.btn,
.pending {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--ink);
  font-weight: 900;
  letter-spacing: 0.3em;
  text-align: center;
  text-decoration: none;
  text-indent: 0.3em;
}

.btn {
  background: var(--ink);
  color: var(--paper);
  transition: background 200ms;
}

.btn:hover {
  background: var(--blue);
  border-color: var(--blue);
}

.btn-quiet {
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-indent: 0.1em;
}

.btn-quiet:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.pending {
  background: repeating-linear-gradient(-45deg, transparent 0 7px, rgba(22, 20, 15, 0.07) 7px 8px);
}

.hint {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.stamp {
  display: inline-block;
  padding: 0.25rem 0.9rem;
  border: 2px solid var(--blue);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px var(--blue);
  color: var(--blue);
  font-weight: 900;
  letter-spacing: 0.3em;
  transform: rotate(-6deg);
}

/* 規格表：有值的欄位才會出現 */
.spec {
  margin-block: 1.6rem 1.4rem;
  border-top: 1px solid var(--ink);
}

.spec div {
  display: grid;
  grid-template-columns: 5.5em 1fr;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--hair);
}

.spec dt {
  padding-top: 0.35em;
}

.spec dd {
  font-weight: 600;
}

.price {
  font-family: var(--font-latin);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.2;
}

.dek {
  font-size: 1.12rem;
  line-height: 1.95;
}

.empty {
  color: var(--muted);
}

/* ---------- 首頁：第一屏 ---------- */

/* 手機：照片與直排標題並排，簡介接在下面 */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2.4rem 1.1rem;
  padding-block: clamp(2.25rem, 5vw, 4.5rem) clamp(3.5rem, 7vw, 6.5rem);
}

.hero-fig {
  grid-column: 1;
  grid-row: 1;
}

.hero-fig img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: 50% 88%;
}

.hero-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  grid-column: 2;
  grid-row: 1;
}

.vtitle {
  font-size: clamp(2.9rem, 12vw, 3.8rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  writing-mode: vertical-rl;
}

.vtitle span {
  display: inline-block;
}

/*
  首頁開場和色條同一個概念：油墨印上去。直排標題每個字由上往下印出，最後蓋上印章，整段約 1 秒。
  印章的回彈是刻意的：蓋章那一下的手感。
*/
@media (prefers-reduced-motion: no-preference) {
  .vtitle span {
    animation: print-down 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i) * 70ms + 120ms);
  }

  .seal {
    animation: stamp 350ms cubic-bezier(0.3, 1.6, 0.5, 1) both 600ms;
  }
}

@keyframes print-down {
  from {
    clip-path: inset(0 0 100% 0);
  }

  to {
    clip-path: inset(0 0 -10% 0);
  }
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(-5deg) scale(1.6);
  }
}

.vsub {
  display: none;
  color: var(--muted);
  writing-mode: vertical-rl;
}

.seal {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--blue);
  box-shadow: inset 0 0 0 3px var(--blue), inset 0 0 0 4px rgba(244, 240, 232, 0.7);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(-5deg);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  grid-column: 1 / -1;
}

.hero-copy > .mono {
  color: var(--muted);
}

.lead {
  font-size: clamp(1.6rem, 2.7vw, 2.5rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.lead em {
  color: var(--blue);
  font-style: normal;
}

.lead br {
  display: none;
}

.toc h2 {
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--ink);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.3em;
}

.toc ol {
  padding: 0;
  list-style: none;
}

.toc a {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  min-height: 44px;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--hair);
  text-decoration: none;
}

.toc a:hover .toc-title {
  color: var(--blue);
}

.toc-no {
  color: var(--blue);
}

.toc-dots {
  flex: 1;
  border-bottom: 1px dotted var(--muted);
  transform: translateY(-0.35em);
}

.toc-page {
  font-family: var(--font-latin);
  font-size: 1.1rem;
  font-style: italic;
}

@media (min-width: 52rem) {
  .hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 5fr) auto;
    column-gap: clamp(1.25rem, 3vw, 3.25rem);
  }

  .hero-fig img {
    aspect-ratio: 4 / 5;
    object-position: 50% 80%;
  }

  .hero-copy {
    grid-column: 2;
    grid-row: 1;
  }

  .toc {
    margin-top: auto;
  }

  .hero-title {
    grid-column: 3;
    gap: 1.2rem;
  }

  .vtitle {
    font-size: clamp(3.6rem, 7.7vw, 7.7rem);
  }

  .vsub {
    display: block;
    letter-spacing: 0.25em;
  }

  .seal {
    width: 64px;
    height: 64px;
    font-size: 2rem;
  }

  .lead br {
    display: inline;
  }
}

/* ---------- 首頁：作品跨頁 ---------- */

/* 手機：照片在上，文字框往上疊一點，小圖兩欄 */
.spread {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: clamp(4rem, 9vw, 8.5rem);
}

/* 滑過照片不放大：那是裝飾性的制式效果，可點的提示交給標題連結 */
.spread-main img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.spread-main figcaption {
  display: none;
}

.spread-text {
  position: relative;
  z-index: 2;
  margin: -3rem 0 0 1.2rem;
  padding: 1.4rem 0 0 1.2rem;
  background: var(--paper);
}

.spread--rev .spread-text {
  margin: -3rem 1.2rem 0 0;
  padding: 1.4rem 1.2rem 0 0;
}

.spread-text > .mono {
  color: var(--blue);
}

.spread h3 {
  margin-block: 0.5rem 1.1rem;
  font-size: clamp(2.1rem, 4.2vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.spread h3 a {
  text-decoration: none;
}

.spread h3 a:hover {
  color: var(--blue);
}

.strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: clamp(1.75rem, 4vw, 3.5rem);
}

.strip figure {
  overflow: hidden;
}

.strip img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.strip figcaption {
  font-size: 0.75rem;
}

@media (min-width: 52rem) {
  .spread {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1rem, 2.4vw, 2.25rem);
  }

  .spread-main {
    grid-column: 1 / 8;
    grid-row: 1;
  }

  .spread-main figcaption {
    display: flex;
  }

  /* 文字框疊在照片右下角，像雜誌跨頁 */
  .spread-text {
    grid-column: 7 / 13;
    grid-row: 1;
    align-self: end;
    margin: 0 0 3.2rem;
    padding: clamp(1.25rem, 2.6vw, 2.5rem) 0 clamp(1.25rem, 2.6vw, 2.5rem) clamp(1.25rem, 2.6vw, 2.5rem);
  }

  .spread--rev .spread-main {
    grid-column: 6 / 13;
  }

  .spread--rev .spread-text {
    grid-column: 1 / 7;
    margin: 0 0 3.2rem;
    padding: clamp(1.25rem, 2.6vw, 2.5rem) clamp(1.25rem, 2.6vw, 2.5rem) clamp(1.25rem, 2.6vw, 2.5rem) 0;
  }

  .strip {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(0.6rem, 2vw, 1.75rem);
  }

  .strip figure:nth-child(even) {
    margin-top: clamp(1rem, 3vw, 3rem);
  }
}

/* ---------- 首頁：購買方式 ---------- */

.buy-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2rem 1.6rem;
  margin-bottom: 2.4rem;
}

.buy-intro p {
  max-width: 40em;
}

.steps {
  padding: 0;
  border-top: 1px solid var(--ink);
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  column-gap: 1rem;
  padding-block: 1.2rem;
  border-bottom: 1px solid var(--ink);
}

.steps b {
  grid-row: span 2;
  color: var(--blue);
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1;
}

.steps h3 {
  margin-bottom: 0.3rem;
  font-size: 1.2rem;
  font-weight: 900;
}

.steps p {
  color: var(--muted);
  font-size: 0.95rem;
}

@media (min-width: 52rem) {
  .steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .steps li {
    display: block;
    padding: 1.4rem clamp(0.75rem, 2vw, 1.75rem) 1.4rem 0;
  }

  .steps li + li {
    padding-left: clamp(0.75rem, 2vw, 1.75rem);
    border-left: 1px solid var(--hair);
  }

  .steps b {
    display: block;
    margin-bottom: 1rem;
    font-size: clamp(3rem, 5vw, 4.6rem);
  }
}

/* ---------- 作品列表 ---------- */

.page {
  padding-top: clamp(2.25rem, 5vw, 4rem);
}

.filters {
  display: flex;
  gap: 0.25rem 1.4rem;
  margin: -1rem 0 2.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filters a {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
}

.filters a:hover {
  color: var(--ink);
}

.filters a[aria-current="page"] {
  color: var(--ink);
  font-weight: 900;
  text-decoration: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.5em;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem 1rem;
  margin-bottom: clamp(4.5rem, 10vw, 8.75rem);
}

@media (min-width: 52rem) {
  .catalog {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4rem clamp(1.25rem, 3vw, 2.75rem);
  }
}

.product-card {
  display: block;
  text-decoration: none;
}

.product-card-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  margin-bottom: 0.9rem;
  overflow: hidden;
  background: var(--card);
}

.product-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 第二張照片只在有滑鼠的裝置載入與顯示（display: none 的 lazy 圖片不會下載） */
.product-card-hover {
  display: none;
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 250ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .product-card-hover {
    display: block;
  }

  .product-card:hover .product-card-hover,
  .product-card:focus-visible .product-card-hover {
    opacity: 1;
  }
}

.product-card-meta {
  display: block;
  color: var(--blue);
}

.product-card-name {
  display: block;
  margin-top: 0.2rem;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: 900;
  line-height: 1.35;
}

.product-card:hover .product-card-name {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

.product-card .price {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.25rem;
}

/* ---------- 商品頁 ---------- */

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.6rem;
  padding-top: clamp(0.5rem, 2vw, 1.5rem);
  color: var(--muted);
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--blue);
}

.product-top {
  display: grid;
  gap: 1.75rem;
  padding-block: 0.5rem clamp(4.5rem, 10vw, 8.75rem);
}

.gallery {
  min-width: 0;
}

/* 手機：照片滿版，不畫裁切線 */
.gallery .frame {
  margin-inline: calc(var(--gutter) * -1);
}

.gallery .frame::before {
  display: none;
}

/* 大圖是一條可左右滑動的軌道，每次停在一張照片上 */
.gallery-track {
  position: relative;
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: var(--card);
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-slide {
  flex: 0 0 100%;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.gallery-btn {
  display: none;
}

.gallery-cap {
  display: flex;
  gap: 0.9em;
  min-height: 1.7em;
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.gallery-cap .fig {
  padding-top: 0.15em;
}

/* 手機：縮圖列橫向捲動，目前那張由 JS 捲到看得到的位置 */
.gallery-thumbs {
  display: grid;
  grid-auto-columns: 60px;
  grid-auto-flow: column;
  gap: 8px;
  margin-top: 0.75rem;
  padding: 4px 3px;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}

.gallery-thumbs::-webkit-scrollbar {
  display: none;
}

.gallery-thumbs button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 200ms;
}

.gallery-thumbs button:hover {
  opacity: 0.85;
}

.gallery-thumbs button[aria-current="true"] {
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink);
  opacity: 1;
}

.gallery-thumbs img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.detail-info > .mono {
  color: var(--blue);
}

.detail-info h1 {
  margin-block: 0.5rem 0.8rem;
  font-size: clamp(2.2rem, 4.4vw, 3.8rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.detail-info .price {
  font-size: clamp(1.8rem, 2.6vw, 2.4rem);
  line-height: 1;
}

.detail-info .dek {
  margin-top: 1.3rem;
}

.buy-box {
  margin-top: 1.8rem;
}

.buy-box .btn-quiet {
  margin-top: 0.8rem;
}

.jump {
  margin-top: 1.2rem;
}

@media (min-width: 52rem) {
  .product-top {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: start;
    gap: clamp(1.75rem, 5vw, 5rem);
    padding-top: clamp(1.5rem, 3vw, 2.5rem);
  }

  .gallery .frame {
    margin-inline: 0;
  }

  .gallery .frame::before {
    display: block;
  }

  .gallery-btn {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-top: -23px;
    border: 1px solid var(--ink);
    border-radius: 50%;
    background: rgba(244, 240, 232, 0.92);
    cursor: pointer;
    font-family: var(--font-latin);
    font-size: 1.3rem;
    line-height: 1;
    transition: background 200ms, color 200ms, opacity 200ms;
  }

  .gallery-btn:hover:not(:disabled) {
    background: var(--ink);
    color: var(--paper);
  }

  .gallery-btn:disabled {
    opacity: 0;
    pointer-events: none;
  }

  .gallery-prev {
    left: 14px;
  }

  .gallery-next {
    right: 14px;
  }

  .gallery-thumbs {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(4rem, 1fr));
    margin-top: 1rem;
    overflow: visible;
  }

  /* 捲動看照片時，名稱、價格和購買按鈕一直在旁邊 */
  .detail-info {
    position: sticky;
    top: 1.5rem;
  }
}

/* 故事 */
.story-grid {
  display: grid;
  gap: 2.5rem;
  align-items: start;
}

.story {
  max-width: 36em;
  font-size: 1.05rem;
}

.story > * + * {
  margin-top: 1.1rem;
}

/* 第一段首字放大 */
.story > p:first-child::first-letter {
  float: left;
  margin: 0.06em 0.14em 0 0;
  color: var(--blue);
  font-size: 3.7em;
  font-weight: 900;
  line-height: 0.95;
}

.story h2,
.story h3 {
  margin-top: 2.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.story ul,
.story ol {
  padding-left: 1.2em;
}

.story li::marker {
  color: var(--blue);
}

.story a {
  color: var(--blue);
}

.story-fig {
  max-width: 26rem;
}

.story-fig img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

@media (min-width: 52rem) {
  .story-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(1.75rem, 5vw, 5rem);
  }

  .story-fig {
    max-width: none;
  }
}

/* 可選顏色 */
.colours-intro {
  max-width: 36em;
  margin: -1rem 0 2rem;
}

.chart {
  max-width: 47.5rem;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
}

/* 下一件作品 */
.next {
  margin-bottom: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 3px double var(--ink);
}

.next a {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding-top: 1.4rem;
  text-decoration: none;
}

.next img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.next .mono {
  color: var(--blue);
}

.next b {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 900;
  line-height: 1.3;
}

.next-arrow {
  font-family: var(--font-latin);
  font-size: clamp(2rem, 4vw, 3.4rem);
  transition: transform 300ms;
}

.next a:hover b {
  color: var(--blue);
}

.next a:hover .next-arrow {
  transform: translateX(8px);
}

@media (min-width: 52rem) {
  .next a {
    grid-template-columns: clamp(5.5rem, 12vw, 9.5rem) 1fr auto;
  }
}

/* ---------- 配色模擬器 ---------- */

.simulator {
  display: grid;
  gap: 1.1rem;
}

/* 手機：小花與兩個色號縮成一條，固定在上方，往下點色票時一直看得到 */
.simulator-preview {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 1rem;
  margin-inline: calc(var(--gutter) * -1);
  padding: 10px var(--gutter);
  background: var(--card);
  box-shadow: 0 10px 20px -16px rgba(22, 20, 15, 0.7);
}

.simulator-flower {
  display: block;
  width: 92px;
  height: auto;
  overflow: visible;
}

.simulator-flower .sim-main {
  fill: var(--main);
  transition: fill 300ms ease;
}

.simulator-flower .sim-accent {
  fill: var(--accent);
  transition: fill 300ms ease;
}

.simulator-flower .sim-outline {
  fill: none;
  stroke: rgba(22, 20, 15, 0.25);
  stroke-width: 3;
}

/* 一圈圈深淺交錯的短針腳，模仿鉤針一圈一圈鉤上去的紋路；深色、淺色線上都看得到 */
.simulator-flower .sim-rounds-dark,
.simulator-flower .sim-rounds-light {
  fill: none;
  stroke-dasharray: 3.4 3.6;
  stroke-linecap: round;
  stroke-width: 3.2;
}

.simulator-flower .sim-rounds-dark {
  stroke: rgba(0, 0, 0, 0.13);
}

.simulator-flower .sim-rounds-light {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-dashoffset: 3.5;
}

.simulator-flower .sim-puff {
  pointer-events: none;
}

.simulator-flower .sim-handle,
.simulator-flower .sim-handle-outline,
.simulator-flower .sim-stitch {
  fill: none;
  stroke-linecap: round;
}

.simulator-flower .sim-handle-outline {
  stroke: rgba(22, 20, 15, 0.22);
  stroke-width: 9.5;
}

.simulator-flower .sim-handle {
  stroke: var(--accent);
  stroke-width: 7;
  transition: stroke 300ms ease;
}

.simulator-flower .sim-stitch {
  stroke: rgba(22, 20, 15, 0.18);
  stroke-dasharray: 2.2 3.4;
  stroke-width: 7;
}

.simulator-flower .sim-shadow {
  fill: rgba(22, 20, 15, 0.08);
}

.simulator-flower .sim-button {
  fill: #c08a52;
  stroke: rgba(22, 20, 15, 0.3);
  stroke-width: 1;
}

.simulator-flower .sim-button-hole {
  fill: rgba(22, 20, 15, 0.5);
}

/* 主色／配色鈕：同時顯示色號，也用來切換正在改哪一個 */
.parts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--ink);
}

.part {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 56px;
  padding: 0.5rem 0.6rem;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  transition: background 200ms, color 200ms;
}

.part + .part {
  border-left: 1px solid var(--ink);
}

.part[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.part-swatch {
  flex: none;
  width: 20px;
  height: 20px;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15), 0 0 0 2px var(--paper);
  transition: background 300ms;
}

.part-label {
  display: block;
  font-size: 0.78rem;
  line-height: 1.4;
  opacity: 0.8;
}

.part-note {
  display: none;
}

.part-number {
  display: block;
  font-family: var(--font-latin);
  font-size: 1.7rem;
  line-height: 1;
}

.part-number small {
  margin-left: 0.2rem;
  font-family: var(--font-serif);
  font-size: 0.85rem;
}

.simulator-how {
  margin-bottom: 1rem;
  color: var(--muted);
}

.simulator-how b {
  color: var(--ink);
}

/* 色票：像印刷廠的 Pantone 色票 */
.chips {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  list-style: none;
}

.chip {
  position: relative;
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 5px 5px 7px;
  border: 0;
  background: var(--card);
  box-shadow: 0 1px 0 var(--hair), 0 6px 14px -10px rgba(22, 20, 15, 0.5);
  cursor: pointer;
  text-align: left;
  transition: transform 250ms cubic-bezier(0.2, 0.7, 0.1, 1), box-shadow 250ms;
}

.chip::before {
  content: "";
  display: block;
  aspect-ratio: 4 / 5;
  background: var(--c);
}

.chip b {
  display: block;
  margin-top: 5px;
  font-family: var(--font-latin);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1;
}

.chip[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--ink);
  transform: translateY(-4px);
}

/* 已選的兩個顏色標上「主」「配」 */
.chip[data-role]:not([data-role=""])::after {
  content: attr(data-role);
  position: absolute;
  top: -8px;
  right: -6px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding-inline: 4px;
  border-radius: 11px;
  background: var(--blue);
  color: var(--paper);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

/* 滑過色票只描邊，不浮起；浮起留給「選中」狀態，兩者才分得清楚 */
@media (hover: hover) {
  .chip:hover:not([aria-pressed="true"]) {
    box-shadow: 0 0 0 1px var(--muted);
  }
}

.simulator .hint {
  margin-top: 1rem;
}

@media (min-width: 52rem) {
  .simulator {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
    gap: clamp(1.5rem, 4vw, 4rem);
  }

  .simulator-preview {
    position: static;
    display: block;
    margin: 0;
    padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.25rem, 3vw, 2.5rem) clamp(1rem, 2vw, 1.75rem);
    box-shadow: 0 1px 0 var(--hair), 0 12px 30px -24px rgba(22, 20, 15, 0.6);
  }

  .simulator-flower {
    width: min(100%, 300px);
    margin: 0 auto;
  }

  .parts {
    margin-top: 1.2rem;
  }

  .part {
    gap: 0.8rem;
    padding: 0.7rem 0.9rem;
  }

  .part-swatch {
    width: 30px;
    height: 30px;
  }

  .part-note {
    display: inline;
  }

  .part-number {
    font-size: 2.3rem;
  }

  .chips {
    grid-template-columns: repeat(11, minmax(0, 1fr));
    gap: clamp(6px, 1vw, 12px);
  }

  .chip b {
    font-size: 1.05rem;
  }
}

/* ---------- 404 與錯誤頁 ---------- */

.notice {
  min-height: 50vh;
  padding-block: clamp(2.25rem, 5vw, 4rem) clamp(4.5rem, 10vw, 8.75rem);
}

.notice p {
  max-width: 36em;
  margin-bottom: 1.8rem;
}

.notice code {
  font-family: var(--font-mono);
}

/* ---------- 版權頁（頁尾） ---------- */

.colophon {
  padding-block: clamp(2.5rem, 6vw, 5rem) 1.75rem;
  background: var(--ink);
  color: var(--paper);
}

.colophon-grid {
  display: grid;
  gap: 2rem;
}

.colophon-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  width: max-content;
  max-width: 100%;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-decoration: none;
}

.colophon-logo span {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.22em;
}

.colophon h2 {
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.3em;
}

.colophon dl {
  border-top: 1px solid rgba(244, 240, 232, 0.4);
}

.colophon dl div {
  display: grid;
  grid-template-columns: 7em 1fr;
  padding-block: 0.45rem;
  border-bottom: 1px solid rgba(244, 240, 232, 0.18);
  font-size: 0.92rem;
}

.colophon dt {
  color: rgba(244, 240, 232, 0.6);
}

.colophon-nav {
  display: flex;
  gap: 0.25rem 1.2rem;
}

.colophon-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.colophon-nav a:hover {
  text-decoration: underline;
}

/* 版本號維持原本大小寫，commit 才能和 GitHub 上的對得起來 */
.version {
  margin-top: clamp(2rem, 5vw, 4rem);
  color: rgba(244, 240, 232, 0.5);
  text-transform: none;
}

@media (min-width: 52rem) {
  .colophon-grid {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: clamp(1.5rem, 5vw, 5rem);
    align-items: start;
  }

  .colophon-nav {
    flex-direction: column;
  }
}

/* 減少動態效果：拿掉開場動畫與位移，但保留短暫的顏色、透明度變化，點了有沒有反應還看得出來 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-property: color, background-color, border-color, opacity, fill, stroke !important;
    transition-duration: 150ms !important;
  }
}
