/* ==========================================================================
   DÖWLET SÖWDA GÖZEGÇILIGI GULLUGY (dsgg.com.tm)
   Static HTML5 / CSS3 / Vanilla JS (TM / RU / EN + Local Animations)
   ========================================================================== */

:root {
  --primary-color: #0b4f3a;        /* Official Turkmen deep emerald green */
  --primary-dark: #073829;
  --primary-light: #137557;
  --accent-color: #c59b27;         /* Official gold accent */
  --accent-hover: #b0881d;
  --bg-body: #f5f7f8;
  --bg-white: #ffffff;
  --bg-light: #eef2f5;
  --text-dark: #1c252c;
  --text-muted: #52606d;
  --text-light: #ffffff;
  --border-color: #d9e2ec;
  --shadow-sm: 0 2px 6px rgba(16, 42, 67, 0.06);
  --shadow-md: 0 8px 24px rgba(16, 42, 67, 0.10);
  --shadow-lg: 0 16px 36px rgba(16, 42, 67, 0.16);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.25s ease;
  --container-width: 1200px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-dark);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Top Scroll Progress Bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-color), #f3d27a);
  z-index: 2500;
  transition: width 0.1s linear;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -50px;
  left: 16px;
  background: var(--primary-color);
  color: var(--text-light);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 2000;
  font-weight: 600;
}

.skip-link:focus {
  top: 16px;
}

/* Top Bar */
.top-bar {
  background-color: var(--primary-dark);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top-bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.top-bar-ministry {
  font-weight: 500;
  letter-spacing: 0.2px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.top-bar-actions a:hover {
  color: var(--accent-color);
}

/* Language Switcher (TM / RU / EN) */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.lang-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.4px;
}

.lang-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.lang-btn.active {
  background: var(--accent-color);
  color: #102a43;
}

/* Header & Navigation */
.site-header {
  background-color: var(--bg-white);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 20px;
}

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

.brand-logo {
  width: 66px;
  height: 64px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
}

.brand-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--primary-color);
  letter-spacing: 0.3px;
  line-height: 1.25;
  text-transform: uppercase;
}

/* Desktop Navigation */
.main-nav ul {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-nav a {
  display: block;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-dark);
  border-radius: var(--radius-sm);
  line-height: 1.35;
}

.main-nav a:hover,
.main-nav a.active {
  background-color: rgba(11, 79, 58, 0.08);
  color: var(--primary-color);
}

/* Mobile Menu Button */
.nav-toggle {
  display: none;
  background: var(--primary-color);
  color: var(--text-light);
  border: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  align-items: center;
  gap: 8px;
}

.nav-toggle:hover {
  background: var(--primary-dark);
}

/* Hero Section */
.hero {
  position: relative;
  background: linear-gradient(135deg, rgba(7, 56, 41, 0.90) 0%, rgba(11, 79, 58, 0.84) 60%, rgba(19, 117, 87, 0.82) 100%),
              url("../images/Asgabat.jpg") center/cover no-repeat;
  color: var(--text-light);
  padding: 84px 0 92px;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--accent-color), #e6c15a, var(--accent-color));
}

.hero-content {
  max-width: 840px;
}

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

.hero-content > * {
  animation: heroFadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-content > *:nth-child(1) { animation-delay: 0.05s; }
.hero-content > *:nth-child(2) { animation-delay: 0.15s; }
.hero-content > *:nth-child(3) { animation-delay: 0.25s; }
.hero-content > *:nth-child(4) { animation-delay: 0.35s; }

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 18px;
  color: #f7e3a1;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 20px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.hero-desc {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 34px;
  max-width: 720px;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  text-align: center;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #102a43;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-outline-light {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.75);
  color: var(--text-light);
}

.btn-outline-light:hover {
  background-color: var(--text-light);
  color: var(--primary-color);
}

.btn-green {
  background-color: var(--primary-color);
  color: var(--text-light);
}

.btn-green:hover {
  background-color: var(--primary-dark);
}

.btn-outline-green {
  background-color: transparent;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-outline-green:hover {
  background-color: var(--primary-color);
  color: var(--text-light);
}

/* Quick Services Strip */
.quick-services {
  margin-top: -42px;
  position: relative;
  z-index: 10;
  padding-bottom: 30px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.quick-card,
.dept-card,
.form-card,
.info-card {
  position: relative;
  overflow: hidden;
}

.quick-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
  border-top: 4px solid var(--primary-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
}

.quick-card:hover {
  transform: translateY(-4px);
  border-top-color: var(--accent-color);
  box-shadow: var(--shadow-lg);
}

/* Local Card Shine Effect */
.quick-card::before,
.dept-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.75s ease;
  pointer-events: none;
  z-index: 2;
}

.quick-card:hover::before,
.dept-card:hover::before {
  left: 140%;
}

.quick-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(11, 79, 58, 0.09);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.quick-card h3 {
  font-size: 1.03rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
  line-height: 1.35;
}

.quick-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.quick-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.quick-link:hover {
  color: var(--accent-hover);
}

/* General Sections */
.section {
  padding: 68px 0;
}

.section-alt {
  background-color: var(--bg-white);
}

.section-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 46px;
}

.section-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--primary-color);
  background: rgba(11, 79, 58, 0.08);
  padding: 5px 12px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.section-title {
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.25;
  margin-bottom: 12px;
}

.section-line {
  width: 64px;
  height: 4px;
  background: var(--accent-color);
  margin: 0 auto;
  border-radius: 2px;
}

/* About / Departments Cards */
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.dept-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.section-alt .dept-card {
  background: var(--bg-body);
}

.dept-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(11, 79, 58, 0.35);
  transform: translateY(-3px);
}

.dept-image {
  height: 220px;
  background: linear-gradient(135deg, #0b4f3a, #17694f);
  position: relative;
  overflow: hidden;
}

.dept-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dept-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 56, 41, 0.82), transparent 60%);
  display: flex;
  align-items: flex-end;
  padding: 20px;
}

.dept-badge {
  background: var(--accent-color);
  color: #102a43;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
}

.dept-body {
  padding: 28px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dept-body h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 14px;
  line-height: 1.35;
}

.dept-body p {
  font-size: 0.96rem;
  color: var(--text-dark);
  margin-bottom: 22px;
  text-align: justify;
}

.dept-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Application / Certificate Banner */
.cta-banner {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  color: var(--text-light);
  border-radius: var(--radius-lg);
  padding: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  box-shadow: var(--shadow-md);
}

.cta-banner-text h3 {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.cta-banner-text p {
  color: rgba(255, 255, 255, 0.88);
  max-width: 640px;
  font-size: 0.98rem;
}

.cta-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
}

/* Complaint Form & Contact Layout */
.contact-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 36px;
  align-items: start;
}

.form-card,
.info-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 34px;
  box-shadow: var(--shadow-sm);
}

.form-card h3,
.info-card h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.form-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

label .required {
  color: #d64545;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-dark);
  background-color: #fbfcfd;
  border: 1px solid #cbd2d9;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(11, 79, 58, 0.12);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.form-status {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  display: none;
}

.form-status.success {
  display: block;
  background-color: #e3f9e5;
  color: #1f5f2b;
  border: 1px solid #a3d9a5;
}

.form-status.error {
  display: block;
  background-color: #ffe3e3;
  color: #8a1c1c;
  border: 1px solid #f8b4b4;
}

/* Info Card Items */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.info-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.info-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(11, 79, 58, 0.09);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.info-item h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 3px;
}

.info-item p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 42, 67, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 30px;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-dark);
}

/* Subpages */
.page-banner {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  color: var(--text-light);
  padding: 48px 0;
  border-bottom: 4px solid var(--accent-color);
}

.breadcrumb {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 10px;
}

.breadcrumb a:hover {
  color: var(--accent-color);
}

.page-banner h1 {
  font-size: 2rem;
  font-weight: 800;
}

.content-box {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-sm);
}

.content-box h2 {
  color: var(--primary-color);
  font-size: 1.45rem;
  margin-bottom: 16px;
}

.content-box p {
  margin-bottom: 16px;
  font-size: 1rem;
  text-align: justify;
}

.dept-detail-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 36px;
  align-items: start;
}

.doc-preview-card {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  transition: var(--transition);
}

.doc-preview-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.doc-preview-card img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  margin: 0 auto;
}

.doc-preview-caption {
  margin-top: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Footer */
.site-footer {
  background-color: var(--primary-dark);
  color: rgba(255, 255, 255, 0.85);
  padding-top: 56px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 36px;
  padding-bottom: 42px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-brand h4 {
  color: var(--text-light);
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.footer-brand p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  max-width: 400px;
}

.footer-col h5 {
  color: var(--accent-color);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.footer-col ul li {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.footer-col ul a:hover {
  color: var(--accent-color);
  padding-left: 4px;
}

.footer-bottom {
  padding: 20px 0;
  text-align: center;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
}

/* Local Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }

/* Back to Top Button */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-color);
  color: var(--text-light);
  border: 2px solid var(--accent-color);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: var(--transition);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-color);
  color: #102a43;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .about-grid,
  .contact-layout {
    grid-template-columns: 1fr;
  }
  .cta-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 14px 20px;
  }
  .main-nav.open {
    display: block;
  }
  .main-nav ul {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-title {
    font-size: 1.9rem;
  }
  .footer-grid,
  .dept-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .quick-grid,
  .form-row {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 60px 0 74px;
  }
  .form-card,
  .info-card,
  .content-box {
    padding: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .hero-content > * {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
