/* Pinku web edge styles (04-24; UI-SPEC Screen 14). Values come from apps/mobile/src/theme/tokens.ts.
   Light and dark through prefers-color-scheme with the same token values and contrast pairs as the app.
   No inline styles anywhere (CSP style-src 'self'). */

@font-face {
  font-family: 'Pixelify Sans';
  src: url('/fonts/PixelifySans_500Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Pixelify Sans';
  src: url('/fonts/PixelifySans_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter_400Regular.ttf') format('truetype');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter_700Bold.ttf') format('truetype');
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --background: #FBF1F8;
  --background-grid: #EFDDF0;
  --surface: #FFFAF5;
  --surface-raised: #FFFFFF;
  --surface-sunken: #F5ECF7;
  --text-primary: #3A2250;
  --text-secondary: #65507A;
  --outline: #3A2250;
  --outline-soft: #DCCBE6;
  --accent-primary: #C9B6F2;
  --accent-secondary: #F8C3D9;
  --on-accent: #2A1740;
  --link: #6A3FB8;
  --danger: #A12D4B;
  --focus: #7C5CE0;
  --shadow: #3A2250;
  --titlebar-pink: #FBD0E1;
  --titlebar-lav: #DCCEF8;
  --dot-1: #F7A8C4;
  --dot-2: #F8DC7B;
  --dot-3: #9FDDBE;

  --font-pixel: 'Pixelify Sans', ui-monospace, monospace;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius-window: 16px;
  --radius-button: 14px;
  --radius-input: 12px;
  --border-base: 2px;
  --sticker-sm: 2px 2px 0 0 var(--shadow);
  --sticker-lg: 4px 4px 0 0 var(--shadow);
  --grid-cell: 26px;
  --grid-line: 1.5px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #1B1430;
    --background-grid: #2A2046;
    --surface: #261D40;
    --surface-raised: #30264F;
    --surface-sunken: #1F1737;
    --text-primary: #F6EDFF;
    --text-secondary: #CDBDE3;
    --outline: #B7A4EE;
    --outline-soft: #3F3363;
    --accent-primary: #C9B6F2;
    --accent-secondary: #F4A9C9;
    --on-accent: #231636;
    --link: #CDB8FF;
    --danger: #F6A3B8;
    --focus: #E5D8FF;
    --shadow: #0C0819;
    --titlebar-pink: #57305A;
    --titlebar-lav: #3D3170;
    --dot-1: #F4A9C9;
    --dot-2: #EFCF6E;
    --dot-3: #72D6A8;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 16px 48px;
  background-color: var(--background);
  background-image:
    linear-gradient(var(--background-grid) var(--grid-line), transparent var(--grid-line)),
    linear-gradient(90deg, var(--background-grid) var(--grid-line), transparent var(--grid-line));
  background-size: var(--grid-cell) var(--grid-cell);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
}

main {
  max-width: 480px;
  margin: 0 auto;
}

/* ---------- Window (invite.txt, privacy.txt, ...) ---------- */
.window {
  background: var(--surface);
  border: var(--border-base) solid var(--outline);
  border-radius: var(--radius-window);
  box-shadow: var(--sticker-lg);
  overflow: hidden;
}

.window-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  background: var(--titlebar-pink);
  border-bottom: var(--border-base) solid var(--outline);
}

.window-titlebar.lav {
  background: var(--titlebar-lav);
}

.window-dots {
  display: flex;
  gap: 6px;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--outline);
}

.window-dots span:nth-child(1) { background: var(--dot-1); }
.window-dots span:nth-child(2) { background: var(--dot-2); }
.window-dots span:nth-child(3) { background: var(--dot-3); }

.window-title {
  margin: 0;
  font-family: var(--font-pixel);
  font-weight: 500;
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.39px;
}

.window-body {
  padding: 24px 20px;
}

/* ---------- Type ---------- */
h1,
.h1 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 34px;
  font-weight: 750;
  letter-spacing: -0.42px;
}

h2,
.h2 {
  margin: 24px 0 8px;
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.22px;
}

.window-body > h2:first-child {
  margin-top: 0;
}

p {
  margin: 0 0 16px;
}

.body-sm {
  font-size: 14px;
  line-height: 20px;
}

.caption {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--text-secondary);
}

a {
  color: var(--link);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

ul {
  margin: 0 0 16px;
  padding-left: 22px;
}

li {
  margin-bottom: 6px;
}

/* ---------- Hero (mascot + sticker) ---------- */
.hero {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 80px;
  margin-bottom: 16px;
}

.hero img {
  display: block;
}

.hero .sticker {
  margin-bottom: 4px;
  transform: rotate(-8deg);
}

.fade-in {
  animation: fade-in 240ms ease-out both;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.heading-placeholder {
  height: 34px;
  width: 70%;
  margin: 0 0 12px;
  border-radius: 8px;
  background: var(--surface-sunken);
}

/* ---------- Buttons ---------- */
.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 44px;
  padding: 10px 20px;
  border: var(--border-base) solid var(--outline);
  border-radius: var(--radius-button);
  box-shadow: var(--sticker-sm);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}

.button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.button-primary {
  background: var(--accent-primary);
  color: var(--on-accent);
}

.button-secondary {
  background: var(--surface-raised);
  color: var(--text-primary);
}

.button-small {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 14px;
}

.store-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store-buttons .button {
  flex: 1 1 180px;
}

:focus {
  outline: none;
}

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

/* ---------- Code block ---------- */
.code-block {
  margin: 24px 0 16px;
  padding: 16px;
  background: var(--surface-sunken);
  border: var(--border-base) solid var(--outline-soft);
  border-radius: var(--radius-input);
}

.code-label {
  margin: 0 0 8px;
}

.code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.code {
  font-family: var(--font-pixel);
  font-weight: 600;
  font-size: 20px;
  line-height: 24px;
  letter-spacing: 2px;
  user-select: all;
  -webkit-user-select: all;
}

.code-block .caption {
  margin: 12px 0 0;
}

.note {
  margin: 16px 0 0;
}

.in-app-caption {
  margin: 24px 0 0;
}

/* ---------- Legal pages (/privacy/, /terms/) ---------- */
.legal h3 {
  margin: 20px 0 8px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
}

.legal code {
  font-family: var(--font-pixel);
  font-size: 14px;
}

.table-wrap {
  margin: 0 0 16px;
  overflow-x: auto;
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 20px;
}

.legal th,
.legal td {
  padding: 8px;
  text-align: left;
  vertical-align: top;
  border: 1.5px solid var(--outline-soft);
}

.legal th {
  background: var(--surface-sunken);
  font-weight: 700;
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: 480px;
  margin: 24px auto 0;
  text-align: center;
}

.site-footer a {
  display: inline-block;
  min-height: 44px;
  padding: 12px 8px;
}

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

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    animation: none;
  }
  .button {
    transition: none;
  }
  .button:active {
    transform: none;
  }
}
