/* ==========================================================================
   Legion Network contact page
   --------------------------------------------------------------------------
   Styles the suite's own Contact Us page (/contact/) and the parts that
   contact.js builds around its form. See README.md.

   The form stays the suite's: same fields, same editor, same reCAPTCHA. This
   file lays the page out and sets the form flat on it.

   It builds on what is already installed: the suite skin (legion-suite.css)
   supplies the --ln-* tokens and the look of buttons and fields. Every rule
   is scoped to the contact page (body[data-pagemodule="contact"]) or to
   .lnk, the class the script puts on that page's content column, so it
   cannot touch another page.

   Sections
     1  Tokens
     2  Before the script has run, and if it never does
     3  The top: headline, signal canvas, topics
     4  Section headings
     5  The desk: form on the left, what to include on the right
     6  The suite's form
     7  The side column
     8  Other ways to reach us
     9  After sending: the suite's "check your email" and "sent" views
    10  Phones and tablets
    11  Legion Cyber
    12  Reduced motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1  Tokens. The --ln-* values come from the suite skin; the fallbacks are
      its dark values, used only if the skin is ever missing.
   -------------------------------------------------------------------------- */
.lnk {
  --lnk-bg: var(--ln-bg, #06080D);
  --lnk-text: var(--ln-text, #F3F6FB);
  --lnk-body: var(--ln-text-body, #CCD4E2);
  --lnk-text-2: var(--ln-text-2, #A3AEC2);
  --lnk-text-3: var(--ln-text-3, #76829A);
  --lnk-line: var(--ln-line, #212A3B);
  --lnk-line-soft: var(--ln-line-soft, #161C29);
  --lnk-line-strong: var(--ln-line-strong, #33405A);
  --lnk-elev: var(--ln-elev, #0E121B);
  --lnk-accent: var(--ln-accent, #08D0F8);
  --lnk-warn: var(--ln-warn, #F5B84B);
  --lnk-mono: var(--ln-mono, "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace);

  /* the signal */
  --lnk-fx-top: #19D6FB;
  --lnk-fx-bottom: #1A66F2;
  --lnk-fx-spark: #FFFFFF;
  --lnk-fx-alpha: 0.8;

  color: var(--lnk-text);
  padding-bottom: clamp(48px, 7vw, 96px);
}
html[data-ips-scheme-active="light"] .lnk,
html[data-ips-scheme="light"] .lnk {
  --lnk-fx-top: #0A8FD0;
  --lnk-fx-bottom: #1450D0;
  --lnk-fx-spark: #081020;
  --lnk-fx-alpha: 0.75;
}
html[data-ips-theme="3"] .lnk,
html[data-ips-theme="3"][data-ips-scheme-active] .lnk {
  --lnk-fx-top: #00F0FF;
  --lnk-fx-bottom: #2A55FF;
  --lnk-fx-spark: #FF4FD0;
  --lnk-fx-alpha: 0.82;
}

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

/* guests are told they can sign in first; the suite marks guests on <html> */
html:not([data-ips-guest]) .lnk .lnk-for-guest { display: none; }

/* --------------------------------------------------------------------------
   2  Before the script has run, and if it never does.
      The plain form is held back for a moment so the page does not jump when
      the script builds around it. If the script has not run after 1.2
      seconds, the plain form shows and works as it always did.
   -------------------------------------------------------------------------- */
@keyframes lnk-show { to { visibility: visible; } }
body[data-pagemodule="contact"] .ipsLayout__primary-column:has(> .ipsBox--contact):not(.lnk) {
  visibility: hidden;
  animation: lnk-show 0s 1.2s forwards;
}

/* --------------------------------------------------------------------------
   3  The top
   -------------------------------------------------------------------------- */
body.ipsApp .lnk {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  column-gap: clamp(36px, 5.5vw, 88px);
  align-items: start;
}
body.ipsApp .lnk > * { grid-column: 1 / -1; min-width: 0; }
body.ipsApp .lnk > .ipsPageHeader { display: none; }

.lnk-top {
  position: relative;
  padding-top: clamp(48px, 7vw, 104px);
}
.lnk-sky {
  position: absolute;
  top: 0;
  left: var(--lnk-bleed-left, 0px);
  width: var(--lnk-bleed-width, 100%);
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.lnk--live .lnk-sky { opacity: 1; }

.lnk-hero {
  position: relative;
  z-index: 1;
  max-width: min(100%, 46rem);
}
.lnk-kicker {
  margin: 0 0 22px;
  font-family: var(--lnk-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  color: var(--lnk-accent);
}
.lnk-title {
  margin: 0;
  font-size: clamp(2.625rem, 6.6vw, 5.5rem);
  font-weight: 600;
  line-height: 0.97;
  letter-spacing: -0.04em;
  color: var(--lnk-text);
  text-wrap: balance;
}
.lnk-lede {
  max-width: 33em;
  margin: clamp(20px, 2.4vw, 30px) 0 0;
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.5;
  color: var(--lnk-text-2);
  text-wrap: pretty;
}

/* the six topics: one line across, each topic under its own stretch of it */
.lnk-topics__h {
  position: relative;
  z-index: 1;
  margin: clamp(72px, 9vw, 132px) 0 16px;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--lnk-text-2);
}
.lnk-topics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.lnk .lnk-topic {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 138px;
  margin: 0;
  padding: 20px 22px 24px 0;
  border: 0;
  border-top: 1px solid var(--lnk-line);
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  outline-offset: 4px;
  transition: border-color 0.2s ease;
}
.lnk-topic__name {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--lnk-text);
  transition: color 0.2s ease;
}
/* the mark that fills when a topic is chosen */
.lnk-topic__name::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: calc(0.625em - 4.5px);
  border: 1.5px solid var(--lnk-line-strong);
  border-radius: 50%;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.lnk-topic__what {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--lnk-text-2);
  text-wrap: pretty;
}
.lnk .lnk-topic:hover { border-top-color: var(--lnk-line-strong); }
.lnk .lnk-topic:hover .lnk-topic__name::before { border-color: var(--lnk-accent); }
.lnk .lnk-topic:focus-visible { outline: 2px solid var(--lnk-accent); }
.lnk .lnk-topic[aria-checked="true"] { border-top-color: var(--lnk-accent); }
.lnk .lnk-topic[aria-checked="true"] .lnk-topic__name { color: var(--lnk-accent); }
.lnk .lnk-topic[aria-checked="true"] .lnk-topic__name::before {
  border-color: var(--lnk-accent);
  background: var(--lnk-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lnk-accent) 22%, transparent);
}

/* --------------------------------------------------------------------------
   4  Section headings
   -------------------------------------------------------------------------- */
.lnk-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--lnk-line);
}
.lnk .lnk-h2 {
  margin: 0;
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--lnk-text);
}
.lnk-signin {
  margin: 0;
  font-size: 0.875rem;
  color: var(--lnk-text-3);
}
.lnk-signin a { color: var(--lnk-text-2); text-decoration: underline; text-underline-offset: 3px; }
.lnk-signin a:hover { color: var(--lnk-accent); }

.lnk .lnk-more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--lnk-accent);
  text-decoration: none;
}
.lnk .lnk-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.lnk .lnk-more:not([target])::after { content: "\2192"; }
.lnk .lnk-more svg { flex: none; }

/* --------------------------------------------------------------------------
   5  The desk
   -------------------------------------------------------------------------- */
body.ipsApp .lnk > .lnk-write {
  grid-column: 1;
  grid-row: 3;
  margin-top: clamp(64px, 8vw, 112px);
}
body.ipsApp .lnk > .ipsBox--contact {
  grid-column: 1;
  grid-row: 4;
}
body.ipsApp .lnk > .lnk-brief {
  grid-column: 2;
  grid-row: 3 / span 2;
  align-self: stretch;
  margin-top: clamp(64px, 8vw, 112px);
}
body.ipsApp .lnk > .lnk-ways { grid-row: 5; }

/* --------------------------------------------------------------------------
   6  The suite's form, set flat on the page
   -------------------------------------------------------------------------- */
body.ipsApp .lnk > .ipsBox--contact,
body.ipsApp .lnk > .ipsBox--contact .ipsBox--formTemplate {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}
body.ipsApp .lnk .ipsForm--contact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
  margin: 0;
  padding: 26px 0 0;
  list-style: none;
}
body.ipsApp .lnk .ipsForm--contact > li {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
body.ipsApp .lnk .ipsForm--contact > .ipsFieldRow { padding-bottom: 24px; }
body.ipsApp .lnk .lnk-form--guest #contact_contact_name { grid-column: 1; }
body.ipsApp .lnk .lnk-form--guest #contact_email_address { grid-column: 2; }

body.ipsApp .lnk .ipsFieldRow__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 9px;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--lnk-text-2);
}
body.ipsApp .lnk .ipsFieldRow__content { padding: 0; }
body.ipsApp .lnk .ipsForm--contact :is(input.ipsInput, .ipsInput--text) {
  width: 100%;
  max-width: none;
  min-height: 48px;
  padding-inline: 14px;
  border-radius: var(--ln-r-md, 10px);
  background: var(--lnk-elev);
  border-color: var(--lnk-line);
  color: var(--lnk-text);
  font-size: 1rem;
}
body.ipsApp .lnk .ipsForm--contact .ipsEditor {
  border-radius: var(--ln-r-md, 10px);
  border-color: var(--lnk-line);
  background: var(--lnk-elev);
}
body.ipsApp .lnk .ipsForm--contact .ipsEditor:focus-within {
  border-color: var(--lnk-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lnk-accent) 22%, transparent);
}
body.ipsApp .lnk .ipsForm--contact .ipsEditor .ProseMirror { min-height: 260px; }
body.ipsApp .lnk .ipsFieldRow__warning:empty { display: none !important; }

/* a card number or password in the message */
.lnk-guard {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--lnk-warn) 45%, transparent);
  border-radius: var(--ln-r-md, 10px);
  background: color-mix(in srgb, var(--lnk-warn) 10%, transparent);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--lnk-text);
}
.lnk-guard[hidden] { display: none; }

/* Send, with the reply time beside it */
body.ipsApp .lnk .ipsForm--contact > .ipsSubmitRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 14px 22px;
  padding: 4px 0 0;
  border: 0;
  background: none;
  text-align: start;
}
body.ipsApp .lnk .ipsForm--contact > .ipsSubmitRow .ipsButton {
  min-width: 148px;
  min-height: 48px;
  margin: 0;
  padding-inline: 26px;
  font-size: 0.9375rem;
}
.lnk-after {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--lnk-text-3);
}

/* --------------------------------------------------------------------------
   7  The side column: what to include for the chosen topic
   -------------------------------------------------------------------------- */
.lnk-brief {
  padding-inline-start: clamp(24px, 3vw, 44px);
  border-inline-start: 1px solid var(--lnk-line);
}
.lnk-brief__in {
  position: sticky;
  top: 96px;
  padding-bottom: 8px;
}
.lnk-brief__kicker {
  margin: 0;
  padding: 6px 0 0;
  font-family: var(--lnk-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  color: var(--lnk-accent);
  overflow-wrap: anywhere;
}
.lnk .lnk-brief__h {
  margin: 26px 0 12px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--lnk-text);
}
.lnk .lnk-brief__list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.lnk .lnk-brief__list li {
  position: relative;
  margin: 0;
  padding: 9px 0 9px 26px;
  border-bottom: 1px solid var(--lnk-line-soft);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--lnk-body);
}
.lnk .lnk-brief__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 14px;
  width: 11px;
  height: 6px;
  border-left: 1.75px solid var(--lnk-accent);
  border-bottom: 1.75px solid var(--lnk-accent);
  transform: rotate(-45deg);
}
body.ipsApp .lnk .lnk-outline { margin-top: 16px; }
body.ipsApp .lnk .lnk-outline:disabled { opacity: 0.6; cursor: default; }
.lnk-brief__text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--lnk-text-2);
  text-wrap: pretty;
}
.lnk-brief__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 14px 0 0;
}
.lnk-brief__never {
  margin: 28px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--lnk-line);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--lnk-text-3);
}

/* --------------------------------------------------------------------------
   8  Other ways to reach us
   -------------------------------------------------------------------------- */
.lnk-ways { margin-top: clamp(72px, 9vw, 128px); }
.lnk .lnk-ways__list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 clamp(24px, 3.5vw, 48px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.lnk .lnk-way {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--lnk-line-soft);
}
.lnk .lnk-way__name {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--lnk-text);
}
.lnk-way__text {
  flex: 1 1 auto;
  margin: 0 0 6px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--lnk-text-2);
  text-wrap: pretty;
}
.lnk-way__mail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0;
}
.lnk .lnk-way__addr {
  font-family: var(--lnk-mono);
  font-size: 0.8125rem;
  color: var(--lnk-accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.lnk .lnk-way__addr:hover { text-decoration: underline; text-underline-offset: 3px; }
.lnk .lnk-copy {
  appearance: none;
  margin: 0;
  padding: 3px 9px;
  border: 1px solid var(--lnk-line);
  border-radius: var(--ln-r-sm, 6px);
  background: none;
  color: var(--lnk-text-2);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease;
}
.lnk .lnk-copy:hover { border-color: var(--lnk-line-strong); color: var(--lnk-text); }
.lnk .lnk-copy:focus-visible { outline: 2px solid var(--lnk-accent); outline-offset: 2px; }
.lnk-post {
  margin: 22px 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--lnk-text-3);
}

/* --------------------------------------------------------------------------
   9  After sending. These views have no form for the script to build on, so
      they are a single quiet panel in the middle of the page. The contact
      form itself is left out (.ipsBox--contact), so that if the script never
      runs the plain form keeps its usual width.
   -------------------------------------------------------------------------- */
body.ipsApp[data-pagemodule="contact"] .ipsLayout__primary-column:not(.lnk) > .ipsBox:not(.ipsPageHeader):not(.ipsBox--contact) {
  max-width: 600px;
  margin: clamp(40px, 8vw, 104px) auto;
}
body.ipsApp[data-pagemodule="contact"] .ipsLayout__primary-column:not(.lnk) > .ipsBox:not(.ipsBox--contact) .ipsBox--formTemplate {
  border: 0;
  background: none;
  box-shadow: none;
}
body.ipsApp[data-pagemodule="contact"] .ipsLayout__primary-column:not(.lnk) > .ipsBox:not(.ipsBox--contact) .ipsLargeIcon {
  color: var(--ln-accent, #08D0F8);
}

/* --------------------------------------------------------------------------
  10  Phones and tablets
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  /* the signal moves above the headline, so leave it room */
  .lnk-top { padding-top: 104px; }
  .lnk-topics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lnk .lnk-topic { min-height: 0; }
  .lnk .lnk-ways__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  /* one column: what to include comes before the message box */
  body.ipsApp .lnk { grid-template-columns: minmax(0, 1fr); }
  body.ipsApp .lnk > .lnk-brief {
    grid-column: 1;
    grid-row: 3;
    margin-top: 56px;
    padding: 0;
    border: 0;
  }
  body.ipsApp .lnk > .lnk-write { grid-row: 4; margin-top: 56px; }
  body.ipsApp .lnk > .ipsBox--contact { grid-row: 5; }
  body.ipsApp .lnk > .lnk-ways { grid-row: 6; }
  .lnk-brief__in { position: static; }
  .lnk-brief__kicker {
    padding: 0 0 16px;
    border-bottom: 1px solid var(--lnk-line);
  }
}
@media (max-width: 640px) {
  .lnk-topics__h { margin-top: 56px; }
  .lnk-topics { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  .lnk .lnk-topic { padding: 16px 0 20px; }
  .lnk-topic__what { font-size: 0.8125rem; }
  body.ipsApp .lnk .ipsForm--contact { grid-template-columns: minmax(0, 1fr); }
  body.ipsApp .lnk .lnk-form--guest #contact_contact_name,
  body.ipsApp .lnk .lnk-form--guest #contact_email_address { grid-column: 1; }
  body.ipsApp .lnk .ipsForm--contact .ipsEditor .ProseMirror { min-height: 200px; }
  body.ipsApp .lnk .ipsForm--contact > .ipsSubmitRow .ipsButton { flex: 1 1 100%; }
  .lnk .lnk-ways__list { grid-template-columns: minmax(0, 1fr); }
  .lnk .lnk-way { padding: 20px 0 22px; }
}

/* --------------------------------------------------------------------------
  11  Legion Cyber (theme 3). Cyber has its own stylesheet and does not load
      the suite skin, so the --ln-* tokens are absent there and this page
      uses the fallbacks in section 1. Cyber sets its headings, paragraph and
      link colours and box borders with !important; the rules below answer
      only those. Headings keep Cyber's own display face and capitals.
   -------------------------------------------------------------------------- */
html[data-ips-theme="3"] body.ipsApp .lnk > .ipsBox--contact,
html[data-ips-theme="3"] body.ipsApp .lnk > .ipsBox--contact .ipsBox--formTemplate {
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
}
html[data-ips-theme="3"] .lnk .lnk-title {
  font-size: clamp(3rem, 7.4vw, 6.5rem) !important;
  line-height: 0.94 !important;
  letter-spacing: 0.02em !important;
}
html[data-ips-theme="3"] .lnk .lnk-topics__h {
  font-size: 1.125rem !important;
  letter-spacing: 0.08em !important;
  color: var(--lnk-text-2) !important;
}
html[data-ips-theme="3"] .lnk .lnk-h2 { font-size: clamp(1.75rem, 2.6vw, 2.25rem) !important; }
html[data-ips-theme="3"] .lnk .lnk-brief__h { font-size: 1.25rem !important; letter-spacing: 0.06em !important; }
html[data-ips-theme="3"] .lnk .lnk-way__name { font-size: 1.375rem !important; letter-spacing: 0.06em !important; }
html[data-ips-theme="3"] .lnk :is(.lnk-kicker, .lnk-brief__kicker) {
  font-family: var(--lnk-mono) !important;
  color: var(--lnk-accent) !important;
}
html[data-ips-theme="3"] .lnk .lnk-lede,
html[data-ips-theme="3"] .lnk .lnk-topic__what,
html[data-ips-theme="3"] .lnk .lnk-brief__text,
html[data-ips-theme="3"] .lnk .lnk-way__text { color: var(--lnk-text-2) !important; }
html[data-ips-theme="3"] .lnk :is(.lnk-signin, .lnk-after, .lnk-brief__never, .lnk-post) { color: var(--lnk-text-3) !important; }
html[data-ips-theme="3"] .lnk :is(.lnk-more, .lnk-way__addr) { color: var(--lnk-accent) !important; }
html[data-ips-theme="3"] .lnk .lnk-signin a {
  color: var(--lnk-text-2) !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}
html[data-ips-theme="3"] .lnk .lnk-topic[aria-checked="true"] .lnk-topic__name { color: var(--lnk-accent) !important; }
html[data-ips-theme="3"] .lnk .lnk-topic,
html[data-ips-theme="3"] .lnk .lnk-topic:hover {
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

/* --------------------------------------------------------------------------
  12  Reduced motion: the script draws one still frame; nothing here moves
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .lnk-sky,
  .lnk .lnk-topic,
  .lnk-topic__name,
  .lnk-topic__name::before,
  .lnk .lnk-copy { transition: none; }
}
