@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Serif+SC:wght@400;500;600;700&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 220 14% 96%;
    --foreground: 220 14% 15%;
    --card: 0 0% 100%;
    --card-foreground: 220 14% 15%;
    --popover: 0 0% 100%;
    --popover-foreground: 220 14% 15%;
    --primary: 36 100% 50%;
    --primary-foreground: 0 0% 100%;
    --secondary: 45 100% 50%;
    --secondary-foreground: 220 14% 15%;
    --muted: 220 14% 90%;
    --muted-foreground: 220 9% 46%;
    --accent: 36 100% 50%;
    --accent-foreground: 0 0% 100%;
    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 98%;
    --border: 220 13% 85%;
    --input: 220 13% 85%;
    --ring: 36 100% 50%;
    --radius: 0.75rem;
    
    /* Custom Colors */
    --orange-primary: #FF9900;
    --orange-light: #FFD700;
    --orange-dark: #FF7A00;
    --gray-bg: #F3F4F6;
    --gray-text: #6B7280;
    --dark-text: #1F2937;
    --green-accent: #10B981;
    --blue-accent: #3B82F6;
    --red-accent: #EF4444;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  html {
    scroll-behavior: smooth;
    overscroll-behavior-y: none;
  }
  body {
    @apply bg-[#F3F4F6] text-foreground antialiased;
    font-family: 'Inter', sans-serif;
    overscroll-behavior-y: none;
  }
  h1, h2, h3, h4, h5, h6 {
    font-family: 'Noto Serif SC', serif;
  }
}

@layer utilities {
  /* Custom Animations */
  @keyframes pulse-glow {
    0%, 100% {
      box-shadow: 0 0 0 0 rgba(255, 153, 0, 0.4);
    }
    50% {
      box-shadow: 0 0 20px 5px rgba(255, 153, 0, 0.2);
    }
  }

  @keyframes float {
    0%, 100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-10px);
    }
  }

  @keyframes slide-up {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes fade-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  @keyframes scale-in {
    from {
      opacity: 0;
      transform: scale(0.9);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  @keyframes heart-beat {
    0%, 100% {
      transform: scale(1);
    }
    25% {
      transform: scale(1.2);
    }
    50% {
      transform: scale(1);
    }
    75% {
      transform: scale(1.15);
    }
  }

  @keyframes shimmer {
    0% {
      background-position: -200% 0;
    }
    100% {
      background-position: 200% 0;
    }
  }

  @keyframes paper-scan {
    0% {
      transform: translateX(-28%) skewX(-10deg);
      opacity: 0;
    }
    14% {
      opacity: 0.48;
    }
    52% {
      opacity: 0.26;
    }
    100% {
      transform: translateX(92%) skewX(-10deg);
      opacity: 0;
    }
  }

  @keyframes paper-rail {
    0% {
      transform: translateX(-22%) rotate(-9deg);
    }
    100% {
      transform: translateX(22%) rotate(-9deg);
    }
  }

  @keyframes paper-ring {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }

  @keyframes paper-float-in {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes typing-dot {
    0%, 100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-5px);
    }
  }

  .animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
  }

  .animate-float {
    animation: float 3s ease-in-out infinite;
  }

  .animate-slide-up {
    animation: slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .animate-fade-in {
    animation: fade-in 0.5s ease-out forwards;
  }

  .animate-scale-in {
    animation: scale-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .animate-heart-beat {
    animation: heart-beat 0.4s ease-in-out;
  }

  .animate-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
  }

  .paper-observatory {
    isolation: isolate;
    background:
      linear-gradient(112deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 252, 255, 0.88) 44%, rgba(255, 248, 232, 0.84) 100%),
      linear-gradient(135deg, rgba(255, 153, 0, 0.18), rgba(8, 145, 178, 0.16), rgba(34, 197, 94, 0.11));
  }

  .paper-grid-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
      linear-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
      linear-gradient(115deg, transparent 0 46%, rgba(255, 153, 0, 0.13) 46% 47%, transparent 47% 100%),
      linear-gradient(65deg, transparent 0 58%, rgba(8, 145, 178, 0.13) 58% 59%, transparent 59% 100%);
    background-size: 44px 44px, 44px 44px, 260px 260px, 320px 320px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.5));
  }

  .paper-scan-layer {
    position: absolute;
    inset: -20% -35%;
    z-index: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.68) 48%, rgba(8, 145, 178, 0.15) 50%, transparent 62%);
    animation: paper-scan 8s cubic-bezier(0.16, 1, 0.3, 1) infinite;
    pointer-events: none;
  }

  .paper-light-rail {
    position: absolute;
    left: -12%;
    right: -12%;
    z-index: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 153, 0, 0.28), rgba(8, 145, 178, 0.32), transparent);
    transform: rotate(-9deg);
    animation: paper-rail 7s ease-in-out infinite alternate;
  }

  .paper-light-rail-a {
    top: 24%;
  }

  .paper-light-rail-b {
    bottom: 22%;
    animation-duration: 9s;
    animation-direction: alternate-reverse;
  }

  .paper-search-shell {
    position: relative;
    z-index: 20;
    max-width: 58rem;
    border-radius: 2rem;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 153, 0, 0.34), rgba(255, 255, 255, 0.82), rgba(8, 145, 178, 0.34));
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.12);
  }

  .paper-search-shell > div:first-child {
    border-radius: calc(2rem - 1px);
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .search-match-highlight {
    border-radius: 0.28em;
    background: #b6f4a6;
    box-shadow: inset 0 -0.08em rgba(46, 125, 50, 0.32);
    color: inherit;
    padding: 0 0.08em;
  }

  .paper-signal-tile {
    min-height: 6.25rem;
    border-radius: 1.4rem;
    border: 1px solid rgba(255, 255, 255, 0.74);
    background: rgba(255, 255, 255, 0.7);
    padding: 1rem;
    box-shadow: 0 18px 54px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: paper-float-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .paper-orbit-panel {
    position: relative;
    min-height: 23rem;
  }

  .paper-orbit-core {
    position: relative;
    height: 100%;
    min-height: 23rem;
  }

  .paper-orbit-ring {
    position: absolute;
    inset: 1.2rem;
    border-radius: 2.25rem;
    border: 1px solid rgba(8, 145, 178, 0.22);
    pointer-events: none;
  }

  .paper-orbit-ring::before,
  .paper-orbit-ring::after {
    content: '';
    position: absolute;
    width: 0.56rem;
    height: 0.56rem;
    border-radius: 999px;
    background: #ff9900;
    box-shadow: 0 0 18px rgba(255, 153, 0, 0.52);
  }

  .paper-orbit-ring::before {
    left: 18%;
    top: -0.28rem;
  }

  .paper-orbit-ring::after {
    bottom: -0.28rem;
    right: 22%;
    background: #0891b2;
    box-shadow: 0 0 18px rgba(8, 145, 178, 0.46);
  }

  .paper-orbit-ring-a {
    animation: paper-ring 22s linear infinite;
  }

  .paper-orbit-ring-b {
    inset: 3.1rem 0.3rem;
    border-color: rgba(255, 153, 0, 0.2);
    transform: rotate(7deg);
    animation: paper-ring 28s linear infinite reverse;
  }

  .paper-orbit-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.75rem;
    border-radius: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.92);
    background: rgba(248, 250, 252, 0.78);
    padding: 0.78rem 0.9rem;
    text-align: left;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
    animation: paper-float-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .paper-orbit-row:hover {
    transform: translateX(4px);
    border-color: rgba(255, 153, 0, 0.34);
    background: rgba(255, 255, 255, 0.92);
  }

  .paper-command-strip {
    display: flex;
    min-height: 6.5rem;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    overflow: hidden;
    border-radius: 1.75rem;
    border: 1px solid rgba(255, 255, 255, 0.76);
    background:
      linear-gradient(120deg, rgba(255, 255, 255, 0.84), rgba(248, 250, 252, 0.74)),
      linear-gradient(90deg, rgba(255, 153, 0, 0.1), rgba(8, 145, 178, 0.1));
    padding: 1.15rem;
    text-align: left;
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.09);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  }

  .paper-command-strip:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 153, 0, 0.34);
    box-shadow: 0 26px 72px rgba(15, 23, 42, 0.13);
  }

  .paper-conference-card {
    position: relative;
    overflow: hidden;
    min-height: 15.5rem;
    border-radius: 1.75rem;
    border: 1px solid rgba(255, 255, 255, 0.82);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.84)),
      linear-gradient(135deg, rgba(255, 153, 0, 0.08), rgba(8, 145, 178, 0.08));
    padding: 1.5rem;
    text-align: left;
    box-shadow: 0 18px 62px rgba(15, 23, 42, 0.08);
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
    animation: paper-float-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .paper-conference-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 153, 0, 0.35);
    box-shadow: 0 30px 82px rgba(15, 23, 42, 0.13);
  }

  @media (prefers-reduced-motion: reduce) {
    .paper-scan-layer,
    .paper-light-rail,
    .paper-orbit-ring-a,
    .paper-orbit-ring-b,
    .paper-signal-tile,
    .paper-orbit-row,
    .paper-conference-card {
      animation: none;
    }
  }

  .typing-dot-1 {
    animation: typing-dot 0.6s ease-in-out infinite;
  }
  .typing-dot-2 {
    animation: typing-dot 0.6s ease-in-out infinite 0.2s;
  }
  .typing-dot-3 {
    animation: typing-dot 0.6s ease-in-out infinite 0.4s;
  }

  /* Glass Effect */
  .glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  /* Custom Scrollbar */
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background: #F3F4F6;
  }

  ::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
  }

  /* Card Hover Effect */
  .card-hover {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  }

  /* Magnetic Button Effect */
  .magnetic-btn {
    transition: transform 0.2s ease-out;
  }

  /* Gradient Border */
  .gradient-border {
    position: relative;
    background: white;
    border-radius: 0.75rem;
  }
  .gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 0.875rem;
    background: linear-gradient(135deg, #FF9900, #FFD700, #FF7A00);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .gradient-border:hover::before {
    opacity: 1;
  }

  /* Underline Animation */
  .underline-animate {
    position: relative;
  }
  .underline-animate::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--orange-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
  }
  .underline-animate:hover::after {
    width: 100%;
  }

  .markdown-body {
    color: inherit;
  }

  .markdown-body h1,
  .markdown-body h2,
  .markdown-body h3,
  .markdown-body h4 {
    margin: 1.25rem 0 0.75rem;
    color: #172033;
  }

  .markdown-body p,
  .markdown-body ul,
  .markdown-body ol,
  .markdown-body blockquote,
  .markdown-body table,
  .markdown-body pre {
    margin: 0.85rem 0;
  }

  .markdown-body ul,
  .markdown-body ol {
    padding-left: 1.5rem;
  }

  .markdown-body li + li {
    margin-top: 0.35rem;
  }

  .changelog-markdown ul {
    list-style-type: disc;
  }

  .changelog-markdown ol {
    list-style-type: decimal;
  }

  .changelog-markdown li::marker {
    color: #ff9900;
  }

  .markdown-body code {
    border-radius: 0.5rem;
    background: #f1f5f9;
    padding: 0.12rem 0.35rem;
    font-size: 0.9em;
  }

  .markdown-body pre {
    overflow-x: auto;
    border-radius: 1rem;
    background: #0f172a;
    padding: 1rem;
    color: #e2e8f0;
  }

  .markdown-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
  }

  .markdown-body blockquote {
    border-left: 4px solid #ffcc80;
    padding-left: 1rem;
    color: #64748b;
  }

  .markdown-body a {
    color: #2563eb;
    text-decoration: underline;
  }

  .markdown-body table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 1rem;
    border: 1px solid #dbe3ee;
  }

  .markdown-body th,
  .markdown-body td {
    border: 1px solid #dbe3ee;
    padding: 0.75rem 0.9rem;
    text-align: left;
    vertical-align: top;
  }

  .markdown-body th {
    background: #f8fafc;
    font-weight: 600;
  }

  .markdown-body hr {
    margin: 1.25rem 0;
    border: 0;
    border-top: 1px solid #e2e8f0;
  }

  .markdown-body .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0;
  }

  .analysis-markdown h1,
  .analysis-markdown h2,
  .analysis-markdown h3,
  .analysis-markdown h4 {
    margin: 1rem 0 0.55rem;
  }

  .analysis-markdown p,
  .analysis-markdown ul,
  .analysis-markdown ol,
  .analysis-markdown blockquote,
  .analysis-markdown table,
  .analysis-markdown pre {
    margin: 0.6rem 0;
  }

  .analysis-markdown li + li {
    margin-top: 0.2rem;
  }

  .analysis-markdown hr {
    margin: 1rem 0;
  }

  .analysis-markdown .katex-display {
    padding: 0.35rem 0;
  }

  .markdown-body .rich-content-tail {
    margin: 0.85rem 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    border-radius: 1rem;
    background: #f8fafc;
    padding: 0.9rem 1rem;
    font: inherit;
    color: inherit;
  }

  .paper-title-math {
    color: inherit;
  }

  .paper-title-math .katex {
    font-size: 1em;
  }

  .paper-title-math .katex-display {
    display: inline-block;
    margin: 0;
    max-width: 100%;
    vertical-align: baseline;
  }
}
