/* Documents – technical materials as a shelf of cards with cover previews.
   .docs          section layout on the mist surface
   .docs__grid    cards; the first two (presentation, technical sheet) are wider
   .doc           one card: cover, name, what it is, size; the whole card is the link
   .doc__cover    the first page, cut by the card's top edge, lifts a little on hover
   .doc__meta     format and size in a quiet line */

.docs {
  display: grid;
  gap: var(--space-7);
}

.docs__grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-4);
}

.doc {
  --doc-cover-h: 200px;
  grid-column: span 2;
  position: relative;
  display: grid;
  grid-template-rows: var(--doc-cover-h) 1fr;
  border-radius: 3px;
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--line);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: box-shadow var(--dur-slower) var(--ease-out);
}

.doc--wide {
  grid-column: span 3;
  --doc-cover-h: 240px;
}

@media (hover: hover) {
  .doc:hover {
    box-shadow: inset 0 0 0 1px var(--line-strong), 0 26px 48px -26px rgb(49 187 238 / 0.42), 0 10px 22px -16px rgb(49 187 238 / 0.3);
  }
}

.doc:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent), 0 0 16px 3px var(--accent-glow);
}

/* Cover: a tilted page on a mist background, cut by the card edge */
.doc__cover {
  position: relative;
  overflow: hidden;
  background: linear-gradient(170deg, var(--mist) 0%, #e3e6ea 100%);
  border-bottom: 1px solid var(--line);
}

.doc__cover img {
  position: absolute;
  left: 12%;
  top: 14%;
  width: 92%;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgb(22 24 27 / 0.1), 0 24px 40px -20px rgb(22 24 27 / 0.45);
  transform: rotate(-3deg);
  transform-origin: 0 0;
  transition: transform var(--dur-cinematic) var(--ease-emphasis);
}

.doc--portrait .doc__cover img {
  left: 24%;
  top: 10%;
  width: 60%;
}

/* The energy label is a tall SVG, framed on white */
.doc--label .doc__cover img {
  left: 32%;
  top: 8%;
  width: 36%;
  background: #fff;
  padding: 6px;
}

@media (hover: hover) {
  .doc:hover .doc__cover img {
    transform: rotate(-1.5deg) translateY(-6px);
  }
}

.doc__badge {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 3px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.doc__body {
  display: grid;
  gap: var(--space-1);
  align-content: start;
  padding: var(--space-5);
}

.doc__name {
  margin: 0;
  font-size: var(--text-h3);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.doc__what {
  margin: 0;
  color: var(--fg-muted);
}

.doc__meta {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: var(--space-3) 0 0;
  font-size: var(--text-small);
  color: var(--fg-muted);
}

.doc__meta svg {
  width: 1em;
  height: 1em;
}

.doc__meta .doc__go {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-left: auto;
  color: var(--fg);
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--dur-base) var(--ease-emphasis);
}

@media (hover: hover) {
  .doc:hover .doc__go {
    transform: translateX(3px);
  }
}

@media (max-width: 1000px) {
  .docs__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc,
  .doc--wide {
    grid-column: span 1;
    --doc-cover-h: 200px;
  }
}

/* Phones: compact rows, the cover as a small sheet on the left, so five documents fit in one screen and a half */
@media (max-width: 560px) {
  .docs__grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .doc,
  .doc--wide {
    --doc-cover-h: auto;
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: none;
  }

  .doc__cover {
    min-height: 100%;
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }

  .doc__cover img,
  .doc--portrait .doc__cover img,
  .doc--label .doc__cover img {
    left: 14%;
    top: 14%;
    width: 110%;
    padding: 0;
    background: none;
  }

  .doc--portrait .doc__cover img,
  .doc--label .doc__cover img {
    width: 72%;
  }

  .doc__badge {
    left: 8px;
    top: 8px;
    padding: 3px 6px;
    font-size: 0.6875rem;
  }

  .doc__body {
    padding: var(--space-4);
  }

  .doc__name {
    font-size: 1.125rem;
  }

  .doc__what {
    font-size: var(--text-small);
  }

  .doc__meta {
    margin-top: var(--space-2);
  }
}

/* Portal card under the library: dark liquid glass on the light band, the logo's own colours, one button */
.portal {
  --portal-pad: var(--space-6);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-6);
  padding: var(--portal-pad);
  border-radius: var(--radius-l);
  color: #f6f7f9;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.10), rgb(255 255 255 / 0.02)),
    linear-gradient(160deg, rgb(28 33 39 / 0.92) 0%, rgb(17 20 24 / 0.96) 60%, rgb(10 12 15 / 0.98) 100%);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.14),
    inset 0 0 0 1px rgb(255 255 255 / 0.06),
    0 30px 60px -30px rgb(0 0 0 / 0.6);
}
/* A soft LED-blue bloom behind the logo gives the glass its depth */
.portal__glow {
  position: absolute;
  z-index: -1;
  left: -8%;
  top: -60%;
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(49 187 238 / 0.28), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}
.portal__logo {
  display: grid;
  place-items: center;
  padding: var(--space-4) var(--space-5);
  border-radius: 12px;
  background: rgb(255 255 255 / 0.06);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.10);
}
.portal__logo img {
  display: block;
  width: 230px;
  height: auto;
}
.portal__eyebrow {
  margin: 0 0 var(--space-2);
  font-size: var(--text-small);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--led-500);
}
.portal__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-h3);
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.portal__text {
  margin: 0;
  color: #aeb3bc;
  max-width: 56ch;
}
.portal__btn {
  --btn-bg: #f6f7f9;
  --btn-fg: #0c0e10;
  --btn-bg-hover: #d9dee4;
  justify-self: end;
  white-space: nowrap;
}
@media (max-width: 1000px) {
  .portal {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .portal__btn {
    grid-column: 1 / -1;
    justify-self: start;
  }
}
@media (max-width: 640px) {
  .portal {
    --portal-pad: var(--space-5);
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
  .portal__logo {
    justify-self: start;
  }
  .portal__logo img {
    width: 190px;
  }
  .portal__btn {
    width: 100%;
    justify-content: center;
  }
}

/* Hover: the card lifts a touch and a soft light sweeps across the glass under the pointer */
/* The card keeps the page's scroll reveal (fade + rise); the hover lift then uses the same, quicker transform */
.portal.reveal {
  transition:
    opacity var(--dur-slower) var(--ease-out),
    transform var(--dur-cinematic) var(--ease-emphasis),
    box-shadow var(--dur-slow) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms), calc(var(--i, 0) * 90ms), 0ms;
}
.portal.reveal.is-in {
  transition:
    opacity var(--dur-slower) var(--ease-out),
    transform var(--dur-slow) var(--ease-out),
    box-shadow var(--dur-slow) var(--ease-out);
}
.portal::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / 0.10), transparent 45%);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
  pointer-events: none;
}
@media (hover: hover) {
  .portal:hover {
    transform: translateY(-3px);
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.18),
      inset 0 0 0 1px rgb(255 255 255 / 0.10),
      0 40px 70px -30px rgb(0 0 0 / 0.65),
      0 24px 48px -28px rgb(49 187 238 / 0.45);
  }
  .portal:hover::after {
    opacity: 1;
  }
  .portal__logo {
    transition: box-shadow var(--dur-slow) var(--ease-out), background-color var(--dur-slow) var(--ease-out);
  }
  .portal:hover .portal__logo {
    background: rgb(255 255 255 / 0.09);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18), 0 0 24px -6px rgb(49 187 238 / 0.5);
  }
}
@media (prefers-reduced-motion: reduce) {
  .portal, .portal::after, .portal__logo { transition: none; }
  .portal:hover { transform: none; }
}
