/* ==========================================================================
   Sample Files Hub — main stylesheet
   Plain CSS, no build step — works directly on GitHub Pages.
   ========================================================================== */

:root {
  --color-header: #2b2e33;
  --color-header-text: #f2f2f0;
  --color-accent: #3d6285;
  --color-accent-dark: #2c4a63;
  --color-bg: #ffffff;
  --color-bg-alt: #f6f6f4;
  --color-text: #22252a;
  --color-text-muted: #6b6f76;
  --color-border: #e3e2df;
  --radius: 8px;
  --max-width: 1320px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* The footer is always pinned to the bottom of the viewport even when a
   page's content is short — .site-main grows to fill the leftover space,
   header and footer keep their natural height. */
.site-main {
  flex: 1 0 auto;
}

.site-header,
.site-footer {
  flex-shrink: 0;
}

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

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

a:hover {
  text-decoration: underline;
}

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

/* ---------- Header ---------- */

.site-header {
  background: var(--color-header);
  color: var(--color-header-text);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  padding-bottom: 22px;
  flex-wrap: wrap;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-header-text);
}

.logo:hover {
  text-decoration: none;
  opacity: 0.9;
}

.logo-mark-img {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  object-fit: contain;
}

/* Scoped to ".nav-links" (not a bare "ul") because .main-nav also contains
   the search box's own <ul class="search-suggestions"> — a broad ".main-nav
   ul" selector would style that dropdown too and break its layout. */
.main-nav .nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.main-nav .nav-links > li {
  display: flex;
}

.main-nav a {
  display: flex;
  align-items: center;
  color: var(--color-header-text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: normal;
}

.main-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.main-nav a.active {
  background: var(--color-accent);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--color-header-text);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 0.9rem;
  cursor: pointer;
}

.nav-toggle svg {
  width: 16px;
  height: 16px;
}

/* ---------- "More" nav overflow menu ---------- */

.nav-more {
  position: relative;
  display: flex;
}

.nav-more-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--color-header-text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: normal;
  cursor: pointer;
}

.nav-more-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav-more.active .nav-more-toggle {
  background: var(--color-accent);
}

.nav-more-toggle .caret svg {
  width: 11px;
  height: 11px;
}

/* Qualified with ".main-nav" so this beats the ".main-nav .nav-links" rule
   (display:flex, margin:0, padding:0) in specificity — otherwise that rule
   wins and the dropdown never actually hides. */
.main-nav .nav-more-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 6px 0;
  margin: 6px 0 0;
  list-style: none;
  z-index: 60;
}

.main-nav .nav-more:hover .nav-more-menu,
.main-nav .nav-more.open .nav-more-menu {
  display: block;
}

.nav-more-menu li a {
  display: block;
  padding: 9px 16px;
  color: var(--color-text);
  border-radius: 0;
  font-size: 0.92rem;
}

.nav-more-menu li a:hover {
  background: var(--color-bg-alt);
  text-decoration: none;
}

.nav-more-menu li a.active {
  background: var(--color-bg-alt);
  color: var(--color-accent);
  font-weight: 600;
}

/* ---------- Header search box ---------- */

/* .main-nav now holds the search box and the link list side by side, in
   that order, so the search box renders first — right before "Media". */
.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.search-form {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 230px;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-header-text);
  font-size: 0.92rem;
  font-family: inherit;
}

.search-input::placeholder {
  color: rgba(242, 242, 240, 0.55);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: rgba(255, 255, 255, 0.14);
}

.search-submit {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-header-text);
  cursor: pointer;
}

.search-submit:hover {
  background: rgba(255, 255, 255, 0.16);
}

.search-submit svg {
  width: 16px;
  height: 16px;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 6px 0 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  z-index: 70;
  max-height: 360px;
  overflow-y: auto;
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestion a {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 14px;
  color: var(--color-text);
}

.search-suggestion a:hover,
.search-suggestion a.is-active {
  background: var(--color-bg-alt);
  text-decoration: none;
}

.search-suggestion-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.search-suggestion-sub {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.search-suggestion-empty {
  padding: 10px 14px;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

/* ---------- Search results page ---------- */

.search-result-count {
  color: var(--color-text-muted);
}

.search-result-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.search-result-card {
  position: relative;
  display: block;
  padding: 18px 20px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
}

.search-result-card:hover {
  border-color: var(--color-accent);
  text-decoration: none;
}

.search-result-card.is-best {
  border-color: var(--color-accent);
  background: #fff;
}

.search-result-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.search-result-title {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.search-result-sub {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ---------- Hero ---------- */

.hero {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  padding: 64px 0 56px;
  text-align: center;
}

.hero h1 {
  font-size: 2.4rem;
  margin: 0 0 14px;
}

.hero p {
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 0 auto 26px;
  font-size: 1.05rem;
}

.hero-badges {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.badge {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Live counts pulled from data/site-data.json at build time — always
   accurate, never a hand-typed number that can drift out of date. */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin: 0 0 28px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hero-stat-number {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--color-accent-dark);
  line-height: 1.2;
}

.hero-stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---------- Page header (category pages) ---------- */

.page-header {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  padding: 40px 0;
}

.page-header .breadcrumbs {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.page-header p {
  color: var(--color-text-muted);
  margin: 0;
  max-width: 720px;
}

/* ---------- Category grid ---------- */

.section {
  padding: 56px 0;
}

.section-heading {
  text-align: center;
  margin-bottom: 40px;
}

.section-heading h2 {
  font-size: 1.7rem;
  margin: 0 0 8px;
}

.section-heading p {
  color: var(--color-text-muted);
  margin: 0;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}

.category-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 26px 22px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.category-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

.category-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
  overflow: hidden;
}

.category-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.category-card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.category-card p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin: 0 0 16px;
  min-height: 44px;
}

.btn {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  padding: 13px 26px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn:hover {
  background: var(--color-accent-dark);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn-outline:hover {
  background: var(--color-accent);
  color: #fff;
}

.btn-sm {
  padding: 9px 16px;
  font-size: 0.88rem;
}

/* ---------- Why-us strip ---------- */

.features {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.features .category-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.feature-item {
  text-align: center;
  padding: 10px;
}

.feature-item .category-icon {
  margin: 0 auto 14px;
}

.feature-item .category-icon svg {
  width: 22px;
  height: 22px;
  color: var(--color-accent);
}

.feature-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.feature-item p {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin: 0;
}

/* ---------- Sidebar layout + ad placeholders (currently unused) ----------
   Not referenced by any template right now — pages are full-width. Kept
   here ready to go for whenever ad placement is wanted again: wrap a
   page's content in <div class="container content-layout"><div
   class="content-main">...main content...</div><aside class="content-
   sidebar"><div class="ad-slot ad-slot--rectangle">...</div></aside>
   </div>, or drop an <div class="ad-slot ad-slot--leaderboard"> inline
   for an in-content box. */

.content-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 44px;
  align-items: start;
}

.content-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 88px;
}

@media (max-width: 960px) {
  .content-layout {
    grid-template-columns: 1fr;
  }

  .content-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 40px;
  }
}

/* ---------- Ad placeholders ----------
   Plain, clearly-labeled placeholder boxes — swap the inner markup for
   your ad network's embed code (AdSense, etc.) whenever you're ready. */

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
}

.ad-slot-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
}

.ad-slot--rectangle {
  width: 100%;
  max-width: 300px;
  height: 250px;
}

.ad-slot--leaderboard {
  width: 100%;
  min-height: 110px;
}

.ad-leaderboard-wrap {
  padding: 0 0 56px;
}

/* ---------- File listing table (category pages) ---------- */

.file-groups {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.file-group h2 {
  font-size: 1.3rem;
  margin: 0 0 4px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-accent);
  display: inline-block;
}

.file-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-top: 16px;
}

table.file-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.file-table th,
.file-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.92rem;
}

.file-table th {
  background: var(--color-bg-alt);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.file-table tr:last-child td {
  border-bottom: none;
}

.file-table tr:hover td {
  background: #fbfcfe;
}

/* Deliberately NOT display:flex on the <td> itself — a table cell that
   switches to flex stops stretching to the row's full height like a normal
   cell does, so it ends up shorter than its siblings and the row looks
   misaligned. The flex layout instead lives on an inner <span> that just
   sits centered inside a normal table cell. */
.file-name {
  font-weight: 600;
}

.file-name-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.file-ext {
  display: inline-block;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  min-width: 40px;
  text-align: center;
}

.file-source {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.file-source a {
  color: var(--color-accent);
}

.empty-note {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  padding: 10px 0 30px;
}

.prose-block {
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.96rem;
  line-height: 1.75;
  max-width: 760px;
}

.prose-block p {
  margin: 0 0 14px;
}

.prose-standalone {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ---------- Contact form ---------- */

.contact-form {
  max-width: 560px;
  display: grid;
  gap: 16px;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.contact-form input,
.contact-form textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 400;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.contact-form .btn {
  justify-self: start;
  border: none;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-direct-note {
  margin-top: 22px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

/* ---------- CTA ---------- */

.cta {
  text-align: center;
  padding: 60px 0;
}

.cta h2 {
  margin: 0 0 12px;
  font-size: 1.6rem;
}

.cta p {
  color: var(--color-text-muted);
  margin: 0 0 24px;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--color-header);
  color: #c9ccd1;
  padding: 48px 0 24px;
  margin-top: 40px;
  font-size: 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 34px;
}

.footer-col h4 {
  color: #fff;
  font-size: 0.95rem;
  margin: 0 0 14px;
}

.footer-col p {
  color: #a7abb3;
  font-size: 0.88rem;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col li {
  margin-bottom: 8px;
}

.footer-col a {
  color: #c9ccd1;
}

.footer-col a:hover {
  color: #fff;
}

.lang-select {
  background: #40464d;
  color: #fff;
  border: 1px solid #52585f;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.85rem;
}

.footer-bottom {
  border-top: 1px solid #495057;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: #9a9ea5;
}

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    width: 100%;
    order: 3;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav .nav-links {
    flex-direction: column;
    /* The base rule's align-items:center is for horizontally centering
       items in a row (desktop) — in this column layout that axis is
       horizontal, so left it as-is would center every link's text
       instead of stacking them flush left like a normal list. */
    align-items: stretch;
  }

  .main-nav a {
    justify-content: flex-start;
  }

  /* On mobile the whole nav is already a single expandable list (via the
     hamburger toggle above), so there's no need for a second-level "More"
     toggle — just show every link inline in that same list. */
  .nav-more-toggle {
    display: none;
  }

  .main-nav .nav-more-menu {
    display: block;
    position: static;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    min-width: 0;
  }

  /* The desktop dropdown's link color (dark text) assumes a white popup
     background — on mobile the menu is transparent against the dark
     header instead, so the links need the light header text color too. */
  .main-nav .nav-more-menu li a {
    color: var(--color-header-text);
  }

  .main-nav .nav-more-menu li a:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  .main-nav .nav-more-menu li a.active {
    background: var(--color-accent);
    color: var(--color-header-text);
    font-weight: 400;
  }

  .search-form {
    width: 100%;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}
