:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #666666;
  --line: #e6e6e6;
  --accent: #111111;
  --maxw: 480px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { font-family: Helvetica, "Helvetica Neue", Arial, sans-serif; }

/* Ilustración destacada arriba, sin líneas ni bordes */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero img { display: block; height: auto; }

.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  background: #ffffff;
  text-align: center;
  padding: 16px calc(20px + env(safe-area-inset-right)) 12px calc(20px + env(safe-area-inset-left));
}

.logo-img {
  display: block;
  height: 34px;
  width: auto;
  margin: 0 auto;
}

.subtitle {
  color: #111;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  margin: 8px 0 0;
}

.instructions {
  max-width: var(--maxw);
  margin: 20px auto 8px;
  padding: 0 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}
.instructions span { flex: 1; }
.instructions span:last-child { text-align: right; }

/* GRID de 2 columnas */
.grid {
  max-width: var(--maxw);
  margin: 0 auto 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
}

/* Ilustración como una celda dentro de la cuadrícula: ocupa todo el alto, centrada */
.illus-cell { justify-content: center; }
.illus-cell .illus-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.illus-cell img { max-width: 100%; max-height: 100%; width: auto; height: 100%; object-fit: contain; }
/* Modo "cover": la foto llena toda la celda manteniendo proporción (recorta lo que sobra) */
.illus-cell.cover { padding: 0; }
.illus-cell.cover .illus-wrap { width: 100%; height: 100%; }
.illus-cell.cover img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
/* Modo "fillw": la foto ocupa todo el ancho de la celda, altura proporcional */
.illus-cell.fillw { padding: 0; justify-content: center; }
.illus-cell.fillw .illus-wrap { display: block; flex: none; width: 100%; }
.illus-cell.fillw img { width: 100%; height: auto; max-width: none; max-height: none; object-fit: contain; }
.blank-cell { background: #fff; }

/* Mini-galería dentro de una celda (variantes unificadas) */
.illus-cell.cell-gallery { padding: 0; }
.cell-gallery-track {
  display: flex;
  width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cell-gallery-track::-webkit-scrollbar { display: none; }
.cell-gallery-track img {
  flex: 0 0 100%;
  width: 100%;
  height: auto;
  display: block;
  scroll-snap-align: center;
}

/* Zona "por revisar": prendas sin familia al final */
.review-notice {
  grid-column: 1 / -1;
  background: rgba(214, 28, 28, 0.30);
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.18em;
  font-size: 14px;
  padding: 18px 12px;
}
.review-card { position: relative; }
.review-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(214, 28, 28, 0.30);
  pointer-events: none;
  z-index: 5;
}

/* Header: color de fondo según la sección */
.site-header { transition: background 0.3s ease; }
.site-header.header-inblue { background: #212133; }
.site-header.header-inblue .subtitle { color: #ffffff; }
.site-header.header-inblue .logo-img { filter: brightness(0) invert(1); }

.site-header.header-berry { background: #FDCDB6; }

.site-header.header-japan { background: #1f6b41; }
.site-header.header-japan .subtitle { color: #ffffff; }
.site-header.header-japan .logo-img { filter: brightness(0) invert(1); }

.site-header.header-knit { background: #000000; }
.site-header.header-knit .subtitle { color: #ffffff; }
.site-header.header-knit .logo-img { filter: brightness(0) invert(1); }

/* Sketchbook: gris claro con rayado a lápiz de grafito */
.site-header.header-sketch { background: #d9d9d9; }
.site-header.header-sketch .subtitle { color: #333333; }
.site-header.header-sketch .logo-img { filter: none; }

/* Texto superpuesto sobre la galería (en el margen blanco superior de la foto) */
.band-gallery { position: relative; }
.gallery-bar {
  position: relative;
  width: calc(100% - 32px);
  height: 3px;
  margin: 12px auto 4px;
  background: #e6e6e6;
  border-radius: 3px;
}
.gallery-bar span {
  position: absolute;
  top: 0;
  height: 100%;
  background: #999;
  border-radius: 3px;
  transition: left 0.08s linear;
}

.gallery-credit {
  width: calc(100% - 32px);
  margin: 2px auto 6px;
  text-align: left;
  font-size: 9.5px;
  font-style: italic;
  color: #888;
}

.gallery-caption {
  position: absolute;
  bottom: 3%;
  left: 0;
  right: 0;
  z-index: 3;
  pointer-events: none;
  color: #111;
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-style: italic;
  font-size: 12px;
  text-align: center;
}

/* Banda de ilustración a todo el ancho, entre familias */
.band {
  grid-column: 1 / -1;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 12px;
}
.band img {
  max-width: 100%;
  height: auto;
  display: block;
}
.band-full {
  padding: 0;
  gap: 0;
  margin-top: -1px;
  margin-bottom: -1px;
}
.band-full img { display: block; }

/* Banda galería: deslizable horizontal, ancho de pantalla */
.band-gallery { padding: 0; gap: 0; }
.band-gallery-track {
  display: flex;
  width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.band-gallery-track::-webkit-scrollbar { display: none; }
.band-gallery-track img {
  flex: 0 0 100%;
  width: 100%;
  height: auto;
  display: block;
  scroll-snap-align: center;
}

/* Instrucciones justo encima de las prendas */
.instructions-row {
  grid-column: 1 / -1;
  background: #ffffff;
  overflow: hidden;
  padding: 11px 0;
  position: sticky;
  top: var(--hh, 74px);
  z-index: 90;
  border-bottom: 1px solid var(--line);
}
.marquee-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  animation: marquesina 46s linear infinite;
}
.marquee-track span {
  color: #e23b3b;
  font-size: 11px;
  font-weight: 700;
  padding-right: 64px;
}
/* Japonés y chino: pesan más en negrita, se compensa para igualar el gris tipográfico */
.marquee-track span.cjk {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
               "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-weight: 500;
  font-size: 10.5px;
}
@keyframes marquesina {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

/* Tarjeta de prenda */
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
  padding: 12px;
}

.gallery {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #ffffff;
  touch-action: pan-y;
}

.gallery-track {
  display: flex;
  height: 100%;
  transition: transform 0.35s ease;
  will-change: transform;
}

.gallery-track img {
  min-width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Flechas y puntos: ocultos */
.nav { display: none; }
.dots { display: none; }

/* Info de la prenda */
.info {
  padding: 10px 2px 4px;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  min-height: 132px;
}
.info-codes { color: var(--ink); letter-spacing: 0.04em; }
.info-price { font-weight: 600; margin-top: 6px; }
.info-name { font-weight: 600; margin-top: 6px; }
.info-comp { color: var(--muted); text-transform: uppercase; margin-top: 2px; }
.label { color: var(--muted); }

/* Prueba FAM001: NAME encima de la foto, resto debajo en gris */
.card-textop { padding-top: 16px; }
.it-name-top {
  text-align: left;
  padding: 0 4px 10px;
  font-size: 10px;
  line-height: 1.25;
}
.info-below {
  text-align: left;
  padding: 10px 4px 4px;
  font-size: 10px;
  line-height: 1.25;
  min-height: 0;
  color: #444444;
}
.info-below .it-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.info-below .it-codes {
  letter-spacing: 0.04em;
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.info-below .it-price { flex: 0 0 auto; white-space: nowrap; }
.info-below .it-note {
  margin-top: 8px;
  font-style: italic;
  color: #666;
}
.info-below .it-comp {
  margin-top: 10px;
  text-transform: uppercase;
  white-space: normal;
  overflow-wrap: break-word;
}

.site-footer {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px 20px 48px;
}

.gallery-track img { cursor: zoom-in; }

/* Visor a pantalla completa */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
  touch-action: none;
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 0.32s ease;
}
.lightbox.visible { opacity: 1; }
.lb-track {
  display: flex;
  width: 100%;
  height: 100%;
  will-change: transform;
}
.lb-slide {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox img {
  max-width: calc(100% - 40px);
  max-height: calc(100% - 40px);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Sección final: galería rotacional 360 (Sketchbook) */
.sketch-section {
  position: relative;
  grid-column: 1 / -1;
  background: #ffffff;
  padding: 180px 0 48px;
}
.sketch-title {
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e23b3b;
}
.sketch-note {
  text-align: center;
  font-size: 11px;
  font-style: italic;
  color: #888;
  margin: 6px 0 18px;
}
.sketch-spin {
  text-align: center;
  margin: 8px 0 18px;
}
.sketch-spin svg { display: inline-block; }

/* Banda de barcos: un solo 360° + flecha encima de la ventana */
.barco-section { padding: 30px 0 40px; }
.barco-360 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  color: #e23b3b;
}
.barco-360 .sketch-spin { line-height: 0; }
/* Vestido/pantalón de barco: caben enteros sin recorte */
.barco-cell .sketch-stage { height: 460px; overflow: visible; }
.barco-cell .sketch-stage img { transform: none; }
.sketch-rail {
  display: flex;
  gap: 1px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sketch-rail::-webkit-scrollbar { display: none; }
.sketch-lead {
  flex: 0 0 6%;
}
.sketch-tail {
  flex: 0 0 6%;
}
.sketch-cell {
  flex: 0 0 88%;
  scroll-snap-align: center;
  padding: 8px 10px 12px;
  box-sizing: border-box;
}
.sketch-stage {
  position: relative;
  height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  touch-action: pan-x pan-y;
}
.rot-railbox { position: relative; }
.rot-hint {
  position: absolute;
  top: 40px;
  left: 14px;
  z-index: 6;
  height: 16px;
  padding-left: 16px;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
  color: #e23b3b;
  pointer-events: none;
}
.rot-dot {
  position: absolute;
  left: 0;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e23b3b;
}
.rot-hint-txt { display: inline; }
.sketch-stage {
  overflow: hidden;
}
.sketch-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
  object-fit: contain;
  transform: scale(1.3);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
/* Frames rotacionales apilados (giro = cambio de opacidad, sin trompicones) */
.rot-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.3);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
  object-fit: contain;
}
.barco-cell .rot-frame { transform: translate(-50%, -50%); }
.sketch-cap {
  text-align: left;
  font-size: 10px;
  line-height: 1.25;
  color: #111;
  padding: 0 4px 10px;
}
.sketch-bar {
  width: calc(100% - 32px);
  height: 3px;
  margin: 14px auto 0;
  background: #e6e6e6;
  border-radius: 3px;
  position: relative;
}
.sketch-bar span {
  position: absolute;
  top: 0;
  height: 100%;
  background: #999;
  border-radius: 3px;
}

/* Visor 360 a pantalla completa */
.sketch360 {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 0.32s ease;
}
.sketch360.visible { opacity: 1; }
.sketch360:active { cursor: grabbing; }
.sketch360-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sketch360-stage img {
  max-width: 88%;
  max-height: 82%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.sketch360-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.3);
}
.sketch360-stage { transition: opacity 0.25s ease; }
.sketch360-hint { transition: opacity 0.25s ease; }
.sketch360-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.sketch360-loader span {
  display: block;
  width: 30px;
  height: 30px;
  border: 2px solid #d8d8d8;
  border-top-color: #333;
  border-radius: 50%;
  animation: sk-spin 0.8s linear infinite;
}
@keyframes sk-spin { to { transform: rotate(360deg); } }
.sketch360-hint {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  overflow: hidden;
  pointer-events: none;
}
.sketch360-hint .marquee-track {
  display: inline-flex;
  white-space: nowrap;
  animation: marquesina 46s linear infinite;
}
.sketch360-hint .marquee-track span {
  font-size: 11px;
  font-weight: 700;
  color: #e23b3b;
  padding-right: 64px;
}
.sketch360-hint .marquee-track span.cjk {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
               "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-weight: 500;
  font-size: 10.5px;
}

/* Responsive: se mantienen 2 columnas también en móvil */
@media (max-width: 640px) {
  .info { padding: 8px 9px 2px; font-size: 11px; }
}
