/* Book Exchange: Apple-style UI with liquid glass top bar (see public/js/glass.js). */

:root {
  --bg: #f5f5f7;
  --surface: #fff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --separator: #e8e8ed;
  --fill: #e8e8ed;
  --fill-hover: #dcdce1;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --link: #0066cc;
  --green: #34c759;
  --orange: #ff9500;
  --red: #e30000;
  --purple: #af52de;
  --field: #fff;
  --field-line: #d2d2d7;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 20px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.05), 0 12px 36px rgba(0, 0, 0, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* top bar: white in light mode, so the logo's light outline becomes near-black */
  --bar: #fff;
  --bar-line: #e8e8ed;
  --bar-text: #1d1d1f;
  --bar-text-2: #86868b;
  --bar-fill: #f0f0f3;
  --bar-fill-hover: #e5e5ea;
  --logo-a: #1d1d1f;
  --logo-b: #8e8e93;
  /* Browse page: grey sidebar beside a white store, like Apple Books */
  --serif: "New York", ui-serif, Georgia, "Times New Roman", serif;
  --sidebar: #f2f2f4;
  --side-hover: #e6e6ea;
  --side-active: #1d1d1f;
  --side-active-text: #fff;
  --store-bg: #fff;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #86868b;
    --separator: #38383a;
    --fill: #2c2c2e;
    --fill-hover: #3a3a3c;
    --blue: #0a84ff;
    --blue-hover: #2997ff;
    --link: #2997ff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --purple: #bf5af2;
    --field: #1c1c1e;
    --field-line: #424245;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-hover: 0 0 0 1px rgba(255, 255, 255, 0.1);
    /* dark bar: white outline for the first part of the logo, grey for the second */
    --bar: #161617;
    --bar-line: #2c2c2e;
    --bar-text: #f5f5f7;
    --bar-text-2: #8e8e93;
    --bar-fill: #2c2c2e;
    --bar-fill-hover: #3a3a3c;
    --logo-a: #fff;
    --logo-b: #8e8e93;
    --sidebar: #161617;
    --side-hover: #2c2c2e;
    --side-active: #3a3a3c;
    --side-active-text: #fff;
    --store-bg: #000;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* on html too, so what the glass samples above the body is the page colour */
html { background: var(--bg); }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent); outline-offset: 2px; }

.muted { color: var(--text-2); }
.small { font-size: 13px; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-size: 14px; letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* glass without WebGL2: frosted CSS stand-in */
.glass-fallback {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 18px;
  border: 0;
  border-radius: 980px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.016em;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s, opacity 0.2s;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-secondary { background: var(--fill); color: var(--text); }
.btn-secondary:hover { background: var(--fill-hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-wide { width: 100%; min-height: 44px; font-size: 17px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); font: inherit; font-size: 14px; cursor: pointer; }

/* ---------------------------------------------------------------- forms */

.field { display: grid; align-content: start; gap: 6px; margin: 0 0 16px; }
.field > span { font-size: 13px; font-weight: 600; letter-spacing: -0.008em; }
.field small { font-size: 12px; color: var(--text-3); }

input:not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--field-line);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  cursor: pointer;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 22%, transparent);
}
input[type=file] { font: inherit; font-size: 14px; color: var(--text-2); }
input[type=file]::file-selector-button {
  margin-right: 12px; padding: 7px 16px; border: 0; border-radius: 980px;
  background: var(--fill); color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- messages */

.flash, .notice {
  margin: 20px 0 0;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 15px;
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
}
.flash-success { background: color-mix(in srgb, var(--green) 16%, var(--surface)); }
.flash-error, .notice-error { background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--red); }

/* ---------------------------------------------------------------- top bar */

/* One solid bar across the page. The navbar on it is still liquid glass; it refracts the bar. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60; /* above the glass overlay (40) and open menus (50) */
  width: 100%;
  background: var(--bar);
  color: var(--bar-text);
  border-bottom: 1px solid var(--bar-line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1240px;
  min-height: 64px;
  margin: 0 auto;
  padding: 8px max(16px, env(safe-area-inset-left));
}
.brand, .account {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--bar-text);
  font-size: 15px;
  flex: none;
}
.brand { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand-x { color: var(--bar-text-2); font-weight: 400; font-size: 18px; }
.account-name { font-size: 14px; color: var(--bar-text); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* HKMU mark as outlines: first part in --logo-a, second in --logo-b */
.mu-logo { width: auto; height: 30px; fill: none; stroke-width: 1.6; stroke-linejoin: round; }
.mu-logo path { vector-effect: non-scaling-stroke; }
.mu-logo .mu-a { stroke: var(--logo-a); }
.mu-logo .mu-b { stroke: var(--logo-b); }

.btn-bar { min-height: 32px; padding: 5px 14px; font-size: 14px; background: var(--bar-fill); color: var(--bar-text); }
.btn-bar:hover { background: var(--bar-fill-hover); }

.app-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ff9f0a, #ff6a00);
  color: #fff;
  font-size: 16px;
}
.app-icon svg { stroke-width: 1.8; }
.app-icon-xl { width: 76px; height: 76px; border-radius: 18px; font-size: 40px; margin: 0 auto; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, #a5b4fc, #6366f1);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

.main-nav { flex: 1; display: flex; justify-content: center; min-width: 0; }
.main-nav > a { padding: 8px 14px; border-radius: 18px; color: var(--bar-text); font-size: 14px; }
.main-nav > a.active { color: var(--blue); font-weight: 600; background: color-mix(in srgb, var(--blue) 12%, transparent); }
.nav-fallback { flex: none; gap: 2px; padding: 4px; border-radius: 24px; background: var(--bar-fill) !important; box-shadow: none !important; }
/* glass navbar on: the links stay for keyboard users and show when focused */
.nav-glass { position: relative; flex: none; }
.nav-glass > a { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nav-glass > a:focus { clip: auto; width: auto; height: auto; top: 100%; margin-top: 6px; background: var(--surface); box-shadow: var(--shadow); white-space: nowrap; }
.navbar-host { display: block; }

@media (max-width: 860px) {
  .account-name { display: none; }
}
@media (max-width: 620px) {
  .brand-x, .brand-name { display: none; }
  /* four tabs do not fit beside the logo and account: the navbar gets its own row */
  .topbar-inner { gap: 10px; flex-wrap: wrap; }
  .main-nav { order: 3; flex-basis: 100%; justify-content: center; }
}

/* ---------------------------------------------------------------- page */

.view { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px 56px; flex: 1; animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 48px 4px 24px;
}
/* same serif title as the Book Exchange store heading */
.page-head h1 { font-family: var(--serif); font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.page-head p { font-size: 17px; color: var(--text-2); margin: 6px 0 0; }
.section-title { font-size: 21px; font-weight: 600; letter-spacing: 0.011em; margin: 36px 4px 14px; }

.card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 24px; }
.card-narrow { max-width: 680px; margin: 0 auto; }
.empty { padding: 56px 16px; text-align: center; color: var(--text-2); font-size: 15px; }

.site-footer { padding: 24px 16px 32px; text-align: center; font-size: 12px; color: var(--text-3); }

/* ---------------------------------------------------------------- badges */

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 980px; background: var(--fill); color: var(--text-2); letter-spacing: 0; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-available, .badge-completed { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.badge-sold { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.badge-swapped { color: var(--purple); background: color-mix(in srgb, var(--purple) 14%, transparent); }
.badge-pending { color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, transparent); }
.badge-rejected, .badge-cancelled { color: var(--text-3); }

/* ---------------------------------------------------------------- browse */

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; padding: 18px; }
.filters .field { margin: 0; }
.filters .filter-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } .filters .field:first-child { grid-column: 1 / -1; } }

.result-count { margin: 20px 4px 12px; font-size: 14px; color: var(--text-2); }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.book-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--text);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s;
}
.book-card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.book-card-body { padding: 14px 16px 16px; display: grid; gap: 4px; }
.book-card h3 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .author { font-size: 14px; color: var(--text-2); }
.book-card .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.price { font-weight: 600; font-size: 17px; }

/* a cover image, or a coloured placeholder with the title when there is none */
.cover { position: relative; aspect-ratio: 3 / 4; background: var(--fill); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; text-align: center;
  color: #fff; font-weight: 700; font-size: 18px; line-height: 1.2; letter-spacing: -0.01em;
  background: linear-gradient(160deg, var(--c1, #5e5ce6), var(--c2, #0a84ff));
}
.cover-placeholder::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; background: rgba(0, 0, 0, 0.18);
}

/* ---------------------------------------------------------------- details */

.detail { display: grid; grid-template-columns: minmax(240px, 360px) 1fr; gap: 40px; padding-top: 40px; align-items: start; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; gap: 24px; } .detail .cover { max-width: 320px; } }
.detail .cover { border-radius: 20px; box-shadow: var(--shadow-hover); }
.detail h1 { font-size: 40px; line-height: 1.1; font-weight: 600; margin: 12px 0 4px; letter-spacing: 0; }
.detail .author { font-size: 21px; color: var(--text-2); margin: 0 0 20px; }
.detail .price { font-size: 32px; margin: 0 0 24px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0 0 28px; font-size: 15px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }

.meter { display: inline-block; width: 120px; height: 6px; border-radius: 3px; background: var(--fill); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--green); border-radius: inherit; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* ---------------------------------------------------------------- create / edit */

.cover-upload { display: flex; gap: 18px; align-items: center; }
.cover-upload img { width: 84px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- trades */

.trade-list { display: grid; gap: 12px; }
.trade {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 20px;
}
.trade-main { flex: 1; min-width: 240px; }
.trade-main p { margin: 2px 0 0; font-size: 14px; color: var(--text-2); }
.trade .actions { margin-left: auto; }

/* ---------------------------------------------------------------- login */

.login { flex: 1; display: grid; place-items: center; padding: 32px 16px; }

/* Sign in and register: one card, form on the left, looping video on the right */
.auth { width: min(1040px, 100%); }
.auth-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 620px;
  background: var(--surface);
  border-radius: 28px;
  box-shadow: var(--shadow-hover);
  overflow: hidden;
}
.auth-card > .login-form { align-self: center; justify-self: center; padding: 48px 40px; }
.auth-media { position: relative; margin: 0; background: #111; }
.auth-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-media figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; gap: 4px;
  padding: 72px 32px 32px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
}
.auth-media strong { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.auth-media span { font-size: 15px; opacity: 0.85; }
.login-form .mu-logo { height: 44px; display: block; margin: 0 auto; stroke-width: 1.8; }
@media (max-width: 820px) {
  .auth-card { grid-template-columns: 1fr; min-height: 0; }
  /* phones: the video becomes a short banner above the form */
  .auth-media { order: -1; height: 200px; }
  .auth-media figcaption { padding: 40px 20px 18px; }
  .auth-media strong { font-size: 19px; }
  .auth-card > .login-form { padding: 32px 20px 36px; }
}

.login-form { width: min(400px, 100%); text-align: center; }
.login-form h1 { font-size: 32px; line-height: 1.125; font-weight: 600; letter-spacing: 0.004em; margin: 22px 0 8px; }
.login-form > p { margin: 0 0 28px; font-size: 17px; }
.field-group { border: 1px solid var(--field-line); border-radius: 12px; background: var(--field); overflow: hidden; text-align: left; }
.field-group input, .field-group select { border: 0 !important; border-radius: 0 !important; padding: 15px 16px !important; font-size: 17px !important; }
.field-group > * + * { border-top: 1px solid var(--field-line) !important; }
.field-group input:focus, .field-group select:focus { box-shadow: inset 0 0 0 2px var(--blue) !important; }
.login-form .btn { margin-top: 14px; }
.login-form .switch-mode { margin-top: 22px; font-size: 15px; color: var(--text-2); }
.login-form .notice { margin: 0 0 18px; text-align: left; }
/* sign-in and create-account share the page; #signup shows when linked to, or after a failed sign-up */
.auth #signup { display: none; }
.auth.show-signup #signup, .auth #signup:target { display: grid; }
.auth.show-signup #signin, .auth:has(#signup:target) #signin { display: none; }
.auth #signin:target { display: grid; }
.auth:has(#signin:target) #signup { display: none; }

/* ---------------------------------------------------------------- info */

.info { text-align: center; padding: 96px 16px; }
.info h1 { font-size: 40px; font-weight: 600; margin: 0 0 8px; }
.info p { color: var(--text-2); margin: 0 0 28px; }

/* ---------------------------------------------------------------- browse: sidebar + store */

.view-wide { max-width: none; padding: 0; }
.view-wide > .flash { margin: 16px 24px 0; }

.store { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - 65px); min-height: calc(100dvh - 65px); }

.sidebar {
  position: sticky;
  top: 65px; /* under the sticky top bar */
  align-self: start;
  height: calc(100vh - 65px);
  height: calc(100dvh - 65px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 12px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--bar-line);
}
.side-search { position: relative; }
.side-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--text-3); }
.side-search input { padding: 7px 10px 7px 32px !important; border-radius: 9px !important; font-size: 14px !important; }
.side-section { display: grid; gap: 2px; }
.side-section h2 { margin: 0 10px 4px; font-size: 13px; font-weight: 700; letter-spacing: -0.005em; }
.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
}
.side-item svg { font-size: 17px; color: var(--text-2); }
.side-item small { margin-left: auto; font-size: 12px; color: var(--text-3); }
.side-item:hover { background: var(--side-hover); text-decoration: none; }
.side-item.active { background: var(--side-active); color: var(--side-active-text); }
.side-item.active svg, .side-item.active small { color: inherit; }
.side-filters { gap: 0; }
.side-filters .field { margin: 0 4px 10px; }
.side-filters .field > span { font-size: 12px; color: var(--text-2); }
.side-filters input, .side-filters select { padding: 7px 10px !important; font-size: 14px !important; border-radius: 9px !important; }
.side-filters .btn { min-height: 32px; font-size: 14px; margin: 0 4px; width: auto; }

.store-main { min-width: 0; padding: 32px 40px 56px; background: var(--store-bg); }
.store-head h1 { font-family: var(--serif); font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.store-head p { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }
.store-main .notice { margin-top: 16px; }
.store-subhead { font-family: var(--serif); font-size: 22px; font-weight: 700; margin: 36px 0 16px; padding-top: 28px; border-top: 1px solid var(--separator); }
.store-head + .book-grid, .store-head + .card { margin-top: 28px; }

/* two featured collections, each with a fan of covers */
.featured { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin: 32px 0 36px; }
.feature { display: grid; align-content: start; gap: 4px; color: var(--text); }
.feature:hover { text-decoration: none; }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.feature-title { font-family: var(--serif); font-size: 21px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.feature-art {
  position: relative;
  display: block;
  margin-top: 12px;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.feature:hover .feature-art { transform: translateY(-3px); }
.tone-blue { background: linear-gradient(135deg, #0a84ff, #5e5ce6); }
.tone-pink { background: linear-gradient(135deg, #ff6b8b, #c58fd9); }
.feature-label { position: absolute; left: 24px; bottom: 20px; z-index: 4; max-width: 45%; color: #fff; font-size: clamp(22px, 2.4vw, 32px); font-weight: 600; line-height: 1.1; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.2); }
.fan { position: absolute; right: 6%; top: 50%; width: 52%; height: 76%; transform: translateY(-50%); }
.fan .cover { position: absolute; top: 0; height: 100%; width: auto; border-radius: 6px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); }
.fan .cover:nth-child(1) { right: 38%; transform: rotate(-10deg) translateY(5%); z-index: 1; }
.fan .cover:nth-child(2) { right: 19%; transform: rotate(-2deg); z-index: 2; }
.fan .cover:nth-child(3) { right: 0; transform: rotate(8deg) translateY(5%); z-index: 3; }
.fan .cover-placeholder { font-size: 13px; padding: 10px; }

/* a horizontal shelf of the newest covers */
.shelf { padding-top: 28px; border-top: 1px solid var(--separator); }
.shelf h2 { font-family: var(--serif); font-size: 22px; font-weight: 700; margin: 0; }
.shelf h2 span { color: var(--text-3); font-weight: 400; }
.shelf > p { margin: 2px 0 14px; font-size: 14px; color: var(--text-2); }
.shelf-row { display: flex; gap: 20px; overflow-x: auto; padding: 4px 2px 18px; scroll-snap-type: x proximity; }
.shelf-book { flex: none; width: 124px; display: grid; gap: 8px; color: var(--text); scroll-snap-align: start; }
.shelf-book:hover { text-decoration: none; }
.shelf-book .cover { border-radius: 4px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.shelf-book:hover .cover { transform: translateY(-4px); }
.shelf-book .cover-placeholder { font-size: 13px; padding: 10px; }
.shelf-price { font-size: 13px; font-weight: 600; }

@media (max-width: 1100px) {
  .featured { grid-template-columns: 1fr; }
}
/* narrow screens: the sidebar becomes a strip of search + category chips above the store */
@media (max-width: 860px) {
  .store { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--bar-line); gap: 10px; }
  .sidebar .side-filters, .sidebar .side-section h2 { display: none; }
  .sidebar nav.side-section { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  .sidebar .side-item { flex: none; background: var(--side-hover); border-radius: 980px; padding: 5px 12px; }
  .sidebar .side-item.active { background: var(--side-active); }
  .sidebar .side-item small { display: none; }
  .store-main { padding: 24px 16px 48px; }
}

/* ---------------------------------------------------------------- buy / swap + glass pop-up menu */

.deal { position: relative; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.deal form { margin: 0; }
.btn-pill-lg { min-height: 48px; padding: 12px 30px; font-size: 17px; font-weight: 600; }
.deal-or { color: var(--text-2); font-size: 15px; }
/* Swap: a tinted glass pill drawn by the overlay scene; plain fill without WebGL2 */
.btn-glass { position: relative; z-index: 50; background: var(--fill); color: var(--blue); }
.btn-glass:hover { background: var(--fill-hover); }
.btn-glass.is-glass, .btn-glass.is-glass:hover { background: transparent; }
.anchor-label { transition: none; }

/* the full-screen layer the menu glass is drawn on; menus and their buttons sit above it */
.glass-overlay { position: fixed; inset: 0; z-index: 40; pointer-events: none; }

.glass-menu {
  position: absolute;
  top: calc(100% + 14px);
  left: 0;
  z-index: 50;
  width: min(380px, calc(100vw - 32px));
  padding: 22px;
  border-radius: 26px; /* the library reads this radius for the glass body */
  visibility: hidden;
  color: var(--text);
}
.glass-menu h3 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.glass-menu-body > p { margin: 0 0 16px; font-size: 14px; color: var(--text-2); }
.glass-menu .field:last-of-type { margin-bottom: 8px; }
.glass-menu .form-actions { margin-top: 12px; }
/* no WebGL2: a frosted card that simply appears */
.glass-menu.is-fallback { background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow-hover); }
.glass-menu.is-fallback.is-open { visibility: visible; }
@media (max-width: 760px) {
  .glass-menu { left: 50%; transform: translateX(-50%); }
}

/* ---------------------------------------------------------------- Google sign-in */

.or-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: var(--text-3); font-size: 13px; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--separator); }
.login-form .btn-google { margin-top: 10px; gap: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--field-line); }
.login-form .btn-google:hover { background: var(--fill); text-decoration: none; }
.btn-google svg { width: 18px; height: 18px; stroke: none; }

/* edit listing: change or remove the cover */
.cover-actions { display: grid; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--red); }
