/* ==========================================================================
   Software Solutions page
   The page's motif is the notch: a page-coloured cut into the corner of a
   rounded photo frame.
   ========================================================================== */

:root {
  --notch-r: var(--radius-lg);
}

/* The two corner pieces beside a notch: page colour outside a quarter circle
   centred on the piece's --notch-at corner, so the frame stays rounded where
   it turns around the notch. Each notch sets --notch-at and switches its
   pieces on with content. */
.sw-hero__panel::before,
.sw-hero__panel::after,
.sw-hero__actions::before,
.sw-hero__actions::after {
  position: absolute;
  width: var(--notch-r);
  height: var(--notch-r);
  background: radial-gradient(
    circle at var(--notch-at),
    transparent calc(var(--notch-r) - 0.5px),
    var(--surface) var(--notch-r)
  );
}

/* --------------------------------------------------------------------------
   Hero: notched cover
   A top-down aerial photo fills a rounded frame. Desktop: the text panel cuts
   into the frame's bottom-left corner. Phones and tablets: the text sits above
   the frame and only the button row cuts into its top-left corner.

   The notch is page-coloured. Where the photo turns around it, two small
   pieces (::before / ::after) paint the page colour outside a quarter circle,
   so the photo's corners stay rounded on every side of the cut.
   -------------------------------------------------------------------------- */

.sw-hero {
  padding-top: calc(var(--header-height) + var(--space-7));

  @media (width >= 64rem) {
    padding-top: calc(var(--header-height) + var(--space-4));
  }
}

/* Phones and tablets: the panel's children join this grid (display: contents)
   so the button row and the frame can share a row and overlap. */
.sw-hero__inner {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  justify-items: start;

  @media (width >= 64rem) {
    display: block;
    position: relative;
    /* The desktop title sizes itself from this width (cqi) */
    container-type: inline-size;
  }
}

/* ---- Text panel ---- */

.sw-hero__panel {
  display: contents;

  @media (width >= 64rem) {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 1;
    display: grid;
    justify-items: start;
    gap: var(--space-4);
    /* Leaves the right half of the photo clear */
    width: 46%;
    padding: var(--space-6) var(--space-7) 0 0;
    background: var(--surface);
    border-top-right-radius: var(--notch-r);

    /* Rounds the photo's corner above the panel and the one to its right */
    &::before,
    &::after {
      --notch-at: 100% 0;

      content: "";
    }

    &::before {
      bottom: 100%;
      left: 0;
    }

    &::after {
      bottom: 0;
      left: 100%;
    }
  }
}

.sw-hero__title {
  font-size: clamp(2.125rem, 1.1rem + 2.7vw, 3.75rem);
  margin-bottom: var(--space-5);

  /* Desktop: the longest line ("preservation industry.", about 11.5em) fits
     the panel's text width (46% of the frame, less its right padding) */
  @media (width >= 64rem) {
    font-size: clamp(2rem, (46cqi - 3rem) / 11.5, 3.25rem);
    margin-bottom: 0;
  }
}

/* Each line sits in its own mask so it can slide up into view */
.sw-hero__line {
  display: block;
  overflow: clip;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.sw-hero__line-inner {
  display: block;
}

.sw-hero__lead {
  max-width: 34rem;
  margin-bottom: var(--space-7);

  @media (width >= 64rem) {
    margin-bottom: 0;
    font-size: var(--fs-base);
  }
}

/* Phones and tablets: the button row is the notch, cut into the frame's
   top-left corner. Desktop: a plain row at the foot of the panel. */
.sw-hero__actions {
  position: relative;
  z-index: 1;
  grid-row: 3;
  grid-column: 1;
  padding: 0 var(--space-4) var(--space-4) 0;
  background: var(--surface);
  border-bottom-right-radius: var(--notch-r);

  &::before,
  &::after {
    --notch-at: 100% 100%;

    content: "";
  }

  /* Below the row, against the frame's left edge */
  &::before {
    top: 100%;
    left: 0;
  }

  /* Beside the row, against the frame's top edge */
  &::after {
    top: 0;
    left: 100%;
  }

  @media (width >= 64rem) {
    padding: var(--space-2) 0 0;
    background: none;
    border-radius: 0;

    &::before,
    &::after {
      content: none;
    }
  }
}

/* ---- Photo frame ---- */

.sw-hero__frame {
  position: relative;
  grid-row: 3 / -1;
  grid-column: 1;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--notch-r);

  @media (width >= 40rem) {
    aspect-ratio: 16 / 10;
  }

  @media (width >= 64rem) {
    aspect-ratio: auto;
    height: clamp(36rem, 100svh - var(--header-height) - var(--space-6), 54rem);
  }
}

.sw-hero__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;

  /* Desktop crops top and bottom: trim the window, not the desk, so the
     monitor rises clear of the text panel */
  @media (width >= 64rem) {
    object-position: 50% 100%;
  }
}

/* --------------------------------------------------------------------------
   Our involvement
   Heading, a short subtitle beneath it, then the four focus areas.
   Focus areas are columns divided by hairlines (four across on desktop, two
   on tablets, stacked on phones), each with a small line diagram that draws
   in once (software-solutions.js).
   -------------------------------------------------------------------------- */

.involvement__head {
  display: grid;
  gap: var(--space-5);
}

.involvement__lead {
  max-width: 46rem;
}

/* ---- Focus areas ---- */

.involvement__focus {
  display: grid;
  margin-top: clamp(var(--space-8), 8vw, var(--space-10));
}

.involvement__rule {
  display: block;
  height: 1px;
  background: var(--line);
}

.involvement__focus-title {
  margin-block: var(--space-5) var(--space-7);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-500);
}

.focus-list {
  --focus-gap: var(--space-7);

  display: grid;

  @media (width >= 40rem) {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8) var(--focus-gap);
  }

  @media (width >= 64rem) {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Phones: a hairline above each area. Larger: a hairline in the middle of
   the gap before each column that isn't first in its row, so every column
   keeps the same width. */
.focus {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--space-3);
  padding-block: var(--space-6);
  border-top: 1px solid var(--line);

  &:first-child {
    padding-top: 0;
    border-top: 0;
  }

  @media (width >= 40rem) {
    padding-block: 0;
    border-top: 0;

    &::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: calc(var(--focus-gap) / -2);
      width: 1px;
      background: var(--line);
    }
  }

  @media (width >= 40rem) and (width < 64rem) {
    &:nth-child(odd)::before {
      content: none;
    }
  }

  @media (width >= 64rem) {
    &:first-child::before {
      content: none;
    }
  }
}

.focus__glyph {
  width: 6.5rem;
  height: auto;
  margin-bottom: var(--space-4);
  overflow: visible;

  * {
    fill: none;
    stroke: var(--ink-500);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
  }

  .focus__track {
    stroke: var(--line);
  }

  .focus__accent {
    stroke: var(--brand-green);
  }

  .focus__accent--bar {
    stroke-width: 3;
  }
}

.focus__title {
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
}

.focus__text {
  font-size: var(--fs-sm);
  color: var(--ink-700);
}

/* --------------------------------------------------------------------------
   Open positions: accordion
   One row per job between hairlines. The whole row toggles its panel
   (software-solutions.js). The open panel holds the full post, with a summary
   beside it on desktop (above it on smaller screens) that keeps the facts and
   the apply button in view. When no job is showing, the empty card appears.
   -------------------------------------------------------------------------- */

.openings__title {
  margin-bottom: var(--space-7);
}

/* ---- Row ---- */

.job {
  border-top: 1px solid var(--line);

  &:last-child {
    border-bottom: 1px solid var(--line);
  }
}

/* Phones: title and icon, meta below. Larger: title, meta, icon in one line. */
.job__header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  padding-block: var(--space-6);

  @media (width >= 64rem) {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: var(--space-7);
  }
}

.job__title {
  font-size: var(--fs-lg);
}

.job__toggle {
  text-align: left;
  letter-spacing: inherit;
  transition: color var(--duration-fast) ease;

  /* Stretches the button over the whole row */
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius-sm);
  }

  &:focus-visible {
    outline: none;

    &::after {
      outline: 2px solid var(--focus-ring);
      outline-offset: 2px;
    }
  }
}

/* Phones and tablets: small tags that wrap cleanly.
   Desktop: one line of text separated by dots. */
.job__meta {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--ink-700);

  li {
    padding: 0.2em 0.7em;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
  }

  @media (width >= 64rem) {
    grid-column: auto;
    grid-row: auto;
    justify-content: flex-end;
    gap: var(--space-3);
    font-size: var(--fs-sm);
    color: var(--ink-500);

    li {
      padding: 0;
      border: 0;
    }

    li + li::before {
      content: "·";
      margin-right: var(--space-3);
    }
  }
}

/* Plus that turns into a minus while open. It sits above the button's
   row-wide hit area, so clicks pass through it to the button. */
.job__icon {
  position: relative;
  pointer-events: none;
  grid-column: 2;
  grid-row: 1;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition:
    border-color var(--duration-fast) ease,
    background-color var(--duration-fast) ease;

  &::before,
  &::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.875rem;
    height: 1.5px;
    margin: -0.75px 0 0 -0.4375rem;
    border-radius: 1px;
    background: var(--ink-900);
    transition: rotate var(--duration-base) var(--ease-out);
  }

  &::after {
    rotate: 90deg;
  }

  @media (width >= 64rem) {
    grid-column: 3;
  }
}

.job__header:hover {
  .job__toggle {
    color: var(--brand-green);
  }

  .job__icon {
    border-color: var(--brand-green);
  }
}

.job__header:has([aria-expanded="true"]) .job__icon {
  border-color: var(--brand-green);
  background: var(--brand-green-tint);

  &::after {
    rotate: 0deg;
  }
}

/* ---- Open panel ---- */

.job__body {
  display: grid;
  gap: var(--space-7);
  padding-bottom: var(--space-8);

  @media (width >= 64rem) {
    grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
    align-items: start;
    gap: var(--space-9);
  }
}

.job__details {
  display: grid;
  gap: var(--space-7);
}

.job__block {
  display: grid;
  gap: var(--space-3);
  max-width: 46rem;

  p,
  li {
    font-size: var(--fs-sm);
    color: var(--ink-700);
  }

  /* The block already sets the line length */
  p {
    max-width: none;
  }
}

.job__heading {
  font-size: var(--fs-md);
}

.job__subheading {
  margin-top: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-900);
}

.job__list {
  display: grid;
  gap: var(--space-2);

  li {
    position: relative;
    padding-left: var(--space-5);

    /* Short green dash in place of a bullet */
    &::before {
      content: "";
      position: absolute;
      top: 0.8em;
      left: 0;
      width: 0.625rem;
      height: 1.5px;
      background: var(--brand-green);
    }
  }
}

.job__note {
  .job__block & {
    color: var(--ink-500);
  }
}

/* Facts and apply button. Smaller screens: above the details.
   Desktop: beside them, staying in view while the details scroll. */
.job__summary {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-6);
  border-radius: var(--notch-r);
  background: var(--surface-alt);

  @media (width < 64rem) {
    order: -1;
  }

  @media (width >= 64rem) {
    position: sticky;
    top: calc(var(--header-height) + var(--space-6));
  }
}

.job__facts {
  display: grid;
  gap: var(--space-4);

  @media (width >= 40rem) and (width < 64rem) {
    grid-template-columns: repeat(3, 1fr);
  }

  dt {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-500);
  }

  dd {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--ink-900);
  }
}

.job__apply {
  width: 100%;

  @media (width >= 40rem) and (width < 64rem) {
    width: auto;
    justify-self: start;
  }
}

.job__alt {
  font-size: var(--fs-xs);
  color: var(--ink-500);
}

/* ---- No openings ----
   Hidden while the list has a job showing; takes the list's place otherwise. */

.openings__empty {
  display: none;
  gap: var(--space-3);
  justify-items: start;
  padding: clamp(var(--space-6), 5vw, var(--space-8));
  border-radius: var(--notch-r);
  background: var(--surface-alt);
}

.openings__list:not(:has(.job:not([hidden]))) {
  display: none;

  + .openings__empty {
    display: grid;
  }
}

.openings__empty-glyph {
  width: 6.5rem;
  margin-bottom: var(--space-3);
  fill: none;
  stroke: var(--ink-500);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.openings__empty-title {
  font-size: var(--fs-lg);
}

.openings__empty-text {
  color: var(--ink-700);
}
