/* Homepage, design "preview one" (homepage.js): category rail + comparison, then the sections below. Shared look (header,
   buttons, colours) lives in theme.css; this file is the homepage's own layout. Muted text is #5c6371 or darker on
   white / paper (WCAG AA for body text). */

/* ---------- rail + comparison ---------- */
.market-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); max-width: 1600px; margin: 0 auto; }
.mine-categories { padding: 36px 16px 32px 24px; border-right: 1px solid hsl(var(--border)); }
.category-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.category-heading h2 { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #5c6371; }
.category-heading h2::before { display: none; }
.category-heading button { border: 0; background: none; padding: 4px 0; font: 600 12px var(--font); color: #7a5414; text-decoration: underline; cursor: pointer; }
.category-nav { display: grid; gap: 6px; position: sticky; top: 16px; }
.category-link { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px; border: 1px solid transparent; border-radius: 6px;
  background: none; color: inherit; font: 500 15px/1.25 var(--font); text-align: left; cursor: pointer; text-decoration: none; }
.category-link:hover { background: #fbefdd; color: inherit; }
.category-link[aria-pressed="true"] { background: #fbefdd; border-color: #f0c47e; }
.category-art { display: flex; align-items: center; min-width: 34px; }
.category-art img { display: block; flex: none; }
.category-art img + img { width: 26px; height: 26px; margin-left: -6px; }
.rail-drop { width: 26px; height: 26px; margin: 0 4px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #3e8ed0; opacity: .85; }
.category-name { display: grid; gap: 2px; }
.category-name small { font-size: 12.5px; font-weight: 400; color: #5c6371; }
.category-arrow { margin-left: auto; display: flex; color: #5c6371; }
.category-arrow svg { width: 15px; height: 15px; }

.market-content { min-width: 0; padding: 44px 32px 36px; }
#market-title { margin: 0 0 12px; font-size: clamp(32px, 3.6vw, 54px); line-height: 1.08; letter-spacing: -.035em; font-weight: 800; font-stretch: 100%; max-width: 28ch; text-wrap: balance; }
.market-lead { margin: 0; max-width: 68ch; font-size: 18px; line-height: 1.55; color: #4b5260; }
.market-search { display: flex; align-items: center; gap: 12px; margin-top: 28px; padding: 7px 7px 7px 20px; min-height: 66px; background: #fff;
  border: 1px solid #dcdad5; border-radius: 8px; box-shadow: 0 4px 20px rgb(16 20 29 / .04); color: #10141d; }
.market-search > svg { width: 22px; height: 22px; flex: none; color: #5c6371; }
.market-search input { flex: 1; min-width: 0; height: auto; padding: 10px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: inherit; font-size: 17px; }
.market-search input::placeholder { color: #6b7280; opacity: 1; }
.market-search input:focus { outline: 0; }
.market-search:focus-within { outline: 2px solid #bd7b1a; outline-offset: 2px; }
.market-search .btn { flex: none; height: 52px; padding: 0 26px; font-size: 16px; }
.market-counts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 16px 2px 26px; padding: 0; list-style: none; font-size: 14px; color: #4b5260; }
.market-counts b { margin-right: 4px; font-size: 18px; font-weight: 750; color: hsl(var(--foreground)); }

.market-table-wrap { overflow: hidden; border: 1px solid hsl(var(--border)); border-radius: 6px; background: hsl(var(--card)); }
.market-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 15px; }
.market-table th { height: 60px; padding: 12px 14px; background: #f5f3ef; color: hsl(var(--foreground)); text-align: left; font-size: 13.5px; font-weight: 650;
  text-transform: none; letter-spacing: 0; border: 0; vertical-align: middle; }
.market-table th:first-child { width: 34%; } .market-table th:nth-child(2) { width: 15%; } .market-table th:nth-child(3) { width: 12%; }
.market-table th:nth-child(4) { width: 11%; } .market-table th:nth-child(5) { width: 11%; } .market-table th:last-child { width: 17%; }
.market-table th button { padding: 4px 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; text-transform: capitalize; }
.market-table th button span { margin-left: 4px; font-size: 13px; color: #5c6371; }
.market-table th[aria-sort="ascending"] button, .market-table th[aria-sort="descending"] button { color: #8a5a10; }
.market-table th button:hover { color: #8a5a10; }
.market-table small { display: block; font-size: 13px; line-height: 1.45; font-weight: 400; color: #5c6371; }
.market-table td { padding: 14px; border-top: 1px solid #efedea; vertical-align: middle; background: none !important; }
.market-table tbody tr:hover td { background: #fffaf2 !important; }
.market-product { display: flex; align-items: center; gap: 16px; color: inherit; text-decoration: none; }
.market-product img { flex: none; width: 96px; height: 96px; object-fit: contain; mix-blend-mode: multiply; }
.market-product b { display: block; margin-bottom: 6px; font-size: 18px; font-weight: 750; letter-spacing: -.01em; line-height: 1.2; }
.market-product:hover b { text-decoration: underline; text-decoration-color: var(--amber); text-underline-offset: 3px; }
.market-profit b { font-size: 24px; font-weight: 750; color: #1f7a60; white-space: nowrap; }
.market-profit b.neg { color: #b43832; }
.market-price b, .market-payback b, .market-offers b { font-size: 16px; font-weight: 700; white-space: nowrap; }
.market-action { text-align: right; }
.market-action .btn { gap: 8px; padding: 11px 14px; font-size: 14px; white-space: nowrap; }
.market-action svg { width: 16px; height: 16px; }
.market-empty { padding: 48px 24px; text-align: center; color: #4b5260; }
.market-empty button { border: 0; background: none; color: #7a5414; text-decoration: underline; cursor: pointer; font: inherit; }
.market-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.market-foot .btn { min-width: 160px; }
.market-all { margin-left: auto; font-weight: 600; color: hsl(var(--primary)); }

:root[data-theme="dark"] .market-search { background: #1b2230; border-color: #323a49; color: #f3f1ed; }
:root[data-theme="dark"] .market-table th { background: #242b38; }
:root[data-theme="dark"] .market-table td { border-color: #323a49; }
:root[data-theme="dark"] .market-table tbody tr:hover td { background: #222a37 !important; }
:root[data-theme="dark"] .market-product img { mix-blend-mode: normal; }
:root[data-theme="dark"] .market-profit b { color: #4fd1a5; }
:root[data-theme="dark"] .category-link:hover, :root[data-theme="dark"] .category-link[aria-pressed="true"] { background: #30291d; }
:root[data-theme="dark"] .market-lead, :root[data-theme="dark"] .market-counts, :root[data-theme="dark"] .category-name small,
:root[data-theme="dark"] .market-table small, :root[data-theme="dark"] .category-heading h2 { color: #b7bfcb; }

/* ---------- sections below ---------- */
.hp-below { max-width: 1600px; margin: 0 auto; padding: 8px 32px 56px; }
.hp-sec { padding: 36px 0 8px; border-top: 1px solid hsl(var(--border)); margin-top: 28px; }
.hp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.hp-head h2, .hp-links h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.hp-head h2::before { display: none; }
.hp-head a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: hsl(var(--primary)); }
.hp-head a svg { width: 15px; height: 15px; }
.hp-sub { margin: 0 0 4px; color: #4b5260; }
.hp-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 14px; overflow-x: auto; padding: 14px 2px 10px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.hp-card { display: grid; gap: 4px; align-content: start; padding: 14px; scroll-snap-align: start; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 6px; color: inherit; }
.hp-card:hover { border-color: #e2b46d; color: inherit; }
.hp-card-img { display: grid; place-items: center; height: 120px; margin-bottom: 6px; }
.hp-card-img img { max-height: 120px; object-fit: contain; mix-blend-mode: multiply; }
.hp-card b { font-size: 15px; line-height: 1.3; }
.hp-card-spec, .hp-card-note { font-size: 13px; color: #5c6371; }
.hp-card-profit { justify-self: start; margin-top: 4px; padding: 2px 8px; border-radius: 4px; background: #e3f4ee; color: #17614c; font-weight: 700; font-size: 13.5px; }
.hp-card-profit.neg { background: #fbe9e7; color: #9d2f29; }
.hp-card-deal { display: grid; gap: 2px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed hsl(var(--border)); font-size: 13px; color: #4b5260; }
.hp-card-deal > b { font-size: 18px; color: hsl(var(--foreground)); }
.hp-hosts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding-top: 14px; }
.hp-host { display: grid; gap: 4px; padding: 16px; border-radius: 6px; background: #faf3e8; border: 1px solid #f1dfc2; color: inherit; }
.hp-host:hover { border-color: #e2b46d; color: inherit; }
.hp-host-p, .hp-host-meta { font-size: 13px; color: #5c6371; }
.hp-host-rate { font-size: 13px; color: #4b5260; } .hp-host-rate b { font-size: 22px; color: hsl(var(--foreground)); }
.hp-links { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.hp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.hp-chips a { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 12px; border: 1px solid hsl(var(--border)); border-radius: 6px; background: hsl(var(--card)); font-weight: 600; font-size: 14px; color: inherit; }
.hp-chips a:hover { border-color: #e2b46d; background: #fffaf2; color: inherit; }
.hp-chips em { font-style: normal; font-weight: 500; font-size: 12.5px; color: #5c6371; }
.hp-chips img { border-radius: 50%; }
.hp-how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 14px 0 0; padding: 0; list-style: none; counter-reset: s; }
.hp-how li { padding: 18px; border-radius: 6px; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); counter-increment: s; }
.hp-how li::before { content: counter(s); display: inline-grid; place-items: center; width: 28px; height: 28px; margin-bottom: 10px; border-radius: 50%; background: var(--amber); color: var(--ink); font-weight: 800; }
.hp-how b { display: block; font-size: 17px; }
.hp-how p { margin: 6px 0 0; color: #4b5260; line-height: 1.55; }
.hp-faq { display: grid; gap: 8px; max-width: 900px; padding-top: 12px; }
.hp-faq details { border: 1px solid hsl(var(--border)); border-radius: 6px; background: hsl(var(--card)); }
.hp-faq summary { padding: 14px 16px; font-weight: 650; cursor: pointer; }
.hp-faq p { margin: 0; padding: 0 16px 16px; color: #4b5260; line-height: 1.6; }
.hp-faq p a { white-space: nowrap; }
.hp-posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding-top: 14px; }
.hp-post { display: grid; gap: 6px; color: inherit; }
.hp-post > b { font-size: 16px; line-height: 1.3; }
.hp-post:hover > b { text-decoration: underline; text-decoration-color: var(--amber); }
.hp-post .mp-cover { border-radius: 6px; }

:root[data-theme="dark"] .hp-host { background: #241f17; border-color: #3a3224; }
:root[data-theme="dark"] .hp-card-img img { mix-blend-mode: normal; }
:root[data-theme="dark"] .hp-card-profit { background: #0f2c25; color: #4fd1a5; }
:root[data-theme="dark"] .hp-chips a:hover { background: #222a37; }
:root[data-theme="dark"] .hp-sub, :root[data-theme="dark"] .hp-how p, :root[data-theme="dark"] .hp-faq p, :root[data-theme="dark"] .hp-card-spec,
:root[data-theme="dark"] .hp-card-note, :root[data-theme="dark"] .hp-host-p, :root[data-theme="dark"] .hp-host-meta, :root[data-theme="dark"] .hp-chips em { color: #b7bfcb; }

/* ---------- narrower screens ---------- */
@media (max-width: 1350px) {
  .market-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .mine-categories { padding: 30px 12px 24px 16px; }
  .category-link { font-size: 14px; gap: 10px; }
  .market-content { padding: 34px 22px 28px; }
  .market-lead { font-size: 17px; }
  .market-product img { width: 72px; height: 72px; }
  .market-product { gap: 10px; }
  .market-product b { font-size: 16px; }
  .market-table td, .market-table th { padding: 12px 9px; }
  .market-profit b { font-size: 20px; }
  .market-price b, .market-payback b, .market-offers b { font-size: 14.5px; }
  .market-action .btn { font-size: 13px; padding: 10px 9px; gap: 5px; }
  .hp-below { padding: 8px 22px 48px; }
}
/* tablets and phones: the rail becomes one swipeable row of chips above the comparison */
@media (max-width: 950px) {
  .market-layout { display: block; }
  .mine-categories { padding: 18px 20px 0; border: 0; }
  .category-heading { margin-bottom: 8px; }
  .category-nav { position: static; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px 4px; scroll-padding-inline: 20px; scroll-snap-type: x proximity; }
  .category-nav::-webkit-scrollbar { display: none; }
  .category-link { flex: none; width: auto; min-height: 48px; padding: 8px 12px 8px 8px; gap: 8px; border-color: hsl(var(--border)); background: hsl(var(--card)); scroll-snap-align: start; font-size: 14px; }
  .category-art { min-width: 0; }
  .category-art img { width: 24px; height: 24px; }
  .category-art img + img { width: 22px; height: 22px; }
  .rail-drop { width: 20px; height: 20px; }
  .category-arrow { display: none; }
  .category-name { white-space: nowrap; }
  .market-content { padding: 22px 20px 26px; }
  .hp-hosts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hp-links { grid-template-columns: 1fr; gap: 8px; }
  .hp-how, .hp-posts { grid-template-columns: 1fr; }
  .hp-below { padding: 0 20px 40px; }
}
/* phones: each miner becomes a card (name, then profit / price / payback, then the button) */
@media (max-width: 700px) {
  #market-title { font-size: 31px; line-height: 1.12; letter-spacing: -.025em; }
  .market-lead { font-size: 15.5px; }
  .market-search { flex-wrap: wrap; min-height: 0; padding: 8px 8px 8px 14px; gap: 6px 10px; margin-top: 20px; }
  .market-search > svg { width: 19px; height: 19px; }
  .market-search input { font-size: 16px; padding: 8px 0; }   /* 16 px: iOS does not zoom into the field */
  .market-search .btn { flex: 1 0 100%; height: 46px; font-size: 15px; }
  .market-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; margin: 16px 0 20px; }
  .market-counts b { font-size: 16px; }
  .market-table { display: block; }
  .market-table caption { display: none; }
  .market-table thead { display: block; padding: 10px 12px; background: #f5f3ef; }
  .market-table thead tr { display: flex; flex-wrap: wrap; gap: 6px 16px; }
  .market-table th { height: auto; padding: 0; width: auto !important; font-size: 12.5px; background: none; }
  .market-table th:first-child, .market-table th:last-child, .market-table th small { display: none; }
  .market-table tbody { display: block; }
  .market-table tbody tr:not([hidden]) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 8px; padding: 16px 14px; border-top: 1px solid #efedea; }
  .market-table td { display: block; padding: 0; border: 0; }
  .market-model { grid-column: 1 / -1; }
  .market-product img { width: 64px; height: 64px; }
  .market-product b { font-size: 16.5px; }
  .market-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 12px; color: #5c6371; }
  .market-profit b { font-size: 19px; }
  .market-profit small { display: none; }
  .market-offers { display: none !important; }
  .market-action { grid-column: 1 / -1; text-align: left; }
  .market-action .btn { width: 100%; justify-content: center; padding: 12px; font-size: 14.5px; }
  .market-foot { flex-direction: column; align-items: stretch; text-align: center; }
  .market-foot .btn { width: 100%; }
  .market-all { margin: 4px auto 0; }
  .hp-head h2, .hp-links h2 { font-size: 21px; }
  .hp-row { grid-auto-columns: 72%; margin: 0 -20px; padding: 14px 20px 10px; scroll-padding: 0 20px; }
  .hp-hosts { grid-template-columns: 1fr; }
  :root[data-theme="dark"] .market-table thead { background: #242b38; }
}
