/* ---------------------------------------------------------------
   Site-wide "academically" wordmark above the footer
   (component: resources/views/components/front/brand-mark.blade.php)

   Theme: every colour and the font come from the variables below.
   Defaults use the site palette; pages with their own palette
   override them further down (matched with body:has(...)).
   All selectors are prefixed .ac-brandmark so nothing else is affected.
--------------------------------------------------------------- */
.ac-brandmark {
  --acb-c1: #030a21;   /* deep navy */
  --acb-c2: #103ac5;   /* brand blue */
  --acb-c3: #0fb995;   /* brand teal */
  --acb-base: #eef1f6; /* pale letters */
  --acb-bg: #ffffff;
  --acb-font: latoblack, Lato, 'Segoe UI', Arial, sans-serif;
  --acb-weight: 900;

  display: block;
  margin: 0;
  padding: clamp(20px, 4vw, 48px) 0 0;
  overflow: hidden;
  background: var(--acb-bg);
}

/* PhD admission page: its blue-teal shades and font */
body:has(main.phd) .ac-brandmark {
  --acb-c1: #0b3b60;
  --acb-c2: #0369a1;
  --acb-c3: #0d9488;
  --acb-font: 'Plus Jakarta Sans', latoblack, Lato, sans-serif;
  --acb-weight: 800;
}

/* Work in Germany pages: their indigo-navy + teal */
body:has(main.wg) .ac-brandmark {
  --acb-c1: #0f1640;
  --acb-c2: #103ac5;
  --acb-c3: #0fb995;
}

.ac-brandmark-word {
  --mx: 50%;
  --my: 50%;
  --acb-spot: 0%;
  position: relative;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: 0.16em;
  font-family: var(--acb-font);
  font-size: clamp(2rem, 12.6vw, 15rem);
  font-weight: var(--acb-weight);
  font-style: normal;
  line-height: 0.95;
  letter-spacing: -0.055em;
  text-transform: none;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  transition: --acb-spot 0.45s ease;
}

.ac-brandmark-base {
  display: block;
  color: var(--acb-base);
}

/* brand-coloured copy on top: the first letter (with a soft bleed) and, on hover, a spotlight */
.ac-brandmark-ink {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(150deg, var(--acb-c1) 0%, var(--acb-c2) 45%, var(--acb-c3) 85%) 0 0 / 15% 100% no-repeat,
    linear-gradient(100deg, var(--acb-c1) 0%, var(--acb-c2) 40%, var(--acb-c3) 75%, var(--acb-c2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  -webkit-mask-image:
    linear-gradient(90deg, #000 0%, #000 7.5%, rgba(0, 0, 0, 0.35) 11%, transparent 15%),
    radial-gradient(circle at var(--mx) var(--my), #000 0, #000 calc(var(--acb-spot) * 0.45), transparent var(--acb-spot));
  mask-image:
    linear-gradient(90deg, #000 0%, #000 7.5%, rgba(0, 0, 0, 0.35) 11%, transparent 15%),
    radial-gradient(circle at var(--mx) var(--my), #000 0, #000 calc(var(--acb-spot) * 0.45), transparent var(--acb-spot));
  -webkit-mask-size: 0% 100%, 100% 100%;
  mask-size: 0% 100%, 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.ac-brandmark-base,
.ac-brandmark-ink {
  transition-property: -webkit-mask-size, mask-size, transform;
  transition-duration: 1.4s, 1.4s, 0.5s;
  transition-timing-function: cubic-bezier(0.65, 0, 0.35, 1), cubic-bezier(0.65, 0, 0.35, 1), ease;
}

/* colour sweeps in when the word scrolls into view (JS adds .is-in) */
.ac-brandmark-word.is-in .ac-brandmark-ink {
  -webkit-mask-size: 100% 100%, 100% 100%;
  mask-size: 100% 100%, 100% 100%;
}

/* graduation cap resting on the "a": drops on when the word comes into view */
.ac-brandmark-cap {
  position: absolute;
  left: 0.6%;
  top: 14%;
  width: 9.4%;
  height: auto;
  opacity: 0;
  transform: translateY(-60%) rotate(-24deg);
  transform-origin: 50% 80%;
  transition: opacity 0.4s ease 0.9s, transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.9s;
  pointer-events: none;
  filter: drop-shadow(0 6px 8px rgba(3, 10, 33, 0.18));
}

.ac-brandmark-cap-board { fill: var(--acb-c1); }
.ac-brandmark-cap-crown { fill: var(--acb-c2); }
.ac-brandmark-cap-button { fill: var(--acb-c3); }
.ac-brandmark-cap-tassel { stroke: var(--acb-c3); }
.ac-brandmark-cap-knot { fill: var(--acb-c3); }

.ac-brandmark-word.is-in .ac-brandmark-cap {
  opacity: 1;
  transform: rotate(-8deg);
}

/* hover: spotlight follows the mouse, letters lift slightly, the cap is tossed up */
.ac-brandmark-word.is-hover {
  --acb-spot: 1.15em;
}

.ac-brandmark-word.is-hover .ac-brandmark-base,
.ac-brandmark-word.is-hover .ac-brandmark-ink {
  transform: translateY(-3px);
}

.ac-brandmark-word.is-in.is-hover .ac-brandmark-cap {
  transform: translateY(-34%) rotate(10deg);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* animates the spotlight radius where supported (others just switch it on) */
@property --acb-spot {
  syntax: '<length-percentage>';
  inherits: true;
  initial-value: 0%;
}

@media (hover: none), (prefers-reduced-motion: reduce) {
  .ac-brandmark-word.is-hover {
    --acb-spot: 0%;
  }
  .ac-brandmark-word.is-hover .ac-brandmark-base,
  .ac-brandmark-word.is-hover .ac-brandmark-ink {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ac-brandmark-ink {
    -webkit-mask-size: 100% 100%, 100% 100%;
    mask-size: 100% 100%, 100% 100%;
    transition: none;
  }
  .ac-brandmark-cap {
    opacity: 1;
    transform: rotate(-8deg);
    transition: none;
  }
}

@media print {
  .ac-brandmark {
    display: none;
  }
}
