@font-face {
  font-family: "IM Fell French Canon";
  src: url("/assets/fonts/im-fell-french-canon-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --fell: "IM Fell French Canon", Georgia, serif;
  --text: "Cormorant Garamond", Georgia, serif;
  --fog: #f6f3ec;
  --bay: #141414;
  --bay-soft: #4a4a48;
    --ampersand: rgba(128, 120, 104, 0.3);
  --on-dark-muted: #cfccc4;
  --paper: #f6f3ec;


  /* One narrow column on every screen. Display type scales with the column. */
  --column: 100vw;
  --form-column: 100vw;
  --u: calc(var(--column) / 100);

  /* How far the type above and below reaches onto the photo. */
  --names-overlap: calc(var(--u) * 9);
  --eyebrow-overlap: calc(var(--u) * 7);
}

/* Larger screens: the card's type scales with --column, and the form's with rem. */
@media (min-width: 700px) {
  html {
    font-size: 116%;
  }

  :root {
    --column: min(100vw, 41rem);
    --form-column: 32rem;
  }
}

@media (min-width: 1000px) {
  html {
    font-size: 135%;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  font-variant-numeric: lining-nums;
  background: var(--fog);
  color: var(--bay);
  font-family: var(--text);
  font-weight: 500;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--fog);
}

.card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(max(14rem, var(--u) * 62), 1fr) auto auto;
  width: var(--column);
  min-height: 100vh;
  min-height: 100svh;
  margin-inline: auto;
  overflow: hidden;
}

/* Lets the names, Save the Date and details each take their own row around the photo. */
.details {
  display: contents;
}

.names {
  position: relative;
  z-index: 2;
  grid-row: 1;
  grid-column: 1;
  padding: calc(var(--u) * 5.1) calc(var(--u) * 6.15) 0;
  font-family: var(--fell);
  font-size: calc(var(--u) * 22);
  font-style: italic;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
}

.name {
  display: block;
  white-space: nowrap;
}

/* Closes the gap the font leaves after its W. */
.kern-w {
  margin-right: -0.17em;
}

.name--second {
  margin-top: 0.05em;
  text-align: right;
}

/* The foot of "Alan" and the ampersand hover over the top of the photo. */
.photo {
  position: relative;
  z-index: 0;
  grid-row: 2;
  grid-column: 1;
  min-height: 0;
  margin-top: calc(var(--names-overlap) * -1);
  overflow: hidden;
}

.photo img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Staggered to mirror the names: "Save" hovers over the bottom of the photo, "Date"
   drops to the right, and a soft "the" layers behind them like the ampersand. */
.eyebrow {
  position: relative;
  z-index: 2;
  grid-row: 3;
  grid-column: 1;
  margin-top: calc(var(--eyebrow-overlap) * -1);
  /* Based on the column, so the words sit as close together on the web as on a phone. */
  padding-inline: calc(var(--u) * 6.15);
  font-family: var(--fell);
  font-size: calc(var(--u) * 22);
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.06em;
  white-space: nowrap;
}

.eyebrow > span {
  display: block;
}

/* Paper-white over the photo, ink below it. The padding keeps the italic's overhang
   inside the painted area. */
.eyebrow-save {
  position: relative;
  z-index: 1;
  width: fit-content;
  padding-right: 0.15em;
  background: linear-gradient(to bottom, var(--paper) var(--eyebrow-overlap), var(--bay) 0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow-the {
  position: absolute;
  top: 0.48em;
  left: 0;
  width: 100%;
  color: var(--ampersand);
  text-align: center;
}

.eyebrow-date {
  position: relative;
  z-index: 1;
  margin-top: 0.05em;
  text-align: right;
}

.when-where {
  position: relative;
  z-index: 2;
  grid-row: 4;
  grid-column: 1;
  padding: calc(var(--u) * 1.5) 1.5rem calc(var(--u) * 5);
  font-family: var(--text);
  font-size: calc(var(--u) * 6.5);
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
}

.date {
  margin-bottom: -0.08em;
  font-size: calc(var(--u) * 13);
  font-style: italic;
  font-variant-numeric: oldstyle-nums;
  line-height: 1;
}

.place {
  font-family: var(--fell);
  font-size: calc(var(--u) * 11);
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

/* The one flourish: a giant, soft ampersand layered behind the names. */
.ampersand {
  position: absolute;
  top: calc(var(--u) * 13.1);
  left: calc(var(--u) * -5);
  z-index: 1;
  width: 1.3em;
  color: var(--ampersand);
  font-family: var(--fell);
  font-size: calc(var(--u) * 57);
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.04em;
  text-align: center;
  user-select: none;
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

.cta {
  display: inline-block;
  margin-top: 0.8em;
  padding: 0.5em 1.2em 0.6em;
  background: var(--bay);
  color: var(--paper);
  font-size: calc(var(--u) * 5.5);
  font-style: italic;
  text-decoration: none;
  transition: background-color 0.2s;
}

.cta:hover {
  background: var(--bay-soft);
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.address {
  display: grid;
  grid-template-columns: 1fr;
  /* The dark band runs edge to edge, with its content in the same column. */
  padding-inline: calc((100% - var(--form-column)) / 2);
  background: var(--bay);
  color: var(--paper);
}

.address-intro {
  padding: 3rem 1.5rem 0;
}

.address-intro h2 {
  max-width: 11em;
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.address-body {
  padding: 2.5rem 1.5rem 3.5rem;
}

.address-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem 1.5rem;
  max-width: 36rem;
}

.address-form[hidden] {
  display: none;
}

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

.field--wide,
.form-actions {
  grid-column: 1 / -1;
}

.field label {
  margin-bottom: 0.35rem;
  color: var(--on-dark-muted);
  font-size: 1.0625rem;
  font-style: italic;
}

.field input {
  width: 100%;
  padding: 0.35rem 0 0.5rem;
  border: 0;
  border-bottom: 1px solid #8f8a78;
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: 1.25rem;
  appearance: none;
}

.field input:focus {
  border-bottom-color: var(--paper);
  box-shadow: 0 1px 0 var(--paper);
  outline: none;
}

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--paper);
  transition: background-color 9999s;
}

.field input[aria-invalid] {
  border-bottom-color: #f2b8a8;
}

.form-note {
  margin-top: 1.25em;
  color: var(--on-dark-muted);
  font-size: 1.125rem;
  font-style: italic;
}

.name-check,
.address-check,
.address-fields {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 0;
  border: 0;
}

.address-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem 1.5rem;
}

.known-address {
  display: grid;
  margin-top: 0.4rem;
  font-size: 1.5rem;
  font-style: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.name-check legend,
.address-check legend {
  padding: 0;
  color: var(--on-dark-muted);
  font-size: 1.0625rem;
  font-style: italic;
}

.invite-name {
  margin-top: 0.4rem;
  font-size: 1.875rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.choices {
  display: flex;
  gap: 2rem;
  margin-top: 0.85rem;
  font-size: 1.25rem;
}

.field--corrected {
  margin-top: 1.25rem;
}

[data-mononym] .field--corrected {
  margin-top: 0;
}

[data-mononym] .field--corrected input {
  font-size: 1.875rem;
  line-height: 1.15;
}

.name-entry {
  position: relative;
}

.name-entry-prompt {
  position: absolute;
  top: 0.75rem;
  right: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--paper);
  font: inherit;
  font-size: 1.0625rem;
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.field--corrected input {
  max-width: 100%;
}

.choices label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
}

.choices input {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  accent-color: var(--paper);
}

.field-error,
.form-status {
  margin-top: 0.4rem;
  color: #f2b8a8;
  font-size: 1.0625rem;
}

.field-trap {
  position: absolute;
  left: -9999px;
}

.form-actions button {
  padding: 0.7em 1.6em 0.75em;
  border: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--bay);
  font: inherit;
  font-size: 1.1875rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.form-actions button:hover:not(:disabled) {
  background: var(--on-dark-muted);
}

.form-actions button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.form-confirmation {
  max-width: 30rem;
  font-size: 1.25rem;
  line-height: 1.45;
}

.form-confirmation:focus {
  outline: none;
}

.form-confirmation-title {
  margin-bottom: 0.25em;
  font-size: 2.25rem;
  font-style: italic;
  line-height: 1.1;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* The fog lifts off the photograph once, on load. */
@media (prefers-reduced-motion: no-preference) {
  .photo img {
    animation: fog-lifts 2.4s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  }

  @keyframes fog-lifts {
    from {
      opacity: 0.15;
      filter: blur(18px);
      transform: scale(1.04);
    }
    to {
      opacity: 1;
      filter: blur(0);
      transform: scale(1);
    }
  }
}
