/* ================================================================
   BABY-ROCK — Design System / Common CSS
   ================================================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand Colors */
  --black:    #0A0A0A;
  --ink:      #1C1C1C;
  --ink2:     #5A5A5A;
  --ink3:     #9A9A9A;
  --white:    #FFFFFF;
  --ivory:    #FAF8F5;
  --cream:    #F2EDE6;
  --beige:    #E5DBCE;
  --dust:     #D4C8B8;
  --brown:    #6B5744;

  /* Accent */
  --red:      #C9303A;
  --red-dark: #A8242D;
  --red-light:#E85562;

  /* Functional */
  --border:   rgba(0,0,0,.10);
  --border-light: rgba(0,0,0,.06);

  /* Shadows */
  --shadow-sm: 0 2px 12px rgba(0,0,0,.08);
  --shadow-md: 0 6px 32px rgba(0,0,0,.12);
  --shadow-lg: 0 16px 56px rgba(0,0,0,.16);

  /* Typography */
  --serif: 'Cormorant Garamond', 'Georgia', serif;
  --sans:  'Noto Sans JP', 'Inter', sans-serif;

  /* Spacing */
  --gap-xs:  8px;
  --gap-sm: 16px;
  --gap-md: 32px;
  --gap-lg: 64px;
  --gap-xl: 96px;

  /* Layout */
  --max-w:    1400px;
  --header-h: 60px;
  --radius:   12px;
  --radius-sm: 6px;
  --radius-full: 999px;

  /* Animation */
  --ease:     cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(0,0,.2,1);
  --t:    .22s;
  --tm:   .40s;
  --tl:   .65s;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
ul, ol { list-style: none; }
input, select { font-family: inherit; }
svg { display: block; }

/* ---------- Typography ---------- */
.serif { font-family: var(--serif); }

h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.2; }

.section-title {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 300;
  letter-spacing: .06em;
  color: var(--black);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink3);
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap-md);
}

@media (max-width: 768px) {
  .container { padding: 0 var(--gap-sm); }
}

/* ---------- HEADER ---------- */
#siteHeader {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 900;
  background: rgba(255,255,255,0);
  transition: background var(--tm) var(--ease), box-shadow var(--tm) var(--ease);
}

#siteHeader.scrolled {
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border);
}

#siteHeader .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--gap-md);
  max-width: var(--max-w);
  margin: 0 auto;
}

/* Logo */
.site-logo {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .15em;
  color: var(--white);
  transition: color var(--t) var(--ease);
  text-transform: uppercase;
}

#siteHeader.scrolled .site-logo { color: var(--black); }

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
}

.site-nav a {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.85);
  transition: color var(--t) var(--ease);
  position: relative;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0; right: 100%;
  height: 1px;
  background: currentColor;
  transition: right var(--t) var(--ease);
}

.site-nav a:hover { color: var(--white); }
.site-nav a:hover::after { right: 0; }

#siteHeader.scrolled .site-nav a { color: var(--ink2); }
#siteHeader.scrolled .site-nav a:hover { color: var(--black); }

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.header-btn {
  position: relative;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  color: var(--white);
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}

.header-btn:hover { background: rgba(255,255,255,.12); }

#siteHeader.scrolled .header-btn { color: var(--ink); }
#siteHeader.scrolled .header-btn:hover { background: var(--cream); }

.badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  display: none;
}

.badge.show { display: flex; }

/* Nav Toggle (mobile) */
#navToggle {
  display: none;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  color: var(--white);
  border-radius: var(--radius-full);
  transition: color var(--t) var(--ease);
}

#siteHeader.scrolled #navToggle { color: var(--black); }

@media (max-width: 768px) {
  #navToggle { display: flex; }
  .site-nav { display: none; }
}

/* ---------- Nav Overlay (mobile) ---------- */
#navOverlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: var(--black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tm) var(--ease);
}

#navOverlay.open {
  opacity: 1;
  pointer-events: all;
}

#navOverlay a {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 300;
  letter-spacing: .1em;
  color: var(--white);
  transition: color var(--t) var(--ease);
}

#navOverlay a:hover { color: var(--red); }

#navClose {
  position: absolute;
  top: var(--gap-sm); right: var(--gap-sm);
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  font-size: 24px;
}

/* ---------- Search Overlay ---------- */
#searchOverlay {
  position: fixed;
  inset: 0;
  z-index: 980;
  background: rgba(10,10,10,.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tm) var(--ease);
}

#searchOverlay.open {
  opacity: 1;
  pointer-events: all;
}

.search-inner {
  width: min(640px, 90vw);
  position: relative;
}

#searchInput {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(255,255,255,.4);
  color: var(--white);
  font-family: var(--serif);
  font-size: clamp(24px, 4vw, 36px);
  padding: var(--gap-sm) 0;
  outline: none;
  transition: border-color var(--t) var(--ease);
}

#searchInput::placeholder { color: rgba(255,255,255,.3); }
#searchInput:focus { border-color: var(--white); }

#searchClose {
  position: absolute;
  top: var(--gap-sm); right: 0;
  color: rgba(255,255,255,.6);
  font-size: 20px;
  transition: color var(--t) var(--ease);
}

#searchClose:hover { color: var(--white); }

/* ---------- Cart Drawer ---------- */
#cartDrawer {
  position: fixed;
  top: 0; right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--white);
  z-index: 990;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--tm) var(--ease);
}

#cartDrawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border);
}

.drawer-header h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: .08em;
}

#cartClose {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  color: var(--ink2);
  transition: background var(--t) var(--ease);
}

#cartClose:hover { background: var(--cream); }

#cartList {
  flex: 1;
  overflow-y: auto;
  padding: var(--gap-sm) var(--gap-md);
}

.cart-item {
  display: flex;
  gap: var(--gap-sm);
  padding: var(--gap-sm) 0;
  border-bottom: 1px solid var(--border-light);
}

.cart-item-img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--cream);
  flex-shrink: 0;
}

.cart-item-info { flex: 1; }
.cart-item-name { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.cart-item-meta { font-size: 12px; color: var(--ink3); }
.cart-item-price { font-size: 13px; font-weight: 600; margin-top: 4px; }

.cart-item-remove {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink3);
  border-radius: var(--radius-full);
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
  align-self: flex-start;
}

.cart-item-remove:hover { background: #fee; color: var(--red); }

.drawer-footer {
  padding: var(--gap-md);
  border-top: 1px solid var(--border);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--gap-sm);
  font-size: 15px;
  font-weight: 600;
}

.btn-cart-checkout {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--black);
  color: var(--white);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  transition: background var(--t) var(--ease);
  margin-bottom: var(--gap-xs);
}

.btn-cart-checkout:hover { background: var(--ink2); }

.cart-empty {
  text-align: center;
  padding: var(--gap-lg) 0;
  color: var(--ink3);
}

.cart-empty svg { margin: 0 auto var(--gap-sm); opacity: .3; }

#drawerOverlay {
  position: fixed;
  inset: 0;
  z-index: 985;
  background: rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tm) var(--ease);
}

#drawerOverlay.show {
  opacity: 1;
  pointer-events: all;
}

/* ---------- Toast ---------- */
#toastContainer {
  position: fixed;
  bottom: var(--gap-md);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
  align-items: center;
}

.toast {
  background: var(--black);
  color: var(--white);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn var(--t) var(--ease-out),
             toastOut var(--t) var(--ease) 2.5s forwards;
  white-space: nowrap;
}

.toast.success { background: #1a6636; }
.toast.error   { background: var(--red); }

@keyframes toastIn  { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform: translateY(12px); } }

/* ---------- Reveal Animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--tl) var(--ease-out), transform var(--tl) var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Product Card (shared) ---------- */
.product-card {
  position: relative;
  cursor: pointer;
  background: var(--ivory);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--tm) var(--ease), transform var(--tm) var(--ease);
}

.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }

.product-card-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  background: var(--cream);
}

.product-card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--tl) var(--ease);
}

.product-card:hover .product-card-img-wrap img { transform: scale(1.06); }

.product-card-badges {
  position: absolute;
  top: var(--gap-sm); left: var(--gap-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

.badge-tag {
  display: inline-block;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
}

.badge-tag.new  { background: var(--black); }
.badge-tag.sale { background: var(--red); }
.badge-tag.gift { background: var(--brown); }

.product-card-wish {
  position: absolute;
  top: var(--gap-sm); right: var(--gap-sm);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.85);
  border-radius: var(--radius-full);
  color: var(--ink3);
  z-index: 2;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--ease);
  backdrop-filter: blur(4px);
}

.product-card-wish:hover { background: var(--white); color: var(--red); transform: scale(1.1); }
.product-card-wish.active { color: var(--red); }
.product-card-wish.active svg path { fill: var(--red); }

.product-card-body {
  padding: 12px 14px 14px;
}

.product-card-brand {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink3);
  margin-bottom: 4px;
}

.product-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  margin-bottom: 6px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-price {
  display: flex;
  align-items: center;
  gap: 6px;
}

.price-current {
  font-size: 14px;
  font-weight: 700;
  color: var(--black);
}

.price-current.sale { color: var(--red); }

.price-original {
  font-size: 12px;
  color: var(--ink3);
  text-decoration: line-through;
}

.product-card-colors {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.color-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
}

.product-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.btn-add-cart {
  flex: 1;
  padding: 9px 12px;
  background: var(--black);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  transition: background var(--t) var(--ease);
}

.btn-add-cart:hover { background: var(--ink2); }

/* ---------- Stars ---------- */
.stars {
  display: inline-flex;
  gap: 2px;
  color: #F5A623;
  font-size: 12px;
}

.star-count {
  font-size: 11px;
  color: var(--ink3);
  margin-left: 4px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dust); border-radius: 3px; }

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

.text-center { text-align: center; }
.mt-xs { margin-top: var(--gap-xs); }
.mt-sm { margin-top: var(--gap-sm); }
.mt-md { margin-top: var(--gap-md); }

/* ---------- Header My Page Button (shared) ---------- */
.header-mypage-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  width: auto !important;
  padding: 0 10px;
}

.header-mypage-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  .header-mypage-label { display: none; }
  .header-mypage-btn { width: 40px !important; padding: 0; justify-content: center; }
}

/* ---------- Language Switcher ---------- */
.lang-switcher {
  position: relative;
  z-index: 950;
}

.lang-switcher-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  white-space: nowrap;
}

.lang-switcher-toggle:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.4);
}

#siteHeader.scrolled .lang-switcher-toggle {
  color: var(--ink);
  border-color: var(--border);
  background: transparent;
}

#siteHeader.scrolled .lang-switcher-toggle:hover {
  background: var(--cream);
}

.lang-current-flag { font-size: 14px; line-height: 1; }
.lang-current-name { font-size: 11px; }

/* minimal header (checkout / complete) */
.co-header .lang-switcher-toggle {
  color: var(--ink);
  border-color: var(--border);
  background: transparent;
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 999;
}

.lang-dropdown.open { display: block; }

.lang-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink2);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}

.lang-btn:hover { background: var(--cream); color: var(--black); }
.lang-btn.active { color: var(--black); font-weight: 700; background: var(--ivory); }
.lang-btn.active::after {
  content: '✓';
  margin-left: auto;
  font-size: 12px;
  color: var(--black);
}

@media (max-width: 480px) {
  .lang-current-name { display: none; }
  .lang-switcher-toggle { padding: 6px 8px; gap: 3px; }
}

/* ---------- CSS Variable aliases (for pages using var(--ink1) etc.) ---------- */
:root {
  --ink1:    var(--black);
  --paper:   var(--white);
  --surface: var(--ivory);
  --accent:  var(--beige);
  --font-serif: var(--serif);
  --font-body:  var(--sans);
  --gap-xl: 96px;
}
