/* Mirello Carvani — private access gate */

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

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

body {
  margin: 0;
  min-height: 100svh;
  /* Stands in for the photograph while it loads, and if it is ever missing. */
  background:
    radial-gradient(120% 90% at 72% 45%, rgb(46 38 30 / 0.9), transparent 60%),
    var(--color-void);
  color: var(--color-ivory);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

::selection { background: var(--color-ivory); color: var(--color-void); }

:focus-visible {
  outline: 1px solid var(--color-ivory-soft);
  outline-offset: 5px;
}

/* ------------------------------------------------------------------ stage */

.stage {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.stage__media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 68% 50%;
}

/* Two scrims: one pulls the whole room down, one carves the reading column. */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgb(5 4 4 / 0.97) 0%, rgb(5 4 4 / 0.95) 30%,
                    rgb(5 4 4 / 0.74) 44%, rgb(5 4 4 / 0.28) 60%, rgb(5 4 4 / 0) 78%),
    linear-gradient(180deg, rgb(5 4 4 / 0.6), transparent 28%, rgb(5 4 4 / 0.65));
}

@media (max-width: 47.99rem) {
  .stage::after {
    background:
      linear-gradient(180deg, rgb(6 5 4 / 0.92) 0%, rgb(6 5 4 / 0.86) 55%,
                      rgb(6 5 4 / 0.62) 100%);
  }
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- language */

.tongue {
  position: fixed;
  top: clamp(1.5rem, 1rem + 1.4vw, 2.5rem);
  right: var(--space-gutter);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* The window in the photograph is the brightest corner of the page, so the
   switch carries its own shadow rather than relying on what is behind it. */
.tongue::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  z-index: -1;
  width: min(24rem, 55vw);
  height: 8rem;
  background: radial-gradient(130% 130% at 100% 0, rgb(5 4 4 / 0.9), rgb(5 4 4 / 0) 72%);
  pointer-events: none;
}

.tongue__option {
  padding: 0.2rem 0;
  border: 0;
  background: none;
  color: var(--color-ivory-soft);
  font: inherit;
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-caps-tight);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out-expo);
}

.tongue__option:hover { color: var(--color-ivory); }
.tongue__option[aria-pressed="true"] { color: var(--color-ivory); }

.tongue__rule {
  width: 1px;
  height: 0.7rem;
  background: var(--color-hairline);
}

/* ------------------------------------------------------------------- gate */

.gate {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  min-height: 100svh;
  padding: var(--space-lg) var(--space-gutter);
}

.column {
  width: min(26rem, 100%);
}

/* ---------------------------------------------------------------- identity */

.wordmark { line-height: 0; }

.wordmark__lockup {
  width: min(15.5rem, 78%);
  height: auto;
}

@media (max-width: 48rem), (max-height: 51rem) {
  .wordmark__lockup { width: min(13rem, 70%); }
}

.eyebrow {
  margin-top: var(--space-lg);
  font-size: var(--text-micro);
  font-weight: 400;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.lede span { display: block; }

.lede {
  margin-top: var(--space-sm);
  color: var(--color-ivory-soft);
  font-size: var(--text-body);
}

/* ------------------------------------------------------------------ forms */

.form { margin-top: var(--space-lg); }
.form[hidden] { display: none; }

.field { display: block; }
.field + .field { margin-top: var(--space-sm); }

.field__label {
  display: block;
  margin-bottom: var(--space-2xs);
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-caps-tight);
  text-transform: uppercase;
}

.field__input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--color-hairline-soft);
  border-bottom-color: var(--color-hairline);
  border-radius: 0;
  background: rgb(236 231 221 / 0.03);
  color: var(--color-ivory);
  font: inherit;
  font-size: var(--text-body);
  transition: border-color var(--duration-fast) var(--ease-out-expo),
              background-color var(--duration-fast) var(--ease-out-expo);
}

.field__input::placeholder { color: var(--color-ivory-muted); }

.field__input:hover {
  border-color: var(--color-hairline);
  background: rgb(236 231 221 / 0.05);
}

.field__input:focus {
  outline: none;
  border-color: var(--color-ivory-soft);
  background: rgb(236 231 221 / 0.07);
}

/* The house prefix is printed on the field; only the digits are typed. */
.code {
  position: relative;
  display: block;
}

.code__prefix {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  color: var(--color-ivory-muted);
  font-size: var(--text-small);
  letter-spacing: 0.3em;
  pointer-events: none;
}

.field__input--code {
  padding-left: 3.4rem;
  font-size: var(--text-small);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.code:focus-within .code__prefix { color: var(--color-ivory-soft); }

/* Consent is asked for separately from the request itself, and freely:
   the form goes through either way. */
.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  margin-top: var(--space-sm);
  color: var(--color-ivory-soft);
  font-size: 0.6875rem;
  line-height: 1.6;
  cursor: pointer;
}

.consent input {
  width: 0.8rem;
  height: 0.8rem;
  margin: 0.3rem 0 0;
  accent-color: var(--color-ivory);
}

.consent:hover { color: var(--color-ivory); }

.notice {
  margin-top: var(--space-2xs);
  color: var(--color-ivory-muted);
  font-size: 0.625rem;
  line-height: 1.6;
}

.notice a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  text-decoration-color: var(--color-hairline);
  transition: color var(--duration-fast) var(--ease-out-expo);
}

.notice a:hover { color: var(--color-ivory-soft); }

/* ------------------------------------------------------------------ steps */

.step { border: 0; margin: 0; padding: 0; }
.step[hidden] { display: none; }

/* Intro copy and the invitation offer belong to the first screen only. */
.column:not([data-step-index="0"]) .lede,
.column:not([data-step-index="0"]) #form-apply .switch { display: none; }

.question {
  display: block;
  margin-bottom: var(--space-md);
  padding: 0;
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.45;
}

.question__count {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--color-ivory-muted);
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-caps);
}

/* Open answers */

.field__input--note {
  resize: none;
  line-height: 1.6;
}

.counter {
  margin-top: var(--space-2xs);
  color: var(--color-ivory-muted);
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-caps-tight);
  text-transform: uppercase;
}

.controls {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
}

.controls .action { margin-top: var(--space-md); }

/* Action reads as type, not as a box — the underline is the affordance. */

.action {
  position: relative;
  display: inline-block;
  margin-top: var(--space-md);
  padding: 0 0 0.4rem;
  border: 0;
  background: none;
  color: var(--color-ivory);
  font: inherit;
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-out-expo);
}

.action::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.action:hover::after,
.action:focus-visible::after { transform: scaleX(1); transform-origin: left; }

.action[disabled] { cursor: progress; opacity: 0.5; }

.status {
  margin-top: var(--space-sm);
  color: var(--color-ivory-soft);
  font-size: var(--text-small);
}

.status:empty { display: none; }
.status[data-tone="error"] { color: #dfa88f; }

/* Switch between application and invitation */

.switch {
  margin-top: var(--space-lg);
  color: var(--color-ivory-muted);
  font-size: var(--text-small);
}

.link {
  display: inline-block;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-ivory-soft);
  font: inherit;
  font-size: var(--text-small);
  text-decoration: underline;
  text-underline-offset: 0.3em;
  text-decoration-thickness: 1px;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out-expo);
}

.link:hover { color: var(--color-ivory); }

/* ---------------------------------------------------------------- receipt */

.receipt { margin-top: var(--space-lg); }

.receipt__title:focus-visible {
  outline-color: var(--color-hairline);
  outline-offset: 0.6rem;
}

.receipt__title {
  font-family: var(--font-script);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.15;
}

.receipt__body {
  max-width: 30ch;
  margin-top: var(--space-sm);
  color: var(--color-ivory-soft);
}

.receipt__ref {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-hairline-soft);
  color: var(--color-ivory-muted);
  font-size: var(--text-micro);
  letter-spacing: var(--tracking-caps-tight);
  text-transform: uppercase;
}

/* ----------------------------------------------------------------- footer */

.colophon {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-hairline-soft);
  color: var(--color-ivory-muted);
  font-size: 0.625rem;
  letter-spacing: var(--tracking-caps-tight);
  text-transform: uppercase;
}

/* The house line holds the left edge; the link groups follow behind it. */
.colophon__house { width: 100%; }

.colophon__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-sm);
}

.colophon a {
  position: relative;
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-expo);
}

.colophon a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -0.3em;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.colophon a:hover { color: var(--color-ivory); }
.colophon a:hover::after { transform: scaleX(1); transform-origin: left; }

@media (max-width: 48rem) {
  .colophon { margin-top: var(--space-md); }
}

/* On a wide screen the footer sits on the floor of the page instead of
   riding along with the column, so it never pushes the gate off-screen. */
@media (min-width: 48.01rem) {
  /* Reserve the footer's own height plus its offset, so the centred
     column can never run into it. */
  .gate { padding-bottom: calc(var(--space-lg) + 4rem); }

  .colophon {
    position: absolute;
    left: var(--space-gutter);
    bottom: var(--space-lg);
    width: min(34rem, calc(100% - 2 * var(--space-gutter)));
    margin-top: 0;
  }
}

/* ----------------------------------------------------------------- motion */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    animation: fade var(--duration-slow) var(--ease-out-expo) forwards;
    animation-delay: var(--delay, 0ms);
  }

  .reveal--rise { transform: translateY(0.75rem); }

  @keyframes fade {
    to { opacity: 1; transform: none; }
  }

  .stage__media {
    animation: settle 2.4s var(--ease-out-expo) forwards;
  }

  @keyframes settle {
    from { transform: scale(1.06); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
}
