@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #050508;
  --bg-secondary: #0d0d15;
  --accent-gold: #d4af37;
  --accent-gold-light: #f4e5c2;
  --accent-gold-glow: rgba(212, 175, 55, 0.25);
  --accent-wine: #7a1f3d;
  --accent-wine-light: #9e3153;
  --accent-wine-glow: rgba(122, 31, 61, 0.35);
  --glass-bg: rgba(13, 13, 21, 0.65);
  --glass-border: rgba(212, 175, 55, 0.15);
  --glass-border-focus: rgba(212, 175, 55, 0.4);
  --text-primary: #f4e5c2;
  --text-secondary: #c0bfa6;
  --text-muted: #848375;
  --text-dark: #0a0a0f;
  --font-serif: 'Cormorant Garamond', serif;
  --font-sans: 'Inter', sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.2s ease;
  --border-radius-lg: 16px;
  --border-radius-md: 8px;
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-wine);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* Particle Canvas */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #120e17 0%, #050508 100%);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

p {
  line-height: 1.6;
  font-weight: 300;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Global Layout / Nav */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 5, 8, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-smooth);
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-shadow: 0 0 10px var(--accent-gold-glow);
}

.logo-icon {
  width: 28px;
  height: 28px;
  fill: var(--accent-gold);
}

nav ul {
  display: flex;
  list-style: none;
  gap: 2.5rem;
}

nav a {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  padding: 0.4rem 0;
  transition: var(--transition-fast);
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-gold);
  transition: var(--transition-smooth);
  box-shadow: 0 0 8px var(--accent-gold);
}

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

nav a:hover::after,
nav a.active::after {
  width: 100%;
}

nav a.active {
  color: var(--accent-gold);
  font-weight: 500;
}

/* Mobile Menu Button */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 110;
}

.menu-toggle span {
  width: 25px;
  height: 2px;
  background-color: var(--accent-gold);
  transition: var(--transition-fast);
}

/* Main Container */
main {
  flex: 1;
  padding: 3rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 4rem;
  animation: fadeInDown 1s ease-out;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  font-family: var(--font-serif);
  font-style: italic;
}

/* Home Page Cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.5rem;
  margin-bottom: 4rem;
  animation: fadeInUp 1s ease-out 0.2s both;
}

.luxury-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  transition: var(--transition-smooth);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--card-shadow);
}

.luxury-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--accent-wine-glow) 0%, transparent 70%);
  opacity: 0;
  transition: var(--transition-smooth);
  z-index: 0;
}

.luxury-card:hover::before {
  opacity: 1;
}

.luxury-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent-gold);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 25px var(--accent-gold-glow);
}

.card-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
  color: var(--accent-gold);
  filter: drop-shadow(0 0 8px var(--accent-gold-glow));
}

.luxury-card h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.luxury-card p {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
  max-width: 280px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--accent-wine) 0%, #4c1126 100%);
  color: var(--text-primary);
  border: 1px solid var(--accent-gold);
  padding: 0.8rem 2rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn:hover {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #b38f24 100%);
  color: var(--text-dark);
  box-shadow: 0 8px 20px var(--accent-gold-glow);
  transform: scale(1.03);
}

.btn-secondary {
  background: transparent;
  border-color: var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

/* Converter Workspace Layout */
.workspace-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
  animation: fadeInUp 0.8s ease-out;
}

.panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
}

.panel:focus-within {
  border-color: var(--accent-gold-glow);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7), 0 0 15px var(--accent-wine-glow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  padding-bottom: 0.8rem;
}

.panel h3 {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.char-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
}

textarea {
  width: 100%;
  height: 250px;
  background: rgba(5, 5, 8, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  padding: 1.2rem;
  resize: none;
  outline: none;
  transition: var(--transition-fast);
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px var(--accent-gold-glow);
  background: rgba(5, 5, 8, 0.8);
}

textarea[readonly] {
  background: rgba(10, 10, 15, 0.3);
  color: var(--text-secondary);
  cursor: default;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.action-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--accent-gold);
  padding: 0.6rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.action-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.action-btn:hover {
  background: var(--accent-gold);
  color: var(--text-dark);
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px var(--accent-gold-glow);
}

/* Mode Control Switcher */
.control-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  animation: fadeIn 0.8s ease-out;
}

.toggle-container {
  display: inline-flex;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 4px;
  border-radius: 30px;
  box-shadow: var(--card-shadow);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.6rem 1.8rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  border-radius: 25px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.toggle-btn.active {
  background: linear-gradient(135deg, var(--accent-wine) 0%, #4c1126 100%);
  color: var(--text-primary);
  border: 1px solid var(--accent-gold);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.convert-btn-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.convert-btn {
  min-width: 200px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 0 20px var(--accent-wine-glow);
}

/* Accordion / Cipher Reference Key */
.accordion {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  margin-bottom: 3rem;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.accordion-header {
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.accordion-header h3 {
  font-size: 1.3rem;
  font-family: var(--font-serif);
}

.accordion-icon {
  width: 20px;
  height: 20px;
  transition: var(--transition-smooth);
  fill: var(--accent-gold);
}

.accordion.open .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(5, 5, 8, 0.3);
  border-top: 0 solid var(--glass-border);
}

.accordion.open .accordion-content {
  max-height: 1000px; /* high enough for keys */
  border-top: 1px solid var(--glass-border);
}

.key-grid-wrapper {
  padding: 2rem;
}

.key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 1rem;
}

.key-item {
  background: rgba(20, 20, 28, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.1);
  border-radius: var(--border-radius-md);
  padding: 0.8rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.key-item:hover {
  border-color: var(--accent-gold);
  background: rgba(20, 20, 28, 0.8);
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
}

.key-char {
  color: var(--accent-gold);
  font-family: var(--font-serif);
  font-weight: bold;
  font-size: 1.1rem;
}

.key-val {
  font-size: 1.3rem;
  display: inline-block;
}

/* Symbols specific sizing for key value font size */
.symbols-mode .key-val {
  font-size: 1rem;
  font-family: monospace;
  color: var(--text-primary);
}

/* About Page Styles */
.about-container {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  animation: fadeInUp 0.8s ease-out;
}

.about-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 3rem;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.about-section h2 {
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  padding-bottom: 0.8rem;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.about-section p {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.about-section ul {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  list-style-type: square;
}

.about-section li {
  font-size: 1.05rem;
  line-height: 1.5;
}

.about-section li strong {
  color: var(--accent-gold);
}

.disclaimer-box {
  background: rgba(122, 31, 61, 0.15);
  border: 1px solid var(--accent-wine);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  margin-top: 2rem;
  display: flex;
  gap: 15px;
  align-items: center;
}

.disclaimer-box svg {
  width: 36px;
  height: 36px;
  fill: var(--accent-wine-light);
  flex-shrink: 0;
}

.disclaimer-box p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* QR Code Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-secondary);
  border: 1px solid var(--accent-gold);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem;
  max-width: 400px;
  width: 90%;
  position: relative;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0,0,0,0.8), 0 0 30px var(--accent-gold-glow);
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-container {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--accent-gold);
}

.modal-close svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.modal-container h3 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}

#qrcode-container {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  display: inline-block;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

#qrcode-container img {
  display: block;
  margin: 0 auto;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* Custom Success Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-gold);
  border-radius: var(--border-radius-md);
  padding: 1rem 1.8rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 15px var(--accent-gold-glow);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast svg {
  width: 20px;
  height: 20px;
  fill: var(--accent-gold);
}

/* Footer Section */
footer {
  border-top: 1px solid var(--glass-border);
  padding: 2rem;
  text-align: center;
  background: rgba(5, 5, 8, 0.8);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
  letter-spacing: 0.5px;
}

footer p {
  margin-bottom: 0.5rem;
}

footer a {
  color: var(--accent-gold);
  transition: var(--transition-fast);
}

footer a:hover {
  text-shadow: 0 0 5px var(--accent-gold-glow);
}

/* Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive Rules */
@media (max-width: 900px) {
  .workspace-container {
    grid-template-columns: 1fr;
  }
  
  .hero h1 {
    font-size: 2.8rem;
  }
  
  nav ul {
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  header {
    padding: 1rem 1.5rem;
  }
  
  .menu-toggle {
    display: flex;
  }
  
  nav {
    position: fixed;
    top: 60px; /* header height approx */
    left: 0;
    width: 100%;
    height: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    overflow: hidden;
    transition: var(--transition-smooth);
  }
  
  nav.open {
    height: auto;
    padding: 2rem 0;
  }
  
  nav ul {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }
  
  .hero h1 {
    font-size: 2.3rem;
  }
  
  .about-section {
    padding: 2rem;
  }
}
