/* ==========================================================================
   Rojo Apps — shared styles (index, legal, privacy)
   ========================================================================== */

@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@property --dock-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* ---------- Theme tokens ---------- */

:root {
  color-scheme: light;
  --bg: #fbfaf8;
  --fg: #17140f;
  --muted: #5c564e;
  --line: rgba(23, 20, 15, 0.2);
  --surface: rgba(255, 255, 255, 0.62);
  --surface-solid: #f0f0f0;
  --dot: rgba(23, 20, 15, 0.14);
  --dot-hot: rgba(220, 0, 40, 0.55);
  --blob-a: rgba(255, 40, 45, 0.16);
  --blob-b: rgba(255, 170, 52, 0.18);
  --accent: #c8102b;
  --btn-fg: #ffffff;
  --shadow: 0 30px 80px -32px rgba(23, 20, 15, 0.35);
  --inner-hi: rgba(255, 255, 255, 0.7);

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0c0b;
  --fg: #f4f1ec;
  --muted: #a8a097;
  --line: rgba(255, 255, 255, 0.11);
  --surface: rgba(30, 27, 25, 0.55);
  --surface-solid: #1c1a18;
  --dot: rgba(255, 255, 255, 0.09);
  --dot-hot: rgba(255, 106, 77, 0.75);
  --blob-a: rgba(220, 0, 40, 0.2);
  --blob-b: rgba(255, 100, 41, 0.13);
  --accent: #ff6a4d;
  --btn-fg: #0e0c0b;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
  --inner-hi: rgba(255, 255, 255, 0.06);
}

/* ---------- Base ---------- */

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

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.45s ease, color 0.45s ease;
}

a { color: inherit; }

img, svg { display: block; }

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

.skip {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip:focus { top: 16px; }

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

/* ---------- Background: dot grid, cursor spotlight, drifting glow ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg__dots,
.bg__hot {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.3px);
  background-size: 22px 22px;
  background-position: center;
}

.bg__dots {
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 80%);
          mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 80%);
}

.bg__hot {
  background-image: radial-gradient(var(--dot-hot) 1.3px, transparent 1.5px);
  -webkit-mask-image: radial-gradient(circle 190px at var(--mx, -999px) var(--my, -999px), #000, transparent);
          mask-image: radial-gradient(circle 190px at var(--mx, -999px) var(--my, -999px), #000, transparent);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.is-tracking .bg__hot { opacity: 1; }

/* ---------- Top bar & theme toggle ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 24px clamp(20px, 4vw, 48px);
}
.topbar--split { justify-content: space-between; }

.theme-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  color: var(--fg);
  cursor: pointer;
  transition: transform 0.4s var(--ease-out), border-color 0.3s ease;
}
.theme-toggle:hover { transform: rotate(20deg); border-color: var(--muted); }
.theme-toggle svg { grid-area: 1 / 1; transition: opacity 0.3s ease, transform 0.5s var(--ease-out); }
.theme-toggle .i-sun  { opacity: 0; transform: rotate(-90deg) scale(0.6); }
[data-theme="dark"] .theme-toggle .i-sun  { opacity: 1; transform: none; }
[data-theme="dark"] .theme-toggle .i-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }

/* ---------- Brand (logo + wordmark) ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin: 0;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(38px, 6vw, 58px);
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand__logo {
  width: 1.1em;
  height: auto;
  animation: float 6s ease-in-out infinite;
}
.brand__grad {
  background: linear-gradient(90deg, #dc0028, #ff6429, #ffba36, #ff6429, #dc0028);
  background-size: 300% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  color: var(--fg);
  transition: color 0.5s ease;
}
.brand:hover .brand__grad {
  color: transparent;
  animation: sweep 3s linear infinite;
}

.brand--small { font-size: 24px; gap: 12px; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-6px) rotate(-3deg); }
}
@keyframes sweep {
  from { background-position: 0% 0; }
  to   { background-position: 300% 0; }
}

/* ---------- Landing layout ---------- */

.home {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(48px, 8vh, 80px);
  padding: 0 20px 72px;
}

.intro { animation: rise 0.9s var(--ease-out) both; }
.dock  { animation: rise 0.9s var(--ease-out) 0.2s both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Dock ---------- */

.dock {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px;
  list-style: none;
  border-radius: 40px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
          backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 var(--inner-hi);
}

/* A slow ring of light running around the dock's edge */
.dock::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--dock-angle),
    transparent 0deg 250deg,
    rgba(220, 0, 40, 0.7) 290deg,
    rgba(255, 100, 41, 0.9) 320deg,
    rgba(255, 186, 54, 0.9) 340deg,
    transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: dock-spin 9s linear infinite;
  pointer-events: none;
}
@keyframes dock-spin { to { --dock-angle: 360deg; } }

.app,
.soon {
  position: relative;
  display: flex;
  align-items: center;
  height: 184px;
  padding: 16px;
  border-radius: 30px;
  transition: background-color 0.35s ease, opacity 0.35s ease;
}

.app { cursor: default; }

/* Icon button + glow */
.app__icon {
  position: relative;
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: none;
  -webkit-tap-highlight-color: transparent;
}
.app__icon::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 26px;
  background: var(--tint);
  filter: blur(22px);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.5s ease, transform 0.6s var(--ease-out);
}
.app__icon img {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.5s ease, transform 0.5s var(--ease-out);
}

/* Unfurling details panel (desktop) */
.app__panel {
  width: 0;
  overflow: hidden;
  align-self: stretch;
  display: flex;
  align-items: center;
  /* closing: wait a beat so the text fades out first */
  transition: width 0.5s var(--ease-out) 0.1s;
}
.app__info {
  flex-shrink: 0;
  width: 360px;
  margin-left: 28px;
  opacity: 0;
  transform: translateX(-12px);
  filter: blur(4px);
  transition: opacity 0.18s ease, transform 0.25s ease, filter 0.18s ease;
}

.app__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.app__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
}
.app__tag {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.app__chev { display: none; }

.app__more { display: grid; grid-template-rows: 1fr; }
.app__more-inner { min-height: 0; overflow: hidden; }

.app__desc {
  margin: 6px 0 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.app__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.25s var(--ease-out), border-color 0.25s ease, opacity 0.25s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--muted); }
.btn--primary { background: var(--fg); border-color: var(--fg); color: var(--btn-fg); }
.btn--primary:hover { border-color: var(--fg); opacity: 0.9; }

/* Open state (class set by JS; :hover / :focus-within as fallbacks) */
.app.is-open,
.app:has(:focus-visible) { background: var(--surface-solid); }

.app.is-open .app__icon::before,
.app:has(:focus-visible) .app__icon::before { opacity: 0.85; transform: scale(1.12); }

.app.is-open .app__icon img,
.app:has(:focus-visible) .app__icon img {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 12px -4px color-mix(in srgb, var(--tint), transparent 75%);
}

.app.is-open .app__panel,
.app:has(:focus-visible) .app__panel {
  width: 388px;
  transition: width 0.55s var(--ease-out);
}

.app.is-open .app__info,
.app:has(:focus-visible) .app__info {
  opacity: 1;
  transform: none;
  filter: none;
  transition: opacity 0.4s ease 0.18s, transform 0.55s var(--ease-out) 0.18s, filter 0.4s ease 0.18s;
}

.dock:has(.app.is-open) .app:not(.is-open),
.dock:has(.app.is-open) .soon { opacity: 0.5; }

@media (hover: hover) and (min-width: 720px) {
  .app:hover { background: var(--surface-solid); }
  .app:hover .app__icon::before { opacity: 0.85; transform: scale(1.12); }
  .app:hover .app__icon img { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 12px -4px color-mix(in srgb, var(--tint), transparent 75%); }
  .app:hover .app__panel { width: 388px; transition: width 0.55s var(--ease-out); }
  .app:hover .app__info {
    opacity: 1; transform: none; filter: none;
    transition: opacity 0.4s ease 0.18s, transform 0.55s var(--ease-out) 0.18s, filter 0.4s ease 0.18s;
  }
  .dock:hover .app:not(:hover), .dock:hover .soon { opacity: 0.5; }
}

/* "More soon" placeholder — exactly icon-sized */
.soon__box {
  width: 96px;
  height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 24px;
  border: 1.5px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.soon__text { display: none; }

/* ---------- Mobile: vertical list, tap to expand ---------- */

@media (max-width: 719px) {
  .dock {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 460px;
    gap: 4px;
    padding: 8px;
    border-radius: 30px;
  }

  .app,
  .soon {
    height: auto;
    padding: 12px;
    border-radius: 22px;
    align-items: flex-start;
  }
  .app { cursor: pointer; }

  .app__icon,
  .soon__box { width: 64px; height: 64px; border-radius: 16px; }
  .app__icon img { border-radius: 16px; }
  .app__icon::before { border-radius: 18px; filter: blur(16px); }

  .app__panel,
  .app.is-open .app__panel,
  .app:has(:focus-visible) .app__panel {
    flex: 1;
    width: auto;
    min-width: 0;
    overflow: visible;
    align-items: stretch;
    transition: none;
  }

  .app__info,
  .app.is-open .app__info,
  .app:has(:focus-visible) .app__info {
    width: auto;
    flex: 1;
    min-width: 0;
    margin-left: 16px;
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }

  .app__head {
    min-height: 64px;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 2px;
    padding-right: 32px;
    position: relative;
  }
  .app__name { font-size: 20px; }

  .app__chev {
    display: block;
    position: absolute;
    right: 4px;
    top: 50%;
    margin-top: -10px;
    color: var(--muted);
    transition: transform 0.45s var(--ease-out);
  }
  .app.is-open .app__chev { transform: rotate(180deg); }

  .app__more {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.45s var(--ease-out), opacity 0.25s ease;
  }
  .app.is-open .app__more {
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows 0.5s var(--ease-out), opacity 0.4s ease 0.12s;
  }
  .app__desc { margin: 8px 0 14px; font-size: 14px; }
  .app__actions { padding-bottom: 4px; }
  .btn { height: 44px; }

  .soon { align-items: center; }
  .soon__box span { display: none; }
  .soon__text { display: block; margin-left: 16px; color: var(--muted); font-size: 14px; }

  .dock:has(.app.is-open) .app:not(.is-open),
  .dock:has(.app.is-open) .soon { opacity: 1; }
}

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 22px;
  padding: 28px 20px 32px;
  font-size: 13.5px;
  color: var(--muted);
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 2px;
  transition: color 0.2s ease;
}
.site-footer a:hover,
.site-footer a[aria-current="page"] { color: var(--fg); }

/* ---------- Legal pages ---------- */

.legal {
  flex-grow: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}
.legal__card {
  padding: clamp(24px, 5vw, 48px);
  border-radius: 28px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
          backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 var(--inner-hi);
  animation: rise 0.7s var(--ease-out) both;
}
.legal h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.legal__lead { margin: 0 0 32px; color: var(--muted); }
.legal h2 {
  margin: 36px 0 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
}
.legal h3 { margin: 22px 0 8px; font-size: 16px; }
.legal p, .legal li, .legal address { font-size: 15.5px; line-height: 1.65; }
.legal p { margin: 0 0 12px; }
.legal address { font-style: normal; margin-bottom: 12px; }
.legal ul { padding-left: 20px; margin: 0 0 12px; }
.legal a { color: var(--accent); text-underline-offset: 3px; }
.callout {
  margin: 0 0 8px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
}
.callout strong { display: block; margin-bottom: 4px; font-family: var(--font-display); font-size: 16px; }
.callout p { margin: 0; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
}
