/* =========================================================
   Typography (Google Fonts)
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&family=Poppins:wght@300;400;600;700&display=swap');

/* =========================================================
   CSS Reset & Base
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: #111;
  background: #fafafa;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: #0b66ff;
  text-decoration: none;
}
a:hover,
a:focus {
  text-decoration: underline;
}

.container {
  width: min(92%, 1100px);
  margin-inline: auto;
}

/* =========================================================
   Header with Background Image
   ========================================================= */
:root {
  --header-image: url("../images/nynah3.jpg"); /* CHANGE THIS PATH if needed */
  --header-height: clamp(240px, 38vw, 420px);
  --header-overlay: linear-gradient(
    to bottom,
    rgba(0,0,0,.55) 0%,
    rgba(0,0,0,.4) 40%,
    rgba(0,0,0,.35) 60%,
    rgba(0,0,0,.55) 100%
  );
  --brand: #0b66ff;
  --brand-dark: #084fc3;
  --ink: #111;
  --ink-muted: #444;
  --surface: #fff;
  --surface-alt: #f2f5fb;
  --radius: 14px;
  --shadow: 0 10px 25px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06);
}

.header-background {
  position: relative;
  min-height: var(--header-height);
  display: grid;
  align-items: end;
  padding: clamp(16px, 3vw, 28px) 0;
  color: #fff;
  isolation: isolate;
  background-image: var(--header-overlay), var(--header-image);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

/* optional subtle parallax feel on large screens */
@media (min-width: 1000px) {
  .header-background {
    background-attachment: fixed;
  }
}

/* Header inner layout */
.header-background .container {
  width: min(92%, 1100px);
}

.header-background h1 {
  margin: 0 0 4px 0;
  font-family: Oswald, Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.15;
  font-size: clamp(32px, 5vw, 56px);
  text-shadow: 0 3px 20px rgba(0,0,0,.35);
}

.header-background p {
  margin: 0 0 14px 0;
  font-size: clamp(14px, 1.9vw, 18px);
  color: #e8ecff;
}

/* =========================================================
   Navigation
   ========================================================= */
nav[aria-label="Primary"] {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 8px 0 2px;
}

nav[aria-label="Primary"] a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-weight: 600;
  backdrop-filter: saturate(140%) blur(2px);
  transition: background .2s ease, transform .08s ease;
}
nav[aria-label="Primary"] a:hover {
  background: rgba(255,255,255,.22);
}
nav[aria-label="Primary"] a[aria-current="page"] {
  background: #fff;
  color: #111;
}

/* =========================================================
   Main Content
   ========================================================= */
main.container {
  padding-block: clamp(24px, 4vw, 40px);
}

/* Buttons */
.button,
a.button {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: transform .08s ease, background .2s ease, box-shadow .2s ease;
}
.button:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

/* =========================================================
   Progress Bars
   ========================================================= */
.progress {
  --track: #e8edf9;
  --bar: #2f6bff;
  width: 100%;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
  margin: 8px 0 18px;
  height: 14px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(180deg, #3f7aff, #2f6bff);
  display: grid;
  place-items: center start;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  padding-left: 10px;
}

/* =========================================================
   Posts List
   ========================================================= */
.posts {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .posts {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

.blog-post {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid #e9eef7;
}

.blog-post h3 {
  margin: 0 0 6px 0;
  font-family: Oswald, system-ui, sans-serif;
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.25;
}

.blog-post p {
  margin: 0 0 8px 0;
  color: var(--ink-muted);
}

/* =========================================================
   Footer
   ========================================================= */
footer {
  background: var(--surface-alt);
  border-top: 1px solid #e3e8f4;
  padding: 18px 0;
  color: #2a2f3a;
}

/* =========================================================
   Admin UI (local editor)
   ========================================================= */
#admin {
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid #e9eef7;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

#admin .hint {
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-top: 8px;
}

#admin .grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
#admin input[type="text"],
#admin input[type="date"],
#admin input[type="password"],
#admin textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #dbe3f4;
  border-radius: 10px;
  background: #fff;
}
#admin button.danger {
  background: #e11d48;
  color: #fff;
  border: 0;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}
#post-list {
  list-style: none;
  padding-left: 0;
  margin: 10px 0 0 0;
}
.admin-post-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border: 1px solid #e9eef7;
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--surface-alt);
}
.admin-post-title a { text-decoration: underline; }

/* =========================================================
   Modal (View All Posts)
   ========================================================= */
.modal[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
}

.modal-dialog {
  position: relative;
  margin: min(40px, 6vh) auto;
  width: min(900px, 94vw);
  background: var(--surface, #fff);
  color: var(--ink, #111);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 10px 25px rgba(0,0,0,.12));
  overflow: hidden;
}

.modal-header, .modal-footer {
  padding: 12px 16px;
  background: var(--surface-alt, #f2f5fb);
  border-bottom: 1px solid #e3e8f4;
}
.modal-footer { border-top: 1px solid #e3e8f4; border-bottom: 0; }

.modal-body {
  padding: 14px 16px;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  color: inherit;
}

.modal-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.modal-tools input[type="search"] {
  flex: 1;
  padding: 10px;
  border: 1px solid #dbe3f4;
  border-radius: 10px;
  background: #fff;
}

.table-wrap {
  max-height: min(60vh, 600px);
  overflow: auto;
  border: 1px solid #e9eef7;
  border-radius: 10px;
  background: #fff;
}

.posts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.posts-table th, .posts-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2fb;
  vertical-align: top;
}
.posts-table tbody tr:hover {
  background: #f8faff;
}

/* =========================================================
   Utilities
   ========================================================= */
h2 {
  font-family: Oswald, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: .3px;
  font-size: clamp(22px, 3vw, 30px);
  color: #0e1a35;
  margin: 8px 0 12px 0;
}

section + section {
  margin-top: clamp(22px, 4vw, 34px);
}

/* Better focus states for accessibility */
:focus-visible {
  outline: 3px solid #9cc0ff;
  outline-offset: 2px;
}

/* =========================================================
   Optional: Dark Mode
   ========================================================= */
@media (prefers-color-scheme: dark) {
  body { background: #0c0f14; color: #e7ecf7; }
  .blog-post { background: #101623; border-color: #1c2740; }
  footer { background: #0f1420; border-top-color: #1b2642; color: #cdd6f4; }
  .progress { --track: #1b2642; }
  .progress-bar { color: #e9f1ff; }
  nav[aria-label="Primary"] a { background: rgba(255,255,255,.12); }
  nav[aria-label="Primary"] a[aria-current="page"] {
    background: #e7ecf7; color: #0d1526;
  }
  .modal-dialog { background: #101623; color: #e7ecf7; }
  .modal-header, .modal-footer { background: #0f1420; border-color: #1b2642; }
  .table-wrap { background: #101623; border-color: #1c2740; }
  .posts-table th, .posts-table td { border-color: #1b2740; }
  .posts-table tbody tr:hover { background: #0e1626; }
  .modal-tools input[type="search"] { background: #0d1320; border-color: #1b2642; color: #e7ecf7; }
}