/* ==========================================================================
   Careers (careers.html, IDL-05): page layout only. Tokens and components
   come from core.css. Sections: hero + section A–A through the stack,
   disciplines legend, general notes, open-roles register (paper),
   open application, application dialog.
   ========================================================================== */

/* Hatch patterns (defined once, referenced by the drawing and the legend) */
.cr-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.cr-defs path { fill: none; stroke: var(--ctrl); stroke-width: 0.75; }
.cr-defs circle { fill: var(--ctrl); }

/* Shared section head: H2 on the left, aside on the right of the 12-col grid */
.cr-head { align-items: end; row-gap: var(--s-5); margin-bottom: clamp(40px, 5vw, 72px); }
.cr-head h2 { grid-column: 1 / span 7; max-width: 12em; }
.cr-head__aside { grid-column: 9 / span 4; color: var(--tx-2); max-width: 40ch; padding-bottom: 0.3em; }
.cr-head__key { grid-column: 9 / span 4; justify-self: start; color: var(--tx-3); padding-bottom: 0.6em; }
@media (max-width: 1023px) {
  .cr-head h2, .cr-head__aside, .cr-head__key { grid-column: 1 / -1; }
}

/* ---------- Hero ------------------------------------------------------- */
.cr-hero { padding-bottom: clamp(64px, 8vw, 128px); }
.cr-hero .colgrid { -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, #000 45%, transparent 100%); }
.cr-hero__wrap { position: relative; z-index: 1; }
.cr-hero .page-hero__code .rule { flex: 1; }
.cr-hero__grid { align-items: start; row-gap: clamp(56px, 8vw, 96px); }
.cr-hero__main { grid-column: 1 / span 6; padding-bottom: clamp(8px, 2.2vw, 36px); }
.cr-hero h1 { max-width: 7.5em; }
.cr-hero__cta { margin-top: clamp(32px, 4vw, 48px); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; }
.btn:hover .cr-arr-down { transform: translateY(2px); }

/* Section A–A: the drawing */
.cr-sec { grid-column: 7 / span 6; justify-self: end; width: 100%; max-width: 600px; margin: 0; }
.cr-sec__draw { position: relative; }
.cr-sec svg { display: block; width: 100%; height: auto; overflow: visible; }
.cr-sec .o { fill: none; stroke: var(--tx-2); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: miter; }
.cr-sec .o.thin { stroke-width: 0.75; }
.cr-sec .d { fill: none; stroke: var(--tx-3); stroke-width: 0.75; vector-effect: non-scaling-stroke; }
.cr-sec .hid { stroke: var(--ctrl); stroke-dasharray: 4 3; }
.cr-sec .e, .cr-sec .x { stroke: var(--line-2); }
.cr-sec .bg { fill: var(--bg-0); }
.cr-sec .dot { fill: var(--tx-2); }
.cr-sec text { font-family: var(--font-mono); font-weight: 500; fill: var(--tx-3); }
.cr-sec .lv { font-size: 9px; letter-spacing: 0.08em; }
.cr-sec .dt { font-size: 9.5px; letter-spacing: 0.14em; }

/* Tags: real HTML text (stays 11–12px at every width), placed on the leader lines.
   Positions are the leader y-coordinates over the 410-unit viewBox height. */
.cr-tags { list-style: none; padding: 0; position: absolute; inset: 0; pointer-events: none; }
.cr-tag {
  position: absolute; left: 60%; right: 0; display: grid; gap: 5px; justify-items: start;
  transform: translateY(-8px);
  font-family: var(--font-mono); font-size: 12px; line-height: 16px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; color: var(--tx-1);
}
.cr-tag__n b { font-weight: 500; color: var(--tx-3); margin-right: 0.45em; }
.cr-tag .status { font-size: 11px; color: var(--tx-3); }
.cr-tag .status--live { color: var(--accent); }
.cr-tag--t { top: 6.34%; }
.cr-tag--5 { top: 23.41%; }
.cr-tag--4 { top: 38.78%; }
.cr-tag--3 { top: 54.39%; }
.cr-tag--0 { top: 77.32%; }

.cr-sec__cap { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-1); }
.cr-sec__cap .label { color: var(--tx-2); }
.cr-sec__cap .stamp { margin-left: auto; }
.cr-sec__bub {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 1px var(--tx-2); font: 500 11px/1 var(--font-mono); color: var(--tx-1);
}

/* Drawing build-up (careers.js). Hidden only while JS motion runs; failsafe if it never does. */
html.js:not(.reduce-motion) .cr-sec:not(.is-drawn) [data-p],
html.js:not(.reduce-motion) .cr-sec:not(.is-drawn) .cr-tag { opacity: 0; }
html.js:not(.reduce-motion):not(.motion-ready) .cr-sec [data-p],
html.js:not(.reduce-motion):not(.motion-ready) .cr-sec .cr-tag { animation: cr-failsafe 0.4s linear 2.4s forwards; }
html.js:not(.reduce-motion):not(.cr-ready) .cr-hero .colgrid span { transform: scaleY(0); animation: cr-failsafe-col 0.4s linear 2.2s forwards; }
@keyframes cr-failsafe { to { opacity: 1; } }
@keyframes cr-failsafe-col { to { transform: none; } }

@media (max-width: 1023px) {
  .cr-hero__main { grid-column: 1 / -1; padding-bottom: 0; }
  .cr-sec { grid-column: 1 / span 9; justify-self: start; max-width: 620px; }
}
@media (max-width: 767px) {
  .cr-sec { grid-column: 1 / -1; }
  .cr-tag { font-size: 11px; line-height: 14px; gap: 3px; transform: translateY(-7px); }
  .cr-tag .status { font-size: 10px; }
  .cr-sec .dim, .cr-sec .lv { display: none; }
  .cr-sec__cap { flex-wrap: wrap; row-gap: 10px; }
  .cr-sec__cap .stamp { margin-left: 36px; }
}

/* ---------- 01 Disciplines: legend ------------------------------------ */
.cr-work { padding-top: calc(var(--section) * 0.62); }
.legend__head, .legend__row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.legend__head { padding-bottom: 14px; border-bottom: 1px solid var(--line-2); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tx-3); font-weight: 500; }
.legend__head span:nth-child(1) { grid-column: 1; }
.legend__head span:nth-child(2) { grid-column: 2; }
.legend__head span:nth-child(3) { grid-column: 3 / span 4; }
.legend__head span:nth-child(4) { grid-column: 7 / span 4; }
.legend__head span:nth-child(5) { grid-column: 11 / span 2; justify-self: end; }
.legend__list { list-style: none; padding: 0; }
.legend__row { position: relative; align-items: center; padding: 26px 0; border-bottom: 1px solid var(--line-2); transition: background-color var(--dur-micro) linear; }
.legend__sw { grid-column: 1; width: 64px; height: 40px; overflow: visible; }
.legend__sw .sw-bg { fill: var(--bg-0); }
.legend__sw .sw-h { opacity: 0.7; transition: opacity var(--dur-ui) linear; }
.legend__sw .sw-f { fill: none; stroke: var(--tx-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.legend__sw .sw-r { fill: none; stroke: var(--ctrl); stroke-width: 0.75; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.legend__ref { grid-column: 2; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--tx-3); font-variant-numeric: tabular-nums slashed-zero; }
.legend__name { grid-column: 3 / span 4; font-size: var(--t-h4); line-height: 1.22; letter-spacing: -0.01em; font-weight: 500; max-width: 16em; }
.legend__row .legend__name a { text-decoration: none; background: linear-gradient(currentColor, currentColor) left 100% / 0% 1px no-repeat; transition: background-size var(--dur-ui) var(--ease-out); }
.legend__name a::after { content: ""; position: absolute; inset: 0; }
.legend__name a:focus-visible { outline: none; }
.legend__row:has(a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
.legend__line { grid-column: 7 / span 4; color: var(--tx-2); max-width: 40ch; }
.legend__st { grid-column: 11 / span 2; justify-self: end; }
.legend__row:hover { background: var(--bg-1); }
.legend__row:hover .sw-h { opacity: 1; }
.legend__row:hover .legend__name a { background-size: 100% 1px; }

@media (max-width: 1023px) {
  .legend__head { display: none; }
  .legend__list { border-top: 1px solid var(--line-2); }
  .legend__row { grid-template-columns: 64px minmax(0, 1fr) auto; column-gap: 20px; row-gap: 8px; align-items: start; padding: 24px 0; }
  .legend__sw { grid-column: 1; grid-row: 1 / span 3; }
  .legend__ref { grid-column: 2; grid-row: 1; padding-top: 2px; }
  .legend__st { grid-column: 3; grid-row: 1; }
  .legend__name { grid-column: 2 / -1; grid-row: 2; }
  .legend__line { grid-column: 2 / -1; grid-row: 3; }
}
@media (max-width: 479px) {
  .legend__row { grid-template-columns: 48px minmax(0, 1fr) auto; column-gap: 16px; }
  .legend__sw { width: 48px; height: 30px; }
}

/* ---------- 02 Notes --------------------------------------------------- */
.cr-notes { padding-top: calc(var(--section) * 0.5); }
.cr-notes__list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-8) var(--gutter); }
.cr-note { display: grid; align-content: start; }
.cr-note .rule { display: block; margin-bottom: 18px; background: var(--tx-3); }
.cr-note__n { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; color: var(--tx-3); font-weight: 500; }
.cr-note h3 { margin-top: clamp(28px, 3.5vw, 52px); max-width: 11em; }
.cr-note p { margin-top: 12px; color: var(--tx-2); max-width: 30ch; }
@media (max-width: 1023px) { .cr-notes__list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) { .cr-notes__list { grid-template-columns: 1fr; gap: var(--s-7); } .cr-note h3 { margin-top: 20px; } }

/* ---------- 03 Register (paper) --------------------------------------- */
.cr-roles { padding-block: var(--section); }
.cr-roles .cr-head__aside { color: var(--ink-2); }
.reg__head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); padding-bottom: 14px; border-bottom: 1px solid var(--ink-3); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.reg__head span:nth-child(1) { grid-column: 1; }
.reg__head span:nth-child(2) { grid-column: 2 / span 5; }
.reg__head span:nth-child(3) { grid-column: 7 / span 2; }
.reg__head span:nth-child(4) { grid-column: 9 / span 3; }
.reg__list { list-style: none; padding: 0; }
.role { border-bottom: 1px solid var(--paper-line); }
.role__h { margin: 0; font: inherit; color: var(--ink-1); }
.role__btn {
  width: 100%; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: center;
  min-height: 92px; padding: 18px 0; text-align: left; color: var(--ink-1);
}
.role__btn:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 4px; }
.role__ref { grid-column: 1; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--ink-3); font-variant-numeric: tabular-nums slashed-zero; }
.role__title {
  grid-column: 2 / span 5; font-size: var(--t-h4); line-height: 1.2; letter-spacing: -0.012em; font-weight: 500; justify-self: start;
  background: linear-gradient(currentColor, currentColor) left 100% / 0% 1px no-repeat; transition: background-size var(--dur-ui) var(--ease-out);
}
.role__team { grid-column: 7 / span 2; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; }
.role__loc { grid-column: 9 / span 3; font-size: var(--t-small); color: var(--ink-2); }
.role__tog { grid-column: 12; justify-self: end; position: relative; width: 44px; height: 44px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--ink-3); color: var(--ink-1); transition: background-color var(--dur-micro) linear, color var(--dur-micro) linear; }
.role__tog::before, .role__tog::after { content: ""; position: absolute; left: 50%; top: 50%; background: currentColor; }
.role__tog::before { width: 14px; height: 1.5px; margin: -0.75px 0 0 -7px; }
.role__tog::after { width: 1.5px; height: 14px; margin: -7px 0 0 -0.75px; transition: transform var(--dur-ui) var(--ease-move); }
.role__btn:hover .role__title { background-size: 100% 1px; }
.role__btn:hover .role__tog { background: var(--ink-1); color: var(--paper); }
.role.is-open .role__tog::after { transform: scaleY(0); }

/* Expand: grid-template-rows 0fr → 1fr; reduced motion is instant (core zeroes durations) */
.role__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.6s var(--ease-move); }
.role.is-open .role__panel { grid-template-rows: 1fr; }
.role__clip { min-height: 0; overflow: hidden; }
.role__body {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: 28px;
  padding: 4px 0 48px; opacity: 0; transform: translateY(-6px);
  transition: opacity 0.2s linear, transform 0.4s var(--ease-out);
}
.role.is-open .role__body { opacity: 1; transform: none; transition: opacity 0.45s linear 0.12s, transform 0.8s var(--ease-out) 0.08s; }
html:not(.js) .role__panel { grid-template-rows: 1fr; }
html:not(.js) .role__body { opacity: 1; transform: none; }
html:not(.js) .role__tog { visibility: hidden; }
.role__sum { grid-column: 2 / span 5; grid-row: 1; color: var(--ink-2); max-width: 50ch; }
.role__req { grid-column: 7 / span 5; grid-row: 1 / span 2; }
.role__k { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: 10px; }
.role__req ul { list-style: none; padding: 0; border-top: 1px solid var(--paper-line); }
.role__req li { display: grid; grid-template-columns: 22px minmax(0, 1fr); padding: 11px 0 12px; border-bottom: 1px solid var(--paper-line); color: var(--ink-1); font-size: var(--t-small); line-height: 1.45; }
.role__req li::before { content: ""; width: 8px; height: 1px; margin-top: 0.72em; background: var(--ink-3); }
.role__act { grid-column: 2 / span 5; grid-row: 2; align-self: end; }
.cr-roles .btn--primary:hover { background: var(--ink-2); }

.reg__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--s-5); margin-top: clamp(32px, 4vw, 56px); }
.reg__foot .label { color: var(--ink-3); }
.reg__tb { display: grid; grid-template-columns: repeat(3, auto); border-top: 1px solid var(--ink-3); border-left: 1px solid var(--ink-3); }
.reg__tb > div { padding: 8px 14px 10px; border-right: 1px solid var(--ink-3); border-bottom: 1px solid var(--ink-3); display: grid; gap: 3px; }
.reg__tb dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.reg__tb dd { font-size: 13px; color: var(--ink-1); font-weight: 480; }

@media (max-width: 1023px) {
  .reg__head { display: none; }
  .reg__list { border-top: 1px solid var(--ink-3); }
  .role__btn { grid-template-columns: 3rem minmax(0, 1fr) 44px; column-gap: 16px; row-gap: 6px; align-items: start; padding: 22px 0; min-height: 0; }
  .role__ref { grid-column: 1; grid-row: 1; padding-top: 0.45em; }
  .role__title { grid-column: 2; grid-row: 1; }
  .role__team { grid-column: 2; grid-row: 2; margin-top: 4px; }
  .role__loc { grid-column: 2; grid-row: 3; }
  .role__tog { grid-column: 3; grid-row: 1 / span 3; align-self: center; }
  .role__body { grid-template-columns: 3rem minmax(0, 1fr); column-gap: 16px; padding-bottom: 36px; }
  .role__sum, .role__req, .role__act { grid-column: 2; grid-row: auto; }
}
@media (max-width: 479px) {
  .role__btn, .role__body { grid-template-columns: 2.5rem minmax(0, 1fr) 44px; column-gap: 12px; }
  .role__body { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .reg__tb { display: none; }
}

/* ---------- 04 Open application --------------------------------------- */
.cr-open { border-top: 0; }
.cr-open__grid { align-items: end; row-gap: var(--s-6); }
.cr-open__copy { grid-column: 1 / span 7; }
.cr-open__copy h2 { max-width: 11em; }
.cr-open__copy .t-lead { margin-top: var(--s-5); }
.cr-open__actions { grid-column: 9 / span 4; display: grid; gap: var(--s-4); justify-items: end; justify-self: end; }
@media (max-width: 1023px) { .cr-open__copy, .cr-open__actions { grid-column: 1 / -1; } }

/* ---------- Application dialog ---------------------------------------- */
/* margin:auto restores native centring (core's `* { margin: 0 }` reset removes the UA value) */
.cr-modal { margin: auto; width: min(760px, calc(100% - 32px)); overscroll-behavior: contain; }
.cr-modal__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: 6px 10px 6px 28px; border-bottom: 1px solid var(--line-2); }
.cr-modal .modal__close { margin: 0; }
.cr-modal .modal__close svg path { fill: none; stroke: currentColor; stroke-width: 1.5; }
.cr-modal__head { padding: 28px 28px 0; display: grid; gap: 10px; }
.cr-modal__role { font-size: var(--t-small); color: var(--tx-2); }
.cr-modal__k { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tx-3); margin-right: 6px; font-weight: 500; }
.cr-modal__role strong { font-weight: 520; }
.cr-modal__body { padding: 28px 28px 32px; }
.cr-form { display: grid; gap: 24px; }
.cr-form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px var(--gutter); }
.cr-hint { font-size: 14px; color: var(--tx-3); line-height: 1.45; }
.field[data-invalid] .cr-hint { display: none; }
.cr-file {
  position: relative; display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 14px 16px;
  border: 1px dashed var(--ctrl); border-radius: var(--radius); background: var(--bg-1);
  transition: border-color var(--dur-micro) linear, background-color var(--dur-micro) linear;
}
.cr-file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.cr-file:hover, .cr-file.is-over { border-color: var(--tx-2); background: var(--bg-3); }
.cr-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.cr-file__btn {
  display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 36px; padding: 0 12px;
  border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--ctrl); color: var(--tx-1); font-size: 14px; font-weight: 520; pointer-events: none;
}
.cr-file__btn svg path { fill: none; stroke: currentColor; stroke-width: 1.25; }
.cr-file__name { min-width: 0; font-size: 14px; color: var(--tx-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); letter-spacing: 0.02em; }
.cr-file.has-file .cr-file__name { color: var(--tx-1); }
.field[data-invalid] .cr-file { border-color: var(--err); border-style: solid; }
.cr-form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; padding-top: 4px; }
.cr-form__note { font-size: 14px; color: var(--tx-3); }
.cr-status { display: flex; gap: 10px; align-items: flex-start; min-height: 0; }
.cr-status[data-state]::before, .cr-toast::before {
  content: ""; flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%;
}
.cr-status[data-state="err"]::before { content: "!"; display: inline-grid; place-items: center; font: 600 11px/1 var(--font-mono); color: var(--bg-0); background: var(--err); }
.cr-status[data-state="ok"]::before, .cr-toast::before {
  background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.3 2.3 4.7-4.9' fill='none' stroke='%230a0c10' stroke-width='1.6'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}
@media (max-width: 599px) {
  .cr-form__row { grid-template-columns: 1fr; }
  .cr-modal__bar { padding-left: 20px; }
  .cr-modal__head { padding: 24px 20px 0; }
  .cr-modal__body { padding: 24px 20px 28px; }
  .cr-file { flex-wrap: wrap; gap: 10px; }
}

/* Page-level announcement after a successful send (the dialog has closed) */
.cr-toast {
  position: fixed; left: var(--margin); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 120;
  display: flex; gap: 10px; align-items: flex-start; max-width: min(440px, calc(100% - 2 * var(--margin)));
  padding: 16px 18px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius);
  color: var(--tx-1); font-size: var(--t-small); line-height: 1.45;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity var(--dur-ui-exit) linear, transform var(--dur-ui) var(--ease-out);
}
.cr-toast:empty { padding: 0; border: 0; }
.cr-toast:empty::before { display: none; }
.cr-toast.is-in { opacity: 1; transform: none; pointer-events: auto; }

/* paper polarity for the section opener */
.cr-roles .section-rule .label { color: var(--ink-2); }
.cr-roles .section-rule .label .idx { color: var(--ink-3); }

/* The application dialog needs JavaScript */
html:not(.js) [data-apply] { display: none; }

@media (forced-colors: active) {
  .role__tog { border: 1px solid ButtonText; }
  .role__tog::before, .role__tog::after { forced-color-adjust: none; background: ButtonText; }
}
