/* ============================================================
   Harbor Market — "coastal trading post, set crisp"
   Instrument Serif (display) + Instrument Sans (body/UI)
   Signature device: the tide-table ledger row —
   maker in letter-spaced small caps, price in tabular figures,
   ruled above and below by hairlines.
   ============================================================ */

/* 1 · Tokens ------------------------------------------------- */

:root {
  color-scheme: light;

  /* palette */
  --fog: #f5f6f4;          /* page */
  --paper: #ffffff;        /* cards, fields */
  --navy: #1c2b39;         /* ink, header text, primary buttons */
  --navy-deep: #14202b;    /* footer, pressed */
  --slate: #5c6b77;        /* secondary text on fog/white */
  --slate-deep: #46545f;   /* secondary text on seafoam */
  --seafoam: #dfe8e3;      /* quiet fills, tags */
  --seafoam-tint: #ebf0ec; /* media placeholder top */
  --hairline: #e1e4e0;
  --hairline-dark: #c2c9c4;
  --buoy: #c3402f;         /* one role: the save action (+ errors) */
  --buoy-tint: #fbf1ef;

  /* type */
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, system-ui, sans-serif;

  /* rhythm */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --measure: 62ch;
  --radius-s: 3px;
  --radius-m: 6px;
  --radius-l: 10px;
  --pace: 200ms;
  --ease: cubic-bezier(0.25, 0.6, 0.3, 1);
  --shadow-toast: 0 12px 32px rgba(20, 32, 43, 0.22);
}

/* 2 · Reset & base ------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  background: var(--fog);
  color: var(--navy);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--navy);
  color: var(--fog);
}

img {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  text-align: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
  border-radius: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 3 · Type roles --------------------------------------------- */

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

h1 em,
h2 em {
  font-style: italic;
}

p {
  margin: 0;
}

/* Kicker lines — italic serif, not the small-caps chip cliché */
.eyebrow {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.4;
  color: var(--slate);
}

.muted {
  color: var(--slate);
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8125rem;
}

/* Letter-spaced caps utility look (used via component rules) */

/* 4 · Buttons & links ---------------------------------------- */

.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.55rem 1.35rem;
  border-radius: var(--radius-s);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background-color var(--pace) var(--ease),
    border-color var(--pace) var(--ease),
    color var(--pace) var(--ease);
}

.btn-primary {
  background: var(--navy);
  color: var(--fog);
}

.btn-primary:hover:not(:disabled) {
  background: var(--navy-deep);
}

.btn-ghost {
  border: 1px solid var(--navy);
  color: var(--navy);
  background: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--paper);
  border-color: var(--navy-deep);
}

.link-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--navy);
  text-decoration: underline;
  text-decoration-color: var(--hairline-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: text-decoration-color var(--pace) var(--ease);
}

.link-action:hover:not(:disabled) {
  text-decoration-color: var(--navy);
}

.nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--navy);
  padding: 0.35rem 0.15rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--pace) var(--ease);
}

.nav-link:hover {
  border-bottom-color: var(--navy);
}

/* Card CTA — understated, arrow travels on hover */
.card-view {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: underline;
  text-decoration-color: var(--hairline-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: text-decoration-color var(--pace) var(--ease);
}

.card-view::after {
  content: "→"; /* fallback for browsers without alt-text content syntax */
  content: "→" / "";
  font-weight: 400;
  transition: translate var(--pace) var(--ease);
}

.card-view:hover {
  text-decoration-color: var(--navy);
}

.card-view:hover::after {
  translate: 3px 0;
}

/* The one buoy-red role: saving a piece */
.save-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.375rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--hairline-dark);
  border-radius: var(--radius-s);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--navy);
  background: transparent;
  transition: border-color var(--pace) var(--ease),
    background-color var(--pace) var(--ease),
    color var(--pace) var(--ease);
}

.save-heart {
  color: var(--buoy);
  font-size: 1rem;
  line-height: 1;
  translate: 0 -1px;
}

.save-action:hover:not(:disabled) {
  border-color: var(--buoy);
}

.save-action.saved {
  background: var(--buoy-tint);
  border-color: var(--buoy);
  color: var(--buoy);
}

.signout-action {
  align-self: start;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: color var(--pace) var(--ease);
}

.signout-action:hover {
  color: var(--navy);
}

/* 5 · Forms -------------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  margin: 0;
}

.form-grid label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate-deep);
}

.form-grid input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--hairline-dark);
  border-radius: var(--radius-s);
  background: var(--paper);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--navy);
  transition: border-color var(--pace) var(--ease);
}

.form-grid input:hover {
  border-color: var(--slate);
}

.form-grid input:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 0;
  border-color: var(--navy);
}

.form-grid input::placeholder {
  color: var(--slate);
  opacity: 1;
}

.span-2 {
  grid-column: 1 / -1;
}

/* 6 · Topbar ------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(0, 32rem) auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: 0.8rem var(--gutter);
  background: var(--fog);
  border-bottom: 1px solid var(--hairline);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  color: var(--navy);
}

.brand-mark {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-s);
  background: var(--navy);
  color: var(--fog);
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1;
}

.brand-copy {
  display: grid;
  min-width: 0;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.375rem;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--slate);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-search {
  display: block;
  min-width: 0;
}

.market-search input {
  width: 100%;
  min-height: 2.625rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--navy);
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--navy);
  font-size: 0.9375rem;
}

.market-search input::placeholder {
  color: var(--slate);
  opacity: 1;
}

.market-search input:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.6rem);
  justify-self: end;
}

.account-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  max-width: 14rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--navy);
}

.account-link .account-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid transparent;
  transition: border-color var(--pace) var(--ease);
}

.account-link:hover .account-name {
  border-bottom-color: var(--navy);
}

.avatar {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--fog);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1;
}

/* 7 · Boot shell --------------------------------------------- */

.app-shell {
  min-height: 100vh;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  padding: 2rem;
  text-align: center;
}

.boot h1 {
  font-size: clamp(1.9rem, 5vw, 3rem);
  max-width: 22ch;
}

/* 8 · Page scaffold ------------------------------------------ */

.page {
  display: flex;
  flex-direction: column;
  gap: clamp(3.5rem, 8vw, 6.25rem);
  width: min(72.5rem, 100%);
  margin-inline: auto;
  padding: clamp(2.25rem, 5vw, 4rem) var(--gutter) clamp(4rem, 9vw, 6.5rem);
}

.section {
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem 2.5rem;
  flex-wrap: wrap;
  margin-bottom: clamp(1.5rem, 3.5vw, 2.5rem);
}

.section-head h2 {
  font-size: clamp(1.75rem, 3vw, 2.375rem);
  margin-top: 0.35rem;
}

.section-head p:not(.eyebrow) {
  margin-top: 0.6rem;
  max-width: 46ch;
  color: var(--slate);
}

/* 9 · Media frame & graceful image fallback ------------------ */
/* A reserved frame carries a quiet tide-line pattern and a serif
   monogram drawn from the maker's real name. The image floats
   above it; if the file is missing or fails, the frame simply
   stays — no raw alt text, no broken glyph. */

.media-frame {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-m);
  aspect-ratio: 4 / 5;
  background: repeating-linear-gradient(
      180deg,
      transparent 0 12px,
      rgba(28, 43, 57, 0.05) 12px 13px
    ),
    linear-gradient(180deg, var(--seafoam-tint), var(--seafoam));
}

.media-mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(3.25rem, 9vw, 4.5rem);
  line-height: 1;
  color: rgba(28, 43, 57, 0.3);
  user-select: none;
}

.media-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* if the browser paints alt text, it paints nothing visible */
  color: transparent;
  font-size: 0;
  transition: transform var(--pace) var(--ease);
}

.media-frame img.is-missing {
  visibility: hidden;
}

/* 10 · Tide row — the signature ledger ----------------------- */

.tide-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.125rem;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  transition: border-color var(--pace) var(--ease);
}

.tide-maker {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate);
}

.tide-figure {
  flex: 0 0 auto;
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

/* 11 · Hero -------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.hero-copy {
  animation: rise 640ms var(--ease) both;
}

.hero-copy h1 {
  margin-top: 0.9rem;
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  max-width: 13ch;
}

.hero-lede {
  margin-top: 1.35rem;
  max-width: 44ch;
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--slate);
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  margin-top: 2rem;
}

.detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.detail-actions .save-action {
  min-height: 2.75rem;
  padding: 0.5rem 1.35rem;
  font-size: 0.9375rem;
}

/* Stat chips, dissolved into one ruled row of small caps —
   distributed across the rule like entries in a tide table */
.promise-band {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 2.75rem;
  padding: 0.85rem 0.125rem;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.promise-band span {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--slate-deep);
}

/* Featured pieces — cards with the ledger under each image */
.hero-gallery {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
  align-items: start;
  animation: rise 640ms var(--ease) 90ms both;
}

.feature-card {
  display: block;
  width: 100%;
  min-width: 0;
  color: var(--navy);
}

.feature-card.large {
  grid-row: 1 / 3;
}

.feature-card .media-frame {
  aspect-ratio: 3 / 2;
}

.feature-card.large .media-frame {
  aspect-ratio: 4 / 5;
}

.feature-card:hover .media-frame img {
  transform: scale(1.02);
}

.feature-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
  margin-top: 0.75rem;
  padding: 0.55rem 0.125rem;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  transition: border-color var(--pace) var(--ease);
}

.feature-card:hover .feature-meta {
  border-color: var(--hairline-dark);
}

.feature-meta strong {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
}

.feature-figures {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--slate);
  white-space: nowrap;
}

/* 12 · Category rail ----------------------------------------- */

.category-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(13rem, 22vw, 16rem);
  gap: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-dark) transparent;
}

.category-card {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  scroll-snap-align: start;
  color: var(--navy);
}

.category-card .media-frame {
  aspect-ratio: 5 / 4;
  margin-bottom: 0.5rem;
}

.category-card .media-mark {
  font-size: 2.75rem;
}

.category-card:hover .media-frame img {
  transform: scale(1.02);
}

.category-card strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.15;
}

/* Description only — the media frame and its monogram are spans too,
   and must keep their own display (the mark centers with grid). */
.category-card span:not(.media-frame):not(.media-mark) {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--slate);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* 13 · Product cards & grid ---------------------------------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr));
  gap: 2.5rem 1.5rem;
}

.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-media {
  display: block;
  width: 100%;
}

.product-media:hover .media-frame img,
.product-media:focus-visible .media-frame img {
  transform: scale(1.02);
}

.product-card .tide-row {
  margin-top: 0.85rem;
}

.product-card:hover .tide-row {
  border-color: var(--hairline-dark);
}

.product-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.55rem;
  padding-top: 0.8rem;
}

.product-name {
  font-size: 1.25rem;
  line-height: 1.15;
}

.product-desc {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--slate);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-s);
  background: var(--seafoam);
  color: var(--navy);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meta-note {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--slate);
}

.product-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.9rem;
}

/* 14 · Maker story band -------------------------------------- */

.maker-story {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem 4rem;
  align-items: center;
  padding: clamp(2.25rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 3.5rem);
  border-radius: var(--radius-l);
  background: var(--seafoam);
}

.maker-story .eyebrow {
  color: var(--slate-deep);
}

.maker-story h2 {
  margin-top: 0.6rem;
  font-size: clamp(1.9rem, 3.4vw, 2.75rem);
  max-width: 14ch;
}

.maker-story > p {
  color: var(--slate-deep);
  max-width: 42ch;
}

.maker-story .btn-ghost {
  justify-self: start;
  background: transparent;
}

.maker-story .btn-ghost:hover:not(:disabled) {
  background: var(--fog);
}

/* 15 · Browse ------------------------------------------------ */

.collection-intro {
  max-width: 44rem;
}

.collection-intro h1 {
  margin-top: 0.9rem;
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
}

.collection-intro p:not(.eyebrow) {
  margin-top: 1.1rem;
  max-width: 52ch;
  font-size: 1.0625rem;
  color: var(--slate);
}

.market-browse {
  display: grid;
  grid-template-columns: minmax(14rem, 16.5rem) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
}

.browse-panel {
  position: sticky;
  top: 6.25rem;
}

.browse-panel h3 {
  font-size: 1.375rem;
  margin-bottom: 1rem;
}

.department-list {
  display: grid;
  border-top: 1px solid var(--hairline);
}

.department-list button {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--hairline);
  border-left: 2px solid transparent;
  color: var(--navy);
  transition: background-color var(--pace) var(--ease),
    border-color var(--pace) var(--ease);
}

.department-list button:hover {
  background: var(--paper);
}

.department-list button.active {
  background: var(--seafoam);
  border-left-color: var(--navy);
}

.department-list strong {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.department-list span {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--slate);
}

.department-list button.active span {
  color: var(--slate-deep);
}

.market-results {
  min-width: 0;
  display: grid;
  gap: 1.75rem;
}

.browse-grid {
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
}

.browse-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.8rem 0.125rem;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.browse-summary strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.browse-summary span {
  font-size: 0.8125rem;
  color: var(--slate);
}

.browse-summary .btn-ghost {
  min-height: 2.375rem;
  padding: 0.3rem 1rem;
  font-size: 0.8125rem;
}

/* 16 · Empty & status states --------------------------------- */

.empty-state {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  max-width: 34rem;
  margin-inline: auto;
  padding: clamp(2.25rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-l);
  background: var(--paper);
  text-align: center;
}

.empty-state h3 {
  font-size: 1.625rem;
}

.empty-state .btn-primary {
  margin-top: 0.5rem;
}

/* Full-page catalogue status (loading / error) */
.catalogue-status {
  max-width: none;
  min-height: 55vh;
  align-content: center;
  border: 0;
  background: none;
}

.catalogue-status h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  max-width: 18ch;
}

.catalogue-status .muted {
  max-width: 52ch;
}

.catalogue-error h1 {
  color: var(--navy);
}

.catalogue-error .muted {
  color: var(--buoy);
}

.tide-loader {
  width: 4.5rem;
  height: 2px;
  margin-top: 0.75rem;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--hairline) 0 40%, var(--navy) 50%, var(--hairline) 60% 100%);
  background-size: 300% 100%;
  animation: tide-sweep 1.6s linear infinite;
}

@keyframes tide-sweep {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: 0% 0;
  }
}

/* 17 · Product detail ---------------------------------------- */

.back-action {
  margin-bottom: 1.75rem;
  font-size: 0.875rem;
}

.detail-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.detail-media .media-frame {
  aspect-ratio: 4 / 5;
}

.detail-media .media-mark {
  font-size: clamp(4.5rem, 8vw, 7rem);
}

.detail-copy h1 {
  margin-top: 0.9rem;
  font-size: clamp(2.1rem, 4vw, 3.125rem);
  max-width: 16ch;
}

.detail-price {
  margin-top: 1.5rem;
  padding: 0.7rem 0.125rem;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  font-size: 1.375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.detail-lede {
  margin-top: 1.5rem;
  max-width: 48ch;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--slate);
}

/* Provenance, set as ledger rows */
.provenance {
  margin-top: 2rem;
  border-top: 1px solid var(--hairline);
}

.provenance div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  padding: 0.7rem 0.125rem;
  border-bottom: 1px solid var(--hairline);
}

.provenance strong {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate-deep);
}

.provenance span {
  font-size: 0.875rem;
  color: var(--navy);
}

/* 18 · Auth -------------------------------------------------- */

.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: start;
}

.auth-story {
  padding-top: clamp(0rem, 3vw, 2.5rem);
}

.auth-story h1 {
  margin-top: 0.9rem;
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  max-width: 13ch;
}

.auth-story > p:not(.eyebrow) {
  margin-top: 1.1rem;
  max-width: 42ch;
  font-size: 1.0625rem;
  color: var(--slate);
}

.auth-benefits {
  display: grid;
  margin-top: 2.25rem;
  border-top: 1px solid var(--hairline);
  max-width: 26rem;
}

.auth-benefits span {
  padding: 0.7rem 0.125rem;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-deep);
}

.account-card {
  display: grid;
  gap: 1.25rem;
  align-content: start;
  padding: clamp(1.5rem, 3.5vw, 2.25rem);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-l);
  background: var(--paper);
}

.auth-card {
  gap: 1.5rem;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--hairline);
}

.tabs button {
  padding: 0.7rem 0.5rem;
  margin-bottom: -1px;
  text-align: center;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--slate);
  border-bottom: 2px solid transparent;
  transition: color var(--pace) var(--ease),
    border-color var(--pace) var(--ease);
}

.tabs button:hover {
  color: var(--navy);
}

.tabs button.active {
  color: var(--navy);
  font-weight: 600;
  border-bottom-color: var(--navy);
}

.auth-heading h2 {
  margin-top: 0.4rem;
  font-size: 1.75rem;
}

.auth-heading .muted {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
}

.demo-login {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-m);
  background: var(--seafoam);
}

.demo-login > div {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  min-width: 0;
}

.demo-login strong {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--navy);
}

.demo-login code {
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-s);
  background: var(--paper);
  border: 1px solid var(--hairline);
  color: var(--slate-deep);
}

.demo-login .link-action {
  font-size: 0.875rem;
}

.privacy-note {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--slate);
}

/* 19 · Account ----------------------------------------------- */

.account-page {
  gap: clamp(2.5rem, 6vw, 4.5rem);
}

.account-welcome {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.profile-avatar {
  flex: 0 0 auto;
  width: 4rem;
  height: 4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--fog);
  font-family: var(--serif);
  font-size: 1.875rem;
  line-height: 1;
}

.account-welcome h1 {
  margin-top: 0.35rem;
  font-size: clamp(1.9rem, 3.6vw, 2.75rem);
}

.account-welcome p:not(.eyebrow) {
  margin-top: 0.4rem;
  color: var(--slate);
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.account-card h2 {
  font-size: 1.625rem;
}

.account-card .muted {
  font-size: 0.9375rem;
}

/* Account details as a tide-table ledger */
.profile-summary dl {
  margin: 0;
  display: grid;
  border-top: 1px solid var(--hairline);
}

.profile-summary dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.125rem;
  border-bottom: 1px solid var(--hairline);
}

.profile-summary dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate);
}

.profile-summary dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: right;
}

/* Membership row carries a raw role token (e.g. "user") */
.profile-summary dl div:last-child dd {
  text-transform: capitalize;
}

.profile-form {
  margin-top: 0.25rem;
}

.saved-section {
  min-width: 0;
}

/* 20 · Footer ------------------------------------------------ */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding: clamp(2rem, 5vw, 3rem) var(--gutter);
  background: var(--navy);
  color: var(--fog);
}

.site-footer > div {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

.site-footer .brand-mark {
  background: var(--fog);
  color: var(--navy);
}

.site-footer p {
  line-height: 1.45;
}

.site-footer p strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.25rem;
}

.site-footer p span {
  font-size: 0.8125rem;
  color: #c6cfd6;
}

.site-footer nav {
  display: inline-flex;
  gap: 1.75rem;
}

.site-footer nav button {
  color: var(--fog);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color var(--pace) var(--ease);
}

.site-footer nav button:hover {
  border-bottom-color: var(--fog);
}

.site-footer :focus-visible {
  outline-color: var(--fog);
}

.site-footer small {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: #c6cfd6;
}

/* 21 · Notices & session ------------------------------------- */

.notice {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 60;
  max-width: min(26rem, calc(100vw - 2.5rem));
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-m);
  background: var(--navy);
  color: var(--fog);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: var(--shadow-toast);
  translate: -50% 0;
  animation: toast-in 260ms var(--ease) both;
}

.notice.error {
  background: var(--paper);
  color: var(--buoy);
  border: 1px solid var(--buoy);
}

@keyframes toast-in {
  from {
    opacity: 0;
    translate: -50% 10px;
  }

  to {
    opacity: 1;
    translate: -50% 0;
  }
}

.session-status {
  position: fixed;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-m);
  background: var(--paper);
  color: var(--slate);
  font-size: 0.8125rem;
  font-weight: 500;
}

.session-status::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--navy);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }

  50% {
    opacity: 1;
  }
}

/* 22 · Entrance motion --------------------------------------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* 23 · Responsive -------------------------------------------- */

@media (max-width: 64rem) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero-copy h1 {
    max-width: 16ch;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-story {
    padding-top: 0;
  }

  .market-browse {
    grid-template-columns: 1fr;
  }

  .browse-panel {
    position: static;
  }

  .department-list {
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    border-top: 0;
    gap: 0.5rem;
  }

  .department-list button {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-m);
    background: var(--paper);
  }

  .department-list button.active {
    border-color: var(--navy);
    border-left: 1px solid var(--navy);
    background: var(--seafoam);
  }
}

@media (max-width: 52.5rem) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "search search";
    column-gap: 0.9rem;
    row-gap: 0.7rem;
  }

  .brand {
    grid-area: brand;
  }

  .market-search {
    grid-area: search;
  }

  .top-actions {
    grid-area: actions;
    gap: 0.9rem;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
    font-size: 1.2rem;
  }

  .brand-name {
    font-size: 1.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-sub {
    display: none;
  }

  .account-link .account-name {
    max-width: 6rem;
  }

  .detail-view {
    grid-template-columns: 1fr;
  }

  .detail-media {
    max-width: 30rem;
  }

  .account-layout {
    grid-template-columns: 1fr;
  }

  .maker-story {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
}

@media (max-width: 33.75rem) {
  /* On narrow screens the promise band becomes a true tide table:
     one entry per ruled row instead of a ragged wrap. */
  .promise-band {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    border-bottom: 0;
  }

  .promise-band span {
    padding: 0.7rem 0.125rem;
    border-bottom: 1px solid var(--hairline);
  }

  .hero-gallery {
    grid-template-columns: 1fr;
  }

  .feature-card.large {
    grid-row: auto;
  }

  .feature-card .media-frame,
  .feature-card.large .media-frame {
    aspect-ratio: 3 / 2;
  }

  .product-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem 1rem;
  }

  .product-name {
    font-size: 1.125rem;
  }

  .product-actions {
    justify-content: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .account-welcome {
    align-items: flex-start;
  }

  .profile-avatar {
    width: 3.25rem;
    height: 3.25rem;
    font-size: 1.5rem;
  }
}

@media (max-width: 25rem) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

/* 24 · Reduced motion ---------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
