/* ==========================================================================
   FJAKA WEALTH MANAGEMENT — DESIGN SYSTEM
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FONT FACE (must come first)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Libre Baskerville';
  src: url('/fonts/libre-baskerville-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   2. CUSTOM PROPERTIES (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Primary Colors */
  --royal-blue: #1e3a5f;
  --deep-blue: #0f2744;
  --adriatic: #2d5a7b;

  /* Neutrals */
  --white: #ffffff;
  --warm-white: #faf9f7;
  --sand: #f0ebe3;
  --stone: #d4cdc4;

  /* Accent */
  --gold: #996f00;

  /* Text */
  --text-primary: #1a1a1a;
  --text-body: #374151;
  --text-muted: #6b7280;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 3rem;
  --space-2xl: 6rem;

  /* Typography Scale */
  --font-heading: 'Libre Baskerville', Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1.125rem;
  --text-lg: 1.5rem;
  --text-xl: 2.25rem;
  --text-2xl: 3rem;

  /* Layout */
  --max-width: 1200px;
  --content-width: 680px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* --------------------------------------------------------------------------
   3. RESET & BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* smooth scroll for anchor links (skip-link, service sections)
     INTENTIONAL: overridden for prefers-reduced-motion users below */
  scroll-behavior: smooth;
}

/* IMPORTANT: This override is intentional for accessibility.
   Do not remove — it disables smooth scroll AND animations for users
   who have indicated motion sensitivity in their OS settings. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-body);
  background-color: var(--warm-white);
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

a:hover {
  text-decoration: underline;
}

/* Skip Link */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 1000;
  padding: var(--space-sm) var(--space-md);
  background: var(--royal-blue);
  color: var(--white);
}

.skip-link:focus {
  position: fixed;
  top: 0;
  left: 0;
}

/* --------------------------------------------------------------------------
   4. TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.2;
}

h1 {
  font-size: var(--text-2xl);
  line-height: 1.2;
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: var(--text-xl);
  line-height: 1.25;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--text-lg);
  line-height: 1.3;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-md);
}

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

/* Prose (blog content) */
.prose {
  max-width: var(--content-width);
  margin: 0 auto;
}

.prose h2 {
  margin-top: var(--space-2xl);
}

.prose > h2:first-child {
  margin-top: 0;
}

.prose ul, .prose ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}

.prose li {
  margin-bottom: var(--space-xs);
}

.prose blockquote {
  border-left: 3px solid var(--stone);
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-muted);
  font-style: italic;
}

.prose code {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 0.9em;
  background: var(--sand);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

.prose pre {
  background: var(--deep-blue);
  color: var(--warm-white);
  padding: var(--space-md);
  overflow-x: auto;
  margin: var(--space-lg) 0;
}

.prose pre code {
  background: none;
  padding: 0;
}

/* --------------------------------------------------------------------------
   5. COMPONENTS
   -------------------------------------------------------------------------- */

/* Buttons */
.btn {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform var(--transition-fast),
              background-color var(--transition-fast);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background-color: var(--royal-blue);
  color: var(--white);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  background-color: var(--deep-blue);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--white);
  color: var(--royal-blue);
  border: 2px solid var(--royal-blue);
}

.btn-secondary:hover {
  background-color: var(--warm-white);
}

.btn-light {
  background-color: var(--white);
  color: var(--royal-blue);
}

.btn-light:hover {
  background-color: var(--warm-white);
  transform: translateY(-1px);
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--stone);
  padding: var(--space-lg);
}

.card-sand {
  background: var(--sand);
  border: none;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Section spacing */
.section {
  padding: var(--space-2xl) 0;
}

.section-sand {
  background-color: var(--sand);
}

.section-blue {
  background-color: var(--royal-blue);
  color: var(--white);
}

.section-blue h2,
.section-blue h3 {
  color: var(--white);
  margin-top: 0;
}

/* WCAG AA FIX: Links inside blue sections must be white for contrast */
.section-blue a {
  color: var(--white);
  text-decoration: underline;
}

.section-blue a:hover {
  text-decoration: none;
}

.section-blue .btn-light {
  color: var(--royal-blue);
  text-decoration: none;
}

.section-deep {
  background-color: var(--deep-blue);
  color: var(--white);
}

/* WCAG AA FIX: Links inside deep blue sections */
.section-deep a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: underline;
}

.section-deep a:hover {
  color: var(--white);
}

/* --------------------------------------------------------------------------
   6. HEADER & NAVIGATION
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--warm-white);
  border-bottom: 1px solid var(--stone);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.logo {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  color: var(--royal-blue);
  text-decoration: none;
}

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

.nav-main {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.nav-main a {
  color: var(--text-body);
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.nav-main a:hover {
  color: var(--royal-blue);
  text-decoration: none;
}

.nav-main a[aria-current="page"] {
  color: var(--royal-blue);
  font-weight: 500;
}

.nav-cta {
  padding: var(--space-xs) var(--space-md);
  background: var(--royal-blue);
  color: var(--white) !important;
}

.nav-cta:hover {
  background: var(--deep-blue);
}

/* Mobile nav toggle (CSS-only) */
.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  position: relative;
  transition: transform var(--transition-fast);
}

.nav-toggle-label span::before,
.nav-toggle-label span::after {
  content: '';
  position: absolute;
}

.nav-toggle-label span::before {
  top: -8px;
}

.nav-toggle-label span::after {
  top: 8px;
}

/* Mobile breakpoint */
@media (max-width: 767px) {
  .nav-toggle-label {
    display: block;
  }

  .nav-main {
    position: absolute;
    top: 4rem;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--warm-white);
    border-bottom: 1px solid var(--stone);
    padding: var(--space-md);
    gap: var(--space-sm);
    display: none;
  }

  .nav-toggle:checked ~ .nav-main {
    display: flex;
  }

  .nav-toggle:checked + .nav-toggle-label span {
    background: transparent;
  }

  .nav-toggle:checked + .nav-toggle-label span::before {
    transform: rotate(45deg);
    top: 0;
  }

  .nav-toggle:checked + .nav-toggle-label span::after {
    transform: rotate(-45deg);
    top: 0;
  }

  .logo {
    font-size: var(--text-base);
  }

  .nav-cta {
    width: 100%;
    text-align: center;
    margin-top: var(--space-sm);
  }
}

/* --------------------------------------------------------------------------
   7. FOOTER
   -------------------------------------------------------------------------- */
main {
  flex: 1 0 auto;
}

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

.footer-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-brand .logo {
  color: var(--white);
  display: block;
  margin-bottom: var(--space-sm);
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-sm);
  max-width: 300px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-lg);
}

.footer-nav a {
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-sm);
}

.footer-nav a:hover {
  color: var(--white);
}

.footer-legal {
  padding-top: var(--space-lg);
}

.footer-legal p {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: var(--space-xs);
}

.footer-legal a {
  color: rgba(255, 255, 255, 0.6);
}

.footer-legal a:hover {
  color: var(--white);
}

@media (max-width: 767px) {
  .footer-main {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .footer-nav {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

/* --------------------------------------------------------------------------
   8. POST CARDS
   -------------------------------------------------------------------------- */
.post-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.post-date {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.post-category {
  font-size: var(--text-xs);
  color: var(--adriatic);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-title {
  margin: 0;
  font-size: var(--text-lg);
}

.post-title a {
  color: var(--text-primary);
}

.post-title a:hover {
  color: var(--adriatic);
}

.post-excerpt {
  color: var(--text-body);
  margin: 0;
}

.post-link {
  font-size: var(--text-sm);
  font-weight: 500;
}

/* Post list */
.post-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* --------------------------------------------------------------------------
   9. HOME PAGE
   -------------------------------------------------------------------------- */
.hero {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: var(--sand);
  background-size: cover;
  background-position: center;
  padding: var(--space-2xl) var(--space-md);
}

.hero-content h1 {
  font-size: calc(var(--text-2xl) * 1.25);
  margin-bottom: var(--space-md);
}

.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--text-body);
  margin-bottom: var(--space-xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.value-prop {
  font-size: var(--text-lg);
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  color: var(--text-body);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

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

  .hero-content h1 {
    font-size: var(--text-2xl);
  }
}

/* --------------------------------------------------------------------------
   10. PAGE LAYOUT
   -------------------------------------------------------------------------- */
.page-header {
  background: var(--sand);
  padding: var(--space-xl) 0;
}

.page-header h1 {
  margin-bottom: 0;
}

.page-subtitle {
  font-size: var(--text-lg);
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* --------------------------------------------------------------------------
   11. POST LAYOUT
   -------------------------------------------------------------------------- */
.post-header {
  background: var(--sand);
}

.post-header .container {
  max-width: var(--content-width);
}

.post-meta {
  margin-bottom: var(--space-lg);
}

.post-meta a {
  font-size: var(--text-sm);
}

.post-header time {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.post-header .post-category {
  display: inline-block;
  margin-bottom: var(--space-sm);
}

.post-header h1 {
  margin-bottom: 0;
}

.post-footer {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
}

.post-footer hr {
  border: none;
  border-top: 1px solid var(--stone);
  margin-bottom: var(--space-lg);
}

/* --------------------------------------------------------------------------
   12. CONTACT PAGE
   -------------------------------------------------------------------------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: start;
}

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

  .contact-info {
    order: -1;
  }
}

.contact-form {
  background: var(--white);
  padding: var(--space-xl);
  border: 1px solid var(--stone);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
  font-size: var(--text-sm);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--stone);
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--warm-white);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: 2px solid var(--adriatic);
  outline-offset: 2px;
  border-color: var(--adriatic);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* Form Messages (No-JS, uses :target) */
.form-messages {
  margin-bottom: var(--space-lg);
}

/* Hide all messages by default */
.message {
  display: none;
  padding: var(--space-md);
  border-left: 4px solid;
  margin-bottom: var(--space-md);
}

/* Show message when targeted via URL hash */
.message:target {
  display: block;
}

.message-success {
  background-color: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.message-error {
  background-color: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}

/* Scroll targeted message into view */
.message:target {
  scroll-margin-top: calc(var(--space-2xl) + 60px);
}

/* --------------------------------------------------------------------------
   13. FOCUS STYLES (Accessibility)
   -------------------------------------------------------------------------- */
:focus {
  outline: 2px solid var(--adriatic);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--adriatic);
  outline-offset: 2px;
}

/* High contrast focus for dark backgrounds */
.section-blue :focus-visible,
.section-deep :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--white);
}

/* --------------------------------------------------------------------------
   14. SCREEN-READER ONLY (Accessibility)
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   15. MOBILE SPACING
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .section {
    padding: var(--space-xl) 0;
  }

  .hero {
    min-height: 50vh;
    padding: var(--space-xl) var(--space-md);
  }

  .prose h2 {
    margin-top: var(--space-xl);
  }

  .contact-grid {
    gap: var(--space-lg);
  }

  .post-footer {
    margin-top: var(--space-xl);
  }
}
