/*
 * Bretalon Contact: the enquiry section rendered by [bretalon_contact].
 * Takes the theme's tokens when they exist (bretalon-editorial v2) and the same values
 * otherwise, so it looks the same under the classic theme. Visible without JavaScript;
 * motion is decoration only and stops under prefers-reduced-motion.
 */

/* Page content is held to 820px for reading; the enquiry section uses the full container. */
.page-content-inner:has(> .btc) { max-width: none; }

.btc {
  --btc-gold: var(--gold, #c9a96e);
  --btc-gold-light: var(--gold-light, #e0c48a);
  --btc-gold-deep: var(--gold-deep, #a8874f);
  --btc-ink: var(--text-primary, #e8e3d8);
  --btc-ink-2: var(--text-secondary, #a8a29a);
  --btc-ink-3: var(--text-muted, #9ca3af);
  --btc-inverse: var(--text-inverse, #0d1420);
  --btc-field: rgba(13, 20, 32, 0.6);
  --btc-field-focus: rgba(13, 20, 32, 0.88);
  --btc-line: var(--border, rgba(201, 169, 110, 0.12));
  --btc-line-strong: var(--border-strong, rgba(201, 169, 110, 0.25));
  --btc-error: #f2a69a;
  --btc-serif: var(--font-serif, 'Cormorant Garamond', Georgia, 'Times New Roman', serif);
  --btc-sans: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  --btc-ease: var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));

  container: btc / inline-size;
  position: relative;
  padding-block: clamp(1.5rem, 4vw, 3.5rem) 0;
  scroll-margin-top: calc(var(--header-h-compact, 68px) + 1.5rem);
  color: var(--btc-ink-2);
  font-family: var(--btc-sans);
}

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

.btc [hidden] { display: none !important; }

/* The theme's scroll reveal fades each paragraph and heading in on its own. Here the section
   moves as a whole instead, and error messages have to appear at once. */
.reveal-on .btc [data-reveal]:not(.is-visible) { opacity: 1; transform: none; }
.reveal-on .btc [data-reveal].is-revealing { transition: none !important; }

.btc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: start;
}

@container btc (min-width: 880px) {
  .btc-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .btc-intro { position: sticky; top: calc(var(--header-h-compact, 68px) + 2.5rem); }
}

/* ---------- Intro ---------- */

.btc .btc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 1.4rem;
  font: 600 0.7rem/1 var(--btc-sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--btc-gold);
}
.btc .btc-eyebrow::before {
  content: "";
  flex: none;
  width: 28px;
  height: 1px;
  background: currentColor;
}

.btc .btc-title {
  margin: 0 0 1.25rem;
  font-family: var(--btc-serif);
  font-weight: 400;
  font-size: clamp(2.3rem, 4.6vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--btc-ink);
  text-wrap: balance;
}

.btc .btc-lede {
  margin: 0;
  max-width: 36ch;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--btc-ink-2);
}

.btc .btc-facts {
  margin: 2.5rem 0 0;
  padding: 0;
  border-top: 1px solid var(--btc-line);
}
.btc .btc-facts > div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--btc-line);
}
.btc .btc-facts dt {
  margin: 0;
  padding-top: 0.22rem;
  font: 600 0.66rem/1.5 var(--btc-sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--btc-gold);
}
.btc .btc-facts dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--btc-ink);
}

/* ---------- Panel ---------- */

.btc-panel {
  container: btc-panel / inline-size;
  position: relative;
  scroll-margin-top: calc(var(--header-h-compact, 68px) + 1rem);
  padding: clamp(1.25rem, 3.6vw, 3rem);
  background: linear-gradient(180deg, rgba(28, 42, 62, 0.62), rgba(22, 32, 50, 0.36));
  border: 1px solid var(--btc-line-strong);
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.8);
}

/* A gold rule across the top: drawn in on load, full width while the form is in use. */
.btc-panel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--btc-gold) 28%, var(--btc-gold-light) 50%, var(--btc-gold) 72%, transparent);
  transform: scaleX(0.4);
  opacity: 0.75;
  transition: transform 0.9s var(--btc-ease), opacity 0.6s var(--btc-ease);
  animation: btc-line 1.4s var(--btc-ease) 0.25s both;
  pointer-events: none;
}
.btc-panel:focus-within::before { transform: scaleX(1); opacity: 1; }

.btc .btc-form-head { margin-bottom: 1.75rem; }
.btc .btc-form-title {
  margin: 0 0 0.4rem;
  font: 400 clamp(1.6rem, 2.6vw, 2rem)/1.15 var(--btc-serif);
  color: var(--btc-ink);
}
.btc .btc-form-note {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--btc-ink-3);
}

.btc .btc-alert {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem 0.85rem 1.1rem;
  border: 1px solid rgba(242, 166, 154, 0.4);
  border-left: 3px solid var(--btc-error);
  background: rgba(242, 166, 154, 0.07);
  color: var(--btc-ink);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ---------- Fields ---------- */

.btc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.35rem 1.25rem;
}
@container btc-panel (min-width: 520px) {
  .btc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .btc-wide { grid-column: 1 / -1; }
}
.btc-field { min-width: 0; }

.btc .btc-field > label,
.btc .btc-topics > legend {
  display: block;
  margin: 0 0 0.55rem;
  padding: 0;
  font: 500 0.72rem/1.3 var(--btc-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--btc-ink-2);
}
.btc .btc-opt {
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--btc-ink-3);
}

.btc-control { position: relative; display: block; }
.btc-control::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--btc-gold-deep), var(--btc-gold-light));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s var(--btc-ease);
  pointer-events: none;
}
.btc-control:focus-within::after { transform: scaleX(1); }

.btc input[type="text"],
.btc input[type="email"],
.btc textarea {
  display: block;
  width: 100%;
  min-height: 3.15rem;
  margin: 0;
  padding: 0.8rem 1rem;
  background: var(--btc-field);
  border: 1px solid var(--btc-line-strong);
  border-radius: 0;
  box-shadow: none;
  color: var(--btc-ink);
  caret-color: var(--btc-gold-light);
  font: 400 1rem/1.5 var(--btc-sans);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.25s;
}
.btc textarea { min-height: 9.5rem; resize: vertical; overflow: auto; }

.btc input[type="text"]:hover,
.btc input[type="email"]:hover,
.btc textarea:hover { border-color: rgba(201, 169, 110, 0.42); }

.btc input[type="text"]:focus,
.btc input[type="email"]:focus,
.btc textarea:focus {
  outline: none;
  border-color: var(--btc-gold);
  background: var(--btc-field-focus);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.14);
}

.btc input[aria-invalid="true"],
.btc textarea[aria-invalid="true"] { border-color: var(--btc-error); }
.btc input[aria-invalid="true"]:focus,
.btc textarea[aria-invalid="true"]:focus {
  border-color: var(--btc-error);
  box-shadow: 0 0 0 3px rgba(242, 166, 154, 0.16);
}

.btc input:-webkit-autofill,
.btc input:-webkit-autofill:hover,
.btc input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--btc-ink);
  box-shadow: 0 0 0 100px #121b2a inset;
  transition: background-color 600000s 0s, color 600000s 0s;
}

.btc .btc-err {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.5rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--btc-error);
}
.btc .btc-err::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  margin-top: 0.5em;
  border-radius: 50%;
  background: currentColor;
}

.btc-under {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.btc .btc-count {
  flex: none;
  margin: 0.55rem 0 0 auto;
  font-size: 0.75rem;
  color: var(--btc-ink-3);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.btc .btc-count.is-near { color: var(--btc-gold-light); }

/* ---------- Topic chips (native radios) ---------- */

.btc .btc-topics { margin: 0; padding: 0; border: 0; min-width: 0; }
.btc-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btc-chip { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.btc-chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.btc-chip span {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.55rem 1rem;
  border: 1px solid var(--btc-line-strong);
  background: rgba(13, 20, 32, 0.35);
  color: var(--btc-ink-2);
  font: 400 0.88rem/1.2 var(--btc-sans);
  user-select: none;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s, transform 0.35s var(--btc-ease);
}
.btc-chip span::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--btc-ink-3);
  transition: background-color 0.2s, box-shadow 0.3s var(--btc-ease), transform 0.35s var(--btc-ease);
}
.btc-chip:hover span { color: var(--btc-ink); border-color: rgba(201, 169, 110, 0.5); }
.btc-chip input:checked + span {
  color: var(--btc-gold-light);
  border-color: var(--btc-gold);
  background: rgba(201, 169, 110, 0.1);
}
.btc-chip input:checked + span::before {
  background: var(--btc-gold);
  box-shadow: 0 0 0 4px rgba(201, 169, 110, 0.18);
  transform: scale(1.2);
}
.btc-chip input:focus-visible + span { outline: 2px solid var(--btc-gold); outline-offset: 2px; }
.btc-chip:active span { transform: scale(0.97); }

/* Honeypot: off screen for people, still in the form for bots. */
.btc .btc-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Footer row and send ---------- */

.btc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--btc-line);
}
.btc .btc-privacy {
  flex: 1 1 16rem;
  max-width: 46ch;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--btc-ink-3);
}
.btc .btc-privacy a {
  color: var(--btc-ink-2);
  text-decoration: underline;
  text-decoration-color: rgba(201, 169, 110, 0.5);
  text-underline-offset: 3px;
}
.btc .btc-privacy a:hover { color: var(--btc-gold-light); }

.btc .btc-send {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 3.25rem;
  margin: 0;
  padding: 0 2.1rem;
  border: 1px solid var(--btc-gold);
  border-radius: 0;
  background: var(--btc-gold);
  color: var(--btc-inverse);
  font: 500 0.8rem/1 var(--btc-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.25s, border-color 0.25s, transform 0.35s var(--btc-ease), box-shadow 0.35s var(--btc-ease);
}
.btc .btc-send:hover {
  background: var(--btc-gold-light);
  border-color: var(--btc-gold-light);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -10px rgba(201, 169, 110, 0.6);
}
.btc .btc-send:active { transform: translateY(0); }
.btc .btc-send:focus-visible { outline: 2px solid var(--btc-gold-light); outline-offset: 3px; }
.btc-send-arrow { flex: none; transition: transform 0.35s var(--btc-ease); }
.btc .btc-send:hover .btc-send-arrow { transform: translateX(4px); }

/* Sending: a light passes across the button. */
.btc .btc-send[aria-busy="true"] { cursor: progress; transform: none; box-shadow: none; }
.btc .btc-send[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, 0.5) 50%, transparent 75%);
  transform: translateX(-100%);
  animation: btc-sweep 1.15s var(--btc-ease) infinite;
}
.btc .btc-send[aria-busy="true"] .btc-send-arrow { animation: btc-nudge 1.15s var(--btc-ease) infinite; }

@container btc-panel (max-width: 519px) {
  .btc .btc-send { width: 100%; }
  .btc-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .btc-chip,
  .btc-chip span { width: 100%; }
  .btc-chip span { padding: 0.55rem 0.75rem; font-size: 0.86rem; line-height: 1.25; }
  .btc-chip:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---------- Sent ---------- */

.btc .btc-done {
  padding: clamp(1.5rem, 5vw, 3.25rem) 0;
  text-align: center;
  outline: none;
}
.btc-check {
  display: block;
  width: 68px;
  height: 68px;
  margin: 0 auto 1.6rem;
  overflow: visible;
  fill: none;
  stroke: var(--btc-gold);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btc-check circle {
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  transform: rotate(-90deg);
  transform-origin: 26px 26px;
  animation: btc-draw 1s var(--btc-ease) 0.1s forwards;
}
.btc-check path {
  stroke-width: 2;
  stroke-dasharray: 34;
  stroke-dashoffset: 34;
  animation: btc-draw 0.55s var(--btc-ease) 0.8s forwards;
}
.btc .btc-done-title {
  margin: 0 0 0.75rem;
  font: 400 clamp(2rem, 3.6vw, 2.75rem)/1.1 var(--btc-serif);
  color: var(--btc-ink);
}
.btc .btc-done-text {
  max-width: 36ch;
  margin: 0 auto 1.9rem;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--btc-ink-2);
}
.btc .btc-again {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: 500 0.76rem/1 var(--btc-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--btc-gold);
  text-decoration: underline;
  text-decoration-color: rgba(201, 169, 110, 0.4);
  text-underline-offset: 6px;
  transition: color 0.2s, text-decoration-color 0.2s;
}
.btc .btc-again:hover { color: var(--btc-gold-light); text-decoration-color: currentColor; }

/* ---------- Motion ---------- */

.btc-intro { animation: btc-rise 0.9s var(--btc-ease) 0.05s both; }
.btc-panel { animation: btc-rise 0.9s var(--btc-ease) 0.15s both; }

/* contact.js: a panel that starts below the fold waits, then rises as it scrolls into view. */
.btc-panel.btc-wait { opacity: 0; transform: translateY(30px); animation: none; }
.btc-panel.btc-show { animation: btc-rise 1s var(--btc-ease) both; }
.btc-panel.btc-show::before { animation: btc-line-again 1.4s var(--btc-ease) 0.35s both; }

@keyframes btc-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes btc-line { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes btc-line-again { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes btc-draw { to { stroke-dashoffset: 0; } }
@keyframes btc-sweep { to { transform: translateX(100%); } }
@keyframes btc-nudge { 50% { transform: translateX(5px); } }

@media (prefers-reduced-motion: reduce) {
  .btc-intro,
  .btc-panel,
  .btc-panel::before,
  .btc-panel.btc-show,
  .btc-panel.btc-show::before { animation: none; }
  .btc *,
  .btc *::before,
  .btc *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .btc-panel { display: none; }
}
