/* DLSS 5 Manager — shared styles for index.html and tutorials.html
 *
 * Sizes are in rem and the root font size grows with the viewport
 * (15px on phones and laptops up to 18px on 2K/4K screens), so the whole
 * layout scales together instead of looking tiny on large monitors.
 */

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

:root {
  /* Deep blue-teal palette taken from the background photo. */
  --bg: #0c1a24;
  --surface: #12232f;
  --surface-2: #182d3b;
  --border: #213848;
  --border-strong: #2e4859;
  --glass: rgba(14, 30, 41, 0.78);
  --text: #e9f0f4;
  --text-muted: #a3b6c2;
  --text-faint: #6f8796;
  --accent: #10b981;
  --accent-hover: #0ea371;
  --accent-text: #3dd598;
  --radius: 0.625rem;
  --radius-sm: 0.375rem;
  /* System fonts: nothing to download, and they render instantly. */
  --font: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --patreon: #ff424d;
  --patreon-hover: #ff5a63;
  --content-width: 82rem;
  --gutter: clamp(1rem, 3vw, 2rem);
  --header-height: 3.75rem;
  color-scheme: dark;
}

html {
  font-size: clamp(15px, 0.3vw + 11px, 18px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg) radial-gradient(ellipse 80% 40% at 50% 0%, rgba(64, 140, 190, 0.14), transparent 70%) no-repeat;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

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

.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(12, 26, 36, 0.86);
  border-bottom: 1px solid var(--border);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 0.3rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.25rem;
  padding: 0 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}

.site-nav .nav-link svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.site-nav .nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.site-nav .nav-link[aria-current='page'] {
  color: var(--accent-text);
  background: rgba(16, 185, 129, 0.1);
}

/* Patreon button (header, release notes) */

.btn-patreon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1.1rem;
  border-radius: 999px;
  background: var(--patreon);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(255, 66, 77, 0.25);
  transition: background-color 0.15s, transform 0.15s;
}

.btn-patreon svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.btn-patreon:hover {
  background: var(--patreon-hover);
  transform: translateY(-1px);
}

.btn-patreon--nav {
  height: 2.25rem;
  margin-left: 0.375rem;
  padding: 0 0.95rem;
  font-size: 0.875rem;
}

@media (max-width: 700px) {
  .hide-sm {
    display: none;
  }
}

@media (max-width: 560px) {
  .site-nav .nav-github {
    display: none;
  }

  .site-nav .nav-link {
    padding: 0 0.625rem;
  }
}

@media (max-width: 400px) {
  .site-nav .nav-link span {
    display: none;
  }
}

@media (max-width: 340px) {
  .brand span {
    display: none;
  }
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 3rem;
  padding: 0 1.375rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.btn--primary {
  background: var(--accent);
  color: #04130c;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: var(--glass);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--secondary:hover {
  border-color: var(--text-faint);
}

.btn--small {
  height: 2.25rem;
  padding: 0 0.9rem;
  font-size: 0.875rem;
}

/* Ads */

.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
}

.ad-slot__label {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* On the photo background the label needs a shadow to stay readable. */
.hero__ad {
  flex-shrink: 0;
  margin-top: clamp(1.5rem, 5vh, 3rem);
}

.hero .ad-slot__label {
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.ad-slot__frame {
  display: flex;
  justify-content: center;
  max-width: 100%;
  overflow: hidden;
}

.ad-slot__frame iframe {
  display: block;
  max-width: none;
  border: 0;
  /* Matching the frame's scheme keeps its background transparent in dark mode. */
  color-scheme: normal;
}

/* Footer */

.site-footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.site-footer__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1.25rem var(--gutter);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

/* ---------- Home ---------- */

.hero {
  position: relative;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vh, 3rem) var(--gutter) 3rem;
  overflow: hidden;
  isolation: isolate;
}

/* Background photo, slightly zoomed so it can drift with the mouse (see home.js).
   Only its transform changes, so moving it never repaints the page. */
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #2b4f61;
}

.hero__bg img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  transform: scale(1.08);
  will-change: transform;
  user-select: none;
}

.hero__copyright {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.875rem;
  margin: 0;
  text-align: center;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.hero__content {
  /* Centred in the space above the ad. */
  margin: auto 0;
  width: 100%;
  max-width: 48rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(0.75rem, 1.8vh, 1.5rem);
}

/* The logo is sized by viewport height too, so the hero fits short laptop screens. */
.hero__logo {
  width: min(40rem, 88vw, 56vh);
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  /* Static shadow: keeps the silver logo readable on the bright sky. */
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.625rem;
}

.hero__meta {
  margin: -0.25rem 0 0;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.92);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.hero__meta strong {
  color: #fff;
  font-weight: 600;
}

.release-notes {
  width: 100%;
  max-width: 34rem;
  text-align: left;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(14, 30, 41, 0.9);
}

.release-notes summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.release-notes summary::-webkit-details-marker {
  display: none;
}

.release-notes summary svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.release-notes[open] summary svg {
  transform: rotate(180deg);
}

.release-notes__body {
  max-height: min(20rem, 40vh);
  overflow-y: auto;
  padding: 0 0.875rem 0.875rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: #c6d4dc;
  overscroll-behavior: contain;
}

.release-notes__body ul {
  margin: 0.75rem 0 0;
  padding-left: 1.125rem;
}

.release-notes__body li + li {
  margin-top: 0.375rem;
}

.release-notes__body p {
  margin: 0.75rem 0 0;
}

.release-notes__body a:not(.btn-patreon) {
  color: var(--accent-text);
  overflow-wrap: anywhere;
}

.release-notes__body h3 {
  margin: 1.25rem 0 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.release-notes__body img {
  max-width: 100%;
  height: auto;
  margin-top: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.release-notes__body .is-centered {
  text-align: center;
}

.release-notes__body .btn-patreon {
  margin-top: 0.25rem;
}

.release-notes__link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .hero__actions {
    width: 100%;
  }

  .hero__actions .btn {
    flex: 1 1 100%;
  }
}

/* Short landscape screens (small laptops with browser bars, phones turned sideways). */
@media (max-height: 560px) and (min-width: 641px) {
  .hero {
    align-items: flex-start;
  }
}

/* ---------- Tutorials ---------- */

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.25rem var(--gutter) 3.5rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-head h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-head p {
  margin: 0.375rem 0 0;
  max-width: 40rem;
  color: var(--text-muted);
}

.toolbar {
  position: sticky;
  top: var(--header-height);
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  margin-bottom: 1.25rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.lang-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.chip[aria-pressed='true'] {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--text-faint);
}

.chip__count {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.toolbar__selects {
  display: flex;
  gap: 0.5rem;
}

.select {
  height: 2rem;
  min-width: 0;
  max-width: 15rem;
  padding: 0 1.9rem 0 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3b6c2' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 0.625rem center;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  text-overflow: ellipsis;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.select:hover {
  border-color: var(--border-strong);
}

.result-count {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.page .ad-slot {
  margin: 0 0 1.5rem;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(17.5rem, 100%), 1fr));
  gap: 1.75rem 1.25rem;
}

.video-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.video-card[hidden] {
  display: none;
}

.video-card__thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.video-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}

/* Hide the browser's broken-image icon if a thumbnail cannot load. */
.video-card__thumb img[data-failed] {
  visibility: hidden;
}

.video-card__thumb:hover img {
  opacity: 0.85;
}

.video-card__badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.125rem 0.4rem;
  border-radius: 0.25rem;
  background: rgba(0, 0, 0, 0.78);
  font-size: 0.6875rem;
  font-weight: 600;
  color: #fff;
}

.video-card__badge--new {
  left: auto;
  right: 0.5rem;
  background: var(--accent);
  color: #04130c;
}

.video-card__body {
  padding-top: 0.625rem;
}

.video-card__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  /* Reserve two lines so cards in a row line up while titles load. */
  min-height: 2.8em;
}

.video-card__title a {
  text-decoration: none;
}

.video-card__title a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.video-card__meta {
  margin-top: 0.25rem;
  min-height: 1.5em;
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-card__meta a {
  text-decoration: none;
}

.video-card__meta a:hover {
  color: var(--text);
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.submit-box {
  margin-top: 3rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.submit-box h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.submit-box p {
  margin: 0.25rem 0 0;
  max-width: 40rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.submit-box code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  padding: 0.0625rem 0.375rem;
  border-radius: 0.25rem;
  background: var(--surface-2);
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 60;
  max-width: calc(100vw - 2rem);
  transform: translate(-50%, 0.75rem);
  padding: 0.625rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 760px) {
  .toolbar {
    position: static;
  }

  .lang-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 0.125rem;
    width: calc(100% + var(--gutter) * 2);
    scrollbar-width: none;
  }

  .lang-filter::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex-shrink: 0;
  }

  .toolbar__selects {
    width: 100%;
  }

  .select {
    flex: 1;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .page {
    padding-top: 1.5rem;
  }

  .page-head h1 {
    font-size: 1.625rem;
  }

  .page-head .btn {
    display: none;
  }
}

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