:root {
  --paper: #f4f0e7;
  --paper-deep: #e8e1d5;
  --ink: #172925;
  --forest: #163d34;
  --rust: #a84d2f;
  --gold: #b69a68;
  --line: rgba(23, 41, 37, .18);
  --white: #fffdf8;
  --muted: #68726d;
  --max: 1380px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", system-ui, sans-serif; line-height: 1.65; -webkit-font-smoothing: antialiased; }
body.dialog-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
.skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link:focus { position: fixed; z-index: 200; top: 10px; left: 10px; padding: 10px 15px; color: white; background: var(--forest); }

.catalog-header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 30px; height: 76px; padding: 0 max(24px, calc((100vw - var(--max)) / 2)); border-bottom: 1px solid var(--line); background: rgba(244,240,231,.95); backdrop-filter: blur(16px); }
.catalog-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font: 18px Georgia, serif; letter-spacing: .06em; text-decoration: none; white-space: nowrap; }
.catalog-brand img { width: 38px; height: 38px; object-fit: contain; }
.catalog-brand b { color: var(--rust); font-weight: 600; }
.catalog-nav { display: flex; align-items: center; gap: 20px; }
.catalog-nav > a { color: var(--ink); font-size: 12px; font-weight: 700; text-decoration: none; }
.catalog-languages { display: flex; gap: 3px; padding-left: 16px; border-left: 1px solid var(--line); }
.catalog-languages button { min-width: 34px; height: 32px; padding: 0 5px; border: 0; color: var(--muted); background: transparent; font: 700 10px Arial, sans-serif; cursor: pointer; }
.catalog-languages button[aria-pressed="true"] { color: white; background: var(--rust); }
.request-trigger { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 8px 0 17px; border: 0; color: white; background: var(--forest); font-size: 12px; font-weight: 700; cursor: pointer; }
.request-trigger strong { display: grid; width: 27px; height: 27px; place-items: center; color: var(--forest); border-radius: 50%; background: var(--white); font-size: 11px; }

.catalog-hero { display: grid; grid-template-columns: 1.25fr .75fr; align-items: end; gap: 80px; max-width: var(--max); margin: auto; padding: 90px 28px 75px; border-bottom: 1px solid var(--line); }
.catalog-kicker, .section-no { margin: 0 0 20px; color: var(--rust); font: 800 10px/1.3 Arial, sans-serif; letter-spacing: .2em; }
h1, h2 { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif; font-weight: 500; line-height: 1.2; letter-spacing: -.035em; }
h1 { font-size: clamp(52px, 7vw, 92px); }
h1 em { color: var(--rust); font-style: normal; }
.catalog-intro { max-width: 520px; padding-bottom: 12px; }
.catalog-intro p { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 16px; line-height: 2; }
.prototype-badge { display: inline-block; margin-top: 22px; padding: 5px 10px; color: var(--rust); border: 1px solid var(--rust); font-size: 10px; font-weight: 700; letter-spacing: .1em; }

.catalog-tools { display: grid; grid-template-columns: minmax(280px, 1.5fr) 1fr 1fr auto; gap: 16px; max-width: var(--max); margin: 0 auto; padding: 26px 28px; border-bottom: 1px solid var(--line); }
.catalog-tools label, .custom-color-row label, .color-reference, .request-options label { display: grid; gap: 5px; }
.catalog-tools label > span, .custom-color-row label > span, .color-reference > span, .request-options label > span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.catalog-tools input, .catalog-tools select, .custom-color-row input[type="text"], .color-reference input, .request-options input, .request-options select { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: rgba(255,255,255,.45); padding: 0 13px; outline: none; }
.catalog-tools input:focus, .catalog-tools select:focus, .custom-color-row input:focus, .color-reference input:focus, .request-options input:focus, .request-options select:focus { border-color: var(--rust); box-shadow: inset 0 0 0 1px var(--rust); }
.reset-button { align-self: end; height: 46px; padding: 0 18px; border: 1px solid var(--ink); color: var(--ink); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }

.catalog-results { max-width: var(--max); margin: auto; padding: 90px 28px 120px; }
.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 42px; }
.results-heading h2 { font-size: clamp(38px, 5vw, 58px); }
.results-heading > p { margin: 0; font-size: 12px; }
.results-heading > p strong { color: var(--rust); font: 500 40px/1 Georgia, serif; }
.fabric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 44px 22px; }
.fabric-card { min-width: 0; }
.fabric-card-button { display: block; width: 100%; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.fabric-card-image { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #d6d3ce; }
.fabric-card-image img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); transition: transform .45s ease, filter .3s; }
.fabric-card-button:hover img, .fabric-card-button:focus-visible img { transform: scale(1.035); filter: grayscale(.5); }
.fabric-card-image::after { content: "SIMULATE COLOR ↗"; position: absolute; right: 0; bottom: 0; padding: 8px 11px; color: white; background: var(--forest); font: 700 8px Arial, sans-serif; letter-spacing: .12em; }
.fabric-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-top: 15px; }
.fabric-card h3 { margin: 0; font: 500 24px/1.25 Georgia, serif; }
.fabric-card-code { color: var(--rust); font: 700 10px Arial, sans-serif; letter-spacing: .1em; }
.fabric-card-description { min-height: 46px; margin: 8px 0 13px; color: var(--muted); font-size: 12px; }
.fabric-card-specs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); list-style: none; }
.fabric-card-specs li { padding: 4px 7px; background: var(--paper-deep); font-size: 9px; font-weight: 700; letter-spacing: .04em; }
.empty-state { padding: 70px 20px; border-block: 1px solid var(--line); text-align: center; }

.catalog-guide { padding: 100px max(28px, calc((100vw - var(--max)) / 2)); color: var(--white); background: var(--forest); }
.catalog-guide .section-no { color: var(--gold); }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 55px; border-top: 1px solid rgba(255,255,255,.25); }
.guide-grid article { min-height: 240px; padding: 28px 35px 30px 0; border-bottom: 1px solid rgba(255,255,255,.25); }
.guide-grid article + article { padding-left: 35px; border-left: 1px solid rgba(255,255,255,.25); }
.guide-grid article > span { color: var(--gold); font: italic 21px Georgia, serif; }
.guide-grid h3 { margin: 58px 0 10px; font-family: "Yu Mincho", serif; font-size: 22px; }
.guide-grid p { margin: 0; color: #cbd5d1; font-size: 12px; }
.color-notice { max-width: 900px; margin: 36px 0 0; padding-left: 18px; border-left: 2px solid var(--gold); color: #cbd5d1; font-size: 11px; }

dialog { max-width: none; max-height: none; margin: auto; padding: 0; border: 0; color: var(--ink); background: var(--paper); box-shadow: 0 25px 90px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(8,20,17,.72); backdrop-filter: blur(7px); }
.fabric-dialog { width: min(1280px, calc(100vw - 42px)); height: min(820px, calc(100vh - 42px)); overflow: auto; }
.dialog-close { position: fixed; z-index: 5; top: max(31px, calc((100vh - min(820px, calc(100vh - 42px))) / 2 + 12px)); right: max(31px, calc((100vw - min(1280px, calc(100vw - 42px))) / 2 + 12px)); display: grid; width: 42px; height: 42px; place-items: center; border: 0; color: white; background: var(--forest); font: 300 27px/1 Arial, sans-serif; cursor: pointer; }
.fabric-dialog-grid { display: grid; grid-template-columns: 1.2fr .8fr; min-height: 100%; }
.simulator-stage { display: flex; flex-direction: column; min-width: 0; padding: 66px 34px 30px; background: #ddd7cd; }
.simulator-canvas-wrap { position: relative; display: grid; flex: 1; min-height: 420px; place-items: center; overflow: hidden; background: #ccc7bf; }
.simulator-canvas-wrap canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.canvas-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: var(--paper-deep); font-size: 12px; }
.canvas-loading.is-hidden { display: none; }
.simulator-caption { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 16px; font: 700 10px Arial, sans-serif; letter-spacing: .08em; }
.simulator-caption span:last-child { display: flex; align-items: center; gap: 7px; }
.simulator-caption i { display: inline-block; width: 13px; height: 13px; border: 1px solid rgba(0,0,0,.2); border-radius: 50%; }
.simulator-caption code { color: var(--muted); font-size: 10px; }
.fabric-config { padding: 70px 48px 45px; overflow: auto; }
.fabric-config h2, .request-dialog h2 { font-size: clamp(34px, 4vw, 52px); }
.dialog-code { margin: 6px 0 17px; color: var(--rust); font: 700 10px Arial, sans-serif; letter-spacing: .12em; }
.dialog-description { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.fabric-specs { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0; border-block: 1px solid var(--line); }
.fabric-specs div { display: grid; gap: 2px; padding: 10px 0; }
.fabric-specs div:nth-child(even) { padding-left: 18px; border-left: 1px solid var(--line); }
.fabric-specs dt { color: var(--muted); font-size: 9px; }
.fabric-specs dd { margin: 0; font-size: 11px; font-weight: 700; }
.color-fieldset { margin: 24px 0 0; padding: 0; border: 0; }
.color-fieldset legend { margin-bottom: 12px; font-size: 12px; font-weight: 800; }
.preset-colors { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.color-swatch { position: relative; aspect-ratio: 1; border: 0; background: var(--swatch); cursor: pointer; }
.color-swatch::after { content: ""; position: absolute; inset: -3px; border: 1px solid transparent; }
.color-swatch:hover::after, .color-swatch:focus-visible::after, .color-swatch.is-selected::after { border-color: var(--ink); }
.custom-color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 17px; }
.custom-color-row label:first-child { grid-template-columns: 1fr 46px; align-items: end; }
.custom-color-row label:first-child span { grid-column: 1 / -1; }
.custom-color-row input[type="color"] { grid-column: 1 / -1; width: 100%; height: 46px; padding: 3px; border: 1px solid var(--line); background: white; cursor: pointer; }
.color-reference { margin-top: 12px; }
.request-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.add-request { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; margin-top: 18px; padding: 0 18px; border: 0; color: white; background: var(--rust); font-size: 13px; font-weight: 700; cursor: pointer; }
.add-request:hover { background: var(--forest); }

.request-dialog { width: min(820px, calc(100vw - 42px)); max-height: calc(100vh - 42px); overflow: auto; }
.request-dialog-inner { padding: 70px 60px 55px; }
.request-dialog-inner > p:not(.section-no):not(.request-note) { color: var(--muted); font-size: 13px; }
.request-items { margin-top: 30px; border-top: 1px solid var(--line); }
.request-item { display: grid; grid-template-columns: 92px 1fr auto; gap: 16px; align-items: center; padding: 17px 0; border-bottom: 1px solid var(--line); }
.request-item-thumb { position: relative; width: 92px; height: 68px; overflow: hidden; background: var(--item-color); }
.request-item-thumb img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); mix-blend-mode: multiply; opacity: .78; }
.request-item h3 { margin: 0; font: 500 18px Georgia, serif; }
.request-item p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.remove-item { width: 32px; height: 32px; border: 1px solid var(--line); color: var(--muted); background: transparent; cursor: pointer; }
.request-empty { padding: 35px 0; border-bottom: 1px solid var(--line); }
.request-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 28px; }
.request-actions button, .request-actions a { display: flex; align-items: center; justify-content: center; min-height: 50px; border: 1px solid var(--forest); font-size: 12px; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; }
.copy-request { color: var(--forest); background: transparent; }
.send-request { color: white; background: var(--forest); }
.request-actions [disabled], .request-actions [aria-disabled="true"] { opacity: .4; pointer-events: none; }
.request-note { margin: 15px 0 0; color: var(--muted); font-size: 10px; }

.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 360px; padding: 14px 18px; color: white; background: var(--forest); box-shadow: 0 12px 35px rgba(0,0,0,.25); font-size: 12px; font-weight: 700; opacity: 0; transform: translateY(15px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.catalog-footer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 28px max(28px, calc((100vw - var(--max)) / 2)); background: var(--paper-deep); font-size: 10px; }
.catalog-footer span:nth-child(2) { text-align: center; }
.catalog-footer span:last-child { text-align: right; }

@media (max-width: 1000px) {
  .catalog-hero { grid-template-columns: 1fr; gap: 35px; }
  .catalog-tools { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .fabric-grid { grid-template-columns: repeat(2, 1fr); }
  .fabric-dialog { height: calc(100vh - 30px); }
  .fabric-dialog-grid { grid-template-columns: 1fr; }
  .simulator-stage { min-height: 570px; }
  .fabric-config { overflow: visible; }
}

@media (max-width: 680px) {
  .catalog-header { height: 68px; padding-inline: 16px; }
  .catalog-brand { font-size: 13px; }
  .catalog-brand img { width: 32px; height: 32px; }
  .catalog-nav > a { display: none; }
  .catalog-nav { gap: 9px; }
  .catalog-languages { padding-left: 0; border-left: 0; }
  .catalog-languages button { min-width: 29px; height: 29px; font-size: 9px; }
  .request-trigger { min-height: 38px; padding-left: 11px; }
  .request-trigger > span { display: none; }
  .catalog-hero { padding: 64px 20px 52px; }
  h1 { font-size: clamp(45px, 15vw, 64px); }
  .catalog-tools { grid-template-columns: 1fr; padding: 22px 20px; }
  .search-field { grid-column: auto; }
  .catalog-results { padding: 70px 20px 90px; }
  .fabric-grid { grid-template-columns: 1fr; }
  .fabric-card-description { min-height: 0; }
  .guide-grid { grid-template-columns: 1fr; }
  .guide-grid article, .guide-grid article + article { min-height: auto; padding: 25px 0 30px; border-left: 0; }
  .guide-grid h3 { margin-top: 25px; }
  .fabric-dialog, .request-dialog { width: 100%; height: 100%; max-height: none; }
  .dialog-close { top: 10px; right: 10px; }
  .simulator-stage { min-height: 440px; padding: 62px 18px 22px; }
  .simulator-canvas-wrap { min-height: 300px; }
  .fabric-config { padding: 45px 22px 35px; }
  .preset-colors { grid-template-columns: repeat(7, 1fr); }
  .request-options, .custom-color-row { grid-template-columns: 1fr; }
  .request-dialog-inner { padding: 65px 22px 40px; }
  .request-item { grid-template-columns: 72px 1fr auto; }
  .request-item-thumb { width: 72px; height: 58px; }
  .request-actions { grid-template-columns: 1fr; }
  .catalog-footer { grid-template-columns: 1fr; text-align: center; }
  .catalog-footer span:nth-child(2), .catalog-footer span:last-child { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
