/* ==========================================================================
   NEWSLETTER - Overlay and form styles
   ========================================================================== */

.newsletter-overlay,
.contact-overlay {
  --bg: #050505;
  --fg: #F0EFEF;
  --muted: #b8b8b0;
  position: fixed;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: min(var(--overlay-panel-max-width), calc(100% - (var(--gap) * 2)));
  /* Never taller than the screen: the panel below scrolls instead */
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-orange);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  visibility: hidden;
}

.newsletter-overlay.is-open,
.contact-overlay.is-open {
  transform: translateX(0);
  visibility: visible;
}

.newsletter-panel,
.contact-panel {
  /* Top space: the former header offset, the overlay sits above the logo */
  padding: var(--logo-height) var(--panel-inline-padding) var(--section-padding-y);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--bg);
  display: flex;
  flex-direction: column;
}

.newsletter-close,
.contact-close {
  position: absolute;
  top: 8px;
  right: 6px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bg);
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: normal;
  transition: opacity 0.2s ease;
}

.newsletter-close:hover,
.contact-close:hover {
  opacity: 0.7;
}

.newsletter-header,
.contact-header {
  margin-bottom: 40px;
}

.newsletter-title-grid,
.contact-title-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  font-family: var(--font-title);
  font-size: clamp(24px, 5vw, 36px);
  font-weight: normal;
  text-transform: uppercase;
  line-height: 1.1;
  transform: scaleY(var(--title-scale-y));
  /* Plaak33 turns "NOTRE" into a ligature (Nᵗʳᵉ) */
  font-variant-ligatures: none;
}

/* Maquette : titre de la fenêtre Newsletter en Plaak 43B, police non achetée :
   Plaak 44B, la plus proche de celles du site (la fenêtre Contact n'est pas dessinée) */
.newsletter-title-grid {
  font-family: 'Plaak44B', var(--font-title);
}

/* Explicit places: the words are in reading order in the HTML */
.title-left {
  grid-column: 1;
  grid-row: 1;
  text-align: left;
}

.title-right {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  padding-right: 15px;
}

/* Zigzag offsets: fixed from about 700px wide, smaller on phones so that
   "NEWSLETTER" is not pushed out of the window */
.title-midleft {
  grid-column: 1;
  grid-row: 2;
  text-align: left;
  padding-left: min(138px, 20vw);
}

.title-midright {
  grid-column: 2;
  grid-row: 2;
  text-align: right;
  padding-right: min(175px, 25vw);
}

.newsletter-text,
.contact-text {
  font-family: var(--font-body);
  color: var(--fg);
  font-size: 18px;
  margin: 0 0 40px;
  line-height: 1.5;
}

.newsletter-form,
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0px;
  margin-bottom: 20px;
}

.form-field label {
  font-family: var(--font-ui);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: bold;
}

.form-field input {
  background: var(--fg);
  border: 1px solid black;
  padding: 7px 16px;
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--bg);
  outline: none;
  transition: box-shadow 0.2s ease;
}

.form-field input::placeholder {
  color: rgba(15, 15, 15, 0.4);
}

.form-field input:focus {
  box-shadow: 0 0 0 2px var(--bg);
}

/* Maquette (composant 260:261) : libellés en Plaak 43B, police non achetée →
   Plaak 44B, 20px, casse telle que saisie (« NOM (facultatif) ») ; texte en
   22px. Téléphone (338:1228) : libellés 15px ; texte inchangé (18px, Q7). */
.newsletter-form .form-field label {
  font-family: 'Plaak44B', var(--font-ui);
  font-size: 20px;
  font-weight: normal;
  text-transform: none;
  letter-spacing: 0;
  font-variant-ligatures: none;
}

@media (min-width: 960px) {
  .newsletter-text {
    font-size: 22px;
  }
}

/* « Sur version mobile, s'ouvre sur l'écran en entier » (note 689:589) */
@media (max-width: 959px) {
  .newsletter-form .form-field label {
    font-size: 15px;
  }

  .newsletter-overlay {
    top: 0;
    max-width: none;
  }
}

.newsletter-submit {
  background: transparent;
  border: none;
  font-family: var(--font-ui);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  cursor: pointer;
  transition: opacity 0.2s ease;
  align-self: flex-end;
  margin-top: 50px;
}

.newsletter-submit:hover {
  opacity: 0.7;
}

.newsletter-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Infomaniak form integration */
.newsletter-form .inf-content {
  display: flex;
  flex-direction: column;
}

.newsletter-form .inf-success {
  text-align: center;
  padding: 20px 0;
}

.newsletter-success-message {
  color: var(--fg);
  font-size: var(--text-md);
  margin: 0;
}

.newsletter-panel.is-success .newsletter-text {
  display: none;
}

.newsletter-form .inf-input.inf-error label,
.newsletter-form .inf-input.inf-error span.inf-message {
  color: #cc0033;
}

.newsletter-form .inf-input.inf-error input {
  border-color: #cc0033;
}

.newsletter-form .inf-input span.inf-message {
  display: none;
  font-size: 12px;
  margin-top: 4px;
}

.newsletter-form .inf-input.inf-error span.inf-message {
  display: block;
}

.newsletter-form .inf-submit {
  margin-top: 30px;
  text-align: right;
}

.form-field-captcha {
  margin-top: 16px;
}

/* Newsletter overlay background */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 190;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  pointer-events: none;
}

body.newsletter-open::after,
body.contact-open::after {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.newsletter-open,
body.contact-open {
  overflow: hidden;
}

/* ==========================================================================
   CONTACT - Overlay and form styles (mirrors newsletter)
   ========================================================================== */

.contact-fields {
  display: flex;
  flex-direction: column;
}

.contact-form .form-field textarea {
  background: var(--fg);
  border: 1px solid black;
  padding: 7px 16px;
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--bg);
  outline: none;
  resize: vertical;
  transition: box-shadow 0.2s ease;
}

.contact-form .form-field textarea:focus {
  box-shadow: 0 0 0 2px var(--bg);
}

.contact-submit-area {
  margin-top: 30px;
  text-align: right;
}

.contact-submit {
  background: transparent;
  border: none;
  font-family: var(--font-ui);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.contact-submit:hover {
  opacity: 0.7;
}

.contact-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.contact-success-message,
.contact-error-message {
  color: var(--fg);
  font-size: var(--text-md);
  margin: 0;
  text-align: center;
  padding: 20px 0;
}

.contact-error-message {
  color: #cc0033;
}

.footer-contact-toggle {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.2;
  /* min-height: 44px touch target, set with the newsletter toggle in layout.css */
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  cursor: pointer;
  transition: color 0.2s ease;
}

.footer-contact-toggle:hover {
  color: var(--color-orange);
}
