/* ===========================================================================
   AL-SAEED ECONOMIC GROUP  —  pages/p-careers-apply.css
   ---------------------------------------------------------------------------
   The application form. The eighteenth distinct visual key:
     Home             teal filled eyebrow, expanding six-panel strip
     About            gold filled eyebrow, timeline on one rule
     Chairman         gold-on-dark eyebrow, letter on the dark ground
     Leadership       outlined eyebrow, portrait grid with no card boxes
     Sectors          rule-and-label eyebrow, alternating full-width rows
     Sector detail    dark filled eyebrow pill, one page as a tab set
     Companies        underlined eyebrow, filterable directory of crest cards
     Projects         vertical bar eyebrow, staggered grid, caption plates
     Project detail   bracketed eyebrow, long-form copy beside a sticky rail
     Global Presence  flanking rules, two-column evidence comparison
     Sustainability   diamond marker, quadrant and an empty report table
     News             highlighter band, front page and a date-first archive
     News detail      corner ticks, no banner, a measured column with breakouts
     Gallery          2x2 dot grid glyph, albums drawn as stacks of prints
     Gallery album    three-sided frame, a mosaic with a 2x2 lead tile
     Contact          trailing rule that fills the line, floating-label form
     Careers          chevron tag cut with clip-path, sideways spine labels
     Careers-apply    the label BANDED between two hairlines, one above and
                      one below. Seventeen marks have sat before, after,
                      around, under, behind or been cut out of the label;
                      this is the first to enclose it on the BLOCK axis, and
                      the only one that needs no [dir] override at all -
                      `border-block` is symmetrical, so it mirrors by being
                      the same on both sides.

   THE PAGE'S OWN DEVICE: the form is not one card of fields, it is a
   DOCUMENT IN THREE NUMBERED PARTS. Each part is a real <fieldset> whose
   heading, number and note sit in a leading column with the fields beside
   them, so a long form reads as three short ones. Contact's single card of
   floating labels is deliberately not repeated: labels here STACK above
   their field with a hint line under the label, which is what a form with
   hints and a file upload needs.

   TWO STRUCTURAL NOTES
   1. The <legend> is visually hidden, not removed. A fieldset needs one for
      its accessible name, but the rendered legend is a special box that
      breaks a grid fieldset - so `.visually-hidden` takes it out of flow
      (clip, not display:none) and the visible heading is an ordinary <h3>
      in the leading column. The group still announces correctly.
   2. There is NO banner photograph. The design supplies none for an
      application page, and reusing a sector photograph here would be
      decoration standing in for content. The hero is the dark ground with a
      hairline hatch across it - which also means this page downloads no
      banner image at all, on the one page where the visitor has work to do.
   =========================================================================== */

.page-careers-apply{
  --eyebrow-fg:var(--gold-dk);
  --page-bg:var(--white);

  /* The hatch angle is a variable rather than two whole background
     declarations, because the angle is the only part that mirrors. */
  --hatch:135deg;
}
[dir="rtl"] .page-careers-apply{--hatch:45deg}

/* ---------------------------------------------------------------------------
   THE EIGHTEENTH EYEBROW — banded between two hairlines
   --------------------------------------------------------------------------- */
.page-careers-apply .eyebrow{
  background:none;box-shadow:none;border:0;border-radius:0;
  padding-inline:0;
  padding-block:.4375rem;
  border-block:.0625rem solid var(--gold);
  color:var(--eyebrow-fg);
}
.page-careers-apply .eyebrow--onDark{
  border-block-color:rgba(196,160,68,.5);
  color:var(--gold-lt);
  background:none;
}

/* ---------------------------------------------------------------------------
   THE BANNER, WITHOUT A PHOTOGRAPH
   --------------------------------------------------------------------------- */
.page-careers-apply .page-hero{background:var(--dark)}
.page-careers-apply .page-hero::before{
  content:"";position:absolute;inset:0;z-index:0;
  background:
    radial-gradient(64rem 32rem at 50% 118%, rgba(4,159,169,.18), transparent 70%),
    repeating-linear-gradient(var(--hatch),
      rgba(196,160,68,.06) 0 .0625rem,
      transparent .0625rem .9375rem);
}

/* ---------------------------------------------------------------------------
   THE FORM AS A DOCUMENT IN PARTS
   --------------------------------------------------------------------------- */
.apply{background:var(--cream)}
.apply__card{
  background:var(--white);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-2);
  padding:clamp(1.5rem,1.25rem + 2vw,3rem);
  margin-top:clamp(2rem,1.5rem + 2vw,3rem);
}

.part{
  /* a fieldset carries a border, padding and margin of its own by default */
  border:0;margin:0;padding:0;
  min-width:0;                       /* fieldsets refuse to shrink otherwise */
  display:grid;gap:var(--s-3) var(--gutter);
}
.part + .part{
  margin-block-start:clamp(2rem,1.5rem + 2vw,3rem);
  padding-block-start:clamp(2rem,1.5rem + 2vw,3rem);
  border-top:.0625rem solid var(--line);
}
@media (min-width:56rem){
  .part{grid-template-columns:minmax(0,15rem) minmax(0,1fr)}
}

.part__head{display:grid;gap:.375rem;align-content:start}
.part__idx{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:var(--fs-sm);font-weight:700;letter-spacing:.08em;
  color:var(--gold-dk);
  /* a numeral is Latin in every edition; this element carries no logical
     insets, so isolating it here is safe */
  direction:ltr;unicode-bidi:isolate;width:fit-content;
}
.part__name{margin:0;font-size:var(--fs-h4);color:var(--ink)}
.part__note{margin:0;font-size:var(--fs-xs);color:var(--muted);max-width:32ch}

.part__fields{display:grid;gap:var(--s-3);min-width:0}
@media (min-width:40rem){
  .part__fields--two{grid-template-columns:repeat(2,minmax(0,1fr))}
  .part__fields--two .field--wide{grid-column:1 / -1}
}

/* ---------------------------------------------------------------------------
   STACKED FIELDS
   ---------------------------------------------------------------------------
   Label, then hint, then control, then the error slot - in that order in the
   markup as well as on screen, so the reading order and the tab order agree
   and the hint is read BEFORE the field it explains.
   --------------------------------------------------------------------------- */
/* `align-content:start` is not cosmetic. A .field is a grid of four auto rows
   inside a two-column row that stretches, and align-content's initial value
   behaves as STRETCH - so leftover height was being handed to the rows, and
   whichever field shared a row with a taller neighbour got a control 4px
   deeper than the others. Measured, not noticed by eye. */
.field{display:grid;gap:.3125rem;min-width:0;align-content:start}
.field__label{
  font-size:var(--fs-sm);font-weight:600;color:var(--ink);
}
.field__label .req{color:var(--gold-dk);margin-inline-start:.125rem}
.field__hint{font-size:var(--fs-xs);color:var(--muted)}

.field input,
.field select,
.field textarea{
  width:100%;
  font:inherit;color:var(--ink);
  background:var(--white);
  border:.0625rem solid var(--line);
  border-radius:var(--r-sm);
  padding:.75rem .875rem;
  transition:border-color var(--dur-fast) var(--ease),
             box-shadow var(--dur-fast) var(--ease);
}
.field textarea{min-height:7.5rem;resize:vertical}
.field input:focus,
.field select:focus,
.field textarea:focus{
  outline:none;
  border-color:var(--teal);
  box-shadow:0 0 0 .1875rem var(--teal-tint);
}

/* --- the select ---------------------------------------------------------- */
/* The native arrow cannot be styled and sits on the wrong side in RTL, so it
   is turned off and drawn as a pseudo-element on a wrapper - which places it
   with `inset-inline-end` and mirrors for nothing. */
.select{position:relative;display:block;min-width:0}
.select select{
  appearance:none;-webkit-appearance:none;
  padding-inline-end:2.5rem;
}
.select::after{
  content:"";position:absolute;pointer-events:none;
  /* WHERE it sits is logical - the trailing edge of the control, so it swaps
     sides for Arabic and Kurdish on its own. WHAT it is is physical: a
     dropdown arrow points DOWN in every direction, so the two borders that
     make the chevron are `right` and `bottom` and must not be logical. As
     `border-inline-end` they became border-LEFT in RTL and the arrow turned
     into a left-pointing "<". */
  inset-inline-end:1rem;top:50%;
  width:.5rem;height:.5rem;
  margin-top:-.3125rem;
  border-right:.125rem solid var(--muted);
  border-bottom:.125rem solid var(--muted);
  transform:rotate(45deg);
}
/* the placeholder option reads as a prompt, not as a value */
.select select:invalid{color:var(--muted)}

/* ---------------------------------------------------------------------------
   THE FILE ZONE
   ---------------------------------------------------------------------------
   The input is CLIPPED, never `display:none` - hiding it that way takes it
   out of the tab order and takes the focus ring with it. The zone lights up
   on :focus-within instead, so a keyboard visitor can see where they are.
   --------------------------------------------------------------------------- */
.filefield{
  position:relative;
  display:grid;gap:var(--s-1);justify-items:center;
  padding:clamp(1.25rem,1rem + 1.5vw,2rem);
  text-align:center;
  background:var(--cream);
  border:.09375rem dashed var(--line);
  border-radius:var(--r-md);
  transition:border-color var(--dur-fast) var(--ease),
             background-color var(--dur-fast) var(--ease);
}
.filefield input[type="file"]{
  position:absolute;width:.0625rem;height:.0625rem;
  padding:0;margin:-.0625rem;overflow:hidden;
  clip:rect(0,0,0,0);white-space:nowrap;border:0;
}
.filefield:focus-within,
.filefield.is-over{
  border-color:var(--teal);
  background:var(--teal-tint);
}
.filefield.has-file{border-style:solid;border-color:var(--teal-dp);background:var(--white)}

.filefield__face{
  display:grid;justify-items:center;gap:.375rem;
  cursor:pointer;
}
.filefield__face svg{
  width:1.75rem;height:1.75rem;
  fill:none;stroke:var(--teal-dp);stroke-width:1.75;
  stroke-linecap:round;stroke-linejoin:round;
}
.filefield__cta{
  font-weight:600;color:var(--teal-dp);
  border-bottom:.0625rem solid currentColor;
}
.filefield__or{font-size:var(--fs-xs);color:var(--muted)}

.filefield__name{
  margin:0;font-size:var(--fs-xs);color:var(--ink-2);
  /* a file name is arbitrary text of unknown script, and it can be long */
  max-width:100%;overflow-wrap:anywhere;
}
.filefield.has-file .filefield__name{font-weight:600;color:var(--teal-dp)}

.filefield__clear{
  border:0;background:none;cursor:pointer;
  font:inherit;font-size:var(--fs-xs);
  color:var(--muted);text-decoration:underline;
  padding:.125rem .25rem;border-radius:var(--r-sm);
  transition:color var(--dur-fast) var(--ease);
}
.filefield__clear:hover{color:var(--err-ink)}

.field.is-invalid .filefield{border-color:var(--err);background:var(--err-wash)}
/* the shared rule paints invalid CONTROLS, and the clipped input is one -
   an invisible box with a red ring around nothing */
.field.is-invalid .filefield input[type="file"]{box-shadow:none}

/* ---------------------------------------------------------------------------
   WHAT HAPPENS TO IT
   --------------------------------------------------------------------------- */
.after{background:var(--white)}
.after__grid{
  display:grid;gap:var(--s-3) var(--gutter);
  margin-top:clamp(1.75rem,1.25rem + 1.5vw,2.5rem);
}
@media (min-width:48rem){
  .after__grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
.plainly{
  display:grid;gap:.5rem;align-content:start;
  padding-inline-start:var(--s-3);
  border-inline-start:.1875rem solid var(--gold);
}
.plainly h3{margin:0;font-size:var(--fs-h4);color:var(--ink)}
.plainly p{margin:0;font-size:var(--fs-sm);color:var(--muted)}
.plainly a{color:var(--gold-dk);text-decoration:underline}

/* ---------------------------------------------------------------------------
   REDUCED MOTION
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion:reduce){
  .field input,.field select,.field textarea,
  .filefield,.filefield__clear{transition:none}
}
