/* Jayone Foods buyer catalog — brand tokens per jayone-data-lab/brand/BRAND_GUIDE.md */
:root {
  --green: #008A5E;        /* Primary — Pantone 3415 C */
  --green-d: #005C3F;
  --green-s: #E3F2EA;
  --lime: #7AC143;         /* Secondary — Pantone 368 C (accent only) */
  --lime-s: #EEF6E3;
  --ink: #111814;
  --ink-2: #4A5550;
  --ink-3: #5F6A65;
  --line: #E1E6E3;
  --line-strong: #C9D1CD;
  --bg: #F6F8F7;
  --surface: #FFFFFF;
  --warn: #7A5000;
  --warn-s: #FFF4DB;
  --info: #1F4E79;
  --info-s: #E8F0F8;
  --off: #4F5754;
  --off-s: #EEF0EF;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(17, 24, 20, .06), 0 2px 8px rgba(17, 24, 20, .05);
  --font: "acumin-pro", "Acumin Pro", "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* 🔴 author CSS (display:flex 등)가 hidden 속성을 이기면 "숨긴" 버튼이 계속 보인다(2026-09-18 검증 P0-1). */
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.modal-open { overflow: hidden; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--bg); }
img { display: block; max-width: 100%; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; gap: 20px; min-height: 72px; }
.logo { height: 33px; width: auto; }
.top-title { border-left: 1px solid var(--line); padding-left: 20px; min-width: 0; }
.top-title h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.asof { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); min-height: 1.45em; }
.top-contact { margin-left: auto; font-size: 15px; font-weight: 600; color: var(--green-d); text-decoration: none; padding: 10px 4px; white-space: nowrap; }
.top-contact:hover { text-decoration: underline; }
.copy { font: inherit; font-size: 13px; font-weight: 600; color: var(--green-d); background: none; border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 12px; margin-left: 6px; cursor: pointer; min-height: 36px; }
.copy:hover { border-color: var(--green); }
.contact-line { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
.contact-line a { color: var(--green-d); } /* 데이터 도착 전에도 자리 확보 — CLS */

/* Controls — sticky on desktop, with a visible lower edge */
/* grid 자식은 기본 min-width:auto 라 칩 줄이 폭을 밀어낸다(375 가로 넘침 75px) → minmax(0,1fr)
   고정(sticky)은 검색줄만 — 칩·필터까지 고정하면 화면의 25% 를 차지했다(검증 r2 P2). */
.controls { padding: 20px 0 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; border-bottom: 1px solid var(--line); }
.searchbar { position: sticky; top: 0; z-index: 6; background: var(--bg); padding: 16px 0 10px; border-bottom: 1px solid transparent; }
.controls { padding-top: 6px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0 14px; color: var(--ink-3); box-shadow: var(--shadow); }
.search:focus-within { outline: 3px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; color: var(--ink); min-height: 48px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px; min-height: 44px; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; min-height: 36px; padding: 0 12px; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--green); color: var(--green-d); }
/* 흰 글자를 얹는 면은 --green-d(#005C3F) — #008A5E 위 흰 글자는 4.38:1 로 AA 미달(검증 r2 P1-1, UI_GUIDE §1.5-2) */
.chip[aria-pressed="true"] { background: var(--green-d); border-color: var(--green-d); color: #fff; }
.chip-n { font-weight: 400; font-variant-numeric: tabular-nums; opacity: .85; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; min-height: 40px; width: 220px; max-width: 100%; padding: 0 32px 0 12px; appearance: none; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234A5550' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.filters select:focus-visible { outline: 3px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.filters select:disabled, .search input:disabled { opacity: .6; cursor: progress; }
.link { font: inherit; font-size: 15px; background: none; border: 0; color: var(--green-d); text-decoration: underline; cursor: pointer; padding: 8px 4px; min-height: 40px; }
.count { margin: 0; font-size: 14px; color: var(--ink-2); min-height: 1.45em; }
/* 로딩 중 짧은 페이지에서 푸터가 화면에 있다가 밀려나는 것도 흔들림이다 — 본문이 한 화면은 차지하게 */
/* 🔴 불러오는 동안은 검색·칩·목록·푸터를 그리지 않는다 — 칩 줄의 최종 높이(줄 수)는 데이터가 와야 알 수 있어서,
   미리 그려 두면 칩이 채워지며 아래를 밀어낸다(1280 CLS 0.136 실측). 처음 나타나는 요소는 '밀림'이 아니다. */
body.loading .searchbar, body.loading .controls, body.loading #grid, body.loading .more-wrap, body.loading .foot { display: none; }
body.loading.failed .foot { display: block; }
main.wrap { min-height: 100vh; } /* 로딩 중 푸터가 화면 끝에 걸려 있다가 멀리 밀려나면 CLS 가 0.98 까지 뛴다(375 실측) */

/* Grid + cards — every card is the same height, whatever the photo */
.status { margin: 40px 0; text-align: center; color: var(--ink-2); }
.status-error { color: #9B1C1C; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; padding: 16px 0 8px; }
.group-h { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; margin: 12px 0 -4px; font-size: 18px; font-weight: 700; }
.group-h:first-child { margin-top: 0; }
.group-n { font-size: 14px; font-weight: 400; color: var(--ink-3); }
.card { display: flex; flex-direction: column; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; cursor: pointer; overflow: hidden; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; min-width: 0; }
.card:hover { border-color: var(--green); box-shadow: 0 4px 16px rgba(0, 92, 63, .12); }
/* 🔴 사진 칸은 정사각형으로 고정 — 사진이 세로로 길거나 아직 안 불러와도 칸 크기가 변하지 않는다(검증 P0-2, CLS). */
.ph { position: relative; aspect-ratio: 1 / 1; width: 100%; overflow: hidden; background: #fff; border-bottom: 1px solid var(--line); }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.ph-none { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; color: var(--ink-2); background: var(--off-s); }
/* 🔴 <button> 카드 안쪽은 내용 폭에 끌려간다(375 실측: 카드 167px · 본문 190~195px → 이름이 단어 중간에서 잘림, 검증 r2 P1-2) */
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; flex: 1; width: 100%; min-width: 0; max-width: 100%; }
.brand { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--green-d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 2.6em; }
.pack { margin: 0; font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
/* 대부분이 In stock 이라 알약으로 두면 예외 상태가 묻힌다 — 정상은 글자만, 예외만 알약. */
.tone-ok { color: var(--green-d); background: transparent; padding-left: 0; }
.tone-warn { color: var(--warn); background: var(--warn-s); }
.tone-info { color: var(--info); background: var(--info-s); }
.tone-new { color: #3F6B16; background: var(--lime-s); }
.tone-off { color: var(--off); background: var(--off-s); }
.storage { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.more-wrap { display: flex; justify-content: center; padding: 16px 0 40px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 18px; border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--green-d); color: #fff; border: 1px solid var(--green-d); }
.btn.primary:hover { background: #00442F; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.btn.secondary:hover { border-color: var(--green); color: var(--green-d); }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid transparent; }
.btn.ghost:hover { color: var(--green-d); }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--off-s); color: var(--ink); }

/* Detail dialog */
dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 20px 60px rgba(17, 24, 20, .3); color: var(--ink); overscroll-behavior: contain; }
dialog::backdrop { background: rgba(17, 24, 20, .45); }
.d-head { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 6px; background: var(--surface); z-index: 1; }
.d-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; padding: 0 28px 28px; }
.d-photo .ph { border: 1px solid var(--line); border-radius: var(--radius); }
.d-photo .ph img { padding: 20px; }
.d-brand { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--green-d); }
.d-info h2 { margin: 4px 0 2px; font-size: 24px; line-height: 1.25; }
.d-item { margin: 0 0 12px; font-size: 14px; color: var(--ink-2); }
.d-item span { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
#d-avail { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.avail-help { font-size: 14px; color: var(--ink-2); }
.specs { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 18px 0; padding: 16px 0 0; border-top: 1px solid var(--line); }
.specs dt { font-size: 14px; color: var(--ink-2); }
.specs dd { margin: 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.specs dd.na { color: var(--ink-3); }
.d-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.contact-note { margin: 0; font-size: 15px; color: var(--ink-2); flex-basis: 100%; }

/* Footer */
.foot { border-top: 1px solid var(--line); background: var(--surface); padding: 20px 0 28px; }
.foot p { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); max-width: 900px; }
.foot-co { color: var(--ink-3); }

/* Phones — controls scroll away with the page so results get the screen */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top-inner { min-height: 60px; gap: 12px; }
  .logo { height: 26px; }
  .top-title { padding-left: 12px; }
  .top-title h1 { font-size: 17px; }
  /* 🔴 폰 머리글은 두 줄 — 1줄: 로고·제목·연락처 / 2줄: 기준 시각(전체 폭). 한 줄에 다 넣으면 'Contact us' 가
     기준 시각 글자를 덮었다(검증 r4 P0-1: 375 78px · 390 67px · 412 43px · 430 27px 겹침). */
  .top-inner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'logo title contact' 'asof asof asof'; column-gap: 12px; row-gap: 2px; align-items: center; padding-top: 10px; padding-bottom: 10px; } /* 좌우는 .wrap 의 16px 그대로(r5 P1-1: 'padding:10px 0' 이 덮어써 양 끝에 붙었다) */
  .logo { grid-area: logo; }
  .top-title { display: contents; }
  .top-title h1 { grid-area: title; border-left: 1px solid var(--line); padding-left: 12px; min-width: 0; }
  .asof { grid-area: asof; margin: 0; }
  .top-contact { grid-area: contact; }
  .asof { min-height: 1.45em; } /* 두 줄 격자에선 기준 시각이 전체 폭이라 한 줄(360 이하만 두 줄 — 아래) */
  .controls { padding-top: 12px; }
  .searchbar { position: static; margin: 0; padding: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
  /* iOS·macOS 는 스크롤바가 없다 — 옆에 칩이 더 있으면 가장자리를 흐리게 해 알린다 */
  .chips.more-right { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
  .chips.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 82%, transparent); mask-image: linear-gradient(to right, transparent, #000 12%, #000 82%, transparent); }
  .chips.more-left:not(.more-right) { -webkit-mask-image: linear-gradient(to right, transparent, #000 12%); mask-image: linear-gradient(to right, transparent, #000 12%); }
  .filters { display: grid; grid-template-columns: 1fr; }
  .filters label, .filters select { width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-body { padding: 10px; }
  .name { font-size: 15px; }
  .storage { display: none; }
  .pack { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; height: 2.7em; line-height: 1.35; }
  .top-contact { font-size: 14px; }
  .badge { font-size: 12px; padding: 2px 7px; }
  .d-body { grid-template-columns: 1fr; gap: 16px; padding: 0 16px 20px; }
  .d-photo .ph { max-width: 320px; margin: 0 auto; }
  .d-info h2 { font-size: 20px; }
  .specs { grid-template-columns: 1fr; gap: 2px; }
  .specs dd { margin-bottom: 8px; }
}
/* 아주 좁은 폰(iPhone SE 320) — 기준 시각 문장이 한 덩어리로 38px 넘쳤다(r3 P2-5) */
@media (max-width: 360px) {
  .nowrap { white-space: normal; }
  .asof { min-height: 2.9em; } /* 320·360 에선 기준 시각이 두 줄로 접힌다 — 자리를 미리(CLS) */
  .top-contact { display: none; }
}
