/* ============================================================
   workex.css — work experience "panels". Each role is an
   instrument card: logo + status tag + period readout,
   with media docked in a light-catching tilt frame.
   ============================================================ */

.workex {
  padding: var(--section-gap) 0;
  position: relative;
}

.role-list {
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 4vw, 40px);
}

.role-card {
  position: relative;
  background: linear-gradient(165deg, var(--panel) 0%, var(--ink-soft) 100%);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: clamp(22px, 4vw, 40px);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out),
    border-color 0.3s var(--ease-out);
}

/* Reveal animation is opt-in: JS adds .js-reveal-ready to <body> only
   after it has set up the IntersectionObserver, then marks each card
   .reveal-pending right before observing it. Content is never hidden
   by default, so it's always visible without JS or if JS is slow. */
.js-reveal-ready .role-card.reveal-pending {
  opacity: 0;
  transform: translateY(28px);
}

.role-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.role-card:hover {
  border-color: var(--hairline-bright);
}

.role-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.role-card__id {
  display: flex;
  align-items: center;
  gap: 16px;
}

.role-card__logo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--ink);
  border: 1px solid var(--hairline-bright);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.role-card__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.role-card__heading h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  color: var(--paper);
  line-height: 1.2;
}

.role-card__heading .company {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--signal);
  letter-spacing: 0.02em;
  margin-top: 4px;
  display: block;
}

.role-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.status-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  padding: 5px 10px;
  border-radius: 30px;
  border: 1px solid var(--hairline-bright);
  color: var(--instrument);
  white-space: nowrap;
}

.status-tag--active {
  color: var(--signal);
  border-color: var(--signal-dim);
}

.status-tag--shipped {
  color: var(--amber);
  border-color: rgba(224, 169, 109, 0.4);
}

.period {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--instrument-dim);
  white-space: nowrap;
}

.role-card__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
  align-items: start;
}

.role-card.has-media .role-card__body {
  grid-template-columns: 1.2fr 1fr;
}

@media (max-width: 860px) {
  .role-card.has-media .role-card__body {
    grid-template-columns: 1fr;
  }
}

.role-card__bullets {
  display: flex;
  flex-direction: column;
  gap: 13px;
  color: var(--paper-dim);
  font-size: 0.96rem;
  line-height: 1.65;
}

.role-card__bullets li {
  list-style: none;
  position: relative;
  padding-left: 18px;
}

.role-card__bullets li::before {
  content: "·";
  position: absolute;
  left: 2px;
  color: var(--signal);
  font-size: 1.3em;
  line-height: 1.1;
}

.role-card__bullets b {
  color: var(--paper);
  font-weight: 600;
}

.role-card__bullets a {
  color: var(--signal);
  text-decoration: underline;
  text-decoration-color: var(--signal-dim);
  text-underline-offset: 2px;
}

.role-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.chip-link {
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: none;
  color: var(--ink);
  background: var(--signal);
  padding: 8px 14px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-out);
}

.chip-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px -8px var(--signal-glow);
}

.chip-link--ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--hairline-bright);
}

.chip-link--ghost:hover {
  border-color: var(--signal);
  color: var(--signal);
}

/* ── Media well: tilt-responsive image/video stack ─────────── */
.role-card__media {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Base frame. By default this does NOT force a crop — the image's own
   natural width/height decides the box shape, so nothing gets cut off.
   "orientation" classes below only set a max-width (how much horizontal
   room the photo is allowed to claim in a gallery), not a crop ratio.
   This keeps every photo showing 100% of itself at its true shape. */
.media-frame {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--hairline-bright);
  background: var(--ink);
  break-inside: avoid; /* keeps each tile intact when used inside CSS columns */
  margin-bottom: 12px;
  display: inline-block; /* shrink-wraps to the image's own rendered size */
  width: 100%;
}

.media-frame img,
.media-frame video {
  width: 100%;
  height: auto;   /* natural aspect ratio — never stretched, never cropped */
  display: block;
}

/* A frame explicitly marked "fixed" is a deliberate exception: a slot
   where consistent framing matters more than showing the whole source
   photo (the hero portrait, the ClearRead mosaic tiles). Only these use
   object-fit: cover, and only because their layout has no other way to
   make mismatched photos sit together cleanly. Plain galleries never
   get this class. */
.media-frame.is-fixed-crop {
  display: block;
}

.media-frame.is-fixed-crop img,
.media-frame.is-fixed-crop video {
  height: 100%;
  object-fit: cover;
}

.media-frame.is-wide { aspect-ratio: 16 / 9; } /* used for video frames */

.media-frame iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  display: block;
}

.media-frame__tag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  background: rgba(11, 14, 17, 0.7);
  color: var(--signal);
  padding: 3px 8px;
  border-radius: 3px;
  backdrop-filter: blur(4px);
  z-index: 2;
}

/* ClearRead custom mosaic grid: tall image on the left spans both
   rows, two stacked frames on the right. This is the one place a
   forced crop makes sense — three photos of different shapes are
   being asked to tile into a fixed 2-column frame, so each tile is
   deliberately marked is-fixed-crop (see render.js) to fill its slot. */
.media-grid--clearread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "a b"
    "a c";
  gap: 10px;
}

.media-grid--clearread [data-area="a"] { grid-area: a; }
.media-grid--clearread [data-area="b"] { grid-area: b; }
.media-grid--clearread [data-area="c"] { grid-area: c; }

.media-grid--clearread .media-frame {
  height: 100%;
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .media-grid--clearread {
    grid-template-columns: 1fr;
    grid-template-areas: "a" "b" "c";
  }
  .media-grid--clearread .media-frame {
    height: auto;
    aspect-ratio: 4 / 3; /* once stacked single-column, give the crop tiles a sane consistent height */
  }
}

