/* Ratios follow the owner's 810 × 1422 paper-board reference on a plain white field. */
.accessories {
  --accessory-ink: #3f433e;
  position: relative;
  isolation: isolate;
  color: var(--accessory-ink);
  background: #fff;
}
.accessory-board {
  position: relative;
  width: min(100%, 1040px);
  margin-inline: auto;
  padding: clamp(180px, 23%, 239px) 4.5% 21%;
  container-type: inline-size;
}
/* Percent block padding is relative to the containing width; cap it with the board. */
@media (min-width: 1040px) {
  .accessory-board { padding: 239px 47px 218px; }
}
.accessory-heading {
  position: absolute;
  top: 130px;
  left: 4.5%;
  right: 4.5%;
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 24px;
}
.accessory-heading h2 { margin: 0; text-align: center; font: 700 clamp(2.25rem, 4.6vw, 4rem)/.95 var(--font-sans); letter-spacing: -.07em; }
.accessory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4.2cqw 4%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.accessory-slot { min-width: 0; position: relative; }
.accessory-card {
  --paper-turn: -.8deg;
  --clip-turn: 0deg;
  --clip-x: 43%;
  --art-width: 82%;
  display: block;
  position: relative;
  aspect-ratio: 226 / 337;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.accessory-card:focus-visible { outline: 2px solid var(--accessory-ink); outline-offset: 10px; }
.paper-stack {
  display: block;
  position: absolute;
  inset: 0;
  transform: rotate(var(--paper-turn));
  transition: transform 220ms cubic-bezier(.2,.7,.2,1);
}
.paper-stack::before {
  content: '';
  position: absolute;
  inset: 2% 1% -.6% -1%;
  border-radius: 2% 1% 5% 2%;
  background: #777b6e;
  box-shadow: -3px 5px 8px #686d5e52, 1px 10px 13px -6px #555a4c66;
  transform: rotate(.6deg);
  opacity: .64;
}
.paper-sheet {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: .7% .5% 1.5% .6%;
  background: linear-gradient(94deg, #c8cbc3, #e3e5de 3%, #e7e8e1 88%, #f3f4ed);
  box-shadow: -.7px 0 1px #70776b73, 0 1px 1px #6f766c66;
}
.paper-sheet--back { transform: translate(-2.1%, 1.1%) rotate(.6deg); }
.paper-sheet--middle { transform: translate(1.1%, .5%) rotate(1deg); }
.paper-sheet--front {
  overflow: hidden;
  background:
    linear-gradient(91deg, #c4c9bd59, #f1f2e500 7%, #fbfbf23d 78%, #fffff766),
    linear-gradient(177deg, #f0f1e8, #eaece3 80%, #e2e5db);
  border-top: 1px solid #f5f5ed70;
  border-right: 1px solid #f4f4ed70;
  box-shadow: -1px 0 1px #757b6e73, 0 2px 2px #5961513d;
}
.paper-sheet--front::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .19;
  background: url('assets/field-grain.svg');
  pointer-events: none;
}
.paper-sheet--front::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.1%;
  border-radius: 0 0 45% 20%;
  background: linear-gradient(0deg, #a8ada131, #edf0e334 18%, transparent);
  pointer-events: none;
}
.accessory-art {
  display: block;
  position: relative;
  width: var(--art-width, 82%);
  aspect-ratio: var(--crop-w) / var(--crop-h);
  overflow: hidden;
}
.paper-sheet .accessory-art {
  position: absolute;
  top: 53%;
  left: 50%;
  transform: translate(-50%, -50%);
  mix-blend-mode: multiply;
  filter: saturate(.76) contrast(.94) brightness(.93);
}
.accessory-art img {
  position: absolute;
  display: block;
  width: calc(1254 / var(--crop-w) * 100%);
  max-width: none;
  height: auto;
  left: calc(var(--crop-x) / var(--crop-w) * -100%);
  top: calc(var(--crop-y) / var(--crop-h) * -100%);
  user-select: none;
  pointer-events: none;
}
/* Real supplier cutouts retain their colors and use contained images, not atlas crops. */
.accessory-art--product { aspect-ratio: 1; }
.paper-sheet .accessory-art--product { top: 51%; mix-blend-mode: normal; filter: none; }
.accessory-art--product img {
  position: static;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* A folded wire, rather than a flat icon: contact shadow, steel edge, then highlight. */
.paper-clip {
  position: absolute;
  z-index: 2;
  width: 10.7%;
  height: 28%;
  top: -9%;
  left: var(--clip-x);
  transform-origin: 50% 38%;
  transform: rotate(var(--clip-turn));
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(-1.2px 1.7px 1px #53594a66);
}
.paper-clip use { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.clip-edge { stroke: #686e62; stroke-width: 2.6; }
.clip-wire { stroke: url('#accessory-steel'); stroke-width: 1.6; }
.clip-glint { stroke: #ffffec; stroke-width: .45; transform: translate(.45px, -.3px); opacity: .7; }
.accessory-caption {
  position: absolute;
  bottom: 7%;
  left: 7%;
  right: 7%;
  text-align: center;
  font-size: clamp(.55rem, 1.15cqw, .75rem);
  line-height: 1.5;
}
.accessory-slot:nth-child(2) .accessory-card { --paper-turn: 1.2deg; --clip-turn: 27deg; --clip-x: 34%; --art-width: 86%; }
.accessory-slot:nth-child(3) .accessory-card { --paper-turn: .7deg; --clip-turn: -38deg; --clip-x: 51%; --art-width: 69%; }
.accessory-slot:nth-child(4) .accessory-card { --paper-turn: -1.3deg; --clip-turn: -36deg; --clip-x: 42%; --art-width: 77%; }
.accessory-slot:nth-child(5) .accessory-card { --paper-turn: 1deg; --clip-turn: -38deg; --clip-x: 54%; --art-width: 80%; }
.accessory-slot:nth-child(6) .accessory-card { --paper-turn: 1.7deg; --clip-turn: -43deg; --clip-x: 45%; --art-width: 85%; }
.accessory-slot:nth-child(7) .accessory-card { --paper-turn: -.9deg; --clip-turn: -23deg; --clip-x: 48%; --art-width: 77%; }
.accessory-slot:nth-child(8) .accessory-card { --paper-turn: .7deg; --clip-turn: -35deg; --clip-x: 48%; --art-width: 84%; }
.accessory-slot:nth-child(9) .accessory-card { --paper-turn: .9deg; --clip-turn: 0deg; --clip-x: 46%; --art-width: 80%; }
.accessory-slot:nth-child(3n) .paper-sheet--back { transform: translate(-3.2%, 1.4%) rotate(1.2deg); }
.accessory-slot:nth-child(4n) .paper-sheet--middle { transform: translate(.4%, -.3%) rotate(-.7deg); }
.accessory-slot:nth-child(7) .paper-sheet--back { transform: translate(-3%, 1.4%) rotate(1.8deg); }
.accessory-svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.accessory-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 32px 24px 24px;
  border: 0;
  color: var(--ink);
  background: transparent;
  overflow: auto;
  overscroll-behavior: contain;
  /* One muted ink and one rule weight for every secondary line in the sheet. */
  --accessory-muted: #52605a;
  --accessory-rule: #203e4b2e;
}
.accessory-dialog[open] { display: grid; }
.accessory-dialog::backdrop { background: transparent; }
.accessory-dialog-shade { position: fixed; inset: 0; background: #182a30a6; }
.accessory-dialog-panel {
  position: relative;
  isolation: isolate;
  width: min(1120px, 100%);
  margin: auto;
  padding: 40px 48px 48px;
}
/* Reuse the approved alpha-cut ivory stock; its real fibers and edges define the sheet. */
.accessory-dialog-paper {
  position: absolute;
  /* Offset the sheet's own alpha margins so its torn edge meets the panel box. */
  inset: -3.7% -2.1% -4.3% -2.2%;
  z-index: -1;
  background: url('assets/instructors/ivory-sheet.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 2px #182a3029) drop-shadow(0 14px 28px #182a3033);
  pointer-events: none;
}
.accessory-dialog-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; font-size: var(--text-label); line-height: 1.6; }
.accessory-dialog .accessory-close { display: grid; place-items: center; flex-shrink: 0; width: 52px; height: 52px; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
.accessory-close .ui-icon { width: 36px; height: 36px; filter: drop-shadow(0 0 2px #f4efdfe6) drop-shadow(0 0 8px #f4efdfb3); }
.accessory-close:active { opacity: .6; }
.accessory-dialog button:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.accessory-detail-layout { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 48px; padding-top: 8px; }
.accessory-detail-art { display: grid; place-items: center; min-width: 0; }
.accessory-detail-art .accessory-art { width: 100%; max-width: 480px; }
.accessory-detail-art .accessory-art--detail img { position: absolute; width: var(--detail-image-width); height: auto; left: var(--detail-image-left); top: var(--detail-image-top); }
.accessory-detail-info { min-width: 0; padding-block: 8px; container-type: inline-size; }
/* Type ramp: 32/18/14/12, with one body leading and one muted ink. */
.accessory-dialog h3 { font: 400 2rem/1.3 var(--font-display); margin: 0 0 16px; letter-spacing: -.04em; overflow-wrap: anywhere; }
.accessory-dialog p { font-size: var(--text-reading); line-height: 1.65; margin: 0; }
.accessory-dialog .accessory-product-category { margin-bottom: 8px; font: 700 var(--text-body)/1.5 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--accessory-muted); }
.accessory-product-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 8px 20px; }
.accessory-product-copy { min-width: 0; }
.accessory-dialog .accessory-product-name { margin: 0; font: 700 1.125rem/1.4 var(--font-body); overflow-wrap: anywhere; }
.accessory-dialog .accessory-product-meta { margin-top: 4px; font: 400 var(--text-body)/1.5 var(--font-body); color: var(--accessory-muted); overflow-wrap: anywhere; }
.accessory-product-price-stock { text-align: right; white-space: nowrap; }
.accessory-dialog .accessory-product-price { font: 700 1.25rem/1.3 var(--font-body); font-variant-numeric: tabular-nums; }
.accessory-dialog .accessory-product-stock { margin-top: 4px; font: 400 var(--text-body)/1.5 var(--font-body); }
.accessory-product-stock--in { color: #456b56; }
.accessory-product-stock--low { color: #805e2d; }
.accessory-product-stock--out { color: #8a4c43; }
.accessory-dialog .accessory-product-information { margin-top: 16px; font: 400 var(--text-reading)/1.65 var(--font-body); color: var(--accessory-muted); }
.accessory-purchase { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--accessory-rule); }
/* Contact actions reuse the lesson-card pills: platform color, icon, 44px target. */
.accessory-purchase-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.accessory-purchase-links .lesson-action { justify-content: center; gap: 8px; height: 44px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-pill); background: var(--ink); color: #fff; font-family: 'Google Sans', 'Space Mono', sans-serif; font-size: var(--text-reading); font-weight: 600; line-height: 1.2; letter-spacing: .01em; text-decoration: none; }
.accessory-purchase-links .lesson-action[data-accessory-contact="whatsapp"] { background: #11763b; }
.accessory-purchase-links .lesson-action[data-accessory-contact="zalo"] { background: #0068ff; }
.accessory-purchase-links .lesson-action[data-accessory-contact="call"] { background: var(--ink); }
.accessory-purchase-links .lesson-action svg { width: 19px; height: 19px; flex: none; }
.accessory-purchase-links .lesson-action:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.accessory-purchase-links .lesson-action:active { filter: brightness(.9); text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .accessory-purchase-links .lesson-action:hover { filter: brightness(1.05); text-decoration: none; }
}
/* Narrow info columns keep the third action on its own full row. */
@container (max-width: 440px) {
  .accessory-purchase-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .accessory-purchase-links .lesson-action[data-accessory-contact="call"] { grid-column: 1 / -1; }
}
html.accessory-open { overflow: hidden; scrollbar-gutter: stable; }
@media (hover: hover) and (pointer: fine) {
  .accessory-card:hover .paper-stack { transform: translateY(-4px) rotate(var(--paper-turn)); }
}
.accessory-card:active .paper-stack { transform: translateY(1px) rotate(var(--paper-turn)); }
@media (max-width: 600px) {
  .accessory-heading { top: 110px; gap: 3px 12px; }
  .accessory-heading h2 { font-size: clamp(1.75rem, 8vw, 2.25rem); }
  .paper-stack::before { box-shadow: -2px 3px 5px #686d5e52, 1px 5px 8px -3px #555a4c66; }
  .paper-clip { filter: drop-shadow(-.5px 1px .6px #53594a66); }
}
@media (max-width: 800px) {
  .accessory-dialog { padding: 40px 12px; }
  .accessory-dialog-panel { align-self: start; margin: 0 auto; padding: 40px 28px 48px; }
  .accessory-dialog-bar { min-height: 48px; padding-right: 52px; }
  /* Fixed close, but seated on the bar's baseline and the content's right edge. */
  .accessory-dialog .accessory-close { position: fixed; top: max(80px, calc(env(safe-area-inset-top) + 40px)); right: max(40px, calc(env(safe-area-inset-right) + 12px)); z-index: 2; width: 48px; height: 48px; }
  .accessory-close .ui-icon { width: 32px; height: 32px; }
  .accessory-detail-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 12px; }
  .accessory-detail-art .accessory-art { width: min(100%, 300px); }
  .accessory-detail-info { padding: 0; }
  .accessory-dialog h3 { font-size: 1.5rem; }
  .accessory-product-summary { gap: 8px 16px; }
  .accessory-dialog .accessory-product-name { font-size: 1rem; }
  .accessory-dialog .accessory-product-price { font-size: 1.125rem; }
}
@media (prefers-reduced-motion: reduce) {
  .paper-stack { transition: none; }
  .accessory-card:hover .paper-stack, .accessory-card:active .paper-stack { transform: rotate(var(--paper-turn)); }
}
