/*
  Bridey landing page: public/home/index.html, served at / by the rewrite in next.config.ts.
  Plain CSS, no framework. Every colour, font, radius and spacing value below reads from :root.
  It styles bare elements, so it must never load inside the Next app.
*/

:root {
  /* colour */
  --veil: #FBF9F6;     /* page background, text on dark fills */
  --silk: #F2EDE6;     /* photo backing, form fields, footer */
  --mocha: #B79C88;    /* mid-tone: ONE full-width band per page */
  --line: #E0D8CC;     /* 1px decorative hairlines only */
  --fawn: #725E4D;     /* secondary text on veil/silk, input borders */
  --truffle: #2F211B;  /* all main text, primary buttons, focus ring */
  --rouge: #6C1F2B;    /* single small accent, see rules */

  /* type ("Instrument Serif fallback" is Georgia sized to match, see the @font-face rules below) */
  --font-serif: "Instrument Serif", "Instrument Serif fallback", Georgia, serif;
  --font-sans: "Instrument Sans", system-ui, sans-serif;

  /* spacing */
  --space-2: 8px;  --space-4: 16px; --space-6: 24px;
  --space-10: 40px; --space-16: 64px; --space-24: 96px;

  /* radius (STYLEGUIDE.md → Shape) */
  --radius-none: 0;      /* full-width bands only */
  --radius-soft: 6px;    /* every box: photos, fields, panels, cards */
  --radius-small: 4px;   /* small marks: checkboxes, swatches */
  --radius-pill: 999px;  /* buttons only */

  /* type sizes from the type table, in rem so they follow the reader's font size (1rem = 16px) */
  --size-display: clamp(3.5rem, 9.4vw, 8.5rem);  /* 56-136px */
  --size-band: clamp(2.75rem, 5.6vw, 5rem);      /* 44-80px, the sell band heading */
  --size-heading: clamp(2.25rem, 3.4vw, 3rem);   /* 36-48px */
  --size-footer-mark: 3.5rem;                     /* 56px */
  --size-wordmark: 2.75rem;                       /* 44px */
  --size-accent: 1.75rem;                         /* 28px */
  --size-title: 1.5rem;                           /* 24px */
  --size-body: 1rem;                              /* 16px */
  --size-label: 0.875rem;                         /* 14px */
  --size-small: 0.8125rem;                        /* 13px */
  --size-subheading: 0.75rem;                     /* 12px */
  --size-designer: 0.6875rem;                     /* 11px, designer names on cards */
  --size-tagline: 0.625rem;                       /* 10px, the footer tagline */

  /* layout */
  --container: 1280px;
  --gutter: clamp(var(--space-6), 4.5vw, var(--space-16));
  --section-pad: clamp(var(--space-16), 6.7vw, var(--space-24));
  --grid-gap: clamp(var(--space-4), 1.9vw, var(--space-6));
  --hero-gap: clamp(var(--space-2), 1.1vw, var(--space-4));
  --hero-pull: clamp(calc(-1 * var(--space-10)), -2.8vw, calc(-1 * var(--space-4)));
  --measure-band: 880px;
  --measure-signup: 640px;
  --measure-lead: 480px;
  /* the row width at which a grid changes its count (see "Grids") */
  --switch-cards: 56rem;   /* listing cards: 4 across above, 2 below */
  --switch-thirds: 40rem;  /* edit tiles and steps: 3 across above, 1 below */

  /* components */
  --hairline: 1px;
  --target: 44px;          /* smallest touch target */
  --control-height: 48px;  /* buttons and the email field */
  --button-pad: 28px;
  --underline: 1px;
  --underline-offset: 5px;
  --focus-width: 2px;
  --focus-offset: 2px;
  --ease: 160ms ease;
}

/*
  Georgia scaled to Instrument Serif's width and height, so serif text breaks onto the same
  lines before and after the web font arrives (font-display: swap) and the page doesn't jump.
  Measured in Chrome: Instrument Serif runs 75.8% of Georgia's width (78.1% in italic), with an
  ascent of 0.99em and a descent of 0.31em. The overrides are divided by size-adjust, which scales them.
*/
@font-face {
  font-family: "Instrument Serif fallback";
  src: local("Georgia");
  size-adjust: 75.8%;
  ascent-override: 130.6%;
  descent-override: 40.9%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Instrument Serif fallback";
  font-style: italic;
  src: local("Georgia Italic"), local("Georgia-Italic");
  size-adjust: 78.1%;
  ascent-override: 126.8%;
  descent-override: 39.7%;
  line-gap-override: 0%;
}

/* ---- Base ---------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--veil);
  color: var(--truffle);
  font-family: var(--font-sans);
  font-size: var(--size-body);
  line-height: 1.625rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ul, ol { margin: 0; }
h1, h2, h3 { font-weight: 400; text-wrap: balance; }
p { text-wrap: pretty; }
ul[role="list"], ol[role="list"] { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }

:focus-visible {
  outline: var(--focus-width) solid var(--truffle);
  outline-offset: var(--focus-offset);
}

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

/* ---- Type styles ----------------------------------------------------------------- */

.t-display {
  font-family: var(--font-serif);
  font-size: var(--size-display);
  line-height: 0.88;
  letter-spacing: -0.03em;
  text-align: center;
}

.t-heading {
  font-family: var(--font-serif);
  font-size: var(--size-heading);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.t-title {
  font-family: var(--font-serif);
  font-size: var(--size-title);
  line-height: 1.2;
}

.t-accent {
  font-family: var(--font-serif);
  font-size: var(--size-accent);
  font-style: italic;
  line-height: 1.2;
}

.t-subheading {
  font-family: var(--font-sans);
  font-size: var(--size-subheading);
  font-weight: 600;
  line-height: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.t-body {
  font-family: var(--font-sans);
  font-size: var(--size-body);
  line-height: 1.625rem;
}

.t-small {
  font-family: var(--font-sans);
  font-size: var(--size-small);
  line-height: 1.25rem;
  color: var(--fawn);
}

.t-label {
  font-family: var(--font-sans);
  font-size: var(--size-label);
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: 0.02em;
}

/* ---- Layout ---------------------------------------------------------------------- */

.container {
  width: min(var(--container), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.section { padding-block: var(--section-pad); }

/* A ruled section: the hairline sits on the content edges, with the section's space below it. */
.section--ruled { padding-block-start: 0; }
.section--ruled > .container {
  padding-block-start: var(--section-pad);
  border-block-start: var(--hairline) solid var(--line);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  margin-block-end: var(--space-10);
}

/*
  Grids. A row picks its column count from its own width, with no media queries:
  (switch - 100%) * 999 lands far below the smaller track size when the row is wider
  than the switch and far above the larger one when it is narrower, so clamp() returns
  one of the two. The 0.1px keeps sub-pixel rounding from dropping a column.
*/
.cards,
.tiles,
.steps {
  display: grid;
  column-gap: var(--grid-gap);
  row-gap: var(--space-10);
}

.cards {
  --many: calc((100% - 3 * var(--grid-gap)) / 4 - 0.1px);
  --few: calc((100% - var(--grid-gap)) / 2 - 0.1px);
  grid-template-columns: repeat(auto-fill, minmax(clamp(var(--many), (var(--switch-cards) - 100%) * 999, var(--few)), 1fr));
}

.tiles,
.steps {
  --many: calc((100% - 2 * var(--grid-gap)) / 3 - 0.1px);
  grid-template-columns: repeat(auto-fill, minmax(clamp(var(--many), (var(--switch-thirds) - 100%) * 999, 100%), 1fr));
}

/* ---- Links and buttons ------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 var(--button-pad);
  border: var(--hairline) solid var(--truffle);
  border-radius: var(--radius-pill);
  background: var(--truffle);
  color: var(--veil);
  font-family: var(--font-sans);
  font-size: var(--size-label);
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--ease), color var(--ease);
}

.button:hover {
  background: transparent;
  color: var(--truffle);
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  font-family: var(--font-sans);
  font-size: var(--size-label);
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-decoration-thickness: var(--underline);
  text-underline-offset: var(--underline-offset);
  transition: color var(--ease);
}

.text-link:hover { color: var(--rouge); }

/* Navigation and footer links: no underline until hovered. */
.nav-link,
.site-footer__links a,
.site-footer__legal a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
}

.nav-link {
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-sans);
  font-size: var(--size-subheading);
  font-weight: 600;
  line-height: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.nav-link:hover,
.site-footer__links a:hover,
.site-footer__legal a:hover,
.card:hover .card__link,
.tile:hover .tile__link {
  text-decoration: underline;
  text-decoration-thickness: var(--underline);
  text-underline-offset: var(--underline-offset);
}

.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 2;
}

/* ---- Header ------------------------------------------------------------------------ */

.site-header__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: var(--space-6);
  padding-block: var(--space-6);
}

.wordmark {
  display: inline-flex;
  grid-row: 1;
  grid-column: 2;
  align-items: center;
  min-height: var(--target);
  font-family: var(--font-serif);
  font-size: var(--size-wordmark);
  line-height: 1;
  letter-spacing: -0.02em;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-6);
}

.site-nav--main { grid-row: 1; grid-column: 1; justify-self: start; }
.site-nav--account { grid-row: 1; grid-column: 3; justify-self: end; }

.menu-toggle { display: none; }

/* Narrow screens: with the script, the two navs fold behind the menu button;
   without it, the row wraps to the wordmark over the two navs. */
@media (max-width: 47.99em) {
  .js .menu-toggle {
    display: inline-flex;
    grid-row: 1;
    grid-column: 1;
    justify-self: start;
  }

  .js .site-nav { display: none; }

  .js .site-header.is-open .site-nav {
    display: block;
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .js .site-header.is-open .site-nav--main {
    grid-row: 2;
    margin-block-start: var(--space-4);
    border-block-start: var(--hairline) solid var(--line);
  }

  .js .site-header.is-open .site-nav--account { grid-row: 3; }

  .js .site-nav ul { flex-direction: column; }

  .js .site-nav .nav-link {
    width: 100%;
    min-height: var(--control-height);
    border-block-end: var(--hairline) solid var(--line);
  }

  html:not(.js) .site-header__bar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  html:not(.js) .wordmark { grid-column: 1; }
  html:not(.js) .site-nav--main { grid-row: 2; grid-column: 1; justify-self: center; }
  html:not(.js) .site-nav--account { grid-row: 3; grid-column: 1; justify-self: center; }
  html:not(.js) .site-nav ul { justify-content: center; }
}

/* ---- Photo slots --------------------------------------------------------------------- */

/* A slot holds its ratio with or without a photo: drop an <img> in and it fills the frame. */
.frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-soft);
  background: var(--silk);
}

.frame--portrait { aspect-ratio: 3 / 4; }
.frame--4x5 { aspect-ratio: 4 / 5; }
.frame--mocha { background: var(--mocha); }

.frame > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame__caption {
  position: absolute;
  bottom: var(--space-4);
  left: var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--size-small);
  line-height: 1.25rem;
  color: var(--fawn);
}

.frame--mocha .frame__caption { color: var(--truffle); }
.frame:has(img) .frame__caption { display: none; }

/* ---- Hero ---------------------------------------------------------------------------- */

.hero { padding-block: var(--space-10) var(--section-pad); }

.hero__title {
  position: relative;
  z-index: 1;
}

.hero__title em { white-space: nowrap; }

.hero__photos {
  display: flex;
  align-items: flex-end;
  gap: var(--hero-gap);
  margin-block-start: var(--hero-pull);
}

.hero__photo { flex: 3 1 0; min-width: 0; }
.hero__photo--centre { flex-grow: 4; }

.hero__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6) var(--space-10);
  margin-block-start: var(--space-10);
}

.hero__lead { max-width: var(--measure-lead); }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-6);
}

/* ---- Edit tiles and listing cards ------------------------------------------------------ */

/* The title link stretches over its tile or card, so the whole piece is one target. */
.tile,
.card { position: relative; }

.tile__link::after,
.card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.tile .frame,
.card .frame { margin-block-end: var(--space-4); }

.card__designer {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--size-designer);
  font-weight: 600;
  line-height: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card__new { color: var(--rouge); }

.card__name { margin-block-start: var(--space-2); }

.card__price { margin-block-start: var(--space-2); }

/* ---- Sell band ------------------------------------------------------------------------- */

.sell-band {
  background: var(--mocha);
  color: var(--truffle);
}

.sell-band__inner {
  width: min(var(--measure-band), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-block: var(--section-pad);
  text-align: center;
}

.sell-band__title {
  margin-block: var(--space-6);
  font-family: var(--font-serif);
  font-size: var(--size-band);
  line-height: 1;
  letter-spacing: -0.02em;
}

.sell-band__title em { display: block; }

.sell-band .button { margin-block-start: var(--space-10); }

/* ---- How it works ---------------------------------------------------------------------- */

.step {
  padding-block-start: var(--space-6);
  border-block-start: var(--hairline) solid var(--truffle);
}

.step__number {
  margin-block-end: var(--space-4);
  color: var(--fawn);
}

.step__title { margin-block-end: var(--space-2); }

/* ---- Email sign-up --------------------------------------------------------------------- */

.signup {
  max-width: var(--measure-signup);
  margin-inline: auto;
  text-align: center;
}

.signup__text { margin-block-start: var(--space-4); }

.signup__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-4);
  margin-block-start: var(--space-10);
  text-align: start;
}

.field {
  display: flex;
  flex: 1 1 16rem;
  flex-direction: column;
  gap: var(--space-2);
}

.field__input {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: var(--hairline) solid var(--fawn);
  border-radius: var(--radius-soft);
  background: var(--silk);
  color: var(--truffle);
  font-size: var(--size-body);
}

.field__input::placeholder {
  color: var(--fawn);
  opacity: 1;
}

.signup__status:not(:empty) { margin-block-start: var(--space-4); }

/* ---- Footer ---------------------------------------------------------------------------- */

.site-footer { background: var(--silk); }

.site-footer__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-10) var(--space-16);
  padding-block: var(--section-pad) var(--space-16);
}

.site-footer__brand { flex: 1 1 18rem; }

.site-footer__mark {
  font-family: var(--font-serif);
  font-size: var(--size-footer-mark);
  line-height: 1;
  letter-spacing: -0.02em;
}

.site-footer__tagline {
  margin-block-start: var(--space-2);
  font-size: var(--size-tagline);
}

.site-footer__nav {
  display: grid;
  flex: 0 1 46rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-6);
}

.site-footer__title {
  margin-block-end: var(--space-2);
  color: var(--fawn);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 var(--space-6);
  padding-block: var(--space-4);
  border-block-start: var(--hairline) solid var(--line);
}

.site-footer__legal {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ---- Motion -------------------------------------------------------------------------- */

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