/*
Theme Name: MoneyForMigrants
Theme URI: https://moneyformigrants.com
Author: MoneyForMigrants
Author URI: https://moneyformigrants.com
Description: Clean, professional, high-trust WordPress theme for financial information authority. Built for migrants and newcomers in the UK. Authority, trust, simplicity.
Version: 1.0.0
Requires at least: 5.9
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: money4migrants
*/

/* ==========================================================================
   Design tokens (from docs/theme.md + theme-responsive.md)
   ========================================================================== */
:root {
  --color-primary: #0B1F3B;
  --color-accent: #2d6a4f;
  --color-accent-hover: #1b4332;
  --color-text: #1a1a1a;
  --color-text-muted: #4a4a4a;
  --color-bg: #ffffff;
  --color-border: #e5e5e5;

  --font-heading: "Georgia", "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;

  --container-max: 1140px;
  --content-padding-desktop: 20px;
  --content-padding-tablet: 18px;
  --content-padding-mobile: 15px;

  --line-height-body: 1.7;
  --space-unit: 1rem;

  /* Breakpoints (theme-responsive.md) */
  --bp-tablet: 1024px;
  --bp-mobile: 640px;
  --bp-mobile-narrow: 480px;
}

/* ==========================================================================
   Base & reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: var(--line-height-body);
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}

@media (max-width: 1024px) {
  body { font-size: 16px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
}

/* ==========================================================================
   Typography (responsive from theme-responsive.md)
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 0;
  margin-bottom: 0.75em;
  line-height: 1.3;
}

h1 { font-size: 38px; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }
h4 { font-size: 20px; }
h5 { font-size: 18px; }
h6 { font-size: 16px; }

@media (max-width: 1024px) {
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  h3 { font-size: 20px; }
  h4 { font-size: 18px; }
  h5 { font-size: 17px; }
  h6 { font-size: 15px; }
}

@media (max-width: 640px) {
  h1 { font-size: 26px; }
  h2 { font-size: 22px; }
  h3 { font-size: 18px; }
  h4 { font-size: 17px; }
  h5 { font-size: 16px; }
  h6 { font-size: 15px; }
}

p {
  margin-top: 0;
  margin-bottom: 1em;
}

p:last-child {
  margin-bottom: 0;
}

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

a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Layout container (theme-responsive: 1140px, padding 20/18/15)
   ========================================================================== */
.m4m-container {
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--content-padding-desktop);
  padding-right: var(--content-padding-desktop);
}

@media (max-width: 1024px) {
  .m4m-container {
    padding-left: var(--content-padding-tablet);
    padding-right: var(--content-padding-tablet);
  }
}

@media (max-width: 640px) {
  .m4m-container {
    padding-left: var(--content-padding-mobile);
    padding-right: var(--content-padding-mobile);
  }
}

/* ==========================================================================
   Header & navigation (theme-responsive: left alignment, nav below header)
   ========================================================================== */
.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}

/* Desktop: two rows – branding (left) + nav below, left-aligned */
.site-header .m4m-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.header-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.site-title a {
  color: var(--color-primary);
  text-decoration: none;
}

.site-title a:hover {
  text-decoration: underline;
}

/* Custom logo in header: max height on small screens */
.site-header .custom-logo-link {
  display: block;
  max-height: 48px;
  width: auto;
}

.site-header .custom-logo-link img {
  max-height: 48px;
  width: auto;
  height: auto;
}

@media (min-width: 769px) {
  .site-header .custom-logo-link,
  .site-header .custom-logo-link img {
    max-height: 60px;
  }
}

/* Desktop nav: below header, no mega menus */
.main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}

.main-navigation li {
  margin: 0;
}

.main-navigation a {
  color: var(--color-text);
  font-size: 1rem;
  padding: 0.5rem 0;
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  box-sizing: border-box;
}

.main-navigation a:hover {
  color: var(--color-primary);
}

/* Close button: hidden on desktop, shown only in mobile slide-out */
.menu-close {
  display: none;
}

/* Mobile menu toggle: hamburger, 44px touch target */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  padding: 12px 18px;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--color-primary);
  align-items: center;
  justify-content: center;
}

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

  /* Slide-out menu (left), no dropdown mega menus */
  .main-navigation {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    padding: 2rem 1.5rem;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .main-navigation.toggled {
    transform: translateX(0);
  }

  .main-navigation ul {
    flex-direction: column;
    gap: 0;
  }

  .main-navigation li {
    border-bottom: 1px solid var(--color-border);
  }

  .main-navigation a {
    padding: 14px 0;
    display: block;
    min-height: 44px;
    line-height: 1.4;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .menu-close {
    display: inline-block;
    margin-bottom: 1rem;
    background: none;
    border: 1px solid var(--color-border);
    padding: 10px 16px;
    min-height: 44px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--color-primary);
  }
}

.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 999;
}

.menu-overlay.active {
  display: block;
}

/* ==========================================================================
   Buttons (trust-oriented green, min 44px touch target)
   ========================================================================== */
/* Buttons: desktop 12px 24px, mobile 12px 18px, min 44px touch target */
.m4m-btn,
.button,
input[type="submit"],
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  min-height: 44px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-accent);
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  transition: background 0.15s ease;
}

.m4m-btn:hover,
.button:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
  background: var(--color-accent-hover);
  color: #fff;
  text-decoration: none;
}

@media (max-width: 640px) {
  .m4m-btn,
  .button,
  input[type="submit"],
  button[type="submit"] {
    padding: 12px 18px;
    min-height: 44px;
  }
}

/* ==========================================================================
   Hero section (homepage)
   ========================================================================== */
.hero-section {
  padding: 3rem 0 4rem;
  text-align: center;
}

.hero-section h1 {
  margin-bottom: 1rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero-section .hero-lead {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .hero-section {
    padding: 2rem 0 3rem;
  }

  .hero-section .hero-lead {
    font-size: 1rem;
  }
}

/* ==========================================================================
   Start Here section
   ========================================================================== */
.start-here-section {
  padding: 3rem 0;
  background: #f8f9fa;
  border-top: 1px solid var(--color-border);
}

.start-here-section h2 {
  margin-bottom: 1rem;
}

.start-here-section .start-here-text {
  max-width: 720px;
  color: var(--color-text-muted);
  margin-bottom: 0;
}

/* ==========================================================================
   Category grid (4 areas)
   ========================================================================== */
.category-grid-section {
  padding: 4rem 0;
}

.category-grid-section h2 {
  margin-bottom: 2rem;
  text-align: center;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.category-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.category-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  text-decoration: none;
  color: inherit;
}

.category-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.category-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Editorial trust section
   ========================================================================== */
.trust-section {
  padding: 4rem 0;
  background: #f8f9fa;
  border-top: 1px solid var(--color-border);
}

.trust-section h2 {
  text-align: center;
  margin-bottom: 2rem;
}

.trust-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.trust-list li {
  padding: 0.75rem 0;
  padding-left: 1.75rem;
  position: relative;
  color: var(--color-text-muted);
}

.trust-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1rem;
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
}

@media (max-width: 640px) {
  .trust-section {
    padding: 3rem 0;
  }

  .trust-list li {
    padding-left: 1.5rem;
  }

  .trust-list li::before {
    top: 0.85rem;
  }
}

/* ==========================================================================
   Latest guides section
   ========================================================================== */
.latest-guides-section {
  padding: 4rem 0;
}

.latest-guides-section h2 {
  margin-bottom: 2rem;
}

.guides-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guides-list li {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.guides-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.guides-list a {
  font-weight: 500;
  font-size: 1.05rem;
}

.guides-list .guide-date {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* ==========================================================================
   Main content area (posts/pages)
   ========================================================================== */
.site-main {
  padding: 2rem 0 4rem;
}

@media (max-width: 640px) {
  .site-main {
    padding: 1.5rem 0 3rem;
  }
}

/* Sidebar: desktop right sidebar; tablet/mobile no sidebar */
.content-area {
  max-width: 720px;
}

.has-sidebar .content-area {
  flex: 1;
  min-width: 0;
}

.widget-area {
  width: 300px;
  flex-shrink: 0;
}

@media (max-width: 1024px) {
  .widget-area {
    display: none;
  }

  .has-sidebar .content-area {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .widget-area {
    display: none;
  }
}

/* Blog layout: single column on mobile, featured image above title */
.blog .site-main .m4m-container,
.archive .site-main .m4m-container,
.search-results .site-main .m4m-container {
  max-width: var(--container-max);
}

.blog .site-main article,
.archive .site-main article,
.search-results .site-main article {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.blog .site-main article:last-child,
.archive .site-main article:last-child,
.search-results .site-main article:last-child {
  border-bottom: none;
}

/* Featured image above title is ensured by template order (content.php) */

.posts-navigation {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}

.posts-navigation .nav-previous,
.posts-navigation .nav-next {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 640px) {
  .posts-navigation {
    flex-direction: column;
    gap: 0.75rem;
  }
}

.entry-header {
  margin-bottom: 1.5rem;
}

.entry-title {
  margin-bottom: 0.5rem;
}

.entry-meta {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Images & media (theme-responsive: max-width 100%, no fixed width)
   ========================================================================== */
.entry-content img,
.entry-thumbnail img,
.entry-content iframe,
.wp-block-image img,
.wp-block-embed iframe,
figure img {
  max-width: 100%;
  height: auto;
  display: block;
}

.entry-content img,
.entry-thumbnail img,
.wp-block-image img,
figure img {
  width: 100%;
  max-width: 100%;
}

.entry-thumbnail {
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.entry-thumbnail img {
  width: 100%;
  object-fit: cover;
}

.entry-thumbnail-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.entry-thumbnail-link:hover {
  text-decoration: none;
  color: inherit;
}

/* Block editor responsive embeds */
.entry-content .wp-block-embed,
.entry-content .wp-block-embed iframe {
  max-width: 100%;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--color-primary);
  color: #e8eaed;
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

@media (max-width: 640px) {
  .site-footer {
    padding: 2rem 0 1.5rem;
    margin-top: 3rem;
  }

  .footer-bottom {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    font-size: 0.85rem;
  }
}

.site-footer a {
  color: #b8d4e8;
}

.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 3rem;
  justify-content: space-between;
}

.footer-col h4 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.footer-col li {
  margin-bottom: 0.5rem;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
}

@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    gap: 1.5rem;
  }
}

/* ==========================================================================
   Utility
   ========================================================================== */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

.alignwide {
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
}

.alignfull {
  max-width: none;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}
