/* GTA Glitches V2 — Shared components */

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0.65rem 1.15rem;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  cursor: pointer;
  color: var(--text-primary);
  background: var(--neu-raised);
  box-shadow:
    4px 4px 10px var(--neu-shadow-dark),
    -3px -3px 8px var(--neu-shadow-light);
  transition:
    box-shadow var(--duration) var(--ease),
    transform var(--duration-fast) var(--ease),
    background var(--duration) var(--ease),
    color var(--duration-fast) var(--ease);
}

.btn:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 3px 3px 7px var(--neu-shadow-dark),
    inset -2px -2px 5px var(--neu-shadow-light);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow:
    4px 4px 12px var(--neu-shadow-dark),
    -2px -2px 8px var(--neu-shadow-light);
}

.btn-primary:hover {
  color: #fff;
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--accent-soft);
}

.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.85rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.theme-toggle .theme-icon {
  display: block;
  flex-shrink: 0;
}

html[data-theme="light"] .theme-toggle .theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle .theme-icon-moon,
html:not([data-theme]) .theme-toggle .theme-icon-moon {
  display: none;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* —— Cards —— */
.card {
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  background: var(--neu-raised);
  box-shadow:
    6px 6px 14px var(--neu-shadow-dark),
    -5px -5px 12px var(--neu-shadow-light);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition:
    box-shadow var(--duration) var(--ease),
    transform var(--duration-fast) var(--ease);
}

.card-link:hover {
  color: inherit;
  text-decoration: none;
  transform: translateY(-2px);
}

.card-link:active {
  transform: translateY(0);
  box-shadow:
    inset 3px 3px 8px var(--neu-shadow-dark),
    inset -2px -2px 6px var(--neu-shadow-light);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-2);
  color: var(--text-primary);
}

.card-body {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* —— Badges / chips —— */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--neu-inset);
  color: var(--text-secondary);
  box-shadow:
    inset 2px 2px 4px var(--neu-shadow-dark),
    inset -1px -1px 3px var(--neu-shadow-light);
}

.badge-working {
  color: var(--status-working);
}

.badge-risky {
  color: var(--status-risky);
}

.badge-patched {
  color: var(--status-patched);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--neu-raised);
  box-shadow:
    3px 3px 8px var(--neu-shadow-dark),
    -2px -2px 6px var(--neu-shadow-light);
  transition: box-shadow var(--duration) var(--ease), color var(--duration-fast) var(--ease);
}

.chip:hover,
.chip[aria-pressed="true"],
.chip.is-active {
  color: var(--text-primary);
  box-shadow:
    inset 2px 2px 6px var(--neu-shadow-dark),
    inset -2px -2px 5px var(--neu-shadow-light);
}

/* —— Forms —— */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.input,
.select,
.textarea,
.search-input {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--neu-inset);
  color: var(--text-primary);
  box-shadow:
    inset 3px 3px 8px var(--neu-shadow-dark),
    inset -2px -2px 6px var(--neu-shadow-light);
}

.textarea {
  min-height: 120px;
  resize: vertical;
  padding-top: 0.75rem;
}

.input::placeholder,
.search-input::placeholder {
  color: var(--text-muted);
}

.search-shell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--neu-inset);
  box-shadow:
    inset 3px 3px 8px var(--neu-shadow-dark),
    inset -2px -2px 6px var(--neu-shadow-light);
}

.search-shell .search-input {
  box-shadow: none;
  background: transparent;
  min-height: 40px;
  padding-inline: 0;
}

/* —— Site header / nav —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--header-z);
  background: var(--neu-base);
  border-bottom: 1px solid var(--border-subtle);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--nav-height);
  width: min(100% - 2 * var(--space-4), var(--content-max));
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
}

.brand:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow:
    3px 3px 8px var(--neu-shadow-dark),
    -2px -2px 6px var(--neu-shadow-light);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: var(--space-1);
  margin-left: var(--space-4);
  flex: 1;
}

.nav-link {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--text-primary);
  background: var(--accent-soft);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.header-status {
  display: flex;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 0.35rem 0.55rem;
  margin-right: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1;
  color: var(--text-muted);
  white-space: nowrap;
}

.header-status .gta-time {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: 600;
}

.header-status .location-text {
  color: var(--text-muted);
}

.header-status .ls-plane {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  margin-left: -0.1rem;
  color: var(--text-muted);
  overflow: visible;
}

.header-status .ls-plane-flight {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 30% 70%;
  animation: ls-plane-takeoff 5.5s cubic-bezier(0.77, 0, 0.175, 1) infinite;
}

.header-status .ls-plane svg {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

.header-status .ls-plane-dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.header-status .ls-plane-dust span {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  left: 28%;
  top: 62%;
  animation: ls-plane-dust 5.5s cubic-bezier(0.77, 0, 0.175, 1) infinite;
}

.header-status .ls-plane-dust span:nth-child(2) {
  left: 36%;
  top: 70%;
  width: 1.5px;
  height: 1.5px;
  animation-delay: 0.1s;
}

.header-status .ls-plane-dust span:nth-child(3) {
  left: 22%;
  top: 54%;
  width: 1.5px;
  height: 1.5px;
  animation-delay: 0.18s;
}

.header-status .ls-plane-dust span:nth-child(4) {
  left: 40%;
  top: 58%;
  width: 1px;
  height: 1px;
  animation-delay: 0.26s;
}

@keyframes ls-plane-takeoff {
  0% {
    transform: translate(0, 1px);
    opacity: 0;
  }
  8% {
    transform: translate(0, 0);
    opacity: 0.9;
  }
  38% {
    transform: translate(0.45rem, -0.35rem);
    opacity: 0.85;
  }
  52% {
    transform: translate(0.85rem, -0.6rem);
    opacity: 0;
  }
  53%,
  100% {
    transform: translate(0, 1px);
    opacity: 0;
  }
}

@keyframes ls-plane-dust {
  0%,
  10% {
    transform: translate(0, 0) scale(0.7);
    opacity: 0;
  }
  16% {
    opacity: 0.5;
  }
  36% {
    transform: translate(-0.22rem, 0.18rem) scale(0.55);
    opacity: 0.35;
  }
  50% {
    transform: translate(-0.4rem, 0.32rem) scale(0.25);
    opacity: 0;
  }
  51%,
  100% {
    transform: translate(0, 0) scale(0.7);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-status .ls-plane-flight {
    animation: none;
    opacity: 0.75;
    transform: none;
  }

  .header-status .ls-plane-dust {
    display: none;
  }
}

.header-status .gta6-countdown-label {
  margin-left: 0.15rem;
  color: var(--text-muted);
}

.header-status .gta6-countdown-time {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 719px) {
  .header-status .location-text,
  .header-status .ls-plane,
  .header-status .gta6-countdown-label {
    display: none;
  }
}

.nav-toggle {
  display: inline-flex;
}

@media (min-width: 900px) {
  .nav-desktop {
    display: flex;
  }
  .nav-toggle {
    display: none;
  }
}

.mobile-nav {
  display: none;
  padding: 0 var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-nav.is-open {
  display: block;
}

.mobile-nav-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--neu-inset);
  box-shadow:
    inset 3px 3px 8px var(--neu-shadow-dark),
    inset -2px -2px 6px var(--neu-shadow-light);
}

.mobile-nav .nav-link {
  padding: 0.75rem 1rem;
  min-height: 44px;
}

@media (min-width: 900px) {
  .mobile-nav {
    display: none !important;
  }
}

/* —— Hub tiles (card style, used on tools/lists) —— */
.hub-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, 1fr);
}

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

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

.hub-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: 120px;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  background: var(--neu-raised);
  box-shadow:
    5px 5px 12px var(--neu-shadow-dark),
    -4px -4px 10px var(--neu-shadow-light);
  transition:
    box-shadow var(--duration) var(--ease),
    transform var(--duration-fast) var(--ease);
}

.hub-tile:hover {
  color: inherit;
  text-decoration: none;
  transform: translateY(-2px);
}

.hub-tile:active {
  transform: translateY(0);
  box-shadow:
    inset 3px 3px 8px var(--neu-shadow-dark),
    inset -2px -2px 6px var(--neu-shadow-light);
}

.hub-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--neu-inset);
  box-shadow:
    inset 2px 2px 5px var(--neu-shadow-dark),
    inset -1px -1px 4px var(--neu-shadow-light);
  font-size: 1.25rem;
  overflow: hidden;
}

.hub-tile-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hub-tile-label {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.hub-tile-caption {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: -0.35rem;
}

/* —— iOS-style app launcher tiles (home) —— */
.launcher-zone {
  width: min(100% - 2 * var(--space-4), 900px);
  margin-inline: auto;
  padding-bottom: var(--space-12);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px 12px;
  justify-items: center;
  width: 100%;
  margin: 0 auto var(--space-8);
}

@media (min-width: 768px) and (max-width: 1023px) {
  .app-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 36px 18px;
    max-width: 750px;
  }
}

@media (min-width: 1024px) {
  .app-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 40px 20px;
    max-width: 900px;
  }
}

.app-tile {
  width: 100%;
  max-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  text-decoration: none;
  color: var(--text-primary);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform var(--duration) var(--ease);
}

@media (min-width: 768px) and (max-width: 1023px) {
  .app-tile {
    max-width: 100px;
  }
}

@media (min-width: 1024px) {
  .app-tile {
    max-width: 110px;
  }
}

@media (max-width: 480px) {
  .app-tile {
    max-width: 100%;
    min-height: 100px;
  }
}

.app-tile:hover {
  color: var(--text-primary);
  text-decoration: none;
}

@media (min-width: 768px) {
  .app-tile:hover {
    transform: scale(1.06);
  }
}

.app-tile:active {
  transform: scale(0.94);
}

.app-tile:active .app-tile-icon {
  box-shadow:
    inset 3px 3px 7px color-mix(in srgb, var(--neu-shadow-dark) 80%, transparent),
    inset -2px -2px 5px color-mix(in srgb, var(--neu-shadow-light) 40%, transparent);
}

.app-tile-icon {
  --tile-face: #d8dde6;
  --tile-face-2: #c2c9d6;
  --grad-a: #8b93a7;
  --grad-b: #5c6578;
  width: 60px;
  height: 60px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--tile-face) 82%, #fff) 0%, var(--tile-face) 48%, var(--tile-face-2) 100%);
  box-shadow:
    4px 4px 10px color-mix(in srgb, var(--neu-shadow-dark) 72%, transparent),
    -2px -2px 6px color-mix(in srgb, var(--neu-shadow-light) 55%, transparent),
    inset 1px 1px 2px rgba(255, 255, 255, 0.28),
    inset -1px -1px 2px rgba(0, 0, 0, 0.12);
  transition: box-shadow var(--duration) var(--ease), transform var(--duration-fast) var(--ease);
}

.app-tile-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.28) 0%, transparent 38%, transparent 68%, rgba(255, 255, 255, 0.06) 100%);
  opacity: 0.5;
}

.app-tile-icon .app-tile-svg {
  position: relative;
  z-index: 1;
  width: 54%;
  height: 54%;
  overflow: visible;
}

.app-tile-icon .icon-paint {
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0.96;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35))
    drop-shadow(0 2px 3px rgba(0, 0, 0, 0.28));
  transition: filter var(--duration) var(--ease), opacity var(--duration-fast) var(--ease);
}

.app-tile-icon .icon-shine {
  stroke-width: 1.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0.7;
  mix-blend-mode: screen;
  pointer-events: none;
}

.app-tile-icon .icon-paint [data-filled="true"] {
  stroke: none;
  opacity: 0.78;
  filter: none;
}

.app-tile:hover .app-tile-icon .icon-paint {
  opacity: 1;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.55))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 10px rgba(255, 255, 255, 0.35));
}

.app-tile:hover .app-tile-icon .icon-shine {
  opacity: 0.95;
  animation: glass-shine-pulse 2.2s ease-in-out infinite;
}

.app-tile:hover .app-tile-icon .icon-grad {
  animation: glass-grad-flow 2.6s ease-in-out infinite;
}

@keyframes glass-grad-flow {
  0% {
    transform: translateX(-35%);
  }
  50% {
    transform: translateX(35%);
  }
  100% {
    transform: translateX(-35%);
  }
}

@keyframes glass-shine-pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-tile:hover .app-tile-icon .icon-grad,
  .app-tile:hover .app-tile-icon .icon-shine {
    animation: none;
  }
}

/* Accent families: vibrant faces + white / lightly tinted icons */
.app-tile-icon.soft-mist {
  --tile-face: #64748b;
  --tile-face-2: #475569;
  --grad-a: #ffffff;
  --grad-b: #f1f5f9;
}
.app-tile-icon.soft-sky {
  --tile-face: #3b82f6;
  --tile-face-2: #1d4ed8;
  --grad-a: #ffffff;
  --grad-b: #dbeafe;
}
.app-tile-icon.soft-sage {
  --tile-face: #22c55e;
  --tile-face-2: #15803d;
  --grad-a: #ffffff;
  --grad-b: #dcfce7;
}
.app-tile-icon.soft-star {
  --tile-face: #5b6cff;
  --tile-face-2: #9b3dff;
  --grad-a: #ffffff;
  --grad-b: #ede9fe;
}

.app-tile-icon.has-star-icon .star-img {
  position: relative;
  z-index: 1;
  display: block;
  width: 72%;
  height: 72%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  transition: filter var(--duration) var(--ease), transform var(--duration-fast) var(--ease);
}

.app-tile-icon.has-star-icon::after {
  opacity: 0.35;
}

.app-tile:hover .app-tile-icon.has-star-icon .star-img {
  filter:
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 10px color-mix(in srgb, var(--grad-a) 50%, transparent))
    drop-shadow(0 0 16px color-mix(in srgb, var(--grad-b) 40%, transparent));
  animation: star-glow-pulse 2.4s ease-in-out infinite;
}

@keyframes star-glow-pulse {
  0%,
  100% {
    filter:
      drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45))
      drop-shadow(0 0 8px color-mix(in srgb, var(--grad-a) 45%, transparent))
      drop-shadow(0 0 12px color-mix(in srgb, var(--grad-b) 30%, transparent));
  }
  50% {
    filter:
      drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45))
      drop-shadow(0 0 12px color-mix(in srgb, var(--grad-a) 55%, transparent))
      drop-shadow(0 0 18px color-mix(in srgb, var(--grad-b) 45%, transparent));
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-tile:hover .app-tile-icon.has-star-icon .star-img {
    animation: none;
  }
}
.app-tile-icon.soft-lilac {
  --tile-face: #8b5cf6;
  --tile-face-2: #6d28d9;
  --grad-a: #ffffff;
  --grad-b: #ede9fe;
}
.app-tile-icon.soft-afk {
  --tile-face: #1c5e48;
  --tile-face-2: #6e3698;
  --grad-a: #ffe066;
  --grad-b: #7e22ce;
}
.app-tile-icon.soft-creators {
  --tile-face: #e85a5a;
  --tile-face-2: #c42828;
  --grad-a: #ffffff;
  --grad-b: #fee2e2;
}
.app-tile-icon.soft-blush {
  --tile-face: #ec4899;
  --tile-face-2: #be185d;
  --grad-a: #ffffff;
  --grad-b: #fce7f3;
}
.app-tile-icon.soft-peach {
  --tile-face: #f97316;
  --tile-face-2: #c2410c;
  --grad-a: #ffffff;
  --grad-b: #ffedd5;
}
.app-tile-icon.soft-sand {
  --tile-face: #eab308;
  --tile-face-2: #ca8a04;
  --grad-a: #ffffff;
  --grad-b: #fef9c3;
}
.app-tile-icon.soft-mint {
  --tile-face: #14b8a6;
  --tile-face-2: #0f766e;
  --grad-a: #ffffff;
  --grad-b: #ccfbf1;
}
.app-tile-icon.soft-slate {
  --tile-face: #475569;
  --tile-face-2: #1e293b;
  --grad-a: #ffffff;
  --grad-b: #f1f5f9;
}
.app-tile-icon.soft-rose {
  --tile-face: #f43f5e;
  --tile-face-2: #be123c;
  --grad-a: #ffffff;
  --grad-b: #ffe4e6;
}

/* Articles: italic typing caret */
.app-tile-icon.has-type-icon .type-glyph {
  position: relative;
  z-index: 1;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  user-select: none;
}

.app-tile-icon.has-type-icon .type-caret {
  display: inline-block;
  margin-left: 0.02em;
  animation: type-caret-blink 1.05s steps(1, end) infinite;
}

@keyframes type-caret-blink {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@media (min-width: 1024px) {
  .app-tile-icon.has-type-icon .type-glyph {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-tile-icon.has-type-icon .type-caret {
    animation: none;
    opacity: 1;
  }
}

/* Brand tiles */
.app-tile-icon.soft-reddit {
  --tile-face: #ff4500;
  --tile-face-2: #e03d00;
  --grad-a: #ff8717;
  --grad-b: #ff4500;
  background: linear-gradient(145deg, #ff6a1a 0%, #ff4500 48%, #e03d00 100%);
}
.app-tile-icon.soft-discord {
  --tile-face: #5865f2;
  --tile-face-2: #4752c4;
  --grad-a: #5865f2;
  --grad-b: #7289da;
  background: linear-gradient(145deg, #6a75f5 0%, #5865f2 48%, #4752c4 100%);
}
.app-tile-icon.soft-friends {
  --tile-face: #1a1224;
  --tile-face-2: #0e0a16;
  --grad-a: #a78bfa;
  --grad-b: #7c3aed;
}

.app-tile-icon.has-brand-logo {
  background: transparent;
  padding: 0;
}

.app-tile-icon.has-brand-logo::after {
  display: none;
}

.app-tile-icon.has-brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  position: relative;
  z-index: 1;
  transition: filter var(--duration) var(--ease), transform var(--duration-fast) var(--ease);
}

.app-tile-icon.has-brand-logo .brand-logo-fallback {
  width: 70%;
  height: 70%;
  margin: auto;
}

.app-tile:hover .app-tile-icon.has-brand-logo img {
  filter: brightness(1.06) saturate(1.05);
}

/* Appeal hammer: slightly smaller inside the peach face */
.app-tile-icon.soft-peach.has-brand-logo {
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--tile-face) 82%, #fff) 0%, var(--tile-face) 48%, var(--tile-face-2) 100%);
}

.app-tile-icon.soft-peach.has-brand-logo img {
  transform: scale(0.86);
  transform-origin: center center;
}

.app-tile:hover .app-tile-icon.soft-peach.has-brand-logo img {
  transform: scale(0.86);
}

.app-tile-icon.has-brand-mark .brand-mark-svg {
  position: relative;
  z-index: 1;
  width: 58%;
  height: 58%;
  overflow: visible;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
  transition: filter var(--duration) var(--ease), transform var(--duration-fast) var(--ease);
}

.app-tile:hover .app-tile-icon.has-brand-mark .brand-mark-svg {
  filter:
    drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2))
    drop-shadow(0 0 10px rgba(255, 255, 255, 0.35));
  animation: brand-mark-glow 2.4s ease-in-out infinite;
}

@keyframes brand-mark-glow {
  0%,
  100% {
    filter:
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2))
      drop-shadow(0 0 8px rgba(255, 255, 255, 0.28));
  }
  50% {
    filter:
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2))
      drop-shadow(0 0 14px rgba(255, 255, 255, 0.5));
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-tile:hover .app-tile-icon.has-brand-mark .brand-mark-svg {
    animation: none;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .app-tile-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    margin-bottom: 9px;
  }
}

@media (min-width: 1024px) {
  .app-tile-icon {
    width: 90px;
    height: 90px;
    border-radius: 22px;
    margin-bottom: 10px;
  }
}

@media (max-width: 480px) {
  .app-tile-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    margin-bottom: 8px;
  }
}

.app-tile-icon .app-tile-svg {
  width: 54%;
  height: 54%;
}

.app-tile-icon:not(.has-brand-logo):not(.has-star-icon) img {
  display: none;
}

.app-tile-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

@media (min-width: 768px) {
  .app-tile-label {
    font-size: 0.8125rem;
  }
}

@media (min-width: 1024px) {
  .app-tile-label {
    font-size: 0.875rem;
  }
}

.app-tile-badge {
  position: absolute;
  top: -2px;
  right: calc(50% - 34px);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--status-working);
  box-shadow: 0 0 0 2px var(--neu-base);
  z-index: 2;
}

@media (min-width: 1024px) {
  .app-tile-badge {
    right: calc(50% - 48px);
  }
}


/* —— Hero —— */
.hero {
  padding: var(--space-10) 0 var(--space-8);
}

.hero-panel {
  padding: var(--space-8) var(--space-6);
  border-radius: var(--radius-xl);
  background: var(--neu-raised);
  box-shadow:
    8px 8px 20px var(--neu-shadow-dark),
    -6px -6px 16px var(--neu-shadow-light);
}

@media (min-width: 720px) {
  .hero-panel {
    padding: var(--space-12) var(--space-10);
  }
}

.hero-kicker {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* —— Lists / glitch rows —— */
.list-panel {
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  background: var(--neu-inset);
  box-shadow:
    inset 4px 4px 10px var(--neu-shadow-dark),
    inset -3px -3px 8px var(--neu-shadow-light);
}

.list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background var(--duration-fast) var(--ease);
}

.list-item:hover {
  background: var(--neu-raised);
  color: inherit;
  text-decoration: none;
  box-shadow:
    3px 3px 8px var(--neu-shadow-dark),
    -2px -2px 6px var(--neu-shadow-light);
}

.list-item + .list-item {
  margin-top: var(--space-1);
}

.list-item-title {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 12rem;
}

.list-item-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* —— Footer —— */
.site-footer {
  margin-top: auto;
  padding: var(--space-5) 0 var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

.site-footer-inner {
  width: min(100% - 2 * var(--space-4), var(--content-max));
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.footer-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-align: left;
  line-height: 1;
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.footer-social {
  display: inline-grid;
  place-items: center;
  color: var(--text-secondary);
  background: none;
  border: 0;
  box-shadow: none;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}

.footer-social:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.footer-social svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-disclaimer {
  font-size: var(--text-xs);
  color: var(--text-muted);
  max-width: 48rem;
  line-height: 1.5;
}

/* —— Empty / loading —— */
.empty-state,
.loading-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--neu-raised);
  box-shadow:
    5px 5px 12px var(--neu-shadow-dark),
    -4px -4px 10px var(--neu-shadow-light);
}

.loading-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 3px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* —— Modal —— */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: var(--overlay);
}

.modal {
  width: min(100%, 420px);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  background: var(--neu-base);
  box-shadow:
    10px 10px 28px var(--neu-shadow-dark),
    -6px -6px 18px var(--neu-shadow-light);
}

.modal h2 {
  margin-bottom: var(--space-3);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* —— Prototype banner —— */
.proto-banner {
  background: var(--accent-soft);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-align: center;
  padding: var(--space-2) var(--space-4);
}

.proto-banner a {
  font-weight: 600;
  text-decoration: none;
}

/* —— Filter bar —— */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

/* —— Breadcrumb —— */
.crumb {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.crumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.crumb a:hover {
  color: var(--text-primary);
}

/* —— Article content —— */
.prose {
  max-width: 65ch;
}

.prose h2 {
  margin-top: var(--space-8);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.prose li + li {
  margin-top: var(--space-2);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--neu-inset);
}

/* —— Tabs —— */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.tab {
  min-height: 40px;
  padding: 0.45rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
}

.tab[aria-selected="true"] {
  color: var(--text-primary);
  background: var(--neu-raised);
  box-shadow:
    3px 3px 8px var(--neu-shadow-dark),
    -2px -2px 6px var(--neu-shadow-light);
}

/* —— Pagination —— */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-8);
}

/* —— Toast —— */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 300;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--neu-raised);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow:
    6px 6px 16px var(--neu-shadow-dark),
    -4px -4px 12px var(--neu-shadow-light);
}

/* —— Utility —— */
.main-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.v2-iframe-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.v2-iframe-shell iframe {
  flex: 1;
  width: 100%;
  border: 0;
  min-height: 70vh;
  background: var(--neu-inset);
}
