* {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #6f6f6f;
  --line: rgba(17, 17, 17, 0.14);
  --line-strong: rgba(17, 17, 17, 0.3);
  --pad: 14px;
  --font: Arial, Helvetica, sans-serif;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-size: 12px;
  line-height: 1.45;
  overflow-y: scroll;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  appearance: none;
  border-radius: 0;
}

p,
h1,
h2 {
  margin: 0;
}

em {
  font-style: normal;
}

.site {
  width: 100%;
  min-height: 100vh;
  background: transparent;
}

.main {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  background: transparent;
}

/* =========================
   SHARED HEADER
========================= */

.home-header {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 18px 18px 0;
  background: transparent;
}

.home-logo-link {
  display: inline-block;
  width: 165px;
  flex-shrink: 0;
}

.home-logo {
  display: block;
  width: 100%;
  height: auto;
}

.home-cart {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 130;

  border: 1.4px solid #111111;
  background: #ffffff;
  border-radius: 999px;
  padding: 7px 20px 8px;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  font-family: "Times New Roman", Times, serif;
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #111111;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  font-size: 11px;
  line-height: 1;
  font-family: Arial, Helvetica, sans-serif;
}

.cart-badge:empty {
  display: none;
}

.cart-panel {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 120;
  width: min(420px, calc(100vw - 36px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.cart-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.cart-panel-inner {
  border: 1px solid rgba(17, 17, 17, 0.35);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 12px 14px 14px;
}

.cart-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.cart-panel-title {
  font-family: "Instrument Serif", serif;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.cart-close {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  font-family: Arial, Helvetica, sans-serif;
}

.cart-panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-empty {
  font-family: "Instrument Serif", serif;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding-top: 10px;
  border-top: 1px solid rgba(17, 17, 17, 0.14);
}

.cart-item:first-child {
  border-top: none;
  padding-top: 0;
}

.cart-item-name,
.cart-item-meta,
.cart-item-qty {
  font-family: "Instrument Serif", serif;
  letter-spacing: -0.02em;
}

.cart-item-name {
  font-size: 24px;
  line-height: 1.02;
}

.cart-item-meta {
  grid-column: 1 / 2;
  font-size: 18px;
  line-height: 1.05;
}

.cart-item-qty {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: start;
  font-size: 20px;
  line-height: 1;
}

/* 旧ヘッダーは使わない */
.topbar {
  display: none;
}

/* =========================
   HOME PAGE ONLY
========================= */

.home-page {
  position: relative;
  min-height: 100vh;
  padding: 0 18px 36px;
  background: transparent;
  font-family: "Instrument Serif", serif;
}

.home-intro {
  margin-top: 14px;
  max-width: 980px;
}

.home-brand {
  display: inline-block;
  background: #000000;
  color: #ffffff;
  padding: 2px 10px 5px;
  font-size: 34px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.home-description {
  margin-top: 10px;
  max-width: 1120px;
  font-size: 39px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.home-email {
  display: inline-block;
  margin-top: 4px;
  font-size: 35px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.home-links {
  margin-top: 130px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  justify-items: center;
  column-gap: 40px;
  min-height: 360px;
}

.home-illustration-link {
  display: block;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.home-illustration-link:hover {
  transform: translateY(-4px);
  opacity: 0.82;
}

.home-illustration-link--left {
  width: 220px;
  justify-self: center;
  align-self: end;
}

.home-illustration-link--center {
  width: 220px;
  justify-self: center;
  align-self: start;
}

.home-illustration-link--right {
  width: 420px;
  justify-self: center;
  align-self: end;
}

.home-illustration {
  display: block;
  width: 100%;
  height: auto;
}

.home-about {
  margin-top: 90px;
  max-width: 760px;
}

.home-about-text {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* =========================
   COMMON
========================= */

.section {
  scroll-margin-top: 76px;
}

.section-label {
  padding: 10px var(--pad);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
}

/* =========================
   PRODUCT DETAIL ONLY
========================= */

.detail-main {
  max-width: none;
  background: transparent;
  padding: 0 18px 36px;
}

.product-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-family: "Instrument Serif", serif;
}

.product-detail .section-label {
  display: none;
  width: 100%;
  align-self: stretch;
}

/* -------------------------
   1. viewer
------------------------- */

.viewer-column {
  order: 1;
  width: 100%;
  max-width: 900px;
  margin: -110px auto 0;
}

.viewer,
.image-viewer,
.gallery-item {
  border: 3px solid rgba(0, 0, 0, 0.8);
  background: #fff;
}

.viewer,
.image-viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #ffffff;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.image-viewer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#debug {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 5;
  font-size: 10px;
  color: rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

/* -------------------------
   2. gallery
------------------------- */

.product-gallery {
  order: 2;
  width: 100%;
  max-width: 900px;
  margin: 18px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* -------------------------
   3. information
------------------------- */

.product-info {
  order: 3;
  width: 100%;
  margin-top: 72px;
  padding: 0 18px;
  align-self: stretch;
  font-family: "Instrument Serif", serif;
}

.product-info > * {
  max-width: 1120px;
  margin-left: 0;
  margin-right: 0;
}

.product-title {
  display: inline-block;
  margin: 0 0 18px;
  padding: 2px 10px 5px;
  background: #000000;
  color: #ffffff;
  font-size: 39px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.03em;
  font-family: "Instrument Serif", serif;
}

.info-line {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  padding: 4px 0;
  align-items: start;
}

.info-line + .info-line {
  margin-top: 0;
}

.info-line--stack {
  align-items: start;
}

.label,
.value,
.paragraph,
#qtyValue,
#qtyValueTee,
.add-cart,
.back-link,
.info-select {
  font-size: 39px;
  line-height: 1.02;
  font-weight: 400;
  letter-spacing: -0.03em;
  font-family: "Instrument Serif", serif;
}

.label {
  color: #111111;
}

.value {
  color: #111111;
}

.paragraph {
  max-width: 1120px;
  color: #111111;
}

.info-select {
  min-width: 160px;
  padding: 2px 8px;
  border: 1px solid rgba(17, 17, 17, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: #111111;
}

.qty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #bfbfbf;
  background: #ffffff;
  padding: 0;
  line-height: 1;
  font-size: 22px;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
}

.purchase {
  padding: 10px 0 0;
}

.add-cart {
  width: auto;
  min-width: 180px;
  border: 1px solid #cfcfcf;
  background: #efefef;
  padding: 6px 12px;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.back-link-wrap {
  padding-top: 10px;
}

.back-link {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
}

/* =========================
   TSHIRT PAGE
========================= */

.tshirt-page .image-viewer,
.tshirt-page .gallery-item {
  border: 2px solid rgba(255, 255, 255, 0.9);
}

/* =========================
   FIXED INFO + SCROLLING IMAGES
========================= */

@media (min-width: 900px) {
  .detail-main {
    position: relative;
  }

  .product-detail {
    position: relative;
    align-items: center;
    padding-bottom: 0;
  }

  .viewer-column,
  .product-gallery {
    position: relative;
    z-index: 1;
  }

  .product-info {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 70;
    width: min(1120px, calc(100vw - 36px));
    max-width: 1120px;
    margin-top: 0;
    padding: 0;
    background: transparent;
    pointer-events: auto;
  }

  .product-info > * {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}

/* =========================
   RESPONSIVE
========================= */

@media (min-width: 900px) {
  .viewer-column {
    max-width: 1000px;
    margin-top: -95px;
  }

  .product-gallery {
    max-width: 1000px;
    margin-top: 22px;
    padding-bottom: 0;
  }

  .product-title,
  .label,
  .value,
  .paragraph,
  #qtyValue,
  #qtyValueTee,
  .add-cart,
  .back-link,
  .info-select {
    font-size: 39px;
  }

  .info-line {
    grid-template-columns: 220px 1fr;
    gap: 20px;
    padding: 4px 0;
  }

  .paragraph {
    max-width: 1120px;
  }
}

@media (max-width: 899px) {
  .home-header {
    padding: 14px 14px 0;
  }

  .home-page {
    padding: 0 14px 28px;
  }

  .detail-main {
    padding: 0 14px 28px;
  }

  .home-logo-link {
    width: 110px;
  }

  .home-cart {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 130;
  
    font-size: 18px;
    padding: 6px 14px 7px;
  }

  .cart-badge {
    top: -5px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
  }

  .cart-panel {
    top: 56px;
    right: 14px;
    width: min(360px, calc(100vw - 28px));
  }

  .cart-panel-title {
    font-size: 22px;
  }

  .cart-empty {
    font-size: 18px;
  }

  .cart-item-name {
    font-size: 20px;
  }

  .cart-item-meta {
    font-size: 15px;
  }

  .cart-item-qty {
    font-size: 16px;
  }

  .home-intro {
    margin-top: 10px;
    max-width: 100%;
  }

  .home-brand {
    font-size: 24px;
    padding: 2px 8px 4px;
  }

  .home-description {
    margin-top: 8px;
    max-width: 100%;
    font-size: 19px;
    line-height: 1.15;
  }

  .home-email {
    font-size: 19px;
    line-height: 1.15;
  }

  .home-links {
    margin-top: 60px;
    min-height: auto;
    grid-template-columns: 1fr;
    row-gap: 38px;
  }

  .home-illustration-link--left,
  .home-illustration-link--center,
  .home-illustration-link--right {
    width: 180px;
    justify-self: start;
    align-self: auto;
  }

  .home-illustration-link--right {
    width: 220px;
  }

  .home-about {
    margin-top: 50px;
  }

  .home-about-text {
    font-size: 17px;
    line-height: 1.25;
  }

  .viewer-column,
  .product-gallery {
    max-width: 100%;
  }

  .viewer-column {
    margin-top: -56px;
  }

  .product-info {
    position: static;
    width: 100%;
    margin-top: 48px;
    padding: 0 2px;
    background: transparent;
  }

  .product-title {
    display: inline-block;
    margin: 0 0 14px;
    padding: 2px 8px 4px;
    background: #000000;
    color: #ffffff;
    font-size: 19px;
    line-height: 1;
    font-family: "Instrument Serif", serif;
  }

  .info-line {
    grid-template-columns: 96px 1fr;
    gap: 10px;
    padding: 3px 0;
  }

  .label,
  .value,
  .paragraph,
  #qtyValue,
  #qtyValueTee,
  .add-cart,
  .back-link,
  .info-select {
    font-size: 19px;
    line-height: 1.05;
    font-family: "Instrument Serif", serif;
  }

  .paragraph {
    max-width: 100%;
  }

  .info-select {
    min-width: 110px;
    padding: 2px 6px;
    font-size: 19px;
  }

  .add-cart {
    font-size: 19px;
  }

  .back-link {
    font-size: 19px;
  }
}
