/* ===============================================================
   Brand faces, self-hosted.

   Ease ships each weight as its own family ("Ease SemiDisplay Medium"
   is a family, not a style), so the two Ease files are mapped onto one
   CSS family at different weights. That way font-weight works normally
   in the stylesheet.

   Not subsetted on purpose: the Concrette M licence forbids modifying
   or reassembling the files, and subsetting does both.
   =============================================================== */

@font-face {
  font-family: 'Ease';
  src: url('assets/fonts/EaseStandard-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Ease';
  src: url('assets/fonts/EaseSemiDisplay-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Concrette M';
  src: url('assets/fonts/ConcretteM-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ===============================================================
   KilgourMD — Afternoon Tea RSVP gate
   Values map 1:1 to the Figma file "RSVP.KILGOURMD.COM".
   =============================================================== */

:root {
  /* Brand palette. Do not add colours outside this set. */
  --maroon:      #772121;
  --celeste:     #B6CDEA;
  --cloud:       #F6F6F4;
  --white:       #FFFFFF;
  --black:       #000000;
  --linen:       #E7DFD4;
  --taupe:       #8E8482;

  /* Body text only. Brand Taupe is 3.36:1 on Cloud and fails WCAG AA;
     this clears it at 4.46:1. Use --taupe for fills, rules and borders. */
  --taupe-text:  #79706E;

  --font-sans:   'Ease', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif:  'Concrette M', Georgia, 'Times New Roman', serif;

  --ease:        cubic-bezier(.22, 1, .36, 1);
  --ease-shake:  cubic-bezier(.36, .07, .19, .97);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--cloud);
  color: var(--black);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* --- atmosphere -------------------------------------------------
   Two soft blooms, strictly on-palette, that warm the page without
   introducing a gradient with visible banding.                     */
body::before,
body::after {
  content: '';
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(150px);
  pointer-events: none;
}
body::before {                      /* warm, lower */
  width: 76vw; height: 52vh;
  left: 12vw; bottom: -14vh;
  background: var(--linen);
  opacity: .70;
}
body::after {                       /* cool, upper right */
  width: 52vw; height: 46vh;
  right: -10vw; top: -16vh;
  background: var(--celeste);
  opacity: .30;
}

/* --- page ------------------------------------------------------- */
.page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 100px;   /* bottom > top biases the stack upward */
}
.stack {
  width: 100%;
  max-width: 720px;
  text-align: center;
}

/* --- type ------------------------------------------------------- */
/* Set as type, not an image. Sentence case on purpose: "KilgourMD" has
   internal structure that all-caps flattens, and uppercase made it read
   as a kicker label rather than the brand. -1% tracking is the
   brand-spec figure for emphasis. */
.wordmark {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--maroon);
}
.headline {
  margin: 26px 0 0;
  font-family: var(--font-serif);
  font-size: 90px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--maroon);
}
.subhead {
  margin: 18px 0 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -.02em;
  color: var(--black);
}
.body {
  margin: 14px auto 0;
  max-width: 560px;
  font-size: 15.5px;
  line-height: 1.68;
  letter-spacing: -.01em;
  color: var(--taupe-text);
}

/* --- the bar ---------------------------------------------------- */
.gate { margin: 42px 0 0; }

.bar {
  width: 100%;
  max-width: 500px;
  height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border: 1px solid var(--taupe);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(119, 33, 33, .05);
  transition:
    border-color   180ms var(--ease),
    box-shadow     180ms var(--ease),
    padding-right  180ms var(--ease);
}

/* focus: ring blooms, border goes maroon, shadow deepens.
   Border width stays 1px so nothing reflows; the extra weight is a
   1px shadow ring stacked underneath the soft one. */
.bar:focus-within {
  border-color: var(--maroon);
  box-shadow:
    0 0 0 1px var(--maroon),
    0 0 0 5px rgba(119, 33, 33, .30),
    0 4px 14px rgba(119, 33, 33, .10);
}
.bar.is-error {
  border-color: var(--maroon);
  box-shadow:
    0 0 0 1px var(--maroon),
    0 0 0 5px rgba(119, 33, 33, .38),
    0 4px 14px rgba(119, 33, 33, .10);
}

/* --- field ------------------------------------------------------ */
.field {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
}
.field-label {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -.01em;
  color: var(--taupe-text);
  pointer-events: none;
  transition:
    transform      220ms var(--ease),
    font-size      220ms var(--ease),
    letter-spacing 220ms var(--ease),
    color          180ms var(--ease);
}
.bar:focus-within .field-label,
.bar.has-value   .field-label {
  transform: translateY(calc(-50% - 11px));
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .10em;
}
.bar.is-error .field-label { color: var(--maroon); }

.field-input {
  width: 100%;
  height: 100%;
  padding: 22px 0 0;
  border: 0;
  background: none;
  font-family: inherit;
  /* 17px on purpose. Under 16px, iOS Safari zooms the page on focus. */
  font-size: 17px;
  letter-spacing: .01em;
  color: var(--black);
  caret-color: var(--maroon);
}
.field-input:focus { outline: none; }
.field-input::placeholder { color: transparent; }

/* --- submit -----------------------------------------------------
   Hidden until something is typed. max-width rather than display so
   the input gives the space up smoothly instead of the value jumping. */
.submit {
  flex: none;
  height: 50px;
  max-width: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--maroon);
  color: var(--white);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -.01em;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translateX(6px) scale(.92);
  transition:
    max-width 180ms var(--ease),
    padding   180ms var(--ease),
    opacity   180ms var(--ease),
    transform 180ms var(--ease),
    background-color 140ms var(--ease);
}
.bar.has-value .submit {
  max-width: 220px;
  padding: 0 24px;
  opacity: 1;
  transform: translateX(0) scale(1);
}
.bar.has-value { padding-right: 9px; }

.submit:hover  { background: #661c1c; }   /* Maroon, 8% darker */
.submit:active { background: #5a1919; }
.submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--cloud), 0 0 0 6px rgba(119, 33, 33, .55);
}
.submit[disabled] { opacity: .55; cursor: not-allowed; }

.submit-spinner { display: none; width: 18px; height: 18px; }
.bar.is-busy .submit-label   { display: none; }
.bar.is-busy .submit-spinner {
  display: block;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- messages --------------------------------------------------- */
.message {
  margin: 0;
  max-width: 500px;
  margin-inline: auto;
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: -.01em;
  color: var(--maroon);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 160ms var(--ease), max-height 160ms var(--ease), margin-top 160ms var(--ease);
}
.message.is-shown {
  opacity: 1;
  max-height: 60px;
  margin-top: 12px;
}

.help {
  margin: 24px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: -.01em;
  color: var(--taupe-text);
}
.help a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.help a:focus-visible { outline: 2px solid var(--maroon); outline-offset: 3px; border-radius: 2px; }

/* --- shake ------------------------------------------------------ */
@keyframes shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-14px); }
  40%  { transform: translateX(12px); }
  60%  { transform: translateX(-8px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
.bar.is-shaking { animation: shake 420ms var(--ease-shake); }

/* ===============================================================
   Mobile. Breaks at 820px so iPad portrait (768px) never lands in
   the gap between the 720px column and this layout.
   =============================================================== */
@media (max-width: 820px) {
  .page { padding: 24px 24px 18vh; }   /* bias upward, clear of browser chrome */
  .stack { max-width: 342px; }

  .wordmark { font-size: 20px; }
  .headline { margin-top: 20px; font-size: 44px; }
  .subhead  { margin-top: 14px; font-size: 17px; }
  .body     { margin-top: 11px; max-width: 334px; font-size: 15px; }

  .gate { margin-top: 30px; }
  .bar  { max-width: 342px; height: 64px; gap: 10px; padding: 0 18px; }
  .bar.has-value { padding-right: 8px; }
  .submit { height: 46px; font-size: 14.5px; }
  .bar.has-value .submit { padding: 0 20px; }

  .help { margin-top: 20px; font-size: 12.5px; }
  .message { font-size: 13px; }

  /* Smaller amplitude: on a 342px bar the desktop throw reads as violent. */
  @keyframes shake {
    0%   { transform: translateX(0); }
    20%  { transform: translateX(-10px); }
    40%  { transform: translateX(9px); }
    60%  { transform: translateX(-6px); }
    80%  { transform: translateX(3px); }
    100% { transform: translateX(0); }
  }
}

@media (max-width: 380px) {
  .headline { font-size: 38px; }
}

/* ===============================================================
   Reduced motion: keep every colour, border and ring change.
   Drop the translate, the float and the spin.
   =============================================================== */
@media (prefers-reduced-motion: reduce) {
  .bar.is-shaking { animation: none; }
  .bar.is-busy .submit-spinner { animation: none; }
  .field-label,
  .submit,
  .bar,
  .message { transition-duration: 1ms; }
  .submit { transform: none; }
}
