@import url("https://fonts.googleapis.com/css?family=Lora");

:root {
  --gap: 18px;
  --linen: #F0DEB1;
  --green: #41865A;
  --maroon: #A13642;
  --scroll: 0;
  color-scheme: light;
  scroll-behavior: smooth;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--linen);
  color: var(--green);
  font: 20px/1.5 Lora, serif;
  accent-color: var(--maroon);
}

p { max-width: 25em; }
a { color: var(--maroon); transition: color 0.2s ease; }
a:hover { color: #BA434D; }
h1, h2, h3 { color: var(--green); }
h1 { font-size: clamp(1.5em, 5vw, 2.5em); }
[id] { scroll-margin-top: 24px; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--maroon);
  outline-offset: 5px;
}

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

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  z-index: 10;
  transform: translateY(-200%);
  background: var(--linen);
}

.skip-link:focus { transform: none; }

/* Forms */

form { max-width: 100%; }
fieldset {
  position: relative;
  isolation: isolate;
  min-width: 0;
  max-width: calc(100% - 40px);
  margin: 20px 20px 40px;
  padding: 0.35em 0.75em 0.625em;
  border: 0;
}

fieldset::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -20px -40px -40px;
  background: url("./assets/yellow-paint.svg") center/100% 100% no-repeat;
}

input, textarea, button, select { font: inherit; }
input[type="text"], input[type="email"], textarea, select {
  display: block;
  max-width: 100%;
  padding: 5px 0 0;
  border: 0;
  border-bottom: 2px solid #7BA566;
  background: rgb(255 255 255 / 20%);
  color: var(--maroon);
  caret-color: var(--maroon);
  border-radius: 0;
}

fieldset input[type="text"] { background: transparent; }
::placeholder { color: #A1364288; }
input:focus, textarea:focus, select:focus { border-color: #B0555D; }
textarea { resize: vertical; width: 100%; }
textarea, select { padding: 5px; font-size: 0.8em; }
.field { display: block; min-width: 0; max-width: 100%; }
.field > span { display: block; font-size: 0.8em; line-height: 1.1; }
.attendance label { display: block; cursor: pointer; }
.names { flex-wrap: nowrap; }
.names .field { flex: 1; }

button, input[type="submit"], .button {
  display: inline-block;
  padding: 3.5px 10px;
  border: 0;
  border-radius: 0;
  background: var(--maroon);
  color: var(--linen);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

button:hover, input[type="submit"]:hover, .button:hover { background: #BA434D; }
button:disabled { cursor: wait; opacity: 0.7; }
.text-button, .text-button:hover {
  padding: 0;
  background: none;
  color: var(--maroon);
  text-decoration: underline;
}
#lookup-form + button { margin-top: var(--gap); }
.alert { display: inline-block; padding: 0.5em; }
.alert.success { background: #CFD17F; color: var(--green); }
.alert.error { background: #A1364255; }
.error { color: var(--maroon); }
.error, .hint { font-size: 0.9em; }
#rsvp-status:empty { display: none; }

.col, .row {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: var(--gap);
}

.col { flex-direction: column; }
.stretched { align-self: stretch; }

/* The illustration stays at its original proportions, cropping at phone widths. */

section { position: relative; clear: both; padding: 0 3vw; }
#hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  height: 81vw;
  perspective: 1000px;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: url("./assets/background.svg") center bottom/cover no-repeat;
  pointer-events: none;
}

#hero .header {
  position: absolute;
  z-index: 0;
  top: 30%;
  margin-left: 2%;
  text-align: center;
  font-size: max(16px, 1.8vw);
  transform: translate3d(0, calc(var(--scroll) * 30vh), 0);
}

#title-paint {
  position: absolute;
  z-index: -1;
  left: -5%;
  width: 110%;
  transform: translate3d(0, calc(var(--scroll) * 20vh), 0);
}

.couple { margin: 0; font-size: inherit; line-height: 1.5; }
#jeff-and-molly { display: inline-block; height: 4.57vw; }
#getting-married { margin: 0; }

.figs {
  position: absolute;
  z-index: 2;
  bottom: 44.6%;
  width: 45%;
  height: 8.5%;
}

.figs a {
  display: block;
  position: absolute;
  bottom: 10%;
  width: 12%;
  height: 30%;
  background: center/contain no-repeat;
  transition: transform 0.2s ease;
}

.figs a::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}

.figs a:hover { transform: scale(1.1); }
.figs .registry { left: 13%; bottom: 50%; background-image: url("./assets/links/Registry.svg"); }
.figs .rsvp { left: 28.5%; bottom: 20%; background-image: url("./assets/links/RSVP.svg"); }
.figs .lodging { left: 44%; width: 17%; background-image: url("./assets/links/Lodging.svg"); }
.figs .venue { left: 64%; background-image: url("./assets/links/Venue.svg"); }
.figs .food { left: 57%; bottom: 60%; background-image: url("./assets/links/Food.svg"); }

#map { width: 100%; height: 50vh; min-height: 240px; border: 0; }

footer {
  display: flex;
  justify-content: center;
  margin-top: 10vh;
  padding: 10vh 8vw;
  background: #B0555D;
  color: var(--linen);
}

@media (min-width: 897px) {
  #content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8vw;
  }

  #content > * { margin: 0; min-width: 0; }
  #content h1 { text-align: right; }
}

@media (max-width: 896px) {
  #hero { height: calc(896px * .81); }
  #hero::before { background-size: 896px auto; }
  #jeff-and-molly { height: 41px; }
  .figs { width: calc(896px * .45); }
  #content { display: block; }
}

@media (max-width: 480px) {
  #content { padding: 0 6vw; }
  fieldset { margin-right: 12px; margin-left: 12px; max-width: calc(100% - 24px); }
  fieldset::before { right: -24px; left: -24px; }
  button, input[type="submit"], select { min-height: 44px; }
  .attendance label { padding: 4px 0; }
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  #hero .header, #title-paint { transform: none; }
}
