/* gate.css: the guest name search (gate.js) and the front-page date line states. Tokens come from styles.css. */

.gate[hidden],
.gate__card [hidden] { display: none !important; }

.gate {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0; inset: 0;
  box-sizing: border-box;                  /* gate.js sizes it to the visual viewport while a phone keyboard is up */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(28,10,13, 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  animation: gate-in 0.35s ease both;
}
.gate--out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
@keyframes gate-in { from { opacity: 0; } to { opacity: 1; } }

.gate__card {
  box-sizing: border-box;
  width: 100%;
  max-width: 340px;
  max-height: 100%;                        /* short screens and the keyboard: the card scrolls inside itself */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 28px 24px 22px;
  background: rgba(61,15,23, 0.92);      /* #3d0f17 at 92% */
  color: #fbf7f1;
  border: 1px solid #b8955a;               /* champagne-gold hairline */
  border-radius: 3px;
  box-shadow: inset 0 0 0 4px rgba(61,15,23, 0.92), inset 0 0 0 5px rgba(184, 149, 90, 0.35);
  text-align: center;
}

.gate__title {
  margin: 0 0 10px;
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 500;
  font-size: 24px;
  line-height: 1.2;
  color: #fbf7f1;
}

.gate__help {
  margin: 0 0 20px;
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.5;
  color: rgba(251, 247, 241, 0.82);
}

.gate__form { margin: 0; }

.gate__input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 14px;
  font-family: var(--f-body);
  font-size: 16px;                         /* 16px or more: iOS does not zoom in */
  color: #fbf7f1;
  background: rgba(251, 247, 241, 0.06);
  border: 1px solid rgba(184, 149, 90, 0.6);
  border-radius: 2px;
  text-align: center;
  letter-spacing: 0.02em;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.gate__input:focus { border-color: #b8955a; box-shadow: 0 0 0 2px rgba(184, 149, 90, 0.25); }

.gate__error {
  min-height: 1.4em;
  margin: 10px 0 0;
  font-family: var(--f-body);
  font-size: 13px;
  line-height: 1.45;
  color: #F2C4B4;
}

/* Matching names: one tap target each. A long list scrolls inside itself, never the page. */
.gate__list {
  max-height: min(40vh, 240px);
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: left;
}
.gate__name {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin: 6px 0 0;
  padding: 0 14px;
  font-family: var(--f-body);
  font-size: 16px;
  text-align: left;
  color: #fbf7f1;
  background: rgba(184, 149, 90, 0.14);
  border: 1px solid rgba(184, 149, 90, 0.55);
  border-radius: 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gate__name:hover { background: rgba(184, 149, 90, 0.26); }
.gate__name:focus-visible,
.gate__input:focus-visible { outline: 2px solid #d9bf8a; outline-offset: 2px; }

/* Quiet "Not you? Search again" link at the foot of the reply section. Shown only once a guest is chosen. */
.gate-reset {
  margin: 28px 0 0;
  padding: 12px 8px 4px;
  text-align: center;
}
.gate-reset__btn {
  min-height: 44px;
  font-family: var(--f-body);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ivory, #fbf7f1);
  background: rgba(28,10,13, 0.72);
  border: 0;
  border-radius: 22px;
  padding: 0 16px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.gate-reset__btn:hover { background: rgba(28,10,13, 0.9); }
.gate-reset__btn:focus-visible { background: rgba(28,10,13, 0.9); }

/* On phones the section index is a bar at the bottom: keep the reset link above it. */
@media (max-width: 959px) {
  .gate-reset { padding-bottom: calc(var(--index-h) + 16px + env(safe-area-inset-bottom, 0px)); }
}

/* Very narrow (a phone at 200% zoom is about 160 to 200 CSS px wide): less padding, more room for the text. */
@media (max-width: 260px) {
  .gate { padding: 8px; }
  .gate__card { padding: 20px 12px 14px; }
}

html.still .gate { animation: none; }
html.still .gate--out { transition: none; }

/* Front-page date line: the invited days on their own line, then the month. */
.ov-dates__days { display: block; }
.ov-dates__days[hidden] { display: none !important; }

/* Until a guest is chosen, the section index names no day and offers no Reply link (gate.js adds html.hn-unlocked
   with the guest's days), so neither a tap nor Tab can reach locked content. */
html:not(.hn-unlocked) .index__link[data-section="reply"],
html:not(.hn-unlocked) .index__link[data-section="mayoun"],
html:not(.hn-unlocked) .index__link[data-section="nikkah"],
html:not(.hn-unlocked) .index__link[data-section="shaadi"],
html:not(.hn-unlocked) .index__link[data-section="walima"] { display: none; }

/* Printing before a guest is chosen shows only the front page, never the days. */
@media print {
  html:not(.hn-unlocked) #opening,
  html:not(.hn-unlocked) #passage,
  html:not(.hn-unlocked) #garden,
  html:not(.hn-unlocked) #reply { display: none !important; }
}

.gate__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
