/* ------------------------------------------------ */
/* Custom Cursor & Animated Background                */
/* Additions layered on top of the template styles.   */
/* Kept in a separate file so main.css stays vendor.  */
/* ------------------------------------------------ */

/* ------------------------------------------------ */
/* 01. Custom Cursor                                  */
/* ------------------------------------------------ */

/* The cursor only exists once JS confirms a fine pointer
   and no reduced-motion preference. Until then the native
   cursor stays exactly as it was. */
.cursor-active,
.cursor-active a,
.cursor-active button,
.cursor-active .btn,
.cursor-active input,
.cursor-active textarea,
.cursor-active label,
.cursor-active [role="switch"] {
  cursor: none;
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  will-change: transform;
  transition: opacity 0.25s ease;
}

.cursor.is-visible {
  opacity: 1;
}

/* the precise dot — tracks the pointer with no lag */
.cursor__dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background-color: var(--t-bright);
  /* Colour is deliberately not transitioned — see the note on
     .article-card. A transitioned var()-driven colour holds its stale
     value when the theme switch changes that variable, which left the
     cursor wearing the previous theme's colours until the next hover. */
  transition: width 0.3s var(--_animbezier),
              height 0.3s var(--_animbezier),
              margin 0.3s var(--_animbezier),
              opacity 0.3s ease;
}

/* the trailing ring — eased, carries the state changes */
.cursor__ring {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid var(--stroke-controls);
  border-radius: 50%;
  background-color: transparent;
  /* Size and margin carry the state change; colours switch instantly so
     a theme flip can never leave a stale value behind. */
  transition: width 0.35s var(--_animbezier),
              height 0.35s var(--_animbezier),
              margin 0.35s var(--_animbezier),
              opacity 0.3s ease;
}

.cursor__label {
  font: normal 600 10px/1 var(--_font-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--per-base);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.25s ease, transform 0.25s var(--_animbezier);
}

/* --- state: over an interactive element --- */
.cursor.is-hovering .cursor__ring {
  width: 62px;
  height: 62px;
  margin: -31px 0 0 -31px;
  border-color: transparent;
  background-color: var(--accent);
}

.cursor.is-hovering .cursor__dot {
  opacity: 0;
}

/* --- state: over a gallery image, ring becomes a label --- */
.cursor.is-viewing .cursor__ring {
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border-color: transparent;
  background-color: var(--accent);
}

.cursor.is-viewing .cursor__label {
  opacity: 1;
  transform: scale(1);
}

.cursor.is-viewing .cursor__dot {
  opacity: 0;
}

/* --- state: over a text field --- */
.cursor.is-text .cursor__ring {
  width: 2px;
  height: 30px;
  margin: -15px 0 0 -1px;
  border-radius: 1px;
  border-color: transparent;
  background-color: var(--t-bright);
}

.cursor.is-text .cursor__dot {
  opacity: 0;
}

/* --- state: mouse pressed --- */
.cursor.is-pressed .cursor__ring {
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
}

.cursor.is-pressed.is-hovering .cursor__ring {
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
}

/* ------------------------------------------------ */
/* 02. Animated Background                            */
/* ------------------------------------------------ */

.bg-fx {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

/* the drifting node network */
.bg-fx__canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.bg-fx__canvas.is-ready {
  opacity: 1;
}

/* slow-drifting colour fields for depth, reusing the
   template's own gradient tokens so both themes hold */
.bg-fx__aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(clamp(60px, 9vw, 130px));
  opacity: 0.24;
  will-change: transform;
}

.bg-fx__aurora--one {
  width: clamp(320px, 34vw, 620px);
  height: clamp(320px, 34vw, 620px);
  top: -8%;
  left: -6%;
  background: var(--gradient-one);
  animation: aurora-drift-one 34s ease-in-out infinite;
}

.bg-fx__aurora--two {
  width: clamp(280px, 28vw, 520px);
  height: clamp(280px, 28vw, 520px);
  top: 34%;
  right: -10%;
  background: var(--gradient-two);
  animation: aurora-drift-two 44s ease-in-out infinite;
}

.bg-fx__aurora--three {
  width: clamp(300px, 30vw, 560px);
  height: clamp(300px, 30vw, 560px);
  bottom: -12%;
  left: 26%;
  background: var(--gradient-three);
  animation: aurora-drift-three 38s ease-in-out infinite;
}

[color-scheme=light] .bg-fx__aurora {
  opacity: 0.3;
}

@keyframes aurora-drift-one {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(6vw, 5vh, 0) scale(1.12); }
  66%      { transform: translate3d(2vw, 11vh, 0) scale(0.94); }
}

@keyframes aurora-drift-two {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  40%      { transform: translate3d(-7vw, -6vh, 0) scale(1.15); }
  70%      { transform: translate3d(-3vw, 5vh, 0) scale(0.9); }
}

@keyframes aurora-drift-three {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(5vw, -8vh, 0) scale(1.1); }
}

/* Nothing here overrides the template's own positioning.
   The layer sits at z-index 0 and is inserted before #content in
   the DOM, so every positioned element after it — content, the
   avatar sidebar (fixed at >=992px), the fixed header, PhotoSwipe
   at 1500 — paints above it without any help.
   Earlier revisions forced position:relative onto #header and
   #avatar, which dropped the fixed nav and sidebar into normal
   flow and pushed the hero off-screen. Do not reintroduce that. */

/* ------------------------------------------------ */
/* 03. Article Cards (Writing section)                */
/* Built from the template's own tokens so both       */
/* themes and every breakpoint follow automatically.  */
/* ------------------------------------------------ */

.articles .article__item {
  display: flex;
  padding: 0.75rem;
}

.article-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 2rem;
  border: 1px solid var(--stroke-elements);
  border-radius: var(--_radius-m);
  background-color: var(--base-tint);
  /* Only `transform` is transitioned here, deliberately.
     Transitioning a property whose value comes from a custom property
     (border-color: var(--stroke-elements)) holds the stale computed
     colour when the theme switch changes that variable — the card kept
     its dark border in light mode. Colour changes stay instant so the
     theme is always correct; the lift carries the hover feedback. */
  transition: transform var(--_animspeed-medium) var(--_animbezier);
}

.no-touch .article-card:hover {
  border-color: var(--stroke-controls);
  transform: translateY(-4px);
}

.article-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}

.article-card__date {
  font-size: 0.78em;
  letter-spacing: 0.02em;
  color: var(--t-muted);
}

.article-card__title {
  margin-bottom: 0.6rem;
  color: var(--t-bright);
}

.article-card__standfirst {
  margin-bottom: 1rem;
  font-weight: 500;
  color: var(--t-medium);
}

.article-card__excerpt {
  margin-bottom: 1.8rem;
  color: var(--t-muted);
}

/* push the link to the bottom so cards in a row align */
.article-card__link {
  margin-top: auto;
  align-self: flex-start;
}

@media only screen and (max-width: 767px) {
  .article-card {
    padding: 1.6rem;
  }
}

/* ------------------------------------------------ */
/* 04. Reduced motion & touch                         */
/* ------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .bg-fx__aurora {
    animation: none;
  }
  .cursor__dot,
  .cursor__ring,
  .cursor__label {
    transition: none;
  }
}

/* no custom cursor on touch devices */
@media (hover: none), (pointer: coarse) {
  .cursor {
    display: none;
  }
}
