/* ManCave Productions. Tokens and rules follow design/direction.md. */

:root {
  --blue: #0033b9;
  --paper: #ffffff;
  --mist: #f5f7fa;
  --ink: #182230;
  --muted: #526071;
  --rule: #dfe5ed;
  --edge: #7a8799;
  --dark: #101827;
  --black: #000000;
  --violet-pale: #f0edf8;
  --violet: #534ade;
  --gold: #deb766;
  --mint: #62fad3;
  --cyan: #5ce1e6;
  --pink: #ffa7e4;
  --amber: #ffce66;

  --font-heading: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas,
    "Liberation Mono", monospace;

  --gutter: 1rem;
  --section-y: 3rem;
  --mark-h: 2.25rem;
}

@media (min-width: 480px) { :root { --gutter: 1.5rem; } }
@media (min-width: 768px) { :root { --gutter: 2rem; --section-y: 4rem; } }
@media (min-width: 1024px) { :root { --gutter: 3rem; --section-y: 6rem; --mark-h: 2.75rem; } }
@media (min-width: 1440px) { :root { --gutter: 4rem; } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

img { display: block; max-width: 100%; height: auto; }
p { margin: 0 0 1rem; max-width: 66ch; }
p:last-child { margin-bottom: 0; }

a { color: var(--blue); text-underline-offset: .15em; }
a, button { transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease; }

.container {
  width: min(1280px, calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}

/* Type */
.display {
  margin: 0 0 1.5rem;
  max-width: 20ch;
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 1.25rem + 3vw, 4.5rem);
  font-weight: 650;
  line-height: 1.06;
  letter-spacing: -.035em;
}
.section-title {
  margin: 0 0 2rem;
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 1.2rem + 1.5vw, 3rem);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -.025em;
}
.item-title {
  margin: 0 0 .75rem;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.015em;
}
.lead {
  max-width: 45ch;
  font-size: clamp(1.125rem, 1rem + .4vw, 1.375rem);
  line-height: 1.5;
}
.caption { font-size: .875rem; line-height: 1.5; color: var(--muted); }
.eyebrow {
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .04em;
  color: var(--muted);
}
.tagline {
  margin-bottom: 1.5rem;
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 1.2rem + 1.5vw, 3rem);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -.025em;
  color: var(--blue);
}

/* Focus */
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.surface-dark :focus-visible,
.surface-dark:focus-visible { outline-color: var(--amber); }
.btn--primary:focus-visible { box-shadow: 0 0 0 2px var(--paper); }
.surface-dark .btn--primary:focus-visible { box-shadow: 0 0 0 2px var(--dark); }
/* Large focus targets keep the ring inside the viewport edges. */
.view:focus-visible, main:focus-visible { outline-offset: -3px; }
main:has(> .surface-dark:not([hidden])):focus-visible { outline-color: var(--amber); }
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid Highlight; }
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: .5rem;
  z-index: 10;
  padding: .75rem 1rem;
  border-radius: 6px;
  background: var(--blue);
  color: var(--paper);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.4;
  transform: translateY(-300%);
}
.skip-link:focus { transform: none; }
.skip-link:focus-visible { box-shadow: 0 0 0 2px var(--paper); }

/* Header and navigation */
.site-header { background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 2rem;
  padding-block: .75rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 2.75rem;
  margin-bottom: .5rem;
  color: var(--ink);
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -.015em;
  line-height: 1.25;
  text-decoration: none;
}
.brand:hover { color: var(--blue); }
.brand__mark { height: var(--mark-h); width: auto; flex: none; }

/* Sits on the header's bottom edge so the selected rule meets the header rule. */
.site-nav { flex: 0 1 auto; max-width: 100%; align-self: flex-end; }
.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: .5rem .75rem;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}
.site-nav__item:hover { background: var(--mist); color: var(--blue); }
.site-nav__item[aria-selected="true"] {
  border-bottom-color: var(--blue);
  color: var(--blue);
}
@media (max-width: 767px) {
  .site-nav { flex-basis: 100%; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 2.75rem;
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
}
.btn--primary { background: var(--blue); color: var(--paper); }
.btn--primary:hover { background: #00298f; color: var(--paper); }
.btn--secondary { background: var(--paper); border-color: var(--edge); color: var(--blue); }
.btn--secondary:hover { background: var(--mist); }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}
.actions--with-note { align-items: flex-start; }
.action-note { flex: 1 1 16rem; margin: 0; }

/* Sections */
.section { padding-block: var(--section-y); }
.section--compact { padding-block: 2rem; }
.section--mist { background: var(--mist); }
.section--ruled { border-top: 1px solid rgba(255, 255, 255, .16); }

.hero { display: grid; gap: 1.5rem; }
.hero__copy .display:last-child { margin-bottom: 0; }

.split { display: grid; gap: 0; }
.feature-list { display: grid; gap: 1.5rem; }
.feature { padding-top: 1rem; border-top: 1px solid var(--rule); }
.feature p { margin: 0; }

@media (min-width: 768px) {
  .hero { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; align-items: center; }
  .hero--stacked { align-items: end; }
  .feature-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
}
/* Magic Money tablet: one column, so the identity and heading read before the intro. */
@media (min-width: 768px) and (max-width: 1023px) {
  #magic-money .hero--stacked { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1024px) {
  .hero { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3rem; }
  .hero > .hero__copy { grid-column: span 5; }
  .hero > .hero__media { grid-column: span 7; }
  .hero--stacked > .hero__copy:first-child { grid-column: span 7; }
  .split { grid-template-columns: 4fr 8fr; gap: 3rem; }
  .split > .section-title { margin-bottom: 0; }
}

/* Logo panels: presentation only, artwork stays untouched. */
.logo-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border-radius: 4px;
}
.logo-panel img {
  width: auto;
  max-width: 100%;
  max-height: var(--logo-h, 12rem);
  object-fit: contain;
}
.logo-panel--chainlens { background: var(--black); }
.logo-panel--magic-money, .logo-panel--arcade { background: var(--dark); }
.logo-panel--afterglow, .logo-panel--poker, .logo-panel--world { background: var(--violet-pale); }
.logo-panel--hero { min-height: 16rem; --logo-h: 22rem; padding: 2rem; }
@media (min-width: 1024px) { .logo-panel--hero { min-height: 28rem; } }

.logo-inset {
  display: inline-flex;
  flex: none;
  padding: .5rem;
  border-radius: 4px;
  background: var(--black);
}
.logo-inset img { width: 2.5rem; height: 2.5rem; }

/* Home */
.home-hero { background: var(--mist); padding-block: var(--section-y); }
.home-hero__copy > p:not(.tagline):not(.lead) { max-width: 60ch; }
@media (min-width: 1024px) {
  .home-hero {
    background: var(--mist) url("assets/company-grid.svg") center / cover no-repeat;
  }
  .home-hero__copy { max-width: calc(50% - 1.5rem); }
}

.product-index { display: grid; gap: 1.5rem; }
.product-entry { display: flex; flex-direction: column; align-items: flex-start; }
.product-entry__media {
  align-self: stretch;
  height: 14rem;
  margin-bottom: 1.5rem;
  --logo-h: 11rem;
}
.product-entry > p { flex: 1 0 auto; margin-bottom: 1.5rem; }

@media (min-width: 768px) {
  .product-index { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
}
@media (min-width: 1024px) {
  .product-index { gap: 4rem 3rem; }
  .product-entry__media { height: 18rem; --logo-h: 14rem; }
}

/* Arcade entry: ChainLens inset above the two labelled games; one row once wide enough. */
.product-entry__media--arcade {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .75rem 1rem;
  align-content: center;
  align-items: end;
  justify-items: center;
  height: auto;
  min-height: 14rem;
}
.product-entry__media--arcade > .logo-inset { grid-column: 1 / -1; }
.preview-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  min-width: 0;
  margin: 0;
  --logo-h: 5rem;
}
.preview-game figcaption {
  color: var(--paper);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.4;
}
@media (min-width: 1024px) {
  /* Wrapping shrinks the flex line to its content, so align-content can centre the row. */
  .product-entry__media--arcade { display: flex; flex-wrap: wrap; gap: 1rem; min-height: 18rem; }
  .product-entry__media--arcade > .logo-inset { align-self: center; }
  .preview-game { --logo-h: 7.5rem; }
  .preview-game--wide { flex: 0 1 40%; }
}

.community {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 3rem;
}
.community .section-title { margin-bottom: .75rem; }

/* AfterGlow: violet accents on white, sparse gold decoration. */
.view--afterglow .eyebrow { color: var(--violet); }
.view--afterglow .feature { border-top-color: var(--rule); }
.view--afterglow .feature:first-child { border-top: 2px solid var(--gold); padding-top: calc(1rem - 1px); }

/* Dark product surfaces */
.surface-dark { background: var(--dark); color: var(--paper); }
.surface-dark .eyebrow, .surface-dark .caption { color: var(--paper); }
.surface-dark .feature { border-top-color: rgba(255, 255, 255, .16); }
.surface-dark--mint { --accent: var(--mint); }
.surface-dark--cyan { --accent: var(--cyan); }
.surface-dark .eyebrow { color: var(--accent); }
.surface-dark a:not(.btn) { color: var(--accent); }
.surface-dark .btn--primary { background: var(--accent); color: var(--dark); }
.surface-dark .btn--primary:hover { background: var(--paper); color: var(--dark); }
.surface-dark .btn--secondary { background: transparent; border-color: var(--edge); color: var(--paper); }
.surface-dark .btn--secondary:hover { background: rgba(255, 255, 255, .08); }

/* Compact identity up through tablet; the full wordmark needs a wide hero to stay legible. */
.product-identity__icon { display: none; }
.wordmark { display: none; }
@media (max-width: 1023px) {
  .surface-dark .product-identity {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.5rem;
    color: var(--paper);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -.015em;
  }
  .product-identity__icon { display: block; flex: none; width: 3.5rem; height: 3.5rem; }
}
@media (min-width: 1024px) {
  .wordmark { display: flow-root; width: min(100%, 1000px); margin: 3rem auto 0; }
  /* The PNG is 38% transparent above and below its artwork. It stays uncropped; these
     margins only let the section close some of that gap. Percentages follow the width. */
  .wordmark img { width: 100%; margin-block: -10%; }
}

.notes { margin: 0; padding: 0; list-style: none; max-width: 66ch; }
.notes li { padding-block: 1rem; border-top: 1px solid rgba(255, 255, 255, .16); }
.notes li:last-child { padding-bottom: 0; }

/* Arcade */
.arcade-name {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.015em;
}
.game-grid { display: grid; gap: 1.5rem; }
.game { display: flex; flex-direction: column; min-width: 0; }
.game__media {
  height: 15rem;
  margin-bottom: 1.5rem;
  --logo-h: 12rem;
  border: 1px solid rgba(255, 255, 255, .16);
}
@media (min-width: 768px) { .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; } }
@media (min-width: 1024px) { .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4rem 3rem; } }
@media (min-width: 1024px) and (max-width: 1439px) { .product-index, .game-grid { row-gap: 3rem; } }

/* Footer */
.site-footer { background: var(--paper); border-top: 1px solid var(--rule); padding-block: 2rem; }
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 2rem;
}
.site-footer p { margin: 0; }
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
}

/* Without JavaScript all views stay in the page, one after another. */
.view { scroll-margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
