/**
 * FoodHub247 — /links "link in bio" page.
 * Motion-heavy 3D-ish landing page: floating parallax product panels,
 * glowing avatar, tilting glassmorphic link cards. Self-contained palette
 * mirrors the main site's CSS variables (theme.css) for brand consistency.
 */

:root {
  --lp-primary: #2D4422;
  --lp-primary-dark: #1e3016;
  --lp-primary-light: #3d5a2e;
  --lp-accent: #A54A2E;
  --lp-accent-light: #c96a45;
  --lp-white: #ffffff;
  --lp-radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--lp-primary-dark);
  overflow-x: hidden;
}

body.links-page {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--lp-white);
  position: relative;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* ---------- Motion background ---------- */
.links-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(160deg, var(--lp-primary-dark) 0%, var(--lp-primary) 55%, var(--lp-accent) 140%);
}

.links-bg__panel {
  position: absolute;
  width: 46vw;
  max-width: 460px;
  min-width: 220px;
  aspect-ratio: 3 / 4;
  background-size: cover;
  background-position: center;
  border-radius: 24px;
  opacity: 0.5;
  filter: saturate(1.1) brightness(0.85);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  will-change: transform;
  animation: links-drift 16s ease-in-out infinite;
}

.links-bg__panel--1 { top: -6%; left: -10%; transform: rotate(-14deg); animation-delay: 0s; }
.links-bg__panel--2 { top: 8%; right: -14%; transform: rotate(11deg); animation-duration: 19s; animation-delay: -3s; }
.links-bg__panel--3 { bottom: -12%; left: -8%; transform: rotate(9deg); animation-duration: 21s; animation-delay: -7s; }
.links-bg__panel--4 { bottom: -8%; right: -10%; transform: rotate(-10deg); animation-duration: 18s; animation-delay: -11s; }

@keyframes links-drift {
  0%, 100% { transform: translate(0, 0) rotate(var(--rot, 0deg)); }
  50% { transform: translate(14px, -18px) rotate(var(--rot, 0deg)); }
}

.links-bg__scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(30, 48, 22, 0.35) 0%, rgba(20, 28, 16, 0.75) 55%, rgba(10, 16, 8, 0.92) 100%);
  backdrop-filter: blur(2px);
}

.links-bg__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.55;
  will-change: transform;
}
.links-bg__orb--1 { width: 260px; height: 260px; background: var(--lp-accent); top: 8%; left: 12%; }
.links-bg__orb--2 { width: 220px; height: 220px; background: var(--lp-primary-light); bottom: 12%; right: 10%; }
.links-bg__orb--3 { width: 180px; height: 180px; background: var(--lp-accent-light); top: 45%; right: 30%; }

/* ---------- Content shell ----------
   Mobile-first: compact enough that avatar + title + card row + footer
   all fit in one device height with no scroll. Desktop gets the roomier,
   fully 3D-tilting vertical list. */
.links-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  padding: 20px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.links-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--lp-white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 30px 6px rgba(165, 74, 46, 0.45), 0 12px 24px rgba(0, 0, 0, 0.4);
  animation: links-avatar-pulse 3.2s ease-in-out infinite;
}
.links-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes links-avatar-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15), 0 0 30px 6px rgba(165, 74, 46, 0.45), 0 12px 24px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.22), 0 0 44px 12px rgba(165, 74, 46, 0.65), 0 12px 24px rgba(0, 0, 0, 0.4); }
}

.links-title {
  margin: 10px 0 2px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.links-tagline {
  margin: 0 0 16px;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.78);
}

/* ---------- Link cards — vertical column, full 3D tilt driven by device gyroscope on touch ---------- */
.links-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  perspective: 900px;
}

.link-card {
  position: relative;
  flex: 0 0 auto;
  width: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--lp-radius);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-decoration: none;
  color: var(--lp-white);
  transform-style: preserve-3d;
  will-change: transform;
  opacity: 0;
  animation: link-card-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--delay, 0ms);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease-out;
}

.link-card:hover,
.link-card:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.link-card:active {
  transform: scale(0.97) !important;
  transition: transform 0.1s ease-out;
}

/* Hero card (Website) — periodic light sweep to draw the eye first */
.link-card--hero {
  overflow: hidden;
}
.link-card--hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.22) 48%, transparent 66%);
  background-size: 220% 100%;
  background-position: 140% 0;
  animation: link-card-shimmer 4.5s ease-in-out infinite;
  animation-delay: 1.4s;
  pointer-events: none;
}
@keyframes link-card-shimmer {
  0%, 45% { background-position: 140% 0; }
  70%, 100% { background-position: -40% 0; }
}

@keyframes link-card-in {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.link-card__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: var(--lp-white);
}
.link-card--primary .link-card__icon { background: linear-gradient(135deg, var(--lp-primary-light), var(--lp-primary)); }
.link-card--accent .link-card__icon { background: linear-gradient(135deg, var(--lp-accent-light), var(--lp-accent)); }

.link-card__body {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.link-card__label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
}

.link-card__desc {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.68);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card__arrow {
  display: inline-flex;
  flex-shrink: 0;
  opacity: 0.55;
  font-size: 0.8rem;
}

.links-share {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: var(--lp-white);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease-out;
}
.links-share:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.42); }
.links-share:active { transform: scale(0.96); }

.links-share__toast {
  margin: 8px 0 0;
  font-size: 0.72rem;
  color: var(--lp-accent-light);
  font-weight: 600;
  min-height: 1em;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.links-share__toast.is-visible { opacity: 1; }

.links-footer {
  margin-top: 12px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.55);
}
.links-footer a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: underline;
}

/* Reduced motion: respect user preference */
@media (prefers-reduced-motion: reduce) {
  .links-bg__panel, .links-avatar, .link-card, .link-card--hero::after { animation: none !important; }
  .link-card { opacity: 1; transform: none !important; }
}

/* Small phones: shrink background panels further so they don't dominate */
@media (max-width: 600px) {
  .links-bg__panel { width: 60vw; opacity: 0.35; }
  .links-bg__orb { filter: blur(36px); }
}

/* Desktop — two-row grid (cards flow down each column, 2 per column), full 3D pointer-tilt (see links-page.js), bigger header */
@media (min-width: 768px) {
  .links-shell { max-width: 900px; height: auto; min-height: 100dvh; padding: 72px 20px 40px; }

  .links-avatar { width: 108px; height: 108px; border-radius: 28px; padding: 14px; }

  .links-title { font-size: 2rem; margin: 22px 0 4px; }
  .links-tagline { font-size: 0.92rem; margin-bottom: 32px; }

  .links-list {
    display: grid;
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 10px;
    gap: 14px;
    justify-content: center;
  }

  .link-card { padding: 16px 18px; }
  .link-card__icon { width: 44px; height: 44px; font-size: 1.15rem; }
  .link-card__label { font-size: 0.95rem; }
  .link-card__desc { font-size: 0.78rem; }
  .link-card__arrow { font-size: 0.85rem; transition: transform 0.25s ease, opacity 0.25s ease; }
  .link-card:hover .link-card__arrow { transform: translateX(4px); opacity: 1; }

  .links-footer { margin-top: 36px; font-size: 0.75rem; }
}

@media (min-width: 1100px) {
  .links-shell { max-width: 1040px; }
}
