/* ==========================================================================
   HOME — orbit hero, bio, projects door, contacts
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ORBIT HERO
   A tall "driver" section scrolls; the stage inside is sticky. Scroll
   progress 0 -> 1 rotates the media ring a full 360deg around the logo.
   When the loop closes the sticky releases and the page carries on.
   -------------------------------------------------------------------------- */

.orbit-driver {
  position: relative;
  height: 440vh;              /* length of one full revolution */
}

.orbit-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* the ring lives in its own layer so it can fade out at the end of the loop */
.orbit-ring {
  position: absolute;
  inset: 0;
  will-change: transform, opacity;
}

.orbit-tile {
  position: absolute;
  top: 50%;
  left: 50%;
  height: clamp(136px, 19.5vh, 248px);
  will-change: transform, opacity;
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  /* the page opens on the logo alone; home.js flies the tiles out of it on
     the first scroll. Hidden here so none of them flash before frame one.
     Reduced motion overrides this with opacity:1 further down. */
  opacity: 0;
}

.orbit-tile > img,
.orbit-tile > video {
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: cover;
  background: var(--paper-warm);
  box-shadow: 0 1px 2px rgba(20, 22, 28, 0.06),
              0 12px 34px rgba(20, 22, 28, 0.12);
}

/* --- logo lock-up ------------------------------------------------------- */
.orbit-core {
  position: relative;
  z-index: 500;               /* always above the ring */
  display: grid;
  justify-items: center;
  gap: 1.5rem;
  text-align: center;
  pointer-events: none;
}

/* a soft page-coloured halo so the lock-up stays legible when a bright
   tile swings past behind it */
.orbit-core::before {
  content: "";
  position: absolute;
  inset: -14% -22%;
  z-index: -1;
  background: radial-gradient(ellipse farthest-side at 50% 46%,
              rgba(255, 255, 255, 0.96) 0%,
              rgba(255, 255, 255, 0.88) 52%,
              rgba(255, 255, 255, 0) 100%);
}

.orbit-core__logo {
  width: clamp(150px, 19vw, 268px);
  height: auto;
  filter: drop-shadow(0 10px 30px rgba(20, 22, 28, 0.16));
}

@media (max-width: 700px) {
  .orbit-tile { height: 101px; }
  .orbit-core { gap: 1.1rem; }
  .orbit-core::before { inset: -16% -26%; }
  .orbit-core__logo { width: 148px; }
  .orbit-meter { display: none; }
  /* the badge already reads "independent design" — drop the echo */
  .orbit-core__role { display: none; }
}

.orbit-core__name {
  font-size: clamp(1.35rem, 2.6vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
}

.orbit-core__role {
  margin-top: 0.5rem;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- scroll cue --------------------------------------------------------- */
.orbit-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(1.25rem, 4vh, 2.75rem);
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.5s var(--ease);
}

.orbit-cue::after {
  content: "";
  width: 1px;
  height: 34px;
  background: linear-gradient(to bottom, var(--muted), transparent);
  animation: cue-drop 1.9s var(--ease) infinite;
}

@keyframes cue-drop {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 0; }
  35%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  70%  { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* progress ticker — how far through the revolution we are */
.orbit-meter {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(1.25rem, 4vh, 2.75rem);
  z-index: 600;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   2. BIO
   -------------------------------------------------------------------------- */

.bio {
  padding: clamp(5rem, 14vh, 11rem) var(--gutter) clamp(4rem, 10vh, 8rem);
  max-width: 1440px;
  margin-inline: auto;
}

.bio__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 1.5rem;
  margin-bottom: clamp(2.5rem, 6vh, 4.5rem);
  border-bottom: 1px solid var(--rule);
}

.bio__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

@media (min-width: 900px) {
  /* text and the flags photo stack on the left; the snow photo runs tall beside them */
  .bio__body { grid-template-columns: 1.3fr 1fr; align-items: start; }
}

.bio p {
  font-size: var(--fs-lead);
  line-height: 1.5;
  letter-spacing: -0.011em;
  max-width: var(--measure);
}

.bio p + p { margin-top: 1.4em; }

.bio p.bio__hello {
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.bio p.bio__definition {
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
  align-self: start;
}

/* --------------------------------------------------------------------------
   3. SELECTED WORK — the title, with the rail underneath it
   This used to be a link to a separate projects page. The word was so large
   that nobody read it as clickable, so it is a plain section title now and
   the cards live directly below it. Rail styling comes from projects.css.
   -------------------------------------------------------------------------- */

.work__head {
  padding: clamp(2.5rem, 7vh, 5rem) var(--gutter) clamp(0.4rem, 1vh, 0.75rem);
  border-top: 1px solid var(--rule);
  max-width: 1440px;
  margin-inline: auto;
}

/* Same family as the .label used by "01 — About" (11px), one step up, so the
   two section markers read as one system rather than two competing sizes. */
.work__word {
  display: block;
  font-size: 0.9375rem;      /* 15px */
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--muted);
}

/* the rail sits inside the page now, so it needs the closing rule the door
   used to carry, and room to breathe before the contacts line */
.work { border-bottom: 1px solid var(--rule); }

/* --------------------------------------------------------------------------
   4. CONTACT
   -------------------------------------------------------------------------- */


/* --------------------------------------------------------------------------
   Reduced motion — no scroll hijack, ring laid out as a static grid
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .orbit-driver { height: auto; }
  .orbit-stage {
    position: static;
    height: auto;
    min-height: 0;
    padding: clamp(3rem, 8vh, 6rem) var(--gutter);
    gap: 3rem;
  }
  .orbit-ring {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
  }
  .orbit-tile {
    position: static;
    transform: none !important;
    opacity: 1 !important;
    height: 138px;
  }
  .orbit-cue { display: none; }
  .orbit-meter { display: none; }
  .orbit-core__logo { animation: none; }
}
/* --------------------------------------------------------------------------
   Contact — one thin line of small links, after martina gerardi
   -------------------------------------------------------------------------- */

.contact {
  padding: clamp(3rem, 8vh, 6rem) var(--gutter) clamp(2rem, 5vh, 3.5rem);
  max-width: 1440px;
  margin-inline: auto;
}

.contact__strip {
  list-style: none;
  margin: 0;
  padding: 1.4rem 0 0;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.9rem clamp(1.5rem, 6vw, 5rem);
  font-size: clamp(0.72rem, 0.9vw, 0.84rem);
  letter-spacing: 0.01em;
}

.contact__id {
  font-weight: 600;
  color: var(--ink);
}

.contact__strip a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.35s var(--ease);
}

.contact__strip a:hover,
.contact__strip a:focus-visible { color: var(--amber); }

/* on a phone the row would squeeze; let it become a short stack */
@media (max-width: 620px) {
  .contact__strip {
    justify-content: flex-start;
    gap: 0.55rem;
    flex-direction: column;
  }
}

/* --------------------------------------------------------------------------
   Bio photographs, with a mark that draws itself around me and rubs out again
   -------------------------------------------------------------------------- */

.bio__col {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-content: start;
}

.bio__text { display: grid; gap: 1.1em; }
.bio__text .bio__definition { margin-top: 0.35em; }

.shot {
  position: relative;
  margin: 0;
  line-height: 0;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--paper-warm);
}

/* The marks are placed as percentages of the photograph, so it must never be
   cropped; the tall shot keeps its whole frame and drops to the foot of its
   column instead, so both photographs end on the same line. */
@media (min-width: 900px) {
  .shot--tall { align-self: end; }
}

/* --- the mark ----------------------------------------------------------- */

.mark {
  position: absolute;
  left: var(--l);
  top: var(--t);
  width: var(--w);
  height: var(--h);
  pointer-events: none;
}

.mark__box {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mark__box rect {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2.5px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;          /* starts empty */
  animation: mark-draw 5s var(--ease) infinite;
}

/* sits above the box and off its centre line, the way you would scribble it */
.mark__label {
  position: absolute;
  bottom: calc(100% + 0.45em);
  left: var(--nudge, -50%);
  font-size: clamp(0.85rem, 1.5vw, 1.15rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1;
  white-space: nowrap;
  color: var(--amber);
  /* the mark can land on any photograph, so give the words their own contrast */
  text-shadow: 0 1px 3px rgba(20, 22, 28, 0.6), 0 0 12px rgba(20, 22, 28, 0.4);
  opacity: 0;
  animation: mark-label 5s var(--ease) infinite;
}

/* one pass: draw the perimeter, hold, then let the tail eat it from the start */
@keyframes mark-draw {
  0%            { stroke-dashoffset: 100; }
  30%           { stroke-dashoffset: 0; }
  56%           { stroke-dashoffset: 0; }
  86%, 100%     { stroke-dashoffset: -100; }
}

/* the words arrive only once the box has closed */
@keyframes mark-label {
  0%, 29%       { opacity: 0; transform: translateY(0.3em); }
  36%, 56%      { opacity: 1; transform: none; }
  66%, 100%     { opacity: 0; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mark__box rect { animation: none; stroke-dashoffset: 0; }
  .mark__label    { animation: none; opacity: 1; }
}
