/*
  Kuzhimanna Service Co‑operative Bank – Base Styles
  Modern, responsive, accessible, framework‑free.
*/

:root {
  /* Brand palette derived from logo */
  --brand: #11863A;      /* primary green */
  --brand-600: #0f7432;
  --brand-700: #0c5e29;
  --accent: #4E2F8A;     /* purple accent */
  --accent-600: #412775;
  --sun: #F2D024;        /* yellow highlight */

  --ink: #0b1320;
  --muted: #5b6677;
  --bg: #ffffff;
  --bg-alt: #f4faf5;     /* subtle greenish tint */
  --card: #ffffff;
  --border: #e3e8ef;
  --shadow: 0 6px 20px rgba(16, 24, 40, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --container: 1120px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 22px;
  --space-6: 28px;
  --space-7: 36px;
  --space-8: 48px;
  --space-9: 64px;
  --header-h: 72px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  padding-top: var(--header-h);
}

/* Global smooth scrolling and offset for sticky header */
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
.section { scroll-margin-top: calc(var(--header-h) + 12px); }

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.brand, .brand:hover { text-decoration: none; }

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

.skip-link {
  position: absolute; left: -999px; top: -999px; background: #000; color: #fff; padding: 8px 12px; border-radius: 6px;
}
.skip-link:focus { left: 12px; top: 12px; z-index: 1000; }

/* Header */
.site-header {
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  backdrop-filter: saturate(180%) blur(12px);
  background: rgba(255,255,255,0.78);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); }
.brand.small img { width: 28px; height: 28px; }
.brand-text { font-weight: 500; letter-spacing: 0.2px; }
.nav-links { display: flex; align-items: center; gap: 22px; transition: transform 200ms ease, opacity 200ms ease; }
.nav-menu { display: flex; align-items: center; gap: 18px; }
.nav-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-meta { display: none; }
.nav-links a { color: var(--ink); font-weight: 600; }
.nav-links a:hover { color: var(--brand); }
.nav-links a.active { color: var(--brand); }
.nav-toggle { display: none; background: rgba(17,134,58,0.12); border: 1px solid rgba(17,134,58,0.2); padding: 10px; width: 46px; height: 46px; border-radius: 14px; transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease; backdrop-filter: blur(12px); }
.nav-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(17,134,58,0.28); }
.nav-toggle:hover { background: rgba(17,134,58,0.18); }
.nav-toggle .bar { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px auto; border-radius: 999px; transition: transform 160ms ease, opacity 160ms ease, background 160ms ease; }
.nav-toggle.is-active { background: rgba(17,134,58,0.9); border-color: rgba(17,134,58,0.9); box-shadow: 0 12px 34px rgba(17,134,58,0.28); }
.nav-toggle.is-active .bar { background: #ffffff; }
.nav-toggle.is-active .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-active .bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-active .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-meta-link { font-weight: 700; color: var(--brand-700); text-decoration: none; }
.nav-meta-link:hover { text-decoration: underline; }
.nav-meta-hours { font-size: 13px; color: var(--muted); display: block; }

/* Sections */
.section { padding: var(--space-9) 0; }
.section.alt { background: var(--bg-alt); }
.section-header { text-align: center; margin-bottom: var(--space-8); }
.section-header.left { text-align: left; }
.section-header h2 { margin: 0 0 var(--space-2); font-size: clamp(24px, 3vw, 34px); }
.section-header p { margin: 0; color: var(--muted); }

@media (max-width: 600px) {
  .section { padding: var(--space-7) 0; }
  .section-header { margin-bottom: var(--space-6); }
}

/* Subtle reveal */
[data-animate] { opacity: 0; transform: translateY(10px); transition: opacity 320ms ease, transform 320ms ease; }
[data-animate].in-view { opacity: 1; transform: none; }

/* Simple language toggle helpers */
.i18n [lang='ml'] { display: none; }
[data-lang='ml'] .i18n [lang='en'] { display: none; }
[data-lang='ml'] .i18n [lang='ml'] { display: inline; }

.lang-toggle { border: 1px solid var(--border); background: #fff; color: var(--ink); padding: 6px 10px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.lang-toggle:hover { background: #f6fbf7; }

@media (prefers-reduced-motion: reduce) {
  [data-animate] { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: var(--space-8); align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-6); }
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid-3 { grid-template-columns: 1fr; }
}

/* Hero */
.hero {
  background:
    radial-gradient(1200px 600px at 12% 10%, rgba(17, 134, 58, 0.16), transparent 60%),
    radial-gradient(900px 420px at 90% 18%, rgba(78, 47, 138, 0.14), transparent 60%);
}
.hero-copy { max-width: 560px; }
.hero-copy h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.1; margin: 0 0 var(--space-4); }
.lead { color: var(--muted); font-size: 18px; }
.actions { display: flex; gap: 12px; margin-top: var(--space-5); }
.badges { display: flex; flex-wrap: wrap; gap: 12px; margin-top: var(--space-5); padding: 0; list-style: none; }
.badges li { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 8px 12px; font-size: 14px; }
.hero-card { display: grid; gap: var(--space-6); }
.stat { display: grid; gap: 6px; align-content: start; }
.stat-value { font-size: clamp(28px, 4.4vw, 40px); font-weight: 700; color: var(--brand-700); }
.stat-label { color: var(--muted); font-weight: 500; }

.hero-strip {
  margin-top: var(--space-6);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(17, 134, 58, 0.12), rgba(78, 47, 138, 0.12));
  border: 1px solid rgba(17, 134, 58, 0.1);
  box-shadow: var(--shadow);
}
.strip-item { display: flex; flex-direction: column; gap: 4px; }
.strip-label { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.strip-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
}
.strip-value:hover { color: var(--brand-600); text-decoration: underline; }
.strip-value span { display: inline-block; }

@media (max-width: 600px) {
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn { width: 100%; }
  .hero-strip { margin-top: var(--space-5); grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero-strip { padding: var(--space-3); }
}

/* Cards */
.cards { align-items: stretch; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  box-shadow: var(--shadow);
}
.cards > .card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.cards > .card .btn { margin-top: auto; }
.card h3 { margin-top: 0; margin-bottom: 8px; font-size: 20px; }
.card.soft { background: #fdfefe; }
.card.highlight { border-color: rgba(17,134,58,.25); background: linear-gradient(180deg, #ffffff, #f4faf5); }
.card:hover { transform: translateY(-2px); transition: transform 160ms ease; }

@media (max-width: 600px) {
  .card { padding: var(--space-5); }
}

.tick { list-style: none; padding: 0; margin: var(--space-4) 0; display: grid; gap: 8px; }
.tick li {
  position: relative;
  padding-left: 28px;
  margin: 0;
  line-height: 1.5;
}
.tick li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(17, 134, 58, 0.4);
  background: radial-gradient(circle at center, rgba(17, 134, 58, 0.8) 45%, transparent 48%);
}

.note { margin-top: var(--space-6); padding: 14px 16px; background: #f3fbf6; border: 1px dashed #c9ecd6; border-radius: var(--radius-sm); color: #0f3e35; }
.note.small { font-size: 14px; }

/* Buttons */
/* Shared base with accessible focus and subtle motion */
.btn {
  --btn-bg: #fff;
  --btn-fg: var(--ink);
  --btn-bd: transparent;
  --btn-hover-bg: #f6fbf7;
  --btn-hover-fg: var(--ink);
  --btn-shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 1px rgba(16,24,40,.04);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 80ms ease;
  box-shadow: var(--btn-shadow);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { background: var(--btn-hover-bg); color: var(--btn-hover-fg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(17,134,58,.18), var(--btn-shadow); }
.btn:disabled,
.btn[disabled] { opacity: .65; cursor: not-allowed; pointer-events: none; }

.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-lg { padding: 14px 22px; font-size: 16px; }
.btn-block { width: 100%; }

/* Variants */
.btn-primary {
  --btn-bg: linear-gradient(180deg, #19a351, #0f7432);
  --btn-fg: #fff;
  --btn-bd: #0f7432;
  --btn-hover-bg: linear-gradient(180deg, #16984a, #0d682c);
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 18px rgba(17,134,58,.22);
}

.btn-secondary {
  --btn-bg: linear-gradient(180deg, #5e3fb3, #412775);
  --btn-fg: #fff;
  --btn-bd: #412775;
  --btn-hover-bg: linear-gradient(180deg, #5537a6, #392267);
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 18px rgba(65,39,117,.22);
}

.btn-outline {
  --btn-bg: transparent;
  --btn-fg: var(--accent-600);
  --btn-bd: var(--accent);
  --btn-hover-bg: #f3edff;
  --btn-hover-fg: var(--accent-600);
}

.btn-light {
  --btn-bg: #f6fbf7;
  --btn-fg: var(--brand-700);
  --btn-bd: #e0efe3;
  --btn-hover-bg: #e8f5f2;
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--border);
  --btn-hover-bg: #f7f7fb;
}

/* Loading state */
.btn.is-loading,
.btn[aria-busy="true"] { pointer-events: none; color: transparent !important; }
.btn.is-loading::after,
.btn[aria-busy="true"]::after {
  content: "";
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin .9s linear infinite;
  position: absolute;
}

.link { color: var(--accent-600); font-weight: 600; }

/* Notices */
.notices { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.notices li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(180deg, rgba(17, 134, 58, 0.06), rgba(17, 134, 58, 0));
  border: 1px solid rgba(17, 134, 58, 0.18);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  z-index: 0;
}
.notices li::before {
  content: '';
  position: absolute;
  inset: 0;
  border-left: 4px solid rgba(78, 47, 138, 0.6);
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
}
.notices .title { font-weight: 600; }
.notices .title a { color: inherit; }
.notices .meta { color: var(--muted); font-size: 14px; white-space: nowrap; }
@media (max-width: 600px) {
  .notices li { flex-direction: column; align-items: flex-start; }
  .notices .meta { white-space: normal; }
}

/* Forms */
.form .field { display: grid; gap: 8px; margin-bottom: 14px; }
.form label { font-weight: 600; }
.form input, .form textarea { width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font: inherit; }
.form input:focus, .form textarea:focus { outline: 2px solid #bce8df; border-color: #a0dcd0; }
.form-row {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.form-row .field { margin-bottom: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: #fafdfc; padding-top: var(--space-8); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--space-6); align-items: start; }
.links { list-style: none; padding: 0; margin: 8px 0 0; }
.links li { margin: 6px 0; }
.footnote { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--border); padding: var(--space-5) 0; margin-top: var(--space-6); }

.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.small { font-size: 14px; }

/* Key-value list */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Contact */
.contact .org { font-weight: 700; }
.contact #addr-line { white-space: pre-line; }

/* Details/summary (expanders) */
details { border: 1px dashed var(--border); border-radius: 10px; padding: 8px 10px; background: #fff; }
details + * { margin-top: 10px; }
summary { cursor: pointer; font-weight: 600; color: var(--accent-600); outline: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '▾'; margin-left: 6px; font-size: 12px; color: var(--muted); }
details[open] summary::after { content: '▴'; }

/* Responsive Navigation */
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  body.menu-open { overflow: hidden; }
  .nav-overlay { display: none; }
  body.menu-open .nav-overlay { display: block; position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; background: rgba(16,24,40,0.34); backdrop-filter: blur(2px); z-index: 998; }
  .nav-links {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    padding: var(--space-6) var(--space-5) calc(var(--space-6) + 80px);
    display: none;
    flex-direction: column;
    gap: var(--space-5);
    background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(245,248,246,0.98) 60%, rgba(238,243,240,0.96) 100%);
    backdrop-filter: blur(20px);
    border: 0;
    border-radius: 0;
    box-shadow: 0 18px 40px rgba(16,24,40,0.16);
    z-index: 999;
    overflow-y: auto;
    animation: slideDown 200ms ease;
    min-height: calc(100vh - var(--header-h));
  }
  .nav-menu { display: grid; gap: var(--space-3); }
  .nav-menu a {
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(17,134,58,0.08);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 12px 24px rgba(17,134,58,0.12);
    position: relative;
  }
  .nav-menu a:nth-child(odd) { background: rgba(78,47,138,0.1); box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 12px 24px rgba(78,47,138,0.12); }
  .nav-menu a:hover,
  .nav-menu a.active {
    background: linear-gradient(135deg, rgba(17,134,58,0.88), rgba(78,47,138,0.78));
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 20px 34px rgba(17,134,58,0.35);
  }
  .nav-actions { display: grid; gap: 12px; margin-left: 0; }
  .nav-actions .btn,
  .nav-actions .lang-toggle { width: 100%; box-shadow: 0 12px 32px rgba(17,134,58,0.18); }
  .nav-actions .lang-toggle { background: #ffffff; border-color: rgba(17,134,58,0.25); }
  .nav-meta {
    display: grid;
    gap: 8px;
    padding: var(--space-4);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(17,134,58,0.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 10px 26px rgba(17,134,58,0.12);
  }
  .nav-meta-hours { display: block; }
  .nav-links.show { display: flex; }
}

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

/* Gallery */
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
.gallery-grid .gitem { position: relative; overflow: hidden; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow); }
.gallery-grid img { width: 100%; height: 220px; object-fit: cover; display: block; }
.gallery-grid .cap { padding: 10px 12px; font-size: 14px; color: var(--muted); }
@media (max-width: 1200px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 960px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } .gallery-grid img { height: 180px; } }
@media (max-width: 600px) { .gallery-grid { grid-template-columns: 1fr; } .gallery-grid img { height: 200px; } }

/* Activities */
.activity-card img { width: 100%; height: 160px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; }
.activity-meta { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* Back to top */
.backtotop {
  position: fixed; right: 16px; bottom: 18px; width: 42px; height: 42px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--accent); color: #fff; font-size: 20px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}
.backtotop.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.table thead th { background: #f6fbf7; color: var(--ink); position: sticky; top: 0; }
.table tbody tr:hover { background: #fafdfc; }

/* Mobile sticky actions */
.mobile-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: none; gap: 8px; padding: 10px 12px; background: rgba(255,255,255,.95); border-top: 1px solid var(--border); box-shadow: 0 -6px 20px rgba(16,24,40,.06); }
.mobile-actions .mact { flex: 1; text-align: center; padding: 12px 14px; border-radius: 10px; font-weight: 700; }
.mobile-actions .mact.call { background: var(--brand); color: #fff; }
.mobile-actions .mact.email { background: #f3edff; color: var(--accent-600); border: 1px solid #e6dcff; }
@media (max-width: 720px) { .mobile-actions { display: flex; } body { padding-bottom: 64px; } }

/* Branch info styling */
.branch-info { font-style: normal; line-height: 1.8; }
.branch-info p { margin: var(--space-3) 0; }
.branch-info strong { color: var(--brand-700); }
.branch-info a { color: var(--accent); font-weight: 600; }

/* Contact options */
.contact-options { display: grid; gap: var(--space-5); margin: var(--space-6) 0; }
.contact-item h4 { margin: 0 0 var(--space-2); color: var(--brand-700); font-size: 16px; }
.contact-item p { margin: 0; }
.contact-item a { color: var(--accent); font-weight: 600; font-size: 18px; }

/* Form select styling */
.form-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: white;
  cursor: pointer;
}
.form-select:focus {
  outline: 2px solid #bce8df;
  border-color: #a0dcd0;
}

/* Footer – mobile improvements */
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; text-align: center; gap: var(--space-5); }
  .site-footer .brand { justify-content: center; }
  .links { margin-top: var(--space-3); }
  .links li { display: inline-block; margin: 6px 10px; }
  .footnote { flex-direction: column; gap: 8px; text-align: center; }
  .footer-actions { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
}
