/* Shared styles for every page of roltgames.com. */

/* Brand palette: everything is derived from the two base tones,
   --bg (page background) and --blue (the deep blue of the logo). */
:root {
  --bg: #0d0d15;
  --blue: #347cc1;

  --surface: #141522;
  --surface-2: #1b1d2e;
  --border: #2a2e47;
  --blue-dark: #24578a;
  --blue-light: #6fa3d8;
  --text: #e9edf5;
  --text-muted: #9ba4b9;

  --header-height: 64px;
  --content-width: 1120px;
  /* Side spacing shared by the nav, the pages and the carousel, so their
     edges line up. */
  --gutter: clamp(16px, 5vw, 48px);
}

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

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 2px;
}

/* Navigation bar. Link texts and targets are partly placeholders. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgb(13 13 21 / 0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--content-width);
  height: var(--header-height);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.nav-home {
  display: flex;
  align-items: center;
  min-height: 44px;
  border-radius: 8px;
}

.nav-logo {
  display: block;
  width: auto;
  height: 40px;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a,
.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: color 150ms, background-color 150ms;
}

.nav-links a:hover,
.nav-dropdown-toggle:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-links a[aria-current="page"] {
  color: var(--blue-light);
}

/* "Tools" dropdown: opens on mouse hover, or on click / keyboard (nav.js
   sets .is-open). The toggle itself goes nowhere. */
.nav-dropdown {
  position: relative;
}

.nav-caret {
  transition: transform 150ms;
}

.nav-dropdown.is-open .nav-caret {
  transform: rotate(180deg);
}

.nav-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.45);
}

/* Invisible bridge so the menu stays open while the mouse moves down. */
.nav-submenu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 10px;
}

.nav-submenu .nav-icon {
  color: var(--blue-light);
}

.nav-dropdown.is-open .nav-submenu {
  display: block;
}

html:not(.js) .nav-dropdown:focus-within .nav-submenu {
  display: block;
}

@media (hover: hover) and (min-width: 641px) {
  .nav-dropdown:hover .nav-submenu {
    display: block;
  }

  .nav-dropdown:hover .nav-caret {
    transform: rotate(180deg);
  }

  .nav-submenu {
    top: calc(100% + 8px);
  }
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.nav-toggle svg {
  display: block;
  margin: auto;
}

.nav-toggle .icon-close,
.nav-toggle[aria-expanded="true"] .icon-open {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

/* Phones: links fold into a menu button (only when the script runs,
   otherwise the links stay visible). The Tools list opens inline. */
@media (max-width: 640px) {
  .js .nav-toggle {
    display: block;
  }

  .js .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 8px var(--gutter) 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  .js .nav-links.is-open {
    display: flex;
  }

  .nav-links a,
  .nav-dropdown-toggle {
    width: 100%;
    font-size: 16px;
  }

  .nav-submenu {
    position: static;
    min-width: 0;
    padding: 0 0 0 16px;
    border: 0;
    background: none;
    box-shadow: none;
  }
}

main {
  min-height: calc(100vh - var(--header-height) - 1px);
  min-height: calc(100dvh - var(--header-height) - 1px);
}

/* Home page: the news carousel fills the space under the header exactly,
   so the page itself never scrolls. */
main.home {
  --pad-y: clamp(16px, 4vh, 48px);
  --avail-height: calc(100vh - var(--header-height) - 1px - 2 * var(--pad-y));
  height: calc(100vh - var(--header-height) - 1px);
  height: calc(100dvh - var(--header-height) - 1px);
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: var(--pad-y) var(--gutter);
}

@supports (height: 100dvh) {
  main.home {
    --avail-height: calc(100dvh - var(--header-height) - 1px - 2 * var(--pad-y));
  }
}

/* News carousel, the usual hero banner format: 16:9 (4:5 on portrait
   phones), never wider than the nav content and never taller than the space
   under the header. Slides sit in a horizontal scroll-snap track, so touch
   swiping works natively; carousel.js adds arrows, dots and autoplay. */
.carousel {
  --ratio: 16 / 9;
  position: relative;
  width: min(
    100%,
    calc(var(--content-width) - 2 * var(--gutter)),
    calc(var(--avail-height) * var(--ratio))
  );
  aspect-ratio: var(--ratio);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  container-type: inline-size;
}

@media (max-width: 640px) and (orientation: portrait) {
  .carousel {
    --ratio: 4 / 5;
  }
}

.carousel-track {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.slide-media,
.slide-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.slide-media img {
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform 400ms ease;
}

@media (prefers-reduced-motion: no-preference) {
  .slide-link:hover .slide-media img {
    transform: scale(1.03);
  }
}

/* Stand-in until real news art arrives. */
.slide-media.is-placeholder {
  background:
    radial-gradient(60% 80% at 75% 30%, rgb(52 124 193 / 0.45), transparent 70%),
    linear-gradient(135deg, var(--blue-dark), var(--bg) 75%);
}

/* The whole slide is one link (to the Games page). */
.slide-link {
  position: absolute;
  inset: 0;
  display: block;
  color: inherit;
  text-decoration: none;
}

.slide-link:focus-visible {
  outline: 3px solid var(--blue-light);
  outline-offset: -3px;
  border-radius: 16px;
}

/* Darkens the bottom-left corner so the text stays readable on any image. */
.slide-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgb(13 13 21 / 0.92) 0%, rgb(13 13 21 / 0.55) 30%, transparent 60%),
    linear-gradient(to right, rgb(13 13 21 / 0.55) 0%, transparent 55%);
  pointer-events: none;
}

.slide-caption {
  position: absolute;
  z-index: 1;
  left: clamp(16px, 4cqw, 40px);
  right: 16px;
  bottom: 84px;
  max-width: 560px;
}

/* Text sizes follow the carousel width (cqw), not the window. */
.slide-title {
  margin: 0;
  font-size: clamp(20px, 4.4cqw, 44px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.slide-text {
  margin: 8px 0 0;
  color: rgb(233 237 245 / 0.85);
  font-size: clamp(14px, 1.7cqw, 17px);
}

.carousel-controls {
  display: none;
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 16px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.js .carousel-controls {
  display: flex;
}

/* carousel.js hides the controls when there is only one news item. */
.js .carousel-controls[hidden] {
  display: none;
}

.carousel-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgb(233 237 245 / 0.2);
  border-radius: 50%;
  background: rgb(13 13 21 / 0.55);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background-color 150ms, border-color 150ms;
}

.carousel-button:hover {
  border-color: var(--blue-light);
  background: rgb(36 87 138 / 0.7);
}

.carousel-button .icon-play,
.carousel-button[data-paused="true"] .icon-pause {
  display: none;
}

.carousel-button[data-paused="true"] .icon-play {
  display: block;
}

.carousel-dots {
  display: flex;
  margin: 0 4px;
  padding: 0;
  list-style: none;
}

/* 44px touch target around a small visible dot. */
.carousel-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.carousel-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgb(233 237 245 / 0.4);
  transition: width 200ms, background-color 200ms;
}

.carousel-dot:hover::before {
  background: rgb(233 237 245 / 0.7);
}

.carousel-dot[aria-current="true"]::before {
  width: 24px;
  background: var(--blue-light);
}

/* Wide carousel: controls move to the bottom-right, the caption sits lower. */
@container (min-width: 600px) {
  .slide-caption {
    bottom: clamp(20px, 4cqw, 40px);
    right: 280px;
  }

  .carousel-controls {
    left: auto;
    right: clamp(16px, 4cqw, 40px);
    bottom: clamp(20px, 4cqw, 40px);
  }
}

/* Page layout */
.page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 48px var(--gutter) 80px;
}

.page-title {
  margin: 0;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.page-lead {
  max-width: 60ch;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 17px;
}

/* Games list: equal cards, capsule art first, then name, status and a
   short description. Released games come first, then games in development. */
.game-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 641px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.game-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 200ms, transform 200ms;
}

a.game-card:hover {
  border-color: var(--blue);
}

.game-media {
  aspect-ratio: 1232 / 706;
  overflow: hidden;
  background: var(--surface-2);
}

.game-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

/* Stand-in until the real capsule art arrives. */
.game-media.is-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue-dark), var(--surface-2) 70%);
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 22px;
}

.game-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.game-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.25;
}

.game-status {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.game-status.is-released {
  border-color: var(--blue-dark);
  background: rgb(52 124 193 / 0.15);
  color: var(--blue-light);
}

.game-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

@media (prefers-reduced-motion: no-preference) {
  a.game-card:hover {
    transform: translateY(-3px);
  }

  a.game-card:hover .game-media img {
    transform: scale(1.04);
  }
}

/* About page: social / contact links as cards with Phosphor icons. */
.section-title {
  margin: 48px 0 0;
  font-size: 22px;
  font-weight: 700;
}

.social-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.social-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 44px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 200ms, background-color 200ms;
}

.social-card:hover {
  border-color: var(--blue);
  background: var(--surface-2);
}

.social-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgb(52 124 193 / 0.15);
  color: var(--blue-light);
}

.social-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.social-name {
  font-weight: 600;
}

.social-handle {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Let's Plays page: YouTube videos by creators. Thumbnails come from
   YouTube; each card opens the video on YouTube in a new tab. */
.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 641px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .video-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.video-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 200ms, transform 200ms;
}

.video-card:hover {
  border-color: var(--blue);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}

.video-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.video-game {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 10px;
  border: 1px solid var(--blue-dark);
  border-radius: 999px;
  background: rgb(13 13 21 / 0.8);
  color: var(--blue-light);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding-left: 3px;
  border: 1px solid rgb(233 237 245 / 0.25);
  border-radius: 50%;
  background: rgb(13 13 21 / 0.6);
  color: var(--text);
  transform: translate(-50%, -50%);
  transition: background-color 200ms, border-color 200ms;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.video-card:hover .video-play,
.video-card:focus-visible .video-play {
  border-color: var(--blue-light);
  background: rgb(36 87 138 / 0.8);
}

.video-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 18px;
}

/* Long titles are cut after two lines. */
.video-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.video-channel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.video-channel span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* YouTube logo shape (rounded box with a play triangle) before the channel
   name, so the card reads as a YouTube video. YouTube red is the one color
   outside the brand palette, a user decision. */
.video-yt {
  flex: none;
}

.video-yt-bg {
  fill: #ff0000;
}

.video-yt-play {
  fill: #ffffff;
}

.video-note {
  max-width: 60ch;
  margin: 40px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

.video-note a {
  color: var(--blue-light);
}

@media (prefers-reduced-motion: no-preference) {
  .video-card:hover {
    transform: translateY(-3px);
  }

  .video-card:hover .video-thumb img {
    transform: scale(1.04);
  }
}
