/* ============================================================================
   Shared chrome for the two front-facing apex pages: the company page (`/`)
   and the academy hub (`/academy`).

   ## Why this is a file and not inlined

   `index.html` used to inline everything, on the argument that a single-request
   landing page beats a cached stylesheet when there is only one page. There are
   two now, and they share their tokens, shell, header, cards, footer, motion
   and every breakpoint - the whole sheet except a handful of page-specific
   rules. Inlining would mean maintaining that twice, which is how two pages
   that are meant to look identical stop looking identical. `policy.css` made
   the same call for the same reason.

   ## Why it looks like the parent portal now

   Because the client asked for that directly. An earlier apex design was
   rejected for being *too* close to the portal, and that judgement stood while
   the apex was an index of chess sites - reading as a different kind of page
   was the point. The apex is now the company that builds the portal, so the
   shared visual language is the message rather than a copy: same red, same
   light grey ground, same white cards and Inter type as
   `caissachess.lk/src/shared/styles/pages/public/home/_shell.scss`, which is
   where these values come from. Both went light on 2026-10-10; the greys are
   the portal's zinc scale (`gray-50` … `gray-900`).

   ## Why it is wine and teal, not the portal red

   The client's 2026 brand banner moved the company to a deep wine with a
   green-blue teal beside it on an ivory ground, and asked for this site -
   only this site - to follow it. Layout, type and motion are untouched; this
   is a re-tokening. Wine stays the lead (the logo, the headline accent);
   teal is the second voice (eyebrow, sub-label, the header button, every
   other card). The card rhythm alternates the two the way the banner's
   service icons do, so neither reads as an afterthought.
   ========================================================================= */

:root {
  /* The banner's two brand colours. `*-rgb` triplets exist for the
     translucent washes and glows, which need the colour with an alpha. */
  --wine: #8c1d2f;
  --wine-bright: #a8283d;
  --wine-deep: #6a1222;
  --wine-rgb: 140, 29, 47;

  --teal: #0f5c60;
  --teal-bright: #16777a;
  --teal-deep: #0b4447;
  --teal-rgb: 15, 92, 96;

  /* Ivory ground and slate ink with a faint teal undertone, so the neutrals
     belong to the same family as the accents rather than to zinc. */
  --page: #f8f5ef;
  --ink: #1a2326;
  --body: #3b4548;
  --muted: #4f595c;
  --faint: #667073;
  --line: #e6dfd3;
  --line-strong: #d6cdbe;

  --glass: #ffffff;
  --glass-hover: #ffffff;

  --gut: clamp(22px, 5vw, 96px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  position: relative;
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;

  /* The portal's `.ph` shape in the banner's colours: warm white at the top
     fading to ivory, lit wine from the upper left and teal from the upper
     right - the corner the banner puts its teal in.
     Sized to the first screen and not repeated, so a long page settles into
     plain grey below it. */
  background-color: var(--page);
  background-image:
    radial-gradient(900px 560px at 8% -6%, rgba(var(--wine-rgb), 0.08), transparent 70%),
    radial-gradient(760px 480px at 100% 0%, rgba(var(--teal-rgb), 0.09), transparent 70%),
    linear-gradient(180deg, #fffdf9 0%, #fffdf9 40%, var(--page) 100%);
  background-size: 100% 960px;
  background-repeat: no-repeat;

  color: var(--body);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* The portal's chessboard, in faint ink across the top: strongest at the
   edges, fading out behind the copy - an unmasked grid behind body text is a
   legibility problem, not a texture. */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 820px;
  z-index: 0;
  pointer-events: none;
  background-image: repeating-conic-gradient(
    rgba(var(--teal-rgb), 0.045) 0% 25%,
    transparent 0% 50%
  );
  background-size: 112px 112px;
  background-position: center top;
  mask-image: radial-gradient(
    ellipse 70% 85% at 50% 0%,
    #000 0%,
    rgba(0, 0, 0, 0.55) 45%,
    transparent 78%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 70% 85% at 50% 0%,
    #000 0%,
    rgba(0, 0, 0, 0.55) 45%,
    transparent 78%
  );
}

.wrap {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--gut);
  position: relative;
  z-index: 5;
}

/* ------------------------------------------------------------------ header */

.head {
  padding-block: clamp(22px, 4vh, 34px);
}

.head__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: inherit;
}

.brand__logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 8px rgba(var(--wine-rgb), 0.2));
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand__sub {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--teal);
}

/* The masthead's one action, as a teal button. It only scrolls the page (or,
   on the hub, goes back one level), so it is filled but compact - sized to
   the brand lockup beside it, not to a hero CTA. */
.head__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: #ffffff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--teal-deep);
  background: linear-gradient(180deg, var(--teal-bright) 0%, var(--teal) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 6px 16px -6px rgba(var(--teal-rgb), 0.55);
  transition:
    transform 0.3s var(--ease),
    background 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.head__back svg {
  flex-shrink: 0;
  transition: transform 0.3s var(--ease);
}

.head__back:hover,
.head__back:focus-visible {
  transform: translateY(-1px);
  background: linear-gradient(180deg, var(--teal) 0%, var(--teal-deep) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 22px -8px rgba(var(--teal-rgb), 0.6);
}

.head__back:hover svg,
.head__back:focus-visible svg {
  transform: translateY(2px);
}

.head__back:active {
  transform: translateY(0);
}

/* -------------------------------------------------------------------- hero */

main {
  flex: 1;
  padding-block: clamp(30px, 6vh, 70px) clamp(50px, 9vh, 110px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--faint);
  margin-bottom: clamp(18px, 3vh, 26px);
}

/* The dot is decorative and carries no meaning the label does not already
   carry, so it is not announced. */
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(var(--teal-rgb), 0.14);
  flex-shrink: 0;
}

h1 {
  margin: 0 0 clamp(20px, 3.5vh, 30px);
  font-size: clamp(2.3rem, 4.6vw, 3.3rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.035em;
  color: var(--ink);
}

/* Gradient-filled text. `background-clip` needs the transparent fill to show
   through, and the fallback matters: if either declaration is dropped the text
   inherits `--ink` and stays legible rather than vanishing. */
.accent {
  background: linear-gradient(135deg, var(--wine-bright) 0%, var(--wine-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  padding-bottom: 0.06em;
}

.lede {
  margin: 0;
  font-size: clamp(1rem, 1.35vw, 1.19rem);
  line-height: 1.72;
  color: var(--body);
  max-width: 60ch;
}

/* ------------------------------------------------------------- hero layout */

/* Two columns on a wide screen, because one is wrong there: the copy caps at
   60ch for readability, which on a 1240px page leaves the right third empty and
   reading as unfinished rather than as space. The second column is purely
   decorative, so below `lg` it is removed outright - there is nothing in it to
   reflow. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  gap: clamp(30px, 5vw, 64px);
  align-items: center;
}

.hero__art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(230px, 26vw, 340px);
}

/* The glow is a sibling layer rather than a `filter` on the mark: a
   drop-shadow large enough to read at this size costs a full-size blur of a
   256px bitmap on every paint, and this is the same two radial stops the rest
   of the page is built from. */
.hero__art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(var(--wine-rgb), 0.12) 0%,
    rgba(var(--teal-rgb), 0.06) 44%,
    transparent 68%
  );
}

/* Concentric rings, faint, around a white disc - the only geometry on the
   page that is not a rectangle, and enough to stop the mark floating in
   nothing. */
.hero__art::after {
  content: "";
  position: absolute;
  inset: 8%;
  z-index: 0;
  border-radius: 50%;
  border: 1px solid rgba(var(--teal-rgb), 0.18);
  background: rgba(255, 253, 249, 0.75);
  box-shadow:
    0 0 0 clamp(18px, 2.6vw, 34px) rgba(var(--teal-rgb), 0.035),
    0 24px 60px -24px rgba(26, 35, 38, 0.16),
    inset 0 0 60px rgba(var(--wine-rgb), 0.05);
}

.hero__mark {
  position: relative;
  z-index: 1;
  width: clamp(140px, 15vw, 200px);
  height: auto;
  filter: drop-shadow(0 16px 30px rgba(var(--wine-rgb), 0.24));
}

@media (prefers-reduced-motion: no-preference) {
  .hero__mark {
    animation: float 7s ease-in-out infinite;
  }

  @keyframes float {
    50% {
      transform: translateY(-11px);
    }
  }
}

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

  .hero__art {
    display: none;
  }
}

/* ------------------------------------------------------------- section head */

.sect {
  margin-top: clamp(52px, 9vh, 96px);
}

.sect__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  margin-bottom: clamp(22px, 3.5vh, 32px);
  border-bottom: 1px solid var(--line);
}

.sect__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink);
}

/* A small chip rather than loose grey text: it is a status, and at the far
   end of a hairline loose text read as a stray caption. */
.sect__note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(var(--teal-rgb), 0.2);
  background: rgba(var(--teal-rgb), 0.06);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--teal-deep);
  white-space: nowrap;
}

/* The live dot. The ring pulses only for people who have not asked their OS
   for less motion; the dot itself is always there. */
.sect__note--live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .sect__note--live::before {
    animation: live 2.4s ease-in-out infinite;
  }

  @keyframes live {
    50% {
      box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.06);
    }
  }
}

/* ------------------------------------------------------------------- cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(16px, 2vw, 22px);
}

/* Four peers: one row on a wide screen, two by two below it, never three plus
   an orphan (which auto-fit would give at most laptop widths). */
.cards--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

@media (max-width: 640px) {
  .cards--four {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The portal's white card, given room to breathe: it stacks and takes the
   padding because here it is the main event on a wide page. Everything else -
   the hairline border, the 4px lift, the red border on hover - is the
   portal's. */
.card {
  --tone: var(--wine);
  --tone-rgb: var(--wine-rgb);

  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(22px, 2.4vw, 30px);
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: 0 1px 2px rgba(26, 35, 38, 0.04);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition:
    transform 0.35s var(--ease),
    background 0.35s var(--ease),
    border-color 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
}

/* A red wash that fades in from the top-left on hover. Behind the content and
   inert, so it can never intercept the click on the card it decorates. */
/* Every other card speaks teal, as the banner alternates its service icons.
   Counted per grid, so each page's first card is wine. */
.card:nth-child(even) {
  --tone: var(--teal);
  --tone-rgb: var(--teal-rgb);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    ellipse 120% 100% at 0% 0%,
    rgba(var(--tone-rgb), 0.06) 0%,
    transparent 62%
  );
  transition: opacity 0.35s var(--ease);
}

.card > * {
  position: relative;
  z-index: 1;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  background: var(--glass-hover);
  border-color: rgba(var(--tone-rgb), 0.35);
  box-shadow:
    0 18px 40px -12px rgba(26, 35, 38, 0.14),
    0 4px 12px rgba(26, 35, 38, 0.04);
}

.card:hover::before,
.card:focus-visible::before {
  opacity: 1;
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card__icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(var(--tone-rgb), 0.08);
  color: var(--tone);
  transition:
    background 0.35s var(--ease),
    color 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
}

.card:hover .card__icon,
.card:focus-visible .card__icon {
  background: var(--tone);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(var(--tone-rgb), 0.3);
}

.card__go {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: var(--faint);
  transition:
    color 0.35s var(--ease),
    transform 0.35s var(--ease);
}

.card:hover .card__go,
.card:focus-visible .card__go {
  color: var(--tone);
  transform: translateX(4px);
}

.card__title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.card__desc {
  font-size: 14px;
  line-height: 1.62;
  color: var(--muted);
  margin: 0;
}

/* The destination, spelled out. On a page whose whole job is sending people
   somewhere else, saying where is worth the line - and it is what tells someone
   that "Academy" stays on this site while the other two do not. */
.card__host {
  margin-top: auto;
  padding-top: 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------- capability strip */

.caps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: clamp(18px, 2.4vw, 30px);
}

.cap__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 7px;
}

.cap__desc {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0;
}

.cap__rule {
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--wine);
  margin-bottom: 14px;
  opacity: 0.85;
}

.caps > :nth-child(even) .cap__rule {
  background: var(--teal);
}

/* ------------------------------------------------------------------ footer */

footer {
  padding-bottom: clamp(24px, 4vh, 34px);
  font-size: 13px;
  color: var(--faint);
}

/* The rule lives on the inner element, not on `footer`. `.wrap` carries the
   page gutter as padding, so a border on the footer itself spans the padding
   box and visibly overhangs the column of text it is meant to close. */
.foot__inner {
  border-top: 1px solid var(--line);
  padding-top: clamp(24px, 4vh, 34px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px 30px;
  flex-wrap: wrap;
}

.foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.foot__links a {
  color: var(--faint);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

.foot__links a:hover,
.foot__links a:focus-visible {
  color: var(--teal);
}

/* ------------------------------------------------------------------- focus */

/* One visible ring for everything reachable by keyboard. Declared once and
   last so no component's own hover styling can quietly out-specify it. */
a:focus-visible,
.card:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ motion */

/* Decorative only, and off for anyone who asked their OS for less of it.
   `backwards` holds the from-state during the delay - without it every element
   paints at full opacity first and then jumps back to start. */
@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 0.6s var(--ease) backwards;
    animation-delay: calc(70ms * var(--d, 0));
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
  }
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 720px) {
  body::before {
    /* The portal's phone board: smaller squares, a touch fainter, over less
       of the page. */
    height: 620px;
    background-image: repeating-conic-gradient(
      rgba(var(--teal-rgb), 0.04) 0% 25%,
      transparent 0% 50%
    );
    background-size: 64px 64px;
  }

  .brand__logo {
    width: 36px;
    height: 36px;
  }

  .brand__name {
    font-size: 17px;
  }

  .head__back {
    padding: 7px 11px;
    font-size: 12.5px;
  }

  .foot__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 359px) {
  /* Only on the narrowest phones. The sub-label carries "(Private) Limited",
     which is the point of the company page, so it is dropped later than the
     usual 420px breakpoint - down here it genuinely collides with the header
     link and wraps the masthead onto a second line. */
  .brand__sub {
    display: none;
  }
}
