/* Firmware Space
   The palette comes from a bare PCB: solder-mask green, white silkscreen,
   gold ENIG pads and black epoxy chip packages. */

:root {
  --mask: #0F3D2E;        /* solder mask */
  --mask-2: #0B3125;
  --mask-line: #2D5E4C;
  --silk: #EEF2EC;        /* silkscreen white, page ground */
  --paper: #FFFFFF;
  --ink: #13211B;
  --muted: #56675E;
  --line: #D4DCD3;
  --gold: #C9A24A;        /* ENIG pads */
  --gold-ink: #8A6A1F;    /* gold that passes contrast as text on light ground */
  --epoxy: #1A1F1D;
  --epoxy-text: #C7CDC8;
  --focus: #E0B85A;
  --danger: #A33B2B;

  --f-display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --f-body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* scale: 1.25 major third from 16px */
  --s-0: .8rem; --s-1: 1rem; --s-2: 1.25rem; --s-3: 1.563rem; --s-4: 1.953rem; --s-5: 2.441rem; --s-6: 3.052rem;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --r-s: 4px; --r-m: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --silk: #0C1713; --paper: #12201A; --ink: #E3EAE4; --muted: #94A69C; --line: #24382F;
    --gold-ink: #D9B562; --mask: #0F3D2E; --mask-2: #0A2E22; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --silk: #0C1713; --paper: #12201A; --ink: #E3EAE4; --muted: #94A69C; --line: #24382F;
  --gold-ink: #D9B562; color-scheme: dark;
}

:root.cjk { --f-body: 'Onest', 'Noto Sans JP', 'Noto Sans KR', system-ui, sans-serif; }
:root.cjk .h2, :root.cjk .item-title, :root.cjk .page-title, :root.cjk .panel-title {
  font-family: 'Noto Sans JP', 'Noto Sans KR', var(--f-body); font-weight: 700; letter-spacing: 0;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--silk); color: var(--ink);
  font: 400 1rem/1.6 var(--f-body); font-feature-settings: 'ss01';
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: inherit; }
img, svg { display: block; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: 8px; transform: translateY(-200%); background: var(--gold); color: #1a1406; padding: 8px 12px; z-index: 10; }
.skip:focus { transform: none; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.mono { font-family: var(--f-mono); font-size: .9em; letter-spacing: -.01em; }

/* ── header ── */
.site-header { background: var(--mask); color: var(--silk); border-bottom: 1px solid var(--mask-line); }
:root[data-theme="dark"] .site-header, .site-header { --silk: #EEF2EC; }
.header-in { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 500 1rem/1 var(--f-display); letter-spacing: -.02em; white-space: nowrap; }
.logo-mark { width: 26px; height: 26px; }
.logo-body { fill: var(--epoxy); stroke: #3b4541; }
.logo-pins { stroke: var(--gold); stroke-width: 2.2; stroke-linecap: butt; }
.logo-dot { fill: #4a5450; }
.nav { display: flex; gap: 4px; margin-right: auto; }
.nav a { text-decoration: none; padding: 6px 12px; border-radius: var(--r-s); font-size: .95rem; color: #CFE0D7; }
.nav a:hover, .nav a.is-on { color: #fff; background: var(--mask-2); }
.nav-my { text-decoration: none; color: #CFE0D7; font-size: .95rem; padding: 6px 10px; border-radius: var(--r-s); white-space: nowrap; }
.nav-my:hover, .nav-my.is-on { color: #fff; background: var(--mask-2); }
.lang { position: relative; color: #CFE0D7; }
.lang summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; border: 1px solid var(--mask-line); border-radius: var(--r-s); padding: 6px 10px; color: #EEF2EC; font-size: .92rem; white-space: nowrap; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.lang ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; list-style: none; margin: 0; padding: 6px; min-width: 168px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: 0 12px 32px -12px rgba(0,0,0,.35); }
.lang li a { display: block; padding: 8px 12px; border-radius: 5px; text-decoration: none; }
.lang li a:hover { background: color-mix(in srgb, var(--mask) 8%, var(--paper)); }
.lang li a[aria-current] { font-weight: 600; color: var(--mask); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lang li a[aria-current] { color: var(--gold); } }

/* ── hero ── */
.hero { background: var(--mask); color: #EEF2EC; padding: clamp(56px, 9vw, 104px) 0 clamp(36px, 5vw, 56px); overflow-x: clip; position: relative; z-index: 2;
  /* faint copper traces in the mask, like a PCB inner layer seen through */
  background-image:
    radial-gradient(circle at 12% 30%, rgba(255,255,255,.035) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 70%, rgba(255,255,255,.035) 0 2px, transparent 3px);
}
.hero-in { display: flex; flex-direction: column; align-items: center; text-align: center; }

/* The search box is a QFP package sitting on its footprint. */
.footprint { position: relative; width: min(760px, 100%); padding: 18px; border: 1.5px solid rgba(238,242,236,.55); border-radius: 3px; }
.footprint::before { /* pin-1 silkscreen marker */
  content: ''; position: absolute; left: -7px; top: -7px; width: 0; height: 0;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 10px solid rgba(238,242,236,.7); transform: rotate(-45deg);
}
.refdes { position: absolute; top: -26px; left: 2px; font: 600 .85rem/1 var(--f-body); color: rgba(238,242,236,.8); letter-spacing: .04em; }

.chip { --pin-w: 7px; --pin-l: 14px; }
.chip-mid { display: flex; align-items: stretch; }
.pins { display: flex; justify-content: space-evenly; }
.pins-x { padding: 0 calc(var(--pin-l) + 22px); height: var(--pin-l); }
.pins-x[data-side="top"] { align-items: flex-end; }
.pins-y { flex-direction: column; width: var(--pin-l); padding: 22px 0; }
.pins i { display: block; background: #5f5a48; border-radius: 1px; }
.pins-x i { width: var(--pin-w); height: 100%; }
.pins-y i { height: var(--pin-w); width: 100%; }
.chip.is-lit .pins i { background: linear-gradient(180deg, #E5C674, var(--gold) 55%, #A8842F); }
.pins-y i { background-image: none; }
.chip.is-lit .pins-y i { background: linear-gradient(90deg, #E5C674, var(--gold) 55%, #A8842F); }

@media (prefers-reduced-motion: no-preference) {
  .chip.is-lit:not(.is-settled) .pins i { animation: solder .5s calc(var(--i) * 22ms + 150ms) both cubic-bezier(.3,.7,.3,1); }
  @keyframes solder { from { background: #5f5a48; filter: brightness(.7); } 60% { filter: brightness(1.35); } to { filter: none; } }
}

.chip-body {
  position: relative; flex: 1; min-width: 0; background: var(--epoxy); border-radius: 6px;
  padding: 44px clamp(16px, 4vw, 40px) clamp(28px, 4vw, 40px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), inset 0 -2px 0 rgba(0,0,0,.4), 0 18px 40px -18px rgba(0,0,0,.6);
  background-image: radial-gradient(rgba(255,255,255,.025) 1px, transparent 1px); background-size: 3px 3px;
}
.pin1 { position: absolute; top: 16px; left: 16px; width: 12px; height: 12px; border-radius: 50%; background: #121614; box-shadow: inset 0 1px 2px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.05); }
.marking { position: absolute; top: 14px; right: 18px; font: 500 .72rem/1 var(--f-mono); color: #6C746F; letter-spacing: .08em; }
.etch { display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #3a423e; padding-bottom: 8px; }
.etch input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; padding: 8px 0;
  font: 500 clamp(1.1rem, 2.6vw, 1.6rem)/1.2 var(--f-mono); color: var(--epoxy-text); caret-color: var(--gold); letter-spacing: -.01em;
}
.etch input::placeholder { color: #69716C; }
@media (max-width: 520px) {
  .etch { flex-direction: column; align-items: stretch; border-bottom: 0; padding-bottom: 0; }
  .etch input { border-bottom: 1px solid #3a423e; font-size: 1.05rem; }
  .etch:focus-within input { border-bottom-color: var(--gold); }
  .chip-body { padding-top: 40px; }
  .footprint { padding: 12px; }
}
.etch input::-webkit-search-cancel-button { filter: invert(.6); }
.etch:focus-within { border-bottom-color: var(--gold); }
.etch input:focus-visible { outline: none; }

.testpoints { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 18px; margin-top: 28px; color: #B9CFC3; font-size: .95rem; }
.tp { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 2px; cursor: pointer; color: #EEF2EC; font: 500 .9rem/1 var(--f-mono); }
.tp::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--gold); background: var(--mask-2); }
.tp:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }

/* ── buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--r-s); border: 1px solid transparent; padding: 10px 18px; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-gold { background: var(--gold); color: #1d1606; }
.btn-gold:hover { background: #D8B35C; }
.btn-ink { background: var(--mask); color: #EEF2EC; }
.btn-ink:hover { background: #134C39; }
.btn-line { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-line:hover { border-color: var(--muted); }
.btn-big { padding: 14px 22px; font-size: 1.05rem; width: 100%; }

/* ── catalog ── */
.h2 { font: 500 var(--s-3)/1.2 var(--f-display); letter-spacing: -.03em; margin: 0; }
.catalog { padding-top: clamp(40px, 6vw, 72px); padding-bottom: 24px; scroll-margin-top: 16px; }
.catalog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.count { margin: 0; color: var(--muted); font-size: .95rem; }
.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); padding: 3px; overflow-x: auto; max-width: 100%; }
.seg a { padding: 7px 14px; border-radius: 5px; white-space: nowrap; color: var(--muted); font-weight: 500; display: inline-flex; gap: 8px; align-items: baseline; text-decoration: none; }
.seg a span { font: 400 .78rem/1 var(--f-mono); opacity: .8; }
.seg a[aria-current] { background: var(--mask); color: #EEF2EC; }
.seg { margin: 4px 0 18px; }

.list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 190px) 128px 58px 74px 80px; gap: 16px; align-items: center;
  padding: 14px 20px; text-decoration: none; border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
a.row:hover { background: color-mix(in srgb, var(--mask) 5%, var(--paper)); }
a.row:hover .row-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.row-head { padding-top: 10px; padding-bottom: 10px; font-size: .8rem; color: var(--muted); background: color-mix(in srgb, var(--silk) 60%, var(--paper)); }
.row-head span:nth-child(n+6), .row-size, .row-price { text-align: right; }
.row-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; background: color-mix(in srgb, var(--mask) 9%, var(--paper)); color: var(--mask); }
:root[data-theme="dark"] .row-icon { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .row-icon { color: var(--gold); } }
.row-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.row-icon .fill { fill: currentColor; stroke: none; }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-title { font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.row-sub { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-board { color: var(--ink); }
.row-format, .row-size { color: var(--muted); font-size: .9rem; }
.row-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { padding: 40px 24px; text-align: center; }

@media (max-width: 760px) {
  .nav-my { display: none; }
  .row { grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: 'i m p' 'i g g' 'i b b'; row-gap: 4px; padding: 14px 16px; }
  .row-head { display: none; }
  .row-media { grid-area: i; align-self: start; }
  .row-main { grid-area: m; }
  .row-price { grid-area: p; align-self: start; }
  .row-board { grid-area: b; font-size: .8rem; color: var(--muted); }
  .row-tags { grid-area: g; }
  .row-tags:empty { display: none; }
  .row-format, .row-size { display: none; }
  .row-title { white-space: normal; }
  .nav { display: none; }
}

/* ── footer ── */
.site-footer { margin-top: clamp(56px, 8vw, 96px); border-top: 1px solid var(--line); }
.footer-in { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding-top: 24px; padding-bottom: 32px; color: var(--muted); font-size: .9rem; }
.footer-in p { margin: 0; }
.logo-small { font-size: .85rem; color: var(--ink); margin-right: auto; }
.logo-small .logo-mark { width: 20px; height: 20px; }

/* ── item page ── */
.crumbs { padding-top: 28px; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 14px; align-items: start; }
.item-title { font: 500 clamp(1.3rem, 1rem + 1vw, 2rem)/1.15 var(--f-display); letter-spacing: -.035em; margin: 0 0 14px; text-wrap: balance; }
/* facts sit two to a row; the long ones (file name, checksum) take a whole row */
.spec { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; margin: 16px 0 0; border-top: 1px solid var(--line); }
.spec > div { padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.spec > .wide { grid-column: 1 / -1; }
.spec dt { color: var(--muted); font-size: .8rem; margin: 0 0 2px; }
.spec dd { margin: 0; overflow-wrap: anywhere; }
.spec .sha { font-size: .75rem; color: var(--muted); }

/* price, email and the ways to pay in one box; `order` keeps them in that sequence whatever the markup order */
.panel { background: var(--mask); color: #EEF2EC; border-radius: var(--r-m); padding: 16px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; align-items: center; }
.panel-price { order: 2; margin: 0; font: 500 var(--s-3)/1 var(--f-display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.panel-err { order: 5; grid-column: 1 / -1; margin: 0; padding: 10px 12px; border-radius: var(--r-s); background: rgba(163,59,43,.25); border: 1px solid rgba(230,120,100,.5); color: #FFD9D0; font-size: .9rem; }


/* ── order / link pages ── */
.flow { max-width: 640px; margin: 0 auto; padding-top: clamp(40px, 7vw, 80px); }
.flow-status { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--mask); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.panel-title { font: 500 var(--s-4)/1.15 var(--f-display); letter-spacing: -.035em; margin: 0 0 8px; }
.flow-lead { margin: 0 0 28px; color: var(--muted); font-size: 1.05rem; }
.ticket { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.ticket-top { display: flex; gap: 14px; align-items: center; padding: 20px; }
.ticket-top .row-icon { flex: none; }
.ticket-name { font-weight: 600; }
.ticket-meta { color: var(--muted); font-size: .88rem; }
.ticket-act { padding: 0 20px 20px; }
/* perforation between the file and the reusable link, like a tear-off stub */
.ticket-stub { border-top: 2px dashed var(--line); padding: 16px 20px 20px; background: color-mix(in srgb, var(--silk) 50%, var(--paper)); }
.stub-label { font-size: .85rem; color: var(--muted); display: block; margin-bottom: 6px; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-s); padding: 9px 12px; background: var(--paper); font: 400 .82rem/1.2 var(--f-mono); color: var(--ink); }
.done { padding: 20px; border-top: 1px solid var(--line); }
.done h3 { margin: 0 0 4px; font-size: var(--s-1); }
.done p { margin: 0; color: var(--muted); font-size: .92rem; }
.done code { font: .76rem/1.4 var(--f-mono); overflow-wrap: anywhere; color: var(--ink); }
.state { border-left: 3px solid var(--gold); padding: 4px 0 4px 18px; }
.state h1 { margin: 0 0 8px; }
.state p { margin: 0 0 20px; color: var(--muted); max-width: 56ch; }
.state h1 + .state-act { margin-top: 16px; }

.dev-banner { background: #3a2c09; color: #F6E3B2; text-align: center; padding: 8px; font-size: .85rem; }

/* ── autocomplete ── */
.combo { position: relative; flex: 1; min-width: 0; display: flex; }
.combo input { width: 100%; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30; list-style: none; margin: 0; padding: 6px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: 0 18px 40px -16px rgba(0,0,0,.45); text-align: left; max-height: 70vh; overflow: auto; }
.suggest-head { font-size: .78rem; color: var(--muted); padding: 8px 10px 4px; }
.suggest [role="option"] { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 5px; cursor: pointer; font: 400 .95rem/1.3 var(--f-body); }
.suggest [role="option"][aria-selected="true"], .suggest [role="option"]:hover { background: color-mix(in srgb, var(--mask) 9%, var(--paper)); }
.suggest svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.suggest-term span { font-family: var(--f-mono); font-size: .9rem; }
.sf-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.etch .combo input { flex: 1; }

/* ── generic page parts ── */
.page { padding-top: 8px; }
.page-narrow { max-width: 760px; }
.page-title { font: 500 clamp(1.6rem, 3.4vw, var(--s-5))/1.15 var(--f-display); letter-spacing: -.035em; margin: 8px 0 10px; text-wrap: balance; }
.page-title-s { font-size: clamp(1.3rem, 2.6vw, var(--s-4)); margin-top: 28px; }
.h3 { font: 600 var(--s-2)/1.3 var(--f-body); margin: 0 0 8px; }
.notice { background: color-mix(in srgb, var(--gold) 16%, var(--paper)); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line)); border-radius: var(--r-s); padding: 10px 14px; margin: 0 0 16px; }
.notice a { font-weight: 600; }
.count { margin: 0 0 12px; color: var(--muted); font-size: .95rem; }
.tag { font-style: normal; font-size: .75rem; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 22%, var(--paper)); color: var(--gold-ink); margin-left: 6px; }

.searchbar { display: flex; gap: 8px; margin: 20px 0 18px; max-width: 640px; }
.searchbar input { border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 14px; background: var(--paper); font: 500 1rem/1.3 var(--f-mono); }
.searchbar input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.chips { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-link { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--paper); font-size: .92rem; }
.chip-link span { font: .75rem/1 var(--f-mono); color: var(--muted); }
.chip-link:hover { border-color: var(--muted); }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 20px; color: var(--muted); font-size: .92rem; }

/* home: types rail and brands */
.types { padding-top: clamp(32px, 5vw, 56px); }
.type-rail { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1.5px solid var(--ink); }
.type { display: flex; align-items: center; gap: 14px; padding: 18px 24px 18px 0; text-decoration: none; font-weight: 600; }
.type + .type { padding-left: 24px; border-left: 1px solid var(--line); }
.type-n { margin-left: auto; font: 400 .85rem/1 var(--f-mono); color: var(--muted); }
.type:hover .type-name { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) { .type-rail { grid-template-columns: 1fr; } .type + .type { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); } }
.brands { padding-top: clamp(40px, 6vw, 64px); }
.brand-list { list-style: none; padding: 0; margin: 18px 0 0; columns: 4 160px; column-gap: 32px; }
.brand-list li { break-inside: avoid; border-bottom: 1px solid var(--line); }
.brand-list a { display: flex; justify-content: space-between; padding: 10px 0; text-decoration: none; }
.brand-list a span { font: .8rem/1.6 var(--f-mono); color: var(--muted); }
.brand-list a:hover { color: var(--mask); }

/* product */
.item-desc { margin: 0 0 16px; max-width: 64ch; color: var(--muted); font-size: 1rem; }
.related { padding-top: clamp(40px, 6vw, 64px); }
.related .h2 { margin-bottom: 16px; }

/* search page */
.rel-search { margin-top: 32px; }
.empty-line { color: var(--muted); }
.request { margin-top: clamp(40px, 6vw, 64px); padding: 24px; border: 1px dashed var(--line); border-radius: var(--r-m); max-width: 760px; }
.req-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.req-form label span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.req-form input, .my-form input { width: 100%; border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; background: var(--paper); }
.form-msg { grid-column: 1 / -1; margin: 4px 0 0; color: var(--mask); font-weight: 500; }
.form-msg.is-err { color: var(--danger); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .form-msg:not(.is-err) { color: var(--gold); } }
@media (max-width: 640px) { .req-form { grid-template-columns: 1fr; } }

/* my downloads */
.my-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; max-width: 520px; margin-top: 14px; }
.my-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.my-head .count { margin: 0; }
.orders { list-style: none; padding: 0; margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); }
.order { display: grid; grid-template-columns: 36px 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; }
.order + .order { border-top: 1px solid var(--line); }
.order-main { display: flex; flex-direction: column; min-width: 0; }
.order-title { font-weight: 600; text-decoration: none; }
.order-title:hover { text-decoration: underline; }
.order-meta { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.order-state { font-size: .85rem; margin-top: 2px; }
.order-state.is-ready { color: var(--mask); font-weight: 600; }
.order-act { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.order-left { font-size: .8rem; color: var(--muted); }
@media (max-width: 600px) { .order { grid-template-columns: 36px 1fr; } .order-act { grid-column: 2; align-items: flex-start; } }

.state-act { display: flex; flex-wrap: wrap; gap: 10px; }
.flow-gap { margin-top: 20px; }
.done-sha { margin-top: 10px !important; }


/* ── thumbnails in lists ── */
.row-media { width: 56px; height: 40px; border-radius: 6px; overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--mask) 9%, var(--paper)); color: var(--mask); }
:root[data-theme="dark"] .row-media { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .row-media { color: var(--gold); } }
.row-media img { width: 100%; height: 100%; object-fit: cover; }
.row-media svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.row-media .fill { fill: currentColor; stroke: none; }

/* ── header: sign in and account ── */
.btn-signin { text-decoration: none; padding: 6px 14px; border-radius: var(--r-s); background: var(--gold); color: #1d1606; font-weight: 600; font-size: .92rem; white-space: nowrap; }
.btn-signin:hover { background: #D8B35C; }
.account { position: relative; color: #CFE0D7; }
.account summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 12px 3px 3px; border: 1px solid var(--mask-line); border-radius: 999px; color: #EEF2EC; font-size: .92rem; }
.account summary::-webkit-details-marker { display: none; }
.acct-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; list-style: none; margin: 0; padding: 6px; min-width: 190px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: 0 12px 32px -12px rgba(0,0,0,.35); }
.account li form { margin: 0; }
.account li a, .account li button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: none; border-radius: 5px; text-decoration: none; cursor: pointer; font: inherit; }
.account li a:hover, .account li button:hover { background: color-mix(in srgb, var(--mask) 8%, var(--paper)); }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none; font: 600 .8rem/1 var(--f-body); color: #fff; background: hsl(var(--h, 150) 38% 32%); }
@media (max-width: 760px) {
  .acct-name { display: none; }
  .account summary { padding: 3px; }
  .header-in { gap: 12px; }
  .header-in > .logo { margin-right: auto; }   /* the catalog links are hidden here, so push the account and language to the right */
}
@media (max-width: 520px) { .lang summary span { display: none; } .lang summary { padding: 6px 9px; } }

/* ── sign-in page ── */
.panel-title + .auth, .panel-title + .notice { margin-top: 20px; }
.auth { max-width: 380px; }
.auth-providers { display: grid; gap: 10px; }
.btn-provider { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--paper); color: var(--ink); text-decoration: none; font: 500 1rem/1.2 var(--f-body); }
.btn-provider:hover { border-color: var(--muted); }
.btn-provider svg { width: 20px; height: 20px; flex: none; }
.auth-rule { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.auth .my-form { grid-template-columns: 1fr; margin-top: 0; }

/* ── file page: showcase images ── */
.gallery { margin: 0; }
.gallery-main { display: block; aspect-ratio: 16 / 10; max-height: 62vh; background: var(--mask-2); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; cursor: zoom-in; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumbs { list-style: none; display: flex; gap: 8px; padding: 0; margin: 8px 0 0; overflow-x: auto; }
.gallery-thumbs a { display: block; flex: none; width: 80px; height: 54px; border-radius: 6px; overflow: hidden; border: 2px solid transparent; background: var(--mask-2); }
.gallery-thumbs a[aria-current] { border-color: var(--gold); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.gallery-empty { aspect-ratio: 16 / 10; max-height: 62vh; display: grid; place-items: center; border-radius: var(--r-m); background: var(--mask); color: rgba(238,242,236,.45); }
.gallery-icon svg { width: 84px; height: 84px; fill: none; stroke: currentColor; stroke-width: .9; stroke-linecap: round; stroke-linejoin: round; }
.gallery-icon .fill { fill: currentColor; stroke: none; }
.lightbox { padding: 0; border: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: transparent; color: #fff; }
.lightbox::backdrop { background: rgba(6, 12, 9, .94); }
.lightbox-in { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.lightbox img { max-width: min(94vw, 1800px); max-height: 90vh; object-fit: contain; }
.lb-btn { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.28); background: rgba(0,0,0,.5); color: #fff; cursor: pointer; padding: 0; }
.lb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ── like and dislike ── */
.votes { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.vote { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); text-decoration: none; cursor: pointer; font: inherit; }
.vote svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.vote-n { font: 500 .9rem/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.vote:hover { border-color: var(--muted); }
.vote[disabled] { opacity: .6; cursor: progress; }
.vote[aria-pressed="true"] { background: var(--mask); border-color: var(--mask); color: #EEF2EC; }
.vote[aria-pressed="true"][data-vote="-1"] { background: #6b2e25; border-color: #6b2e25; }
.votes .form-msg { margin: 0; }

/* ── comments ── */
.comments { padding-top: clamp(40px, 6vw, 64px); max-width: 760px; }
.cm-n { font: 400 .9rem/1 var(--f-mono); color: var(--muted); margin-left: 10px; vertical-align: middle; }
.cm-form { margin: 18px 0 8px; }
.cm-form textarea { width: 100%; min-height: 84px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--paper); color: var(--ink); font: inherit; line-height: 1.5; }
.cm-form textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cm-form-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.cm-form-row .form-msg { margin: 0; }
.comments > .btn { margin-top: 14px; }
.cm-list { list-style: none; margin: 18px 0 0; padding: 0; }
.cm { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.cm .avatar { width: 32px; height: 32px; }
.cm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.cm-name { font-weight: 600; }
.cm-head time { color: var(--muted); font-size: .85rem; }
.badge { font-size: .72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge-staff { border-color: transparent; background: var(--gold); color: #1d1606; }
.cm-body { margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-act { display: flex; gap: 14px; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: .85rem; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }
.link-btn[disabled] { opacity: .6; cursor: default; text-decoration: none; }
.comments [data-cm-more] { margin-top: 16px; }

/* ── account name ── */
.acct-form { display: flex; gap: 10px; align-items: end; margin: 28px 0 0; max-width: 420px; }
.acct-form label { flex: 1; min-width: 0; }
.acct-form label span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.acct-form input { width: 100%; border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; background: var(--paper); color: var(--ink); }

/* ── tags: other models and keywords a file fits ── */
.row-tags { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; max-height: 3.4em; overflow: hidden; }
.tagchip { font: 400 .78rem/1.4 var(--f-mono); color: var(--gold-ink); white-space: nowrap; }
.tagmore { font: 400 .75rem/1.4 var(--f-mono); color: var(--muted); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 8px; padding: 0; margin: 0 0 16px; }
.tag-link { display: inline-block; padding: 3px 11px; border-radius: 999px; border: 1px solid transparent; background: color-mix(in srgb, var(--gold) 15%, var(--paper)); color: var(--gold-ink); text-decoration: none; font: 500 .85rem/1.4 var(--f-mono); }
.tag-link:hover { border-color: var(--gold); }
@media (min-width: 761px) and (max-width: 1000px) {
  .row { grid-template-columns: 56px minmax(0, 1fr) minmax(0, 150px) 112px 80px; }
  .row-format, .row-size, .row-head span:nth-child(5), .row-head span:nth-child(6) { display: none; }
}


/* ── header between phone and desktop widths: it must not scroll sideways ── */
@media (min-width: 761px) and (max-width: 960px) {
  .header-in { gap: 12px; }
  .nav a { padding: 6px 9px; }
  .nav-my, .acct-name { display: none; }
  .account summary { padding: 3px; }
}

/* ── file page: email field and the two ways to pay (Stripe for cards, Bitcoin and Ethereum for crypto) ── */
.buy { display: contents; }
.buy-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.buy input { order: 1; grid-column: 1 / -1; width: 100%; border: 1px solid var(--mask-line); background: var(--mask-2); color: #EEF2EC; border-radius: var(--r-s); padding: 10px 12px; font-size: 1rem; }
.buy input::placeholder { color: #7f9a8d; }
.buy input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.buy .cf-turnstile { order: 4; grid-column: 1 / -1; }
.buy-actions { order: 3; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; padding-bottom: 6px; }  /* room for the key's bottom edge */
/* A pay button must look pressable: a raised key with a gold bottom edge (like a plated pad), lifted on hover, sunk while pressed. */
.pay { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 12px;
  border: 1px solid #EADFBF; border-radius: 10px; cursor: pointer; background: linear-gradient(#FFFFFF, #ECEEE4);
  box-shadow: inset 0 1px 0 #FFFFFF, 0 4px 0 #B8923A, 0 10px 16px -8px rgba(0, 0, 0, .65);
  transition: transform .08s ease, box-shadow .08s ease; }
.pay svg { display: block; flex: none; }
.pay .logo-stripe { height: 24px; width: auto; }
.pay .coin { width: 28px; height: 28px; }
@media (hover: hover) {
  .pay:hover { background: linear-gradient(#FFFFFF, #F6F7F0); transform: translateY(-2px);
    box-shadow: inset 0 1px 0 #FFFFFF, 0 6px 0 #B8923A, 0 0 0 2px var(--gold), 0 14px 18px -8px rgba(0, 0, 0, .7); }
}
.pay:active, .pay.is-busy { transform: translateY(4px); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .2), 0 0 0 #B8923A, 0 2px 4px -2px rgba(0, 0, 0, .6); }
.pay:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.pay[disabled] { cursor: progress; }
.pay[disabled]:not(.is-busy) { opacity: .5; }
.pay.is-busy svg { opacity: .2; }
.pay.is-busy::after { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(15, 61, 46, .2); border-top-color: var(--mask); animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .pay.is-busy::after { animation-duration: 3s; } }

/* ── file page layout ── */
@media (min-width: 700px) {
  /* picture left, words and the pay box right */
  .item { grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); column-gap: clamp(24px, 4vw, 56px); }
  .item-media { grid-column: 1; grid-row: 1; }
  .item-info { grid-column: 2; grid-row: 1; }
}
@media (min-width: 1000px) { .panel-price { font-size: var(--s-4); } }
@media (max-width: 699px) {
  /* one column: title, picture, then the words, with the pay box kept in reach at the bottom of the screen */
  .crumbs { padding-top: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* one line */
  .item { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding-top: 8px; }
  .item-info, .item-media { display: contents; }
  .item-title { order: 1; margin-bottom: 10px; }
  .gallery { order: 2; margin-bottom: 12px; }
  .gallery-main, .gallery-empty { max-height: 40vh; }
  .gallery-thumbs a { width: 64px; height: 44px; }
  .item-desc { order: 3; margin-bottom: 12px; }   /* the words come right under the picture */
  .item .tags { order: 4; margin-bottom: 10px; }
  .item .votes { order: 5; margin-bottom: 12px; }
  .spec { order: 6; margin: 4px 0 18px; }
  .panel { order: 7; position: sticky; bottom: 0; z-index: 5; margin: 0 calc(-1 * var(--gutter)); border-radius: 12px 12px 0 0;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, .35); }
}
