/*
Theme Name: tuff
Theme URI: https://tuff.kr
Author: tuff
Description: Cargo-mirroring custom block theme for tuff.kr.
Version: 0.2.0
Requires at least: 6.5
Tested up to: 6.9
Requires PHP: 8.0
License: Proprietary
Text Domain: tuff
*/

html { color-scheme: light; }
body {
  background: #fff;
  color: #000;
  overflow-x: hidden;
}

/* 이미지는 어디서든 부모 폭을 절대 넘지 않는다 (Cargo 본문 raw <img> 대응) */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── header / logo / nav ──────────────────────────────────────── */

.tuff-header {
  padding: 40px 24px 24px;
  text-align: center;
}
/* WP site-logo 블록은 .wp-block-site-logo img 로 렌더됨. 우리가 직접 폭 제어 */
.tuff-header .tuff-logo-wrap,
.tuff-header .wp-block-site-logo { display: block; margin: 0 auto; }
.tuff-header .wp-block-site-logo img,
.tuff-header .custom-logo {
  display: block;
  margin: 0 auto;
  max-width: min(600px, 60vw);
  width: 100%;
  height: auto;
}
.tuff-header.is-small .wp-block-site-logo img,
.tuff-header.is-small .custom-logo {
  max-width: 120px;
}
/* nav — Cargo 원본의 marquee 동작. h1 사이즈(32.4px) + hover 시 brand green.
   .tuff-nav 가 overflow hidden, 안쪽 track 이 같은 링크 두 세트로 채워져
   CSS animation 으로 -50% 이동 (한 세트만큼) → 끝없이 흐르는 효과.

   원본 tuff.kr 는 약 709px 폭 영역 안에서 마퀴를 돌렸다. 우리도 폭을
   한 세트(~314px) 보다 살짝 넓게 잡고 mask-image 로 좌우 페이드해서
   두 세트가 동시에 들이대지 못하게 막는다. */
.tuff-nav {
  margin: 16px auto 0;
  overflow: hidden;
  /* 4개 메뉴(<work> <write> <collect> <shop>) 가 한 세트로 보이도록 폭 확보.
     원본 tuff.kr 의 709px 와 유사. */
  width: min(720px, 92vw);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}
.tuff-nav-track {
  display: inline-flex;
  white-space: nowrap;
  /* JS (assets/nav.js) 가 transform 직접 제어하므로 CSS animation 은 폴백용.
     JS 가 로드되면 즉시 animation: none 으로 덮어쓰고 RAF 로 부드럽게 진행.
     -50% wrap 이 seamless 하려면 track 폭 = 정확히 2 × 한 세트.
     gap 대신 각 a 에 margin-right 24px 을 균등히 줘서 6개 모두 같은 단위가 되도록. */
  animation: tuff-nav-marquee 22s linear infinite;
  will-change: transform;
  transition: none;
}
.tuff-nav a {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 32.4px;
  font-weight: 400;
  line-height: 1.3;
  color: rgba(0, 0, 0, 0.75);
  text-decoration: none;
  transition: color 120ms ease-out;
  white-space: nowrap;
  flex-shrink: 0;
  /* 원본 tuff.kr 의 메뉴 간 간격은 13px 안팎. 4개 메뉴 모두 한 화면에 맞추기 위해 좁힘. */
  margin-right: 12px;
}
.tuff-nav a:hover { color: #0fce83; }

@keyframes tuff-nav-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.tuff-nav:hover .tuff-nav-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .tuff-nav-track { animation: none; }
}

/* ── home: inline running text dump ───────────────────────────── */

/* home dump — 원본 tuff.kr computed style 매칭.
   Monument Mono Variable bold (700) / 16.848px / line-height 20.2px / center.
   부모 폭 ~705px, 색 0.4. */
.tuff-home-dump {
  max-width: 705px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 16.848px;
  font-weight: 700;
  line-height: 20.2176px;
  text-align: center;
  word-spacing: 0;
  letter-spacing: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  color: rgba(0, 0, 0, 0.4);
}
.tuff-home-dump a {
  color: inherit;
  text-decoration: none;
}
.tuff-home-dump a:hover { color: rgba(0, 0, 0, 0.75); }
.tuff-home-dump .sep { color: rgba(0, 0, 0, 0.4); }

/* ── archive: centered title + date stack ─────────────────────── */

.tuff-archive {
  padding: 40px 24px 80px;
  text-align: center;
}
.tuff-archive .tuff-archive-label {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  margin: 0 0 64px;
  text-align: left;
  padding-left: 24px;
}
.tuff-archive-row {
  margin: 0 auto 48px;
  max-width: 720px;
}
.tuff-archive-row .tuff-row-title {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0;
  color: rgba(0,0,0,0.75);
}
.tuff-archive-row .tuff-row-title a {
  color: inherit;
  text-decoration: none;
}
.tuff-archive-row .tuff-row-title a:hover { text-decoration: underline; }
.tuff-archive-row .tuff-row-date {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 11px;
  color: #a0a0a0;
  margin-top: 6px;
}

/* ── single ───────────────────────────────────────────────────── */

.tuff-single {
  padding: 40px 24px 32px;
  text-align: center;
}
/* YouTube/Vimeo iframe — 본문 폭에 맞추되 16:9 비율 유지. inline 으로 들어와도 block 강제. */
.tuff-single .tuff-single-body iframe.tuff-embed {
  display: block;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  height: auto;
  margin: 32px auto;
  border: 0;
}
.tuff-single .tuff-single-title {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 20px;
  font-weight: 400;
  margin: 0 0 6px;
}
.tuff-single .tuff-single-date {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 11px;
  color: #a0a0a0;
  margin: 0 0 40px;
}
/* Single body container — 원본 tuff.kr 의 computed style 매칭.
   Diatype Variable 은 paid 라 Pretendard 로 대체 (sans, variable weight). */
.tuff-single .tuff-single-body {
  box-sizing: border-box;
  margin: 0 auto;
  max-width: 720px;
  font-family: var(--wp--preset--font-family--sans);
  font-size: 14.3px;
  font-weight: 500;
  line-height: 20px;
  text-align: center;
  color: rgba(0, 0, 0, 0.75);
  /* 한글은 어절(공백) 단위로만 끊기게. break-word 는 글자 단위 끊김 유발해 의도 깨짐 */
  word-break: keep-all;
  overflow-wrap: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* 텍스트 단락 폭을 넓게 (540px) — 작성자가 의도한 줄바꿈 위치 보존 */
.tuff-single .tuff-single-body p {
  max-width: 540px;
  margin: 0 auto;
}
.tuff-single .tuff-single-body p + p { margin-top: 20px; }
.tuff-single .tuff-single-body p:has(> img) {
  max-width: 100%;
  margin: 0;
}
.tuff-single .tuff-single-body img {
  margin: 32px auto;
  max-width: 100%;
}

/* ── lightbox overlay (FLIP transition) ───────────────────────── */

.tuff-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
  cursor: zoom-out;
  will-change: background-color;
}
.tuff-lightbox-img {
  /* backdrop 클릭 영역 확보 위해 80vw / 80vh 로 제한 — 좌우/상하 여백 충분히 */
  max-width: min(80vw, 1100px);
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  cursor: default;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .tuff-lightbox-img { transition: none !important; transform: none !important; }
  .tuff-lightbox { background: rgba(255,255,255,0.96) !important; transition: none !important; }
}

/* ── shop (WooCommerce, yeezy 톤 — 흑백 + mono + 한 컬럼 + 장식 0) ─── */

/* shop 계열 페이지에서는 로고 작게 + 옆에 <shop> 라벨. 마퀴 nav 도 숨김 (별도 셀렉터). */
.woocommerce .tuff-header,
.woocommerce-page .tuff-header,
.single-product .tuff-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  text-align: left;
}
.woocommerce .tuff-header .wp-block-site-logo img,
.woocommerce .tuff-header .custom-logo,
.woocommerce-page .tuff-header .wp-block-site-logo img,
.woocommerce-page .tuff-header .custom-logo,
.single-product .tuff-header .wp-block-site-logo img,
.single-product .tuff-header .custom-logo {
  max-width: 80px !important;
  margin: 0 !important;
}
.woocommerce .tuff-header::after,
.woocommerce-page .tuff-header::after,
.single-product .tuff-header::after {
  content: "<shop>";
  font-family: var(--wp--preset--font-family--sans);
  font-size: 24px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.75);
  line-height: 1;
}
.woocommerce .tuff-nav,
.woocommerce-page .tuff-nav,
.single-product .tuff-nav { display: none; }

.tuff-shop {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* WC 가 자동 출력하는 군더더기 전부 숨김 — remove_action 이 block 기반 WC10
   에선 안 먹어서 CSS 로 강제 */
.tuff-shop .woocommerce-breadcrumb,
.tuff-shop nav.woocommerce-breadcrumb,
.tuff-shop .woocommerce-result-count,
.tuff-shop .woocommerce-ordering,
.tuff-shop .woocommerce-products-header,
.tuff-shop .page-title,
.tuff-shop .wc-block-components-breadcrumbs,
.tuff-shop .product_meta,
.tuff-shop .woocommerce-tabs,
.tuff-shop .product-categories,
.tuff-shop .posted_in,
.tuff-shop .related.products,
.tuff-shop .up-sells.products,
.tuff-shop .cross-sells {
  display: none !important;
}

/* product list — yeezy 스타일 큰 썸네일 그리드. 정보 최소 (제목/가격만 하단에). */
.tuff-shop ul.products,
.tuff-shop .wc-block-grid__products,
.tuff-shop .wp-block-woocommerce-product-collection {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 32px;
}
.tuff-shop ul.products li.product {
  width: 100% !important;
  float: none !important;
  clear: none !important;
  margin: 0;
  padding: 0;
  border: 0;
  display: block;
  cursor: zoom-in;
}
.tuff-shop ul.products li.product .attachment-woocommerce_thumbnail,
.tuff-shop ul.products li.product img {
  margin: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #f4f4f4;
}
.tuff-shop ul.products li.product .woocommerce-loop-product__title {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  font-weight: 500;
  color: rgba(0,0,0,0.85);
  text-transform: none;
  padding: 0;
  margin: 12px 0 4px;
  line-height: 1.4;
}
.tuff-shop ul.products li.product .price {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  font-weight: 600;
  color: rgba(0,0,0,0.6);
  display: block;
}
.tuff-shop ul.products li.product .price del { opacity: 0.4; margin-right: 8px; }
.tuff-shop ul.products li.product .button,
.tuff-shop ul.products li.product a.button,
.tuff-shop ul.products li.product .added_to_cart,
.tuff-shop ul.products li.product .add_to_cart_button {
  display: none !important;
}
.tuff-shop ul.products li.product > a.woocommerce-LoopProduct-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
.tuff-shop ul.products li.product:hover img { opacity: 0.85; transition: opacity 120ms; }

@media (max-width: 900px) {
  .tuff-shop ul.products { grid-template-columns: repeat(2, 1fr); gap: 24px 16px; }
}
@media (max-width: 480px) {
  .tuff-shop ul.products { grid-template-columns: 1fr; }
}

/* product lightbox modal — 클릭 시 상품 상세 inline 으로. 페이지 이동 없음. */
.tuff-product-modal {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.96);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
  cursor: zoom-out;
  animation: tuff-fade-in 180ms ease-out;
}
@keyframes tuff-fade-in { from { opacity: 0 } to { opacity: 1 } }
.tuff-product-modal__inner {
  cursor: default;
  background: #fff;
  max-width: 1000px;
  width: 100%;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: start;
}
.tuff-product-modal__close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 24px;
  color: rgba(0,0,0,0.6);
  line-height: 1;
  z-index: 10000;
}
.tuff-product-modal__close:hover { color: #000; }
.tuff-product-modal__gallery img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 0 12px;
}
.tuff-product-modal__info {
  font-family: var(--wp--preset--font-family--mono);
  color: rgba(0,0,0,0.85);
}
.tuff-product-modal__title {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 8px;
  color: rgba(0,0,0,0.9);
}
.tuff-product-modal__price {
  font-size: 16px;
  font-weight: 600;
  color: rgba(0,0,0,0.75);
  margin: 0 0 20px;
}
.tuff-product-modal__description {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(0,0,0,0.65);
  margin: 0 0 24px;
  word-break: keep-all;
}
.tuff-product-modal__form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 16px;
}
.tuff-product-modal__qty {
  width: 56px;
  padding: 10px 8px;
  border: 1px solid rgba(0,0,0,0.4);
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  text-align: center;
}
.tuff-product-modal__add {
  background: #000;
  color: #fff;
  border: 0;
  padding: 12px 24px;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 120ms;
  flex: 1;
}
.tuff-product-modal__add:hover { background: #0fce83; color: #000; }
.tuff-product-modal__add[disabled] { opacity: 0.5; cursor: wait; }
.tuff-product-modal__status {
  font-size: 12px;
  color: #0fce83;
  margin: 8px 0 0;
  min-height: 16px;
}
.tuff-product-modal__loading {
  text-align: center;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  color: rgba(0,0,0,0.5);
  padding: 80px 0;
}

@media (max-width: 800px) {
  .tuff-product-modal { padding: 16px; }
  .tuff-product-modal__inner { grid-template-columns: 1fr; gap: 24px; }
  .tuff-product-modal__close { top: 12px; right: 12px; }
}

/* single product page */
.tuff-shop.single-product .product {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}
.tuff-shop.single-product .woocommerce-product-gallery {
  width: 100% !important;
  float: none !important;
  margin: 0;
}
.tuff-shop.single-product .woocommerce-product-gallery img {
  width: 100%;
  height: auto;
  margin: 0;
}
.tuff-shop.single-product .summary {
  width: 100% !important;
  float: none !important;
  margin: 0;
}
.tuff-shop.single-product .product_title {
  font-family: var(--wp--preset--font-family--sans);
  font-size: 28px;
  font-weight: 500;
  color: rgba(0,0,0,0.85);
  margin: 0 0 8px;
}
.tuff-shop.single-product .price {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 18px;
  font-weight: 600;
  color: rgba(0,0,0,0.75);
  margin: 0 0 24px;
}
.tuff-shop.single-product .woocommerce-product-details__short-description {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 14px;
  line-height: 20px;
  color: rgba(0,0,0,0.7);
  margin: 0 0 32px;
}
.tuff-shop.single-product form.cart {
  margin: 0 0 32px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.tuff-shop.single-product input[type="number"].qty {
  width: 56px;
  padding: 10px 8px;
  border: 1px solid rgba(0,0,0,0.4);
  font-family: var(--wp--preset--font-family--mono);
  font-size: 14px;
  text-align: center;
}
.tuff-shop button,
.tuff-shop .button,
.tuff-shop input[type="submit"] {
  background: #000;
  color: #fff;
  border: 0;
  padding: 12px 20px;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 120ms;
}
.tuff-shop button:hover,
.tuff-shop .button:hover,
.tuff-shop input[type="submit"]:hover { background: #0fce83; color: #000; }
.tuff-shop .product_meta,
.tuff-shop .woocommerce-tabs { display: none; } /* 잡다한 메타/탭 숨김 */

/* cart / checkout — 단일 컬럼, 잡다한 UI 제거 */
.tuff-shop table.shop_table { width: 100%; border-collapse: collapse; }
.tuff-shop table.shop_table th,
.tuff-shop table.shop_table td {
  padding: 16px 8px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  text-align: left;
}
.tuff-shop .cart_totals,
.tuff-shop .checkout {
  font-family: var(--wp--preset--font-family--mono);
}
.tuff-shop .woocommerce-message,
.tuff-shop .woocommerce-info {
  background: transparent;
  border-left: 2px solid #0fce83;
  padding: 12px 16px;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 13px;
  color: rgba(0,0,0,0.75);
}

@media (max-width: 800px) {
  .tuff-shop.single-product .product { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 600px) {
  .tuff-shop { padding: 24px 16px 64px; }
  .tuff-shop ul.products li.product {
    grid-template-columns: 72px 1fr;
    gap: 16px;
  }
  .tuff-shop ul.products li.product .price {
    grid-column: 2;
  }
  .tuff-shop ul.products li.product .attachment-woocommerce_thumbnail,
  .tuff-shop ul.products li.product img { width: 72px; height: 72px; }
}

/* ── footer (minimal — original tuff.kr has almost none) ─────── */

.tuff-footer {
  padding: 32px 24px 32px;
  text-align: center;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 11px;
  color: #a0a0a0;
}
.tuff-footer a { color: inherit; }

/* ── mobile polish ────────────────────────────────────────────── */

@media (max-width: 600px) {
  /* ── header ── 로고 크게 두면 시각적 점유 과다. 48vw 로 조여 첫 화면에 콘텐츠 진입 */
  .tuff-header { padding: 28px 18px 12px; }
  .tuff-header .wp-block-site-logo img,
  .tuff-header .custom-logo { max-width: 48vw; }
  .tuff-header.is-small .wp-block-site-logo img,
  .tuff-header.is-small .custom-logo { max-width: 88px; }
  /* 모바일 마퀴 — 폭은 화면의 78% 로 좁혀 한 세트만 보이게.
     속도는 살짝 빠르게(16s), 폰트는 22px 까지만 (가독성/리듬) */
  .tuff-nav { margin: 12px auto 0; width: min(360px, 92vw); }
  .tuff-nav-track { animation-duration: 16s; }
  .tuff-nav a { font-size: 22px; line-height: 1.25; margin-right: 10px; }

  /* ── home dump ── 데스크탑과 동일 톤 유지, 폭만 viewport 에 맞춤 */
  .tuff-home-dump {
    max-width: 100%;
    padding: 28px 18px 72px;
    font-size: 15px;
    line-height: 1.4;
  }

  /* ── archive ── 행 간격 조이고 제목 폭 키워 리듬 회복 */
  .tuff-archive { padding: 20px 18px 72px; }
  .tuff-archive .tuff-archive-label {
    padding-left: 0;
    margin: 8px 0 40px;
    font-size: 12px;
    text-align: left;
  }
  .tuff-archive-row { margin: 0 auto 28px; max-width: 100%; }
  .tuff-archive-row .tuff-row-title {
    font-size: 18px;
    font-weight: 450;
    line-height: 1.3;
  }
  .tuff-archive-row .tuff-row-date {
    font-size: 10.5px;
    margin-top: 4px;
    color: rgba(0,0,0,0.45);
  }

  /* ── single ── 한국어 본문 좌측 정렬 + 폰트 살짝 키워 가독성 확보.
     단락 간격은 line-height 기반이 아닌 margin 으로 명확히 분리 */
  .tuff-single { padding: 20px 20px 72px; }
  .tuff-single .tuff-single-title {
    font-size: 19px;
    font-weight: 500;
    margin: 0 0 4px;
  }
  .tuff-single .tuff-single-date { margin: 0 0 32px; font-size: 10.5px; }
  .tuff-single .tuff-single-body {
    max-width: 100%;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.7;
    text-align: left;
    color: rgba(0,0,0,0.82);
    word-break: keep-all;
    overflow-wrap: normal;
  }
  .tuff-single .tuff-single-body p {
    max-width: 100%;
    margin: 0;
  }
  .tuff-single .tuff-single-body p + p { margin-top: 20px; }
  /* 이미지 단락은 좌우 풀폭, 위아래 여백 넉넉히 — 인쇄물 photo plate 톤 */
  .tuff-single .tuff-single-body p:has(> img) {
    margin: 24px -20px;
  }
  .tuff-single .tuff-single-body img { margin: 0 auto; }
}
