:root {
    --bg: #fcfcfc;
    --fg: #444;
    --muted: #666;
    --accent: #8310b5;
    --highlight: #8410b518;
    --card-bg: #fcfcfc;
    --card-brd: #e0e0e0;
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    src:
        url("../fonts/AtkinsonHyperlegible-Regular.woff2") format("woff2"),
        url("../fonts/AtkinsonHyperlegible-Regular.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Bold";
    src:
        url("../fonts/AtkinsonHyperlegible-Bold.woff2") format("woff2"),
        url("../fonts/AtkinsonHyperlegible-Bold.woff") format("woff");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

html,
body {
    min-height: 100%;
    height: auto;
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: "Atkinson Hyperlegible", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: grid;
    place-items: start start;
    overflow-x: hidden;
}

body {
  min-height: 100svh;
  box-sizing: border-box;
  padding: clamp(24px, 4vw, 64px);
  display: grid;
  place-items: start start;
  overflow-x: hidden;
}

a {
    color: var(--accent);
}

.wrap {
    width: min(850px, 100%);
    overflow: visible;
}

img.smooth-appear {
    opacity: 0;
    transform: translateY(0);
    animation: smoothMoveFade 1s ease-out forwards;
}

img.logo {
    width: 96px;
    margin-bottom: 2em;
}

@keyframes smoothMoveFade {
    0% {
        opacity: 0;
        transform: translateY(-.5em);
    }
    100% {
        opacity: 1;
        transform: translateY(.5em);
    }
}

#text {
    display: block;
    max-width: 100%;
    overflow: visible;
    contain: none;
}

.line {
    display: block;
    margin: 0 0 1rem 0;
    font-size: clamp(1.25rem, 2.2vw + 0.5rem, 1.75rem);
    font-weight: 450;
    letter-spacing: 0.01em;
}

.cursor {
    display: inline-block;
    width: 0.6ch;
    border-right: 2px solid var(--muted);
    animation: blink 1s steps(1) infinite;
    translate: 0 0.07em;
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* Highlight */
.highlight {
    position: relative;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    background-color: var(--highlight);
}

.highlight::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 1px;
    background: color-mix(in srgb, var(--accent) 65%, transparent);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform .18s ease;
    pointer-events: none;
}

.highlight:hover::after,
.highlight:focus-visible::after {
    transform: scaleX(1);
}

@media (hover: hover) and (pointer: fine) {
  .highlight:hover .highlight-card,
  .highlight:focus-visible .highlight-card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

/* Base card */
.highlight-card {
  position: absolute;
  left: 0;
  bottom: 120%;
  min-width: 360px;
  max-width: min(420px, 92vw);
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--card-brd);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 12px 30px rgba(0,0,0,.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 1000;
  font-size: .95rem;
  line-height: 1.45;
}

/* JS toggles this on any device */
.highlight-card.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.highlight:hover .highlight-card,
.highlight:focus-visible .highlight-card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.card-media {
    display: block;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 0 0.5rem 0;
}

.card-media img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.card-title {
    margin: 0.75rem 0 0.125rem 0;
    font-size: 1.125rem;
}

.card-text {
    margin: 0 0 .25rem 0;
    color: var(--muted);
    font-size: .9125rem;
    line-height: 1.3;
}

@media (max-width:640px){
    img.logo {
        width: 64px;
        margin-bottom: 1.5em;
    }
}

/* Mobile: turn the card into a centered “sheet” that never overflows */
@media (max-width: 640px) {
  .highlight { position: static; }

  .highlight-card {
    position: fixed;
    top: 1.5em;
    right: 5%;
    left: 5%;
    bottom: auto;
    max-width: calc(100vw - 24px);
    width: auto;
    max-height: calc(100vh - 24px);
    min-width: 320px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
}

/* Optional: a little dim background when a card is open on mobile */
@media (max-width: 640px) {
  body.card-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.15);
    pointer-events: none;
    z-index: 999; /* just under the card */
  }
}

@media (prefers-reduced-motion: reduce) {
    .cursor {
        animation: none;
        border-color: transparent;
    }

    .highlight-card,
    .highlight::after {
        transition: none;
    }
}
