/* Shared foundations for every page of salata.design */

:root {
  --color-page: #0f0e0e;
  --color-surface: #1a1a1a;
  --color-text: rgba(255, 255, 255, 0.7);
  --color-text-strong: rgba(255, 255, 255, 0.86);
  --color-text-muted: rgba(255, 255, 255, 0.6);
  --color-text-on-media: #1a1a1a;

  --font-sans: "Inter Tight", system-ui, sans-serif;

  --radius-card: 6px;
  --card-width: 880px;
  --card-height: 495px;
  --card-padding: 36px;
  --label-height: 24px;
  --label-gap: 12px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --letter-step: 35ms;

  color-scheme: dark;
}

/* Page-to-page navigation swaps instantly; the card animations in
   js/transition.js make the pages line up, this only prevents a blank flash. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--color-page);
  /* No visible scrollbar: it would shift centred cards between pages */
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2 {
  margin: 0;
  font-weight: 400;
}

/* ---------- Card: "/label" above a dark rounded panel ---------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--label-gap);
  flex-shrink: 0;
}

.card__body {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: var(--card-width);
  height: var(--card-height);
  padding: var(--card-padding);
  overflow: hidden;
  background: var(--color-surface);
  border-radius: var(--radius-card);
}

.card-label {
  display: inline-block;
  font-size: 20px;
  line-height: var(--label-height);
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: color 0.3s ease;
}

a.card-label:hover,
a.card-label:focus-visible {
  color: rgba(255, 255, 255, 0.9);
}

/* ---------- Letter-by-letter text (split by Transition.splitLetters) ---------- */

.char {
  opacity: 0;
}

.is-loaded .char {
  opacity: 1;
  transition: opacity 0.5s ease;
  /* Same pace everywhere; keep --letter-step in sync with LETTER_STEP in js/transition.js */
  transition-delay: calc(var(--text-delay, 0s) + var(--ci) * var(--letter-step));
}

@media (prefers-reduced-motion: reduce) {
  .char {
    opacity: 1;
    transition: none !important;
  }
}

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

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 4px;
  border-radius: 2px;
}
