/* ============================================
   CSS Variables with Fallbacks for Older Browsers
   ============================================ */
:root {
  --accent-gold: #fbbf24;
  --accent-orange: #f97316;
  --accent-sky: #22d3ee;
  --accent-pink: #fb7185;
  --text-main: #e5e7eb;
  --text-muted: #b8c5d1;
  --border-soft: rgba(148, 163, 184, 0.45);
  --focus-outline: 2px solid #22d3ee;
  --focus-outline-offset: 2px;
}

/* ============================================
   Reset & Base Styles (Mobile First)
   ============================================ */
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  background: #000;
  background: radial-gradient(circle at top, #1e293b 0, #020617 50%, #000000 100%);
  background-attachment: fixed;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available; /* iOS Safari fix */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: transparent;
  color: var(--text-main);
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  padding: 2rem 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Skip Link (Accessibility)
   ============================================ */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  min-height: 24px;
  text-decoration: none;
  z-index: 1000;
  border: 2px solid var(--accent-sky);
}

.skip-link:focus {
  top: 0;
  z-index: 1000;
  outline: 2px solid #22d3ee;
  outline-offset: 2px;
}

/* ============================================
   Shell Container (Mobile First)
   ============================================ */
.shell {
  width: 100%;
  max-width: 880px;
  background: rgba(15, 23, 42, 0.98);
  background: linear-gradient(135deg, rgba(15,23,42,0.98), rgba(2,6,23,0.98));
  -webkit-border-radius: 1.75rem;
  -moz-border-radius: 1.75rem;
  border-radius: 1.75rem;
  border: 1px solid var(--border-soft);
  -webkit-box-shadow: 0 28px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(34, 211, 238, 0.2);
  -moz-box-shadow: 0 28px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(34, 211, 238, 0.2);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(34, 211, 238, 0.2);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  margin-top: auto;
  margin-bottom: auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.glow {
  position: absolute;
  top: -40%;
  right: -40%;
  bottom: -40%;
  left: -40%;
  background: 
    radial-gradient(circle at 10% 0%, rgba(248, 250, 252, 0.15), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(34, 211, 238, 0.2), transparent 55%),
    radial-gradient(circle at 90% 80%, rgba(249, 115, 22, 0.35), transparent 60%);
  opacity: 0.75;
  pointer-events: none;
}

/* Modern browsers support inset */
@supports (inset: 0) {
  .glow {
    inset: -40%;
  }
}

/* ============================================
   Content Layout (Mobile First)
   ============================================ */
.content {
  position: relative;
  z-index: 1;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 1.5rem 1.25rem;
  -webkit-box-align: start;
  -webkit-align-items: start;
  -ms-flex-align: start;
  align-items: start;
}

section {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

/* Ensure focused elements are not obscured - WCAG 2.2 2.4.11 */
.content *:focus-visible {
  position: relative;
}

/* ============================================
   Tag Component
   ============================================ */
.tag {
  display: -webkit-inline-box;
  display: -webkit-inline-flex;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  -webkit-border-radius: 999px;
  -moz-border-radius: 999px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background-color: rgba(15, 23, 42, 0.9);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tag-dot {
  width: 8px;
  height: 8px;
  -webkit-border-radius: 999px;
  -moz-border-radius: 999px;
  border-radius: 999px;
  background: #22c55e;
  background: radial-gradient(circle, #22c55e 0, #15803d 45%, #052e16 100%);
  -webkit-box-shadow: 0 0 10px rgba(34, 197, 94, 0.9);
  -moz-box-shadow: 0 0 10px rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.9);
}

/* ============================================
   Typography
   ============================================ */
h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

h1 span {
  background: -webkit-linear-gradient(left, var(--accent-gold), var(--accent-orange), var(--accent-pink));
  background: linear-gradient(to right, var(--accent-gold), var(--accent-orange), var(--accent-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 0 rgba(251, 191, 36, 0.3);
}

/* Fallback for browsers that don't support background-clip: text */
@supports not (background-clip: text) {
  h1 span {
    color: var(--accent-gold);
    background: none;
  }
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 100%;
  margin-bottom: 1.25rem;
}

/* ============================================
   Links & Buttons (Mobile First)
   ============================================ */
/* Style only the Feedback section links to match theme */
section ul a,
main ul a {
  color: var(--accent-sky);
  text-decoration: none;
  -webkit-transition: color 0.2s ease, text-decoration 0.2s ease;
  -moz-transition: color 0.2s ease, text-decoration 0.2s ease;
  -o-transition: color 0.2s ease, text-decoration 0.2s ease;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

section ul a:hover,
main ul a:hover,
section ul a:focus,
main ul a:focus {
  color: var(--accent-gold);
  text-decoration: underline;
  text-decoration-color: var(--accent-gold);
}

section ul a:focus-visible,
main ul a:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
  border-radius: 2px;
}

.links {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.6rem;
}

.btn {
  display: -webkit-inline-box;
  display: -webkit-inline-flex;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  min-height: 24px;
  min-width: 24px;
  -webkit-border-radius: 999px;
  -moz-border-radius: 999px;
  border-radius: 999px;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  -webkit-transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  -moz-transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  -o-transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  position: relative;
  z-index: 10;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.btn:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
  z-index: 100;
}

.btn-primary {
  background: #fbbf24;
  background: -webkit-linear-gradient(135deg, var(--accent-gold), var(--accent-orange));
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-orange));
  color: #0b1120;
  font-weight: 600;
  -webkit-box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85), 0 0 30px rgba(249, 115, 22, 0.7);
  -moz-box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85), 0 0 30px rgba(249, 115, 22, 0.7);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85), 0 0 30px rgba(249, 115, 22, 0.7);
}

.btn-primary:hover {
  -webkit-transform: translateY(-1px);
  -moz-transform: translateY(-1px);
  -ms-transform: translateY(-1px);
  -o-transform: translateY(-1px);
  transform: translateY(-1px);
  -webkit-box-shadow: 0 18px 45px rgba(0, 0, 0, 0.9), 0 0 40px rgba(249, 115, 22, 0.8);
  -moz-box-shadow: 0 18px 45px rgba(0, 0, 0, 0.9), 0 0 40px rgba(249, 115, 22, 0.8);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.9), 0 0 40px rgba(249, 115, 22, 0.8);
}

.btn-primary:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
  z-index: 100;
  -webkit-box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85), 0 0 30px rgba(249, 115, 22, 0.7), 0 0 0 var(--focus-outline-offset) rgba(34, 211, 238, 0.5);
  -moz-box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85), 0 0 30px rgba(249, 115, 22, 0.7), 0 0 0 var(--focus-outline-offset) rgba(34, 211, 238, 0.5);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85), 0 0 30px rgba(249, 115, 22, 0.7), 0 0 0 var(--focus-outline-offset) rgba(34, 211, 238, 0.5);
}

.btn-x {
  background-color: #000000;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  font-weight: 500;
}

.btn-x:hover {
  background-color: #16181c;
  -webkit-transform: translateY(-1px);
  -moz-transform: translateY(-1px);
  -ms-transform: translateY(-1px);
  -o-transform: translateY(-1px);
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
  -webkit-box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5);
  -moz-box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5);
}

.btn-x:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
  z-index: 100;
  border-color: rgba(34, 211, 238, 0.8);
  -webkit-box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5), 0 0 0 var(--focus-outline-offset) rgba(34, 211, 238, 0.5);
  -moz-box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5), 0 0 0 var(--focus-outline-offset) rgba(34, 211, 238, 0.5);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5), 0 0 0 var(--focus-outline-offset) rgba(34, 211, 238, 0.5);
}

/* ============================================
   Legal Pages Content Styling
   ============================================ */
.legal-content {
  max-width: 800px;
  line-height: 1.8;
}

.legal-content h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.legal-content ul {
  margin-left: 2rem;
  margin-top: 0.5rem;
}

.legal-content .back-link-container {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-soft);
}

/* ============================================
   Footer
   ============================================ */
.footer-text {
  font-size: 0.8rem;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  -ms-flex-direction: row;
  flex-direction: row;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border: none;
  border-top: none;
  border-bottom: none;
}

.footer-text span.accent {
  color: #4dd0e1;
}

.footer-links {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  -webkit-transition: color 0.2s ease;
  -moz-transition: color 0.2s ease;
  -o-transition: color 0.2s ease;
  transition: color 0.2s ease;
}

.footer-links a:hover,
.footer-links a:focus {
  color: var(--accent-sky);
  text-decoration: underline;
}

.footer-links a:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
  border-radius: 2px;
}

/* ============================================
   Avatar Section (Mobile First)
   ============================================ */
.avatar-wrap {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  position: relative;
  -webkit-box-ordinal-group: 0;
  -webkit-order: -1;
  -ms-flex-order: -1;
  order: -1;
  margin-bottom: 1rem;
}

.avatar-orbit {
  position: absolute;
  top: 8%;
  right: 8%;
  bottom: 8%;
  left: 8%;
  -webkit-border-radius: 999px;
  -moz-border-radius: 999px;
  border-radius: 999px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  border-top-color: rgba(56, 189, 248, 0.9);
  border-right-color: rgba(249, 115, 22, 0.9);
  -webkit-transform: rotate(-8deg);
  -moz-transform: rotate(-8deg);
  -ms-transform: rotate(-8deg);
  -o-transform: rotate(-8deg);
  transform: rotate(-8deg);
  opacity: 0.8;
}

@supports (inset: 0) {
  .avatar-orbit {
    inset: 8%;
  }
}

.avatar-blob {
  position: absolute;
  width: 70%;
  height: 70%;
  -webkit-border-radius: 999px;
  -moz-border-radius: 999px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.35);
  background: 
    radial-gradient(circle at 20% 0%, rgba(251, 191, 36, 0.35), transparent 60%),
    radial-gradient(circle at 80% 90%, rgba(56, 189, 248, 0.3), transparent 65%);
  -webkit-filter: blur(2px);
  filter: blur(2px);
  opacity: 0.9;
}

.avatar {
  position: relative;
  width: 100%;
  max-width: 200px;
  padding-bottom: 100%; /* Aspect ratio fallback for older browsers */
  -webkit-border-radius: 999px;
  -moz-border-radius: 999px;
  border-radius: 999px;
  overflow: hidden;
  border: 3px solid rgba(248, 250, 252, 0.9);
  -webkit-box-shadow: 0 18px 45px rgba(0, 0, 0, 0.9), 0 0 40px rgba(249, 115, 22, 0.8), 0 0 60px rgba(56, 189, 248, 0.7);
  -moz-box-shadow: 0 18px 45px rgba(0, 0, 0, 0.9), 0 0 40px rgba(249, 115, 22, 0.8), 0 0 60px rgba(56, 189, 248, 0.7);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.9), 0 0 40px rgba(249, 115, 22, 0.8), 0 0 60px rgba(56, 189, 248, 0.7);
  background: #0f172a;
  background: radial-gradient(circle at 50% 0%, #f97316, #0f172a);
}

@supports (aspect-ratio: 1 / 1) {
  .avatar {
    padding-bottom: 0;
    aspect-ratio: 1 / 1;
  }
}

.avatar img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
  object-fit: cover;
  display: block;
}

/* Fallback for browsers that don't support object-fit */
@supports not (object-fit: cover) {
  .avatar img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -o-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
  }
}

/* ============================================
   Tablet Styles (481px and up)
   ============================================ */
@media screen and (min-width: 481px) {
  body {
    padding: 2rem 1.5rem;
  }

  .content {
    padding: 1.75rem 1.5rem;
    gap: 1.75rem;
  }

  .subtitle {
    font-size: 0.98rem;
  }

  .links {
    gap: 0.9rem;
  }

  .btn {
    padding: 0.75rem 1.4rem;
  }

  .avatar {
    max-width: 220px;
  }
}

/* ============================================
   Desktop Styles (781px and up)
   ============================================ */
@media screen and (min-width: 781px) {
  body {
    padding: 3rem 1.5rem;
  }

  .content {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr);
    gap: 2.2rem;
    padding: 2.3rem 2.4rem 2.4rem;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
  }

  /* When main is the only child, make it span full width */
  .content > main:only-child {
    grid-column: 1 / -1;
  }

  .avatar-wrap {
    -webkit-box-ordinal-group: 1;
    -webkit-order: 0;
    -ms-flex-order: 0;
    order: 0;
    margin-bottom: 0;
  }

  .avatar {
    max-width: 260px;
  }

  .subtitle {
    max-width: 34rem;
    margin-bottom: 1.6rem;
  }

  .tag {
    margin-bottom: 1.2rem;
  }

  h1 {
    margin-bottom: 0.9rem;
  }

  .links {
    gap: 0.9rem;
    margin-bottom: 1.6rem;
  }
}

/* ============================================
   Large Desktop Styles (1024px and up)
   ============================================ */
@media screen and (min-width: 1024px) {
  .shell {
    -webkit-box-shadow: 0 28px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(34, 211, 238, 0.2);
    -moz-box-shadow: 0 28px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(34, 211, 238, 0.2);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(34, 211, 238, 0.2);
  }
}

/* ============================================
   High DPI / Retina Display Optimizations
   ============================================ */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
  .avatar img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ============================================
   Reduced Motion (Accessibility)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    -webkit-animation-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    -webkit-animation-iteration-count: 1 !important;
    animation-iteration-count: 1 !important;
    -webkit-transition-duration: 0.01ms !important;
    -moz-transition-duration: 0.01ms !important;
    -o-transition-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  .glow,
  .avatar-blob,
  .avatar-orbit {
    display: none;
  }

  .shell {
    box-shadow: none;
    border: 1px solid #000;
  }

  .btn {
    border: 1px solid #000;
    color: #000;
  }
}
