/* ==========================================================================
   About: portrait beside a short introduction, with two sides
   "At work" (default) and "Outside work". Switching sides
   (scripts/features/about-switch.js adds .is-personal to the section):
     - turns the portrait over like a card to a second photo
     - cross-fades the text to the other panel
     - shifts the section from the onyx band to warm taupe
   Without JavaScript both panels simply show one after the other.
   ========================================================================== */

.about {
  /* Local colors, so the whole section can change mood by re-valuing four
     variables instead of restyling every child. */
  --about-bg: var(--color-band);
  --about-fg: var(--color-on-band);
  --about-soft: var(--color-on-dark);
  --about-faint: var(--color-subtle);
  --about-on-fg: var(--color-band);     /* text on a filled (fg-colored) button */

  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 40px clamp(32px, 6vw, 96px);
  padding: var(--section-y) var(--gutter);
  background: var(--about-bg);
  color: var(--about-fg);
  transition: background-color 700ms ease, color 700ms ease;
}

/* "Outside work" mood: taupe surface with ink text (both adapt to the theme) */
.about.is-personal {
  --about-bg: var(--color-taupe);
  --about-fg: var(--color-ink);
  --about-soft: var(--color-ink);
  --about-faint: var(--color-ink);
  --about-on-fg: var(--color-paper);
}

.about .eyebrow {
  color: var(--about-faint);
  transition: color 700ms ease;
}

.about :focus-visible {
  outline-color: var(--about-fg);
}

/* Outline button in the section's own colors */
.about .btn--outline {
  color: var(--about-fg);
  border-color: var(--about-fg);
}

@media (hover: hover) and (pointer: fine) {
  .about .btn--outline:hover {
    color: var(--about-on-fg);
    background: var(--about-fg);
    border-color: var(--about-fg);
  }
}

/* ==========================================================================
   Portrait (4:5): a two-sided card
   ========================================================================== */

.about__portrait {
  max-width: 440px;
  aspect-ratio: 4 / 5;
  perspective: 1400px;
}

.about__flip {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 1000ms var(--ease);
}

.about.is-personal .about__flip {
  transform: rotateY(180deg);
}

.about__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--radius-box);
  background: var(--color-mist);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  /* swap which face is shown halfway through the 1s flip */
  transition: visibility 0s linear 500ms;
}

.about:not(.is-personal) .about__face--personal,
.about.is-personal .about__face--work {
  visibility: hidden;
}

/* The back of the card */
.about__face--personal {
  transform: rotateY(180deg);
}

/* Full color, always. On hover the photo zooms gently inside its frame. */
.about__face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 900ms var(--ease);
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  html:not(.motion-off) .about__portrait:hover img { transform: scale(1.04); }
}

/* ==========================================================================
   Text column
   ========================================================================== */

.about__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
  min-width: 0;
}

/* ---- The switch: two labels with a pill that slides between them ---- */
.about__switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
  border: 1px solid var(--about-fg);
  border-radius: var(--radius-pill);
  transition: border-color 700ms ease;
}

.about__switch-thumb {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc(50% - 5px);
  border-radius: var(--radius-pill);
  background: var(--about-fg);
  transition: transform 600ms var(--ease), background-color 700ms ease;
}

.about.is-personal .about__switch-thumb {
  transform: translateX(100%);
}

.about__tab {
  position: relative;
  z-index: 1;
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--about-fg);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 500ms ease;
}

.about__tab[aria-selected="true"] {
  color: var(--about-on-fg);
}

/* ---- Panels ---- */
.about__panels {
  width: 100%;
}

.about__panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}

/* Without JavaScript the panels stack with space between them */
.about__panel + .about__panel {
  margin-top: 48px;
}

/* With the switch active, both panels share one grid cell (so the section
   keeps the height of the taller one) and cross-fade. */
.about.is-enhanced .about__panels {
  display: grid;
}

.about.is-enhanced .about__panel {
  grid-area: 1 / 1;
  margin-top: 0;
  transition: opacity 500ms ease 150ms, transform 700ms var(--ease) 150ms, visibility 0s;
}

.about.is-enhanced .about__panel[inert] {
  opacity: 0;
  transform: translateY(18px);
  visibility: hidden;
  transition: opacity 250ms ease, transform 250ms ease, visibility 0s 250ms;
}

.about__panel .section-title {
  font-size: var(--heading-lg);
}

.about__lede {
  max-width: 560px;
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.32;
}

.about__text {
  max-width: 560px;
  margin: 0;
  color: var(--about-soft);
}

/* ---- Interests: small outlined tags on the personal side ---- */
.about__interests {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.about__interests li {
  padding: 10px 16px;
  border: 1px solid var(--about-fg);
  border-radius: var(--radius-pill);
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .24em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; }
  .about__portrait { justify-self: center; width: 100%; max-width: 320px; }
  .about__switch { width: 100%; }
  .about__tab { padding: 0 10px; letter-spacing: .16em; }
}
