/* ==========================================================
   Divisional Secretariat - Public Feedback System
   Design tokens: MAROON-led govt theme with gold accents
   Structure: "Directory board" concept — an office signage
   board reimagined for a public feedback kiosk.
   ========================================================== */

:root {
  --maroon-900: #3d0a1a;
  --maroon-800: #5c1028;
  --maroon-700: #7a1830;
  --maroon-600: #93213c;
  --maroon-500: #b02c4a;
  --gold-500: #cf9f2e;
  --gold-400: #e0b94f;
  --gold-300: #eecd76;
  --navy-900: #16324f;
  --bg: #faf6f1;
  --surface: #ffffff;
  --ink: #241019;
  --ink-soft: #3a2530;
  --ink-muted: #7a6a70;
  --border: #ecdfd9;
  --success: #1f7a4d;

  --rating-1: #c0392b;
  --rating-2: #e07b3f;
  --rating-3: #d9b84a;
  --rating-4: #4f9d69;
  --rating-5: #b02c4a;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 6px 24px rgba(61, 10, 26, 0.10);
  --shadow-card-hover: 0 18px 40px rgba(61, 10, 26, 0.20);
  --shadow-modal: 0 24px 64px rgba(61, 10, 26, 0.38);

  --font-body: 'Noto Sans', 'Noto Sans Tamil', 'Noto Sans Sinhala', sans-serif;
  --font-display: 'Noto Serif', 'Noto Sans Tamil', 'Noto Sans Sinhala', serif;
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
}

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

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------------- Ambient background flourish ---------------- */
body::before {
  content: '';
  position: fixed;
  top: -220px; right: -220px;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(207,159,46,0.14), transparent 70%);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed;
  bottom: -260px; left: -260px;
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(122,24,48,0.10), transparent 70%);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

/* ---------------- Signature element: rotating seal watermark ---------------- */
.seal-watermark {
  position: fixed;
  top: 50%; left: 50%;
  width: 620px; height: 620px;
  transform: translate(-50%, -46%);
  color: var(--maroon-900);
  opacity: 0.035;
  z-index: 0;
  pointer-events: none;
  animation: sealSpin 140s linear infinite;
}
.seal-watermark svg { width: 100%; height: 100%; }
@keyframes sealSpin {
  from { transform: translate(-50%, -46%) rotate(0deg); }
  to   { transform: translate(-50%, -46%) rotate(360deg); }
}

/* ---------------- Header ---------------- */
.site-header {
  background: linear-gradient(120deg, var(--maroon-900), var(--maroon-700) 60%, var(--maroon-600));
  background-size: 200% 200%;
  animation: gradientDrift 12s ease infinite;
  color: #fff;
  padding: 14px 28px;
  position: relative;
  border-bottom: 4px solid var(--gold-500);
  z-index: 10;
  flex-shrink: 0;
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
}

.header-text {
  text-align: left;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.header-brand { display: flex; align-items: center; gap: 16px; animation: fadeSlideDown 0.6s var(--ease-bounce) both; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes gradientDrift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.header-brand { display: flex; align-items: center; gap: 16px; animation: fadeSlideDown 0.6s var(--ease-bounce) both; }

.header-brand .logo,
.header-brand .logo-ds,
.header-actions .logo-ds {
  width: 70px; height: 70px;
  border-radius: 0%;
  padding: 6px;
  object-fit: contain;
  
  animation: logoFloat 6s ease-in-out infinite alternate;
}

.header-brand .logo,
.header-brand .logo-ds,
.header-actions .logo-ds {
  transform-origin: center;
}

.header-brand .logo:hover,
.header-brand .logo-ds:hover,
.header-actions .logo-ds:hover {
  transform: none;
}

@keyframes logoFloat {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-3px) rotate(-0.5deg); }
}

.header-text .office-name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; letter-spacing: 0.2px; }
.office-subtitle-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; justify-content: flex-start; }
.header-text .office-subtitle { font-size: 0.85rem; color: #f0dde3; text-align: left; }

/* ---------------- Badges (shared) ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.3px;
  padding: 4px 10px; border-radius: 999px;
  line-height: 1;
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; flex-shrink: 0; }

.badge-official {
  background: rgba(224,185,79,0.18);
  color: var(--gold-300);
  border: 1px solid rgba(224,185,79,0.45);
  text-transform: uppercase;
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Language switcher (corner) ---------------- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.14);
  color: #fff;
  transition: background 0.25s ease, transform 0.25s var(--ease-bounce), box-shadow 0.25s ease;
}
.icon-button:hover {
  background: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}
.icon-button svg { width: 18px; height: 18px; }

.lang-switcher { position: relative; animation: fadeSlideDown 0.6s var(--ease-bounce) both 0.1s; }

.lang-toggle {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.25s ease, transform 0.25s var(--ease-bounce), box-shadow 0.25s ease;
}
.lang-toggle:hover { background: var(--gold-500); color: var(--maroon-900); transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,0.25); }
.lang-toggle svg { width: 18px; height: 18px; transition: transform 0.4s ease; }
.lang-toggle:hover svg { transform: rotate(180deg); }

.lang-menu {
  position: absolute; top: 50px; right: 0;
  background: #fff; color: var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card-hover);
  overflow: hidden;
  min-width: 150px;
  display: none;
  z-index: 50;
  transform-origin: top right;
}
.lang-menu.open { display: block; animation: popIn 0.22s var(--ease-bounce) both; }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.lang-menu button {
  width: 100%; text-align: left; padding: 11px 16px;
  background: none; border: none; font-size: 0.9rem;
  display: flex; justify-content: space-between; align-items: center;
  transition: background 0.2s ease, padding-left 0.2s ease;
}
.lang-menu button:hover { background: var(--bg); padding-left: 20px; }
.lang-menu button.active { color: var(--maroon-600); font-weight: 700; }

/* ---------------- Main / directory panel ---------------- */
.main-content {
  flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center;
  padding: 22px 24px 16px;
  position: relative; z-index: 1;
  overflow: visible;
}

.directory-panel {
  width: 100%;
  max-width: 760px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.directory-intro {
  flex-shrink: 0;
  text-align: center;
  padding: 26px 28px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(207,159,46,0.06), transparent);
}

.directory-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--maroon-600);
  margin-bottom: 10px;
  animation: fadeSlideUp 0.6s var(--ease-bounce) both;
}
.directory-eyebrow svg { width: 14px; height: 14px; }

.page-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--maroon-900);
  animation: fadeSlideUp 0.7s var(--ease-bounce) both 0.05s;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--ink-muted);
  margin-top: 8px;
  max-width: 46ch;
  margin-left: auto; margin-right: auto;
  animation: fadeSlideUp 0.7s var(--ease-bounce) both 0.1s;
}

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

/* ---------------- Branch directory list ---------------- */
/* Desktop layout: show all branches in a clean grid without internal scrolling. */
.branch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  flex: 1; min-height: 0;
  overflow: visible;
  padding: 16px 16px 20px;
}

.branch-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 16px;
  text-align: left;
  position: relative;
  opacity: 0;
  animation: rowIn 0.5s var(--ease-bounce) both;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.branch-card:hover,
.branch-card:focus-visible,
.branch-card:active {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(61, 10, 26, 0.18);
  background: linear-gradient(90deg, rgba(61, 10, 26, 0.12), rgba(207,159,46,0.10));
  border-color: rgba(61, 10, 26, 0.18);
  padding-left: 18px;
  outline: none;
}
.branch-card:last-child { border-bottom: none; }

@keyframes rowIn {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}

.branch-index {
  order: 1;
  flex-shrink: 0;
  width: 30px;
  font-family: var(--font-display); font-size: 0.85rem; font-weight: 700;
  color: var(--gold-500);
  text-align: center;
  border-right: 1px solid var(--border);
  padding-right: 12px;
  margin-right: -2px;
}

.branch-icon {
  order: 2;
  flex-shrink: 0;
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--maroon-800), var(--maroon-600));
  color: var(--gold-400);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.4s var(--ease-bounce), box-shadow 0.4s ease;
  box-shadow: 0 4px 12px rgba(61,10,26,0.22);
}
.branch-card:hover .branch-icon { transform: rotate(-8deg) scale(1.08); }
.branch-icon svg { width: 22px; height: 22px; }

.branch-name {
  order: 3;
  flex: 1;
  font-weight: 700; font-size: 1rem; color: var(--maroon-900);
  min-width: 0;
}

.branch-tap-hint {
  display: none;
}

/* ---------------- Footer ---------------- */
.site-footer {
  text-align: center; font-size: 0.78rem; color: var(--ink-muted);
  padding: 10px; position: relative; z-index: 1;
  flex-shrink: 0;
}

.trust-badges {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 6px; flex-wrap: wrap;
}

.badge-outline {
  background: var(--surface);
  color: var(--maroon-700);
  border: 1px solid var(--border);
  text-transform: none;
}

/* ---------------- Modal / feedback form ---------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(61, 10, 26, 0.55);
  backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-overlay.open { display: flex; animation: overlayIn 0.25s ease both; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: modalIn 0.35s var(--ease-bounce) both;
}

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

.modal-header {
  background: linear-gradient(120deg, var(--maroon-900), var(--maroon-700));
  color: #fff; padding: 20px 24px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 3px solid var(--gold-500);
}
.modal-header-info { display: flex; align-items: flex-start; gap: 12px; }
.modal-icon {
  flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(224,185,79,0.18);
  border: 1px solid rgba(224,185,79,0.45);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-300);
}
.modal-icon svg { width: 19px; height: 19px; }
.modal-header h3 { font-family: var(--font-display); font-size: 1.2rem; }
.modal-header p { font-size: 0.82rem; color: #f0dde3; margin-top: 4px; }

.modal-close {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 50%; font-size: 1rem; line-height: 1;
  transition: background 0.25s ease, transform 0.35s var(--ease-bounce);
}
.modal-close:hover { background: var(--gold-500); color: var(--maroon-900); transform: rotate(90deg); }

.modal-body { padding: 24px; }

.question-block {
  margin-bottom: 28px;
  opacity: 0;
  animation: fadeSlideUp 0.5s var(--ease-bounce) both;
}
.question-block:last-child { margin-bottom: 6px; }

.question-text {
  font-weight: 600; margin-bottom: 16px; color: var(--maroon-900);
  display: flex; align-items: center; gap: 10px;
}
.question-num {
  flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--maroon-800), var(--maroon-600));
  color: var(--gold-300);
  font-size: 0.72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------------- Emoji rating (signature element) ---------------- */
.emoji-rating { display: flex; justify-content: space-between; gap: 6px; }

.emoji-option {
  flex: 1;
  background: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 12px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform 0.2s var(--ease-bounce), background 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.emoji-option .emoji-badge {
  width: 68px; height: 68px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border: 2px solid var(--border);
  transition: transform 0.3s var(--ease-bounce), background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.emoji-option .emoji {
  width: 42px; height: 42px;
  display: inline-block;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.15));
  transition: transform 0.3s var(--ease-bounce);
  animation: idleFloat 2.6s ease-in-out infinite;
  font-size: 2rem;
}
.emoji-option:nth-child(1) .emoji { animation-delay: 0s; }
.emoji-option:nth-child(2) .emoji { animation-delay: 0.15s; }
.emoji-option:nth-child(3) .emoji { animation-delay: 0.3s; }
.emoji-option:nth-child(4) .emoji { animation-delay: 0.45s; }
.emoji-option:nth-child(5) .emoji { animation-delay: 0.6s; }

.emoji-option[data-rating="1"] .emoji-badge { background: linear-gradient(160deg, #fdece9, #fbd6cf); }
.emoji-option[data-rating="2"] .emoji-badge { background: linear-gradient(160deg, #fdf1e6, #fbe1c8); }
.emoji-option[data-rating="3"] .emoji-badge { background: linear-gradient(160deg, #fdf8e4, #f8ecbd); }
.emoji-option[data-rating="4"] .emoji-badge { background: linear-gradient(160deg, #eaf7ee, #cdedd8); }
.emoji-option[data-rating="5"] .emoji-badge { background: linear-gradient(160deg, #fbeaf0, #f6d0dd); }

@keyframes idleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-5px) rotate(-3deg); }
}

.emoji-option .emoji-label {
  font-size: 0.66rem; color: var(--ink-muted); text-align: center;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.emoji-option:hover { transform: translateY(-3px); }
.emoji-option:hover .emoji-badge { transform: scale(1.1); box-shadow: 0 6px 16px rgba(61,10,26,0.18); }
.emoji-option:hover .emoji {
  animation-play-state: paused;
  transform: scale(1.2) rotate(-8deg);
}

.emoji-option.selected {
  background: linear-gradient(180deg, #fff, var(--bg));
  border-color: var(--gold-500);
}

.emoji-option.selected .emoji-badge {
  border-color: var(--gold-500);
  box-shadow: 0 6px 18px rgba(207,159,46,0.35);
}

.emoji-option.selected .emoji {
  animation: emojiPop 0.5s var(--ease-bounce);
  animation-fill-mode: forwards;
  transform: scale(1.25);
}

.emoji-option.selected .emoji-label { color: var(--maroon-900); font-weight: 700; }

@keyframes emojiPop {
  0%   { transform: scale(1) rotate(0); }
  35%  { transform: scale(1.65) rotate(12deg); }
  60%  { transform: scale(1.15) rotate(-8deg); }
  80%  { transform: scale(1.5) rotate(4deg); }
  100% { transform: scale(1.4) rotate(0); }
}

.emoji-option.selected::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: var(--radius-md);
  pointer-events: none;
  animation: ringPulse 0.6s ease-out;
}
.emoji-option[data-rating="1"].selected { box-shadow: 0 0 0 3px rgba(192,57,43,0.18); }
.emoji-option[data-rating="1"].selected::after { box-shadow: 0 0 0 3px rgba(192,57,43,0.35); }
.emoji-option[data-rating="2"].selected { box-shadow: 0 0 0 3px rgba(224,123,63,0.18); }
.emoji-option[data-rating="2"].selected::after { box-shadow: 0 0 0 3px rgba(224,123,63,0.35); }
.emoji-option[data-rating="3"].selected { box-shadow: 0 0 0 3px rgba(217,184,74,0.2); }
.emoji-option[data-rating="3"].selected::after { box-shadow: 0 0 0 3px rgba(217,184,74,0.4); }
.emoji-option[data-rating="4"].selected { box-shadow: 0 0 0 3px rgba(79,157,105,0.18); }
.emoji-option[data-rating="4"].selected::after { box-shadow: 0 0 0 3px rgba(79,157,105,0.35); }
.emoji-option[data-rating="5"].selected { box-shadow: 0 0 0 3px rgba(176,44,74,0.2); }
.emoji-option[data-rating="5"].selected::after { box-shadow: 0 0 0 3px rgba(176,44,74,0.4); }

@keyframes ringPulse {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.4); }
}

.form-notice { font-size: 0.78rem; color: var(--maroon-600); margin-top: 4px; min-height: 16px; }

.modal-footer { padding: 16px 24px 24px; display: flex; gap: 12px; justify-content: flex-end; }

.btn {
  padding: 11px 22px; border-radius: 999px; font-weight: 700; font-size: 0.88rem;
  border: none; position: relative; overflow: hidden;
  transition: filter 0.15s ease, transform 0.2s var(--ease-bounce), box-shadow 0.25s ease;
}
.btn:active { transform: scale(0.96); }
.btn:hover { box-shadow: 0 8px 20px rgba(61,10,26,0.2); transform: translateY(-2px); }

.btn-primary { background: linear-gradient(120deg, var(--maroon-700), var(--maroon-600)); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }

.btn-secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--maroon-500); color: var(--maroon-700); }

/* ---------------- Thank you state ---------------- */
.thank-you { text-align: center; padding: 42px 24px; }

.thank-you .check-circle {
  width: 76px; height: 76px; border-radius: 50%;
  background: linear-gradient(135deg, var(--success), #2f9d63);
  color: #fff; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; font-size: 2.1rem;
  animation: emojiPop 0.6s var(--ease-bounce);
  box-shadow: 0 10px 26px rgba(31,122,77,0.35);
}

.thank-you h3 { font-family: var(--font-display); color: var(--maroon-900); margin-bottom: 8px; animation: fadeSlideUp 0.5s var(--ease-bounce) both 0.1s; }
.thank-you p { color: var(--ink-muted); animation: fadeSlideUp 0.5s var(--ease-bounce) both 0.2s; }

/* ---------------- Responsive ---------------- */
/* Order: widest breakpoint (tablet) first, narrowest (phones) last,
   so phone-specific rules always win over the broader tablet rules
   instead of being silently overridden by later cascade order. */

@media (max-width: 900px) {
  .header-inner {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

  .header-brand,
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .header-text {
    width: 100%;
  }

  .header-actions {
    gap: 10px;
    flex-wrap: wrap;
  }

  .directory-panel {
    margin: 0 12px;
    max-width: none;
    border-radius: 20px;
  }

  .directory-intro {
    padding: 22px 20px 18px;
  }

  .page-title { font-size: 1.45rem; }
  .page-subtitle { max-width: 100%; }

  .branch-grid {
    grid-template-columns: 1fr;
    padding: 14px 12px 18px;
    gap: 14px;
  }

  .branch-card {
    padding: 16px 14px;
    gap: 14px;
  }

  .branch-index {
    width: 26px;
    padding-right: 10px;
  }

  .branch-icon {
    width: 44px;
    height: 44px;
  }

  .branch-icon svg { width: 20px; height: 20px; }

  .branch-name { font-size: 0.98rem; }

  .main-content { padding: 18px 14px 12px; }
  .site-footer { padding: 14px 12px; }

  .modal-box { max-width: 100%; width: 100%; max-height: 95vh; }
  .modal-overlay { padding: 12px; }
}

/* Hide mobile logo on desktop, hide desktop logo on mobile */
.logo-ds-mobile { display: none; }
.logo-ds-desktop { display: block; }

/* Mobile controls row — hidden on desktop */
.mobile-controls { display: none; }

@media (max-width: 600px) {
  /* Show/hide logo variants */
  .logo-ds-mobile { display: block; }
  .logo-ds-desktop { display: none; }

  .site-header {
    padding: 8px 12px 6px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    height: auto;
  }

  /* 2-row mobile header layout */
  .header-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-height: unset;
  }

  /* Row 1: govlogo | text | dslogo */
  .header-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
    padding: 6px 0;
  }

  /* Hide desktop header-actions on mobile */
  .header-actions {
    display: none;
  }

  .header-text {
    flex: 1;
    text-align: center;
    align-items: center;
    min-width: 0;
    padding: 0 4px;
  }

  .header-text .office-name {
    font-size: 0.95rem;
    line-height: 1.2;
    text-align: center;
  }

  .header-text .office-subtitle-row {
    justify-content: center;
  }

  .header-text .office-subtitle {
    text-align: center;
  }

  .header-brand .logo,
  .header-brand .logo-ds-mobile {
    width: 40px;
    height: 40px;
    padding: 3px;
    flex-shrink: 0;
  }

  /* Row 2: mobile-controls (fullscreen + lang) centered */
  .mobile-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 0 6px;
    border-top: 1px solid rgba(255,255,255,0.12);
  }

  .mobile-controls .icon-button {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
  }

  .mobile-controls .icon-button svg {
    width: 13px;
    height: 13px;
  }

  .mobile-controls .lang-toggle {
    padding: 4px 8px;
    font-size: 0.72rem;
    gap: 4px;
  }

  .mobile-controls .lang-toggle svg {
    width: 13px;
    height: 13px;
  }

  .badge-official { display: none; }

  .main-content {
    padding-top: 130px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
  }

  .directory-intro { padding: 18px 16px 14px; }
  .page-title { font-size: 1.3rem; }
  .page-subtitle { font-size: 0.8rem; }
  .directory-eyebrow { font-size: 0.65rem; }
  .branch-grid { padding: 4px 4px 10px; }
  .branch-card { padding: 12px 8px; gap: 10px; }
  .branch-index { width: 22px; font-size: 0.72rem; padding-right: 8px; }
  .branch-icon { width: 38px; height: 38px; }
  .branch-icon svg { width: 18px; height: 18px; }
  .branch-name { font-size: 0.9rem; }
  .branch-tap-hint { display: none; }
  .trust-badges { gap: 6px; }
  .badge-outline { font-size: 0.62rem; padding: 3px 8px; }

  .modal-overlay { padding: 8px; }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 16px 12px; }
  .modal-footer { padding: 12px 12px 18px; flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; min-width: 110px; }

  .emoji-rating { gap: 4px; }
  .emoji-option { padding: 8px 2px 8px; }
  .emoji-option .emoji-badge { width: 42px; height: 42px; }
  .emoji-option .emoji { width: 22px; height: 22px; font-size: 1.3rem; }
  .emoji-option .emoji-label { font-size: 0.6rem; }
}

/* ---------------- Extra-small phones (avoid emoji row overflow) ---------------- */
@media (max-width: 380px) {
  .site-header { padding: 8px 10px; height: 76px; }
  .main-content { padding: 108px 8px 8px; }
  .header-text .office-name { font-size: 0.88rem; }
  .header-text .office-subtitle { font-size: 0.72rem; }
  .lang-toggle span#currentLangLabel { display: none; }
  .lang-toggle { padding: 8px; }

  .emoji-rating { gap: 2px; }
  .emoji-option { padding: 6px 1px 6px; }
  .emoji-option .emoji-badge { width: 36px; height: 36px; }
  .emoji-option .emoji { width: 19px; height: 19px; font-size: 1.1rem; }
  .emoji-option .emoji-label { font-size: 0.54rem; }
  .modal-body { padding: 14px 8px; }
  .modal-header { padding: 12px 14px; }
  .modal-header h3 { font-size: 1.05rem; }
}

@media (min-width: 1024px) {
  .directory-panel { max-width: 980px; }
  .branch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .seal-watermark { display: none; }
}
