/* Better Days Bakery: coming-soon page.
   Colors are the identity kit's proposed sRGB values (Brand Guidelines p.6), not recovered source values.
   Cream is sampled from the guideline paper and is provisional. */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-500.v1.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-italic-500.v1.woff") format("woff");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dmsans-400.v1.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dmsans-500.v1.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
/* Metric-matched fallbacks so the swap to web fonts barely moves the layout. */
@font-face {
  font-family: "Serif fallback";
  src: local("Times New Roman"), local("TimesNewRomanPSMT"), local("Liberation Serif");
  size-adjust: 96.83%;
  ascent-override: 95.42%;
  descent-override: 29.64%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Sans fallback";
  src: local("Arial"), local("ArialMT"), local("Liberation Sans");
  size-adjust: 103.88%;
  ascent-override: 95.49%;
  descent-override: 29.84%;
  line-gap-override: 0%;
}

:root {
  --blush: #F6E2DC;
  --cream: #FFFAF7;
  --ink: #25251F;
  --gold: #947040;
  --cocoa: #70553C;
  --error: #9A2B22;
  --serif: "Cormorant Garamond", "Serif fallback", Georgia, serif;
  --sans: "DM Sans", "Sans fallback", Arial, Helvetica, sans-serif;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--blush);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--blush);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
}

h1, h2, h3, p { margin: 0; }

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

/* ---------- Layout: one centered column on phones and tablets ---------- */

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) 2rem max(1.25rem, env(safe-area-inset-left));
  text-align: center;
}

.brand {
  margin: 0 auto;
  /* Full signature: the SVG canvas already carries the logo's clear space. */
  width: min(100%, 22.5rem);
  line-height: 0;
  font-size: 1rem;
}

.brand__logo {
  display: block;
  width: 100%;
  height: auto;
}

.intro {
  margin-top: 0.5rem;
}

.intro__label {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.3125rem;
  line-height: 1.2;
  color: var(--cocoa);
}

.intro__headline {
  max-width: 11.5em; /* always two balanced lines, never one long line */
  margin: 0.375rem auto 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.intro__text {
  max-width: 31ch;
  margin: 1rem auto 0;
  text-wrap: pretty;
}

/* ---------- Signup ---------- */

.signup,
.done {
  max-width: 25.5rem;
  margin: 1.75rem auto 0;
  text-align: left;
}

.signup__fields {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.signup__label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.3;
}

.signup__row {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--cream);
  border: 1.5px solid var(--ink);
  border-radius: 0.875rem;
}

.signup__row:has(.signup__input:focus-visible) {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.signup__row[data-invalid] { border-color: var(--error); }

.signup__row[data-invalid]:has(.signup__input:focus-visible) { outline-color: var(--error); }

.signup__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 3rem;
  margin: 0;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 0.625rem;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem; /* 17px: avoids iOS zoom on focus */
  outline: none;
  scroll-margin: 5rem 0 9rem;
}

.signup__input::-webkit-search-decoration { display: none; }

.signup__button {
  flex: 0 0 auto;
  min-width: 7.25rem;
  min-height: 3rem;
  margin: 0;
  padding: 0 1.125rem;
  border: 0;
  border-radius: 0.625rem;
  background: var(--ink);
  color: var(--cream);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 120ms ease;
}

.signup__button:hover { background: #3a3a31; }

.signup__button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.signup[aria-busy="true"] .signup__button {
  cursor: progress;
  background: #4a4a40;
}

.signup__error {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  margin-top: 0.5rem;
  color: var(--error);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
}

/* Small "!" badge so errors are not signalled by color alone. */
.signup__error::before,
.signup__status[data-kind="error"]::before {
  content: "!";
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.06rem;
  border-radius: 50%;
  background: var(--error);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
}

.signup__error[hidden] { display: none; }

.signup__status {
  min-height: 0;
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.signup__status:empty { margin-top: 0; }

.signup__status[data-kind="error"] {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  color: var(--error);
  font-weight: 500;
}

/* Busy text is for screen readers; the button already shows "Sending…". */
.signup__status[data-kind="busy"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.signup__note {
  margin-top: 0.75rem;
  color: var(--cocoa);
  font-size: 0.875rem;
  line-height: 1.5;
}

.signup__closed { display: none; }

/* Honeypot: off-screen, not focusable, hidden from assistive tech. */
.signup__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Closed state: shown only if the server has not been connected to the email list. */
.signup[data-signup="closed"] .signup__row {
  border-color: rgba(37, 37, 31, 0.35);
  background: rgba(255, 250, 247, 0.55);
}
.signup[data-signup="closed"] .signup__input,
.signup[data-signup="closed"] .signup__button { cursor: not-allowed; }
.signup[data-signup="closed"] .signup__button { background: rgba(37, 37, 31, 0.45); }
.signup[data-signup="closed"] .signup__label { color: rgba(37, 37, 31, 0.7); }
.signup[data-signup="closed"] .signup__note { display: none; }
.signup[data-signup="closed"] .signup__closed {
  display: block;
  margin-top: 0.75rem;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
}

/* ---------- Confirmation ---------- */

.done[hidden] { display: none; }

.done {
  padding: 1.25rem 1.25rem 1.125rem;
  background: var(--cream);
  border: 1.5px solid var(--ink);
  border-radius: 0.875rem;
}

.done__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1.1;
}

.done__title:focus { outline: none; }
.done__title:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 2px;
}

.done__text { margin-top: 0.5rem; }

.done__email {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.done__aside {
  margin-top: 0.5rem;
  color: var(--cocoa);
  font-size: 0.875rem;
  line-height: 1.5;
}

.done__reset {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

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

@media (prefers-reduced-motion: no-preference) {
  .done:not([hidden]) { animation: done-in 240ms ease-out; }
  @keyframes done-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
  }
}

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

.footer {
  flex: 0 0 auto;
  padding: 1rem 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  color: var(--cocoa);
  font-size: 0.8125rem;
  text-align: center;
}

/* ---------- Short phones: keep the form close to the first screen ---------- */

@media (max-width: 599px) and (max-height: 700px) {
  .brand { width: min(100%, 17.5rem); }
  .intro__headline { font-size: 2.125rem; }
  .intro__text { margin-top: 0.75rem; }
  .signup, .done { margin-top: 1.25rem; }
}

/* ---------- Tablets: centre the composition vertically ---------- */

@media (min-width: 600px) and (max-width: 959px) {
  .brand { width: min(100%, 26rem); }
  .page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 2.5rem;
  }
}

/* 1x screens in the tablet range (usually narrow desktop windows): keep the
   BETTER DAYS line at the guideline's 480 px minimum. */
@media (min-width: 600px) and (max-width: 959px) and (max-resolution: 1.49dppx) {
  .brand { width: min(100%, 33.5rem); }
}

/* ---------- Very narrow phones ---------- */

@media (max-width: 359px) {
  .signup__input { padding: 0 0.5rem; }
  .signup__button { min-width: 6.25rem; padding: 0 0.875rem; }
}

@media (max-width: 299px) {
  .signup__row { flex-wrap: wrap; }
  .signup__input { flex-basis: 100%; }
  .signup__button { flex-basis: 100%; }
}

/* ---------- Wide screens: logo and signup side by side ---------- */

@media (min-width: 960px) {
  .page {
    display: grid;
    grid-template-columns: minmax(0, 36rem) minmax(0, 27rem);
    justify-content: center;
    align-items: center;
    column-gap: clamp(3rem, 7vw, 6.5rem);
    max-width: none;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    text-align: left;
  }
  .brand {
    /* ≥ 534px wide keeps the BETTER DAYS line ≥ 480px on 1x screens (Brand Guidelines p.5). */
    width: 100%;
    min-width: 33.5rem;
  }
  .intro { margin-top: 0; }
  .intro__headline { font-size: 3.25rem; margin-left: 0; }
  .intro__text { margin-left: 0; max-width: 30ch; font-size: 1.125rem; }
  .signup,
  .done { margin-left: 0; }
}

/* No-JavaScript fallback response from /api/subscribe */
.page--message {
  display: block;
  max-width: 32rem;
  padding-top: 3rem;
}
.page--message .done { margin: 0 auto; animation: none; }
.message__logo { display: block; width: min(100%, 17.5rem); margin: 0 auto 1rem; }
.message__logo img { display: block; width: 100%; height: auto; }
.page--message a { color: inherit; }

/* /confirmed: secondary line under the confirmation text */
.intro__aside {
  max-width: 31ch;
  margin: 0.75rem auto 0;
  color: var(--cocoa);
  font-size: 0.9375rem;
}
@media (min-width: 960px) {
  .intro__aside { margin-left: 0; }
}
