/* =============================================================================
   ROOT VARIABLES - Two Color System
   ============================================================================= */
:root {
  --primary-color: #000000;
  --secondary-color: #ffffff;
  --primary-deep: #1a1a1a;
  --secondary-contrast: #f5f5f5;
  --border-color: #e0e0e0;
  --text-secondary: #666666;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --transition-fast: all 0.2s ease;
  --transition-smooth: all 0.3s ease;
}

/* =============================================================================
   RESET AND BASE
   ============================================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: #f8f9fa;
  color: var(--primary-color);
  line-height: 1.6;
  overflow-x: hidden;
}

/* =============================================================================
   HEADER
   ============================================================================= */
.header {
  background-color: var(--secondary-color);
  width: 100%;
  margin: 0;
  border-bottom: 2px solid #cfd6ce;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.main-menu {
  background-color: var(--secondary-color);
  overflow: hidden;
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  padding: 0 20px;
  color: #555;
}

.brand-logo {
  float: left;
  color: #555;
  text-decoration: none;
  font-size: 22px;
  padding: 15.3px 8px;
}

.brand-logo:hover {
  color: var(--primary-color);
}

.menu-icon {
  font-size: 30px;
  cursor: pointer;
  float: right;
  margin: 10px 15px;
  color: var(--primary-color);
}

/* =============================================================================
   SIDE NAVIGATION
   ============================================================================= */
.sidenav {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  background-color: #fafafa;
  overflow-x: hidden;
  transition: 0.5s;
  padding-top: 60px;
}

.sidenav a,
.sidenav h3 {
  padding: 8px 8px 8px 32px;
  text-decoration: none;
  font-size: 18px;
  color: #222222;
  display: block;
  transition: 0.3s;
  text-align: left;
}

.sidenav a:hover {
  color: #2a80b9;
}

.sidenav .closebtn {
  position: absolute;
  top: 0;
  right: 25px;
  font-size: 36px;
  margin-left: 50px;
}

.sidenav .logo {
  color: var(--primary-color);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
  margin-bottom: 10px;
}

/* =============================================================================
   SCROLL RIBBON
   ============================================================================= */
.scroll-ribbon {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  padding: 10px 20px;
  gap: 15px;
  scrollbar-width: thin;
  border-bottom: 1px solid #e5e5e5;
  background-color: var(--secondary-color);
}

.scroll-ribbon::-webkit-scrollbar {
  height: 6px;
}

.scroll-ribbon::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.scroll-ribbon a {
  flex: 0 0 auto;
  padding: 8px 16px;
  background: #e6e6e6;
  color: #333;
  border-radius: 20px;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.3s;
}

.scroll-ribbon a:hover {
  background: #d0d0d0;
}

/* =============================================================================
   CONTAINER - PROPERLY CENTERED
   ============================================================================= */
.container {
  width: 100%;
  max-width: 1000px;
  margin: 30px auto;
  padding: 30px;
  background: var(--secondary-color);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* =============================================================================
   TYPOGRAPHY - FIXED HIERARCHY
   ============================================================================= */
h1 {
  font-size: 28px;
  color: #222;
  margin-bottom: 24px;
  padding-bottom: 12px;
  font-weight: 700;
  line-height: 1.3;
}

h2 {
  font-size: 24px;
  color: #333;
  margin: 40px 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
  font-weight: 600;
  line-height: 1.4;
}

h3 {
  font-size: 18px;
  color: var(--primary-color);
  margin-bottom: 12px;
  font-weight: 600;
  line-height: 1.4;
}

p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}

/* =============================================================================
   INPUT TEXTAREA
   ============================================================================= */
textarea {
  width: 100%;
  height: 100px;
  padding: 12px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: vertical;
  font-family: "Noto Sans Kannada", "Tunga", sans-serif;
  margin-bottom: 20px;
  background: var(--secondary-color);
  color: var(--primary-color);
  transition: border-color 0.3s;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* =============================================================================
   CONTROLS WRAPPER - STICKY FIXED POSITIONING
   ============================================================================= */
.controls-wrapper {
  width: calc(100% + 60px);
  margin-left: -30px;
  margin-right: -30px;
  margin-bottom: 24px;
  transition: all 0.3s ease;
  padding: 0;
}

.controls-wrapper.fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;
  z-index: 9998;
  background-color: var(--secondary-color);
  padding: 10px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* =============================================================================
   CONTROLS
   ============================================================================= */
.controls {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  padding: 16px 20px;
  background: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #e5e5e5;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: #555;
  white-space: nowrap;
  font-weight: 500;
}

.controls input[type="color"] {
  width: 28px;
  height: 30px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.controls input[type="range"] {
  width: 150px;
  cursor: pointer;
}

/* =============================================================================
   FONT GRID
   ============================================================================= */
#font-grid {
  margin-bottom: 32px;
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

/* =============================================================================
   PAGINATION
   ============================================================================= */
#pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 40px 0;
  padding: 20px;
  flex-wrap: wrap;
}

#pagination button {
  padding: 10px 16px;
  background: #ffffff;
  color: #333;
  border: 1.5px solid #e5e5e5;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  min-width: 44px;
}

#pagination button:hover {
  background: #f0f0f0;
  border-color: #000;
  transform: translateY(-2px);
}

#pagination button.active {
  background: #000;
  color: #fff;
  border-color: #000;
  font-weight: 600;
}

#pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* =============================================================================
   FONT CARD
   ============================================================================= */
.font-card {
  background: var(--secondary-color);
  border: 1.5px solid #e5e5e5;
  overflow: hidden;
  transition: box-shadow 0.3s;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
}

.font-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.font-name {
  color: #333;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* =============================================================================
   FONT PREVIEW - FIXED FOR MOBILE (NO SCROLLBAR, AUTO HEIGHT)
   ============================================================================= */
.font-preview {
  padding: 30px;
  text-align: center;
  font-size: 48px;
  background: var(--secondary-color);
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  border-radius: 8px 8px 0 0;
  line-height: 1.6;
  overflow: hidden;
  min-height: 120px;
  width: 100%;
  max-width: 100%;
}

.no-text {
  color: #999;
  font-style: italic;
  font-size: 16px;
  font-family: sans-serif;
}

/* =============================================================================
   DOWNLOAD BUTTONS
   ============================================================================= */
.download-buttons {
  padding: 16px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  background: transparent;
  border-top: none;
}

.download-btn {
  padding: 10px 20px;
  background: #808080;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s;
}

.download-btn:hover {
  background: #333;
}

.download-btn:active {
  transform: translateY(1px);
}

/* =============================================================================
   HOW TO USE SECTION - CLEAN LIST STYLING
   ============================================================================= */
#how-to-use {
  background: #f9f9f9;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  font-family: "Segoe UI", sans-serif;
  line-height: 1.7;
}

#how-to-use h2 {
  font-size: 1.8em;
  margin-bottom: 24px;
  color: #333;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 12px;
}

#how-to-use p {
  font-size: 1.05em;
  color: #555;
  margin-bottom: 24px;
}

#how-to-use ol {
  list-style-position: outside;
  padding-left: 30px;
  margin: 0;
}

#how-to-use li {
  margin-bottom: 24px;
  color: #444;
  line-height: 1.8;
  list-style-type: decimal;
  padding-left: 10px;
}

#how-to-use li strong {
  color: var(--primary-color);
  font-weight: 600;
}

#how-to-use ul {
  margin: 12px 0 0 40px;
  padding: 0;
  list-style-type: disc;
}

#how-to-use ul li {
  margin-bottom: 10px;
  color: #555;
  padding-left: 0;
  list-style-type: disc;
}

/* =============================================================================
   FAQ SECTION
   ============================================================================= */
#faq {
  background-color: #fdfdfd;
  padding: 32px;
  margin-top: 48px;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  font-family: "Segoe UI", sans-serif;
}

#faq h2 {
  font-size: 1.8em;
  color: #333;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 12px;
}

.faq-item {
  margin-bottom: 28px;
  padding: 24px;
  background: var(--secondary-color);
  border-left: 4px solid var(--primary-color);
  border-radius: 4px;
  transition: all 0.3s;
}

.faq-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.faq-item h3 {
  font-size: 1.1em;
  color: var(--primary-color);
  margin-bottom: 12px;
  margin-top: 0;
}

.faq-item p {
  font-size: 1.05em;
  color: #555;
  line-height: 1.6;
  margin: 0;
}

/* =============================================================================
   FOOTER
   ============================================================================= */
.site-footer {
  background-color: #333;
  color: #ecf0f1;
  padding: 48px 20px 24px;
  margin-top: 64px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 48px;
}

.footer-content h3,
.footer-content h4 {
  color: var(--secondary-color);
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 600;
}

.footer-left p {
  max-width: 300px;
  font-size: 0.95em;
  line-height: 1.6;
  margin-top: 12px;
}

.footer-links ul,
.footer-social ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links ul li,
.footer-social ul li {
  margin-bottom: 10px;
}

.footer-links ul li a,
.footer-social ul li a {
  color: #bdc3c7;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-links ul li a:hover,
.footer-social ul li a:hover {
  color: var(--secondary-color);
}

.footer-bottom {
  text-align: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #34495e;
  color: #95a5a6;
  font-size: 0.9em;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */
@media screen and (max-height: 450px) {
  .sidenav {
    padding-top: 15px;
  }
  .sidenav a {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  .container {
    margin: 16px auto;
    padding: 20px;
    width: 100%;
  }

  .main-menu {
    padding: 0 10px;
  }

  .scroll-ribbon {
    padding: 10px;
  }

  .controls {
    gap: 12px;
    padding: 12px;
  }

  .controls input[type="range"] {
    width: 120px;
  }

  .font-preview {
    font-size: 32px;
    padding: 20px 12px;
    min-height: 100px;
    width: 100%;
    max-width: 100%;
  }

  .download-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .controls-wrapper.fixed {
    padding: 8px 10px;
  }

  .controls-wrapper.fixed .controls {
    padding: 10px;
    gap: 10px;
  }

  .controls-wrapper.fixed label {
    font-size: 14px;
  }

  #how-to-use ol {
    padding-left: 25px;
  }

  #how-to-use ul {
    margin: 10px 0 0 35px;
  }

  #how-to-use li {
    margin-bottom: 18px;
  }

  .faq-item {
    padding: 18px;
  }

  #pagination button {
    padding: 8px 12px;
    font-size: 13px;
    min-width: 38px;
  }
}

@media (max-width: 480px) {
  .font-preview {
    font-size: 24px;
    padding: 16px 10px;
    min-height: 80px;
    width: 100%;
    max-width: 100%;
  }

  h1 {
    font-size: 20px;
  }

  h2 {
    font-size: 18px;
  }

  .scroll-ribbon {
    padding: 5px 10px;
    gap: 8px;
  }

  .scroll-ribbon a {
    padding: 6px 12px;
    font-size: 13px;
  }

  .download-buttons {
    gap: 8px;
    padding: 12px;
  }

  .controls {
    gap: 10px;
    padding: 10px;
  }

  .controls label {
    font-size: 13px;
  }

  .controls input[type="range"] {
    width: 100px;
  }

  .font-name {
    font-size: 15px;
  }

  .brand-logo {
    font-size: 18px;
  }

  #how-to-use {
    padding: 24px;
  }

  #how-to-use ol {
    padding-left: 20px;
  }

  #how-to-use ul {
    margin: 8px 0 0 30px;
  }

  #how-to-use li {
    margin-bottom: 16px;
    font-size: 0.95em;
  }

  #faq {
    padding: 24px;
  }

  .faq-item {
    padding: 16px;
  }

  .faq-item h3 {
    font-size: 1em;
  }

  .faq-item p {
    font-size: 0.95em;
  }

  #pagination {
    gap: 6px;
    padding: 15px 10px;
  }

  #pagination button {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 34px;
  }
}
