/**
 * Components the prototypes imply but never draw: form feedback, the careers
 * listing and the application panel.
 *
 * Everything here is composed from tokens already defined by the pages
 * (--color-accent, --color-surface, --color-divider, --font-mono, the .ccard /
 * .btn / .input shapes). No new colours, radii or type scales are introduced.
 */

/* ── form feedback ─────────────────────────────────────────────────────────── */
.form-status {
  margin: 0;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--color-divider);
}
.form-status.is-success {
  border-color: rgba(57, 211, 192, 0.4);
  background: rgba(57, 211, 192, 0.08);
  color: var(--c-teal);
}
.form-status.is-error {
  border-color: rgba(255, 126, 107, 0.45);
  background: rgba(255, 126, 107, 0.08);
  color: var(--c-coral);
}
.form-status.is-info {
  border-color: rgba(91, 156, 255, 0.4);
  background: rgba(91, 156, 255, 0.08);
  color: var(--c-blue);
}

.field-error {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--c-coral);
}

.input[aria-invalid='true'] {
  border-color: var(--c-coral);
}

/* The honeypot. Hidden from sight, from layout and from assistive tech, but
   still a real focusable-free input that a form-filling bot will populate. */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Native file inputs cannot be styled to match .input, so the control is the
   label and the input itself is visually hidden but still keyboard reachable. */
.file-field input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.file-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border: 1px dashed var(--color-divider);
  border-radius: 999px;
  font-size: 14px;
  color: rgba(243, 242, 239, 0.72);
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s;
}
.file-trigger:hover,
.file-field input[type='file']:focus-visible + .file-trigger {
  border-color: var(--color-accent);
  color: var(--color-text);
}
.file-name {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(243, 242, 239, 0.5);
}

/* Slots the design left unbound (the blog cards). Holds the box and says what
   belongs there, rather than collapsing the layout or faking a photo. */
.image-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 120px;
  padding: 12px;
  text-align: center;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)),
    var(--color-surface-2, #181818);
  box-shadow: inset 0 0 0 1px var(--color-divider);
}
.image-placeholder span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(243, 242, 239, 0.32);
}

/* ══════════════════════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════════════════════

   The prototypes carry their desktop layout as *inline* style attributes, which
   no ordinary rule can beat. Matching on the style attribute and forcing the
   value is therefore the mechanism, not a shortcut — the alternative would be
   rewriting hundreds of inline declarations in the build step and losing the
   1:1 relationship with the design source.

   Measured cause of the sideways drag: the footer's `1.6fr 1fr 1fr 1fr` grid
   with a `min-width:220px` first cell needs ~585px, on all 13 pages. Note the
   pages already set `body{overflow-x:hidden}`, which does NOT stop the viewport
   scrolling — the overflow has to actually go away.
   ────────────────────────────────────────────────────────────────────────── */

/* Nothing may exceed its container regardless of intrinsic size. */
img,
pre,
table,
iframe,
video {
  max-width: 100%;
}
pre {
  overflow-x: auto;
}
body {
  overflow-wrap: break-word;
}

@media (max-width: 900px) {
  /* Footer: four columns → two. */
  [style*="grid-template-columns:1.6fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 30px !important;
  }
  /* The 220px floor on the brand cell is what made the grid unshrinkable. */
  [style*="min-width:220px"],
  [style*="min-width:250px"],
  [style*="min-width:260px"] {
    min-width: 0 !important;
  }
}

@media (max-width: 760px) {
  /* Two-up content grids → single column. Anchored on the property name so
     `1.6fr 1fr 1fr 1fr` cannot match this rule by substring. */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns:120px 1fr"],
  [style*="grid-template-columns:180px 1.1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Wide minimums in auto-fit tracks exceed a phone's width on their own. */
  [style*="minmax(300px"],
  [style*="minmax(320px"] {
    grid-template-columns: 1fr !important;
  }
  .sec {
    padding: clamp(52px, 12vw, 84px) 0 !important;
  }
}

@media (max-width: 560px) {
  [style*="grid-template-columns:1.6fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  /* Footer legal row: stack instead of straining to sit on one line. */
  [style*="justify-content:space-between"][style*="margin-top:50px"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }
}

/* ── nav ───────────────────────────────────────────────────────────────────── */

.cv-burger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0 10px;
  cursor: pointer;
  background: rgba(243, 242, 239, 0.04);
  border: 1px solid var(--color-divider);
  border-radius: 12px;
  transition: background 0.2s, border-color 0.2s;
}
.cv-burger:hover {
  background: rgba(243, 242, 239, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}
.cv-burger span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--color-text);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s;
}
.cv-burger span:nth-child(1) { width: 100%; }
.cv-burger span:nth-child(2) { width: 72%; }
.cv-burger span:nth-child(3) { width: 88%; }
.cv-burger[aria-expanded='true'] span:nth-child(1) { transform: translateY(7px) rotate(45deg); width: 100%; }
.cv-burger[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.cv-burger[aria-expanded='true'] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); width: 100%; }

@media (max-width: 899px) {
  /* The inline links and the nav's own CTA move into the panel. `data-nav-cta`
     is set by the build step so page-body buttons keep their styling. */
  .cv-navlink,
  [data-nav-cta] {
    display: none !important;
  }
  .cv-navin,
  nav > div {
    gap: 12px !important;
  }
  .cv-nav img,
  nav img[alt='Clanvoyant'] {
    height: 34px !important;
    width: auto !important;
  }
}

/* ── menu panel ────────────────────────────────────────────────────────────── */

.cv-menu[hidden] {
  display: none;
}
.cv-menu {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  justify-content: flex-end;
}
.cv-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  animation: cv-menu-fade 0.25s ease both;
}
.cv-menu-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 26px;
  width: min(370px, 88vw);
  height: 100%;
  padding: 22px clamp(20px, 6vw, 32px) 32px;
  /* The panel itself never scrolls — only the link list does, so the header and
     the CTA stay reachable on a short screen instead of falling below the fold. */
  overflow: hidden;
  background: var(--color-surface, #121212);
  border-left: 1px solid var(--color-divider);
  box-shadow: -30px 0 90px rgba(0, 0, 0, 0.6);
  animation: cv-menu-slide 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes cv-menu-fade {
  from { opacity: 0; }
}
@keyframes cv-menu-slide {
  from { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .cv-menu-backdrop,
  .cv-menu-panel {
    animation: none;
  }
}

.cv-menu-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--color-divider);
}
.cv-menu-home {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.cv-menu-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  cursor: pointer;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-divider);
  border-radius: 999px;
}
.cv-menu-close:hover {
  background: rgba(243, 242, 239, 0.07);
}

.cv-menu-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-height: 0; /* lets a flex child actually shrink and scroll */
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.cv-menu-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cv-menu-label {
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(243, 242, 239, 0.38);
}
/* Sized so all eleven links plus the CTA clear a 667px screen without the panel
   needing to scroll, while each row keeps a ~40px touch target. */
.cv-menu-link {
  padding: 7px 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgba(243, 242, 239, 0.82);
  transition: color 0.18s, transform 0.18s;
}
.cv-menu-panel:focus-visible {
  outline: none;
}
.cv-menu-link:hover {
  color: var(--color-text);
  transform: translateX(3px);
}
.cv-menu-link[aria-current='page'] {
  color: var(--color-accent);
}
.cv-menu-cta {
  flex: none;
  justify-content: center;
  padding: 14px 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
}

/* ── homepage ──────────────────────────────────────────────────────────────── */

/* The prototype's component set this display property on mount and on resize.
   A media query does the same job without JavaScript and without a flash of
   hidden links before the script runs. */
[data-navwrap] {
  display: none;
}
@media (min-width: 900px) {
  [data-navwrap] {
    display: flex;
  }
}

/* Anchor targets clear the 66px sticky nav, matching the offset the component
   applied by hand when it scrolled. */
#top,
#who,
#mission,
#ecosystem,
#kasadesk,
#solutions,
#security {
  scroll-margin-top: 66px;
}

.cv-cmd {
  transition: background 0.18s;
}
.cv-cmd:hover,
.cv-cmd:focus-visible {
  background: rgba(243, 242, 239, 0.06);
  outline: none;
}

/* ── careers ───────────────────────────────────────────────────────────────── */
.roles-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.role-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}
.role-card-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.role-card-title {
  font-size: 21px;
  margin: 0;
  letter-spacing: -0.02em;
}
.role-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.role-card-summary {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: rgba(243, 242, 239, 0.6);
  flex: 1;
}
.role-card-cta {
  font-weight: 700;
  font-size: 14px;
  padding: 11px 22px;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}
.role-card-cta[aria-disabled='true'] {
  opacity: 0.45;
  pointer-events: none;
}
.roles-empty {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
  grid-column: 1 / -1;
}
.roles-loading {
  font-family: var(--font-mono);
  font-size: 13px;
  color: rgba(243, 242, 239, 0.4);
  letter-spacing: 0.06em;
}

.apply-panel {
  scroll-margin-top: 90px;
}

@media (max-width: 720px) {
  .roles-grid {
    grid-template-columns: 1fr;
  }
}
