/* ═══════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES & THEME SYSTEM
   ═══════════════════════════════════════════════════════ */
:root {
  --font-display: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --font-body: 'Outfit', system-ui, -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.18);
}

[data-theme="dark"] {
  --bg-primary: #0c0b10;
  --bg-secondary: #16141e;
  --bg-tertiary: #1e1b2a;
  --bg-elevated: #242136;
  --border-color: #2e2a42;
  --border-subtle: #1e1b2a;
  --text-primary: #ece8f4;
  --text-secondary: #9b93b0;
  --text-muted: #8c85a5;
  --accent: #d4a053;
  --accent-hover: #e2b46a;
  --accent-subtle: rgba(212, 160, 83, 0.1);
  --accent-border: rgba(212, 160, 83, 0.25);
  --success: #5cb87a;
  --success-bg: rgba(92, 184, 122, 0.1);
  --error: #e06060;
  --error-bg: rgba(224, 96, 96, 0.1);
  --warning: #e0a840;
  --warning-bg: rgba(224, 168, 64, 0.1);
  --drop-zone-bg: #12101a;
  --drop-zone-border: #2e2a42;
  --drop-zone-active: rgba(212, 160, 83, 0.08);
  --tag-bg: #1e1b2a;
  --glyph-bg: #1a1826;
  --glyph-border: #2a2640;
  --scrollbar-track: #16141e;
  --scrollbar-thumb: #2e2a42;
}

[data-theme="light"] {
  --bg-primary: #f8f5ef;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0ece4;
  --bg-elevated: #ffffff;
  --border-color: #ddd6c8;
  --border-subtle: #ebe6dc;
  --text-primary: #1a1410;
  --text-secondary: #6b5e50;
  --text-muted: #9a8e7e;
  --accent: #b07828;
  --accent-hover: #9a6820;
  --accent-subtle: rgba(176, 120, 40, 0.08);
  --accent-border: rgba(176, 120, 40, 0.25);
  --success: #3a8a54;
  --success-bg: rgba(58, 138, 84, 0.08);
  --error: #c04040;
  --error-bg: rgba(192, 64, 64, 0.08);
  --warning: #b08020;
  --warning-bg: rgba(176, 128, 32, 0.08);
  --drop-zone-bg: #faf7f2;
  --drop-zone-border: #ddd6c8;
  --drop-zone-active: rgba(176, 120, 40, 0.06);
  --tag-bg: #f0ece4;
  --glyph-bg: #faf7f2;
  --glyph-border: #e8e2d8;
  --scrollbar-track: #f0ece4;
  --scrollbar-thumb: #ccc5b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
}

/* ═══════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════
   SKIP NAVIGATION
   ═══════════════════════════════════════════════════════ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-body);
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 8px;
}

/* ═══════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════ */
.wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ═══════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════ */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  color: #fff;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-subtle);
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon,
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ═══════════════════════════════════════════════════════
   PRIVACY BADGE
   ═══════════════════════════════════════════════════════ */
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 100px;
  letter-spacing: 0.01em;
}

.privacy-badge svg { width: 13px; height: 13px; flex-shrink: 0; }

.privacy-tagline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 28px;
  padding: 10px 20px;
  background: var(--success-bg);
  border: 1px solid rgba(92, 184, 122, 0.15);
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--success);
  width: fit-content;
}

.privacy-tagline svg {
  flex-shrink: 0;
  color: var(--success);
}

.privacy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-privacy 2s ease infinite;
}

@keyframes pulse-privacy {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════════
   DROP ZONE
   ═══════════════════════════════════════════════════════ */
.drop-zone {
  border: 2px dashed var(--drop-zone-border);
  border-radius: var(--radius-lg);
  background: var(--drop-zone-bg);
  padding: 52px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, var(--accent-subtle) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--drop-zone-active);
}

.drop-zone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
  background: var(--drop-zone-active);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
  opacity: 1;
}

.drop-zone-content { position: relative; z-index: 1; }

.drop-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: all var(--transition);
}

.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon {
  transform: scale(1.08);
  background: var(--accent);
  color: #fff;
}

.drop-icon svg { width: 22px; height: 22px; }

.drop-zone h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.drop-zone p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.drop-zone .formats {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.format-tag {
  display: inline-block;
  background: var(--tag-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 4px;
}

input[type="file"] { display: none; }

/* ═══════════════════════════════════════════════════════
   SECTIONS (File Info, Converter, Result)
   ═══════════════════════════════════════════════════════ */
.section {
  display: none;
  margin-top: 28px;
  animation: fadeSlideUp 0.4s ease;
}

.section.visible { display: block; }

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

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════
   FILE INFO
   ═══════════════════════════════════════════════════════ */
.file-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.meta-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.meta-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.meta-value {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

/* Font Preview */
.font-preview-area {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  min-height: 80px;
}

.preview-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
}

.preview-text {
  font-size: 2rem;
  line-height: 1.3;
  color: var(--text-primary);
  word-break: break-word;
}

.preview-text-sm {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Glyph Grid */
.glyph-section { margin-top: 16px; }

.glyph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
}

.glyph-cell {
  aspect-ratio: 1;
  background: var(--glyph-bg);
  border: 1px solid var(--glyph-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-primary);
  transition: all 0.15s ease;
  cursor: default;
}

.glyph-cell:hover {
  border-color: var(--accent-border);
  background: var(--accent-subtle);
  transform: scale(1.08);
}

/* Remove file button */
.btn-remove {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-remove:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-bg);
}

.btn-remove svg { width: 14px; height: 14px; }

/* ═══════════════════════════════════════════════════════
   CONVERTER PANEL
   ═══════════════════════════════════════════════════════ */
.convert-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.convert-row label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.format-select {
  flex: 1;
  min-width: 160px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6382' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.format-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.convert-arrow {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.convert-arrow svg { width: 20px; height: 20px; }

.btn-convert {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(212, 160, 83, 0.25);
}

.btn-convert:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 160, 83, 0.35);
}

.btn-convert:active { transform: translateY(0); }

.btn-convert:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-convert svg { width: 16px; height: 16px; }

/* Spinner inside button */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════
   STATUS MESSAGES
   ═══════════════════════════════════════════════════════ */
.status {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 8px;
}

.status.visible { display: flex; }
.status svg { width: 16px; height: 16px; flex-shrink: 0; }

.status.success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(92,184,122,0.2); }
.status.error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(224,96,96,0.2); }
.status.warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(224,168,64,0.2); }
.status.info { background: var(--accent-subtle); color: var(--accent); border: 1px solid var(--accent-border); }

/* ═══════════════════════════════════════════════════════
   RESULT / DOWNLOAD
   ═══════════════════════════════════════════════════════ */
.result-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.result-details {
  flex: 1;
  min-width: 180px;
}

.result-filename {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
  word-break: break-all;
}

.result-size {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-download {
  background: var(--success);
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(92,184,122,0.3);
}

.btn-download svg { width: 16px; height: 16px; }

/* ═══════════════════════════════════════════════════════
   SUPPORTED FORMATS TABLE
   ═══════════════════════════════════════════════════════ */
.formats-section {
  margin-top: 40px;
  margin-bottom: 60px;
}

.formats-section h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.format-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.format-matrix th,
.format-matrix td {
  padding: 10px 14px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.format-matrix th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.format-matrix td { background: var(--bg-secondary); }

.format-matrix .check { color: var(--success); font-weight: 700; font-size: 1rem; }
.format-matrix .cross { color: var(--text-muted); font-size: 0.9rem; }
.format-matrix .label-cell { text-align: left; font-weight: 600; color: var(--text-primary); background: var(--bg-secondary); }

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ═══════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════ */
.site-footer {
  padding: 24px 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: 20px;
}

.footer-text {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .wrapper { padding: 0 16px; }
  .header-inner { height: 56px; }
  .brand-text h1 { font-size: 1.3rem; }
  .brand-text p { font-size: 0.72rem; }
  .drop-zone { padding: 36px 20px; }
  .drop-zone h2 { font-size: 1.1rem; }
  .card { padding: 20px; }
  .file-meta { grid-template-columns: 1fr 1fr; gap: 10px; }
  .convert-row { flex-direction: column; align-items: stretch; }
  .convert-arrow { justify-content: center; transform: rotate(90deg); }
  .btn-convert { justify-content: center; }
  .result-info { flex-direction: column; align-items: stretch; }
  .btn-download { justify-content: center; }
  .preview-text { font-size: 1.5rem; }
  .glyph-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
  .format-matrix { font-size: 0.72rem; }
  .format-matrix th, .format-matrix td { padding: 7px 6px; }
}

/* ===== SITE FOOTER ===== */
.site-footer{
  margin-top:60px;padding:48px 28px 36px;
  border-top:1px solid var(--border-color);
  background:var(--bg-primary);color:var(--text-secondary);
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  font-size:14px;line-height:1.6;
}
.site-footer .footer-inner{max-width:1100px;margin:0 auto}
.site-footer .footer-grid{
  display:grid;grid-template-columns:2fr 1fr 1fr 1fr;
  gap:40px;margin-bottom:40px;
}
.site-footer .footer-brand{display:flex;align-items:center;gap:10px;margin-bottom:16px}
.site-footer .footer-brand svg{width:32px;height:32px;color:#a855f7;flex-shrink:0}
.site-footer .footer-brand-name{
  font-size:20px;font-weight:700;
  background:linear-gradient(90deg,#8B5CF6,#EC4899,#3B82F6);
  -webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;
}
.site-footer .footer-desc{color:var(--text-tertiary);margin-bottom:16px;max-width:360px}
.site-footer .footer-copy{font-size:12px;color:var(--text-tertiary);opacity:.7}
.site-footer h4{font-weight:700;margin-bottom:16px;color:var(--text-primary);font-size:15px}
.site-footer ul{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:10px}
.site-footer a{color:var(--text-secondary);text-decoration:none;transition:color .2s}
.site-footer a:hover{color:#a855f7}
.site-footer .footer-bottom{
  border-top:1px solid var(--border-color);
  padding-top:20px;text-align:center;
}
.site-footer .footer-bottom p{color:var(--text-tertiary);font-size:13px;opacity:.7}
.site-footer .footer-bottom span{color:#a855f7}

@media(max-width:768px){
  .site-footer .footer-grid{grid-template-columns:1fr;gap:32px}
  .site-footer{padding:36px 16px 28px}
}
