/* ==========================================================================
   LAYOUT DESIGN SYSTEM — Modern Minimalist
   8px grid · BEM naming · Mobile-first · System fonts
   ========================================================================== */

/* ---------- 1. CSS Custom Properties (Design Tokens) ---------- */
:root {
  /* Spacing scale (8px grid) */
  --space-1: 0.25rem;   /*  4px */
  --space-2: 0.5rem;    /*  8px */
  --space-3: 1rem;      /* 16px */
  --space-4: 1.5rem;    /* 24px */
  --space-5: 2rem;      /* 32px */
  --space-6: 3rem;      /* 48px */
  --space-7: 4rem;      /* 64px */
  --space-8: 6rem;      /* 96px */

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

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

  --leading-tight:  1.25;
  --leading-normal: 1.6;

  /* Colours – light theme */
  --color-bg:          #fafbfc;
  --color-surface:     #ffffff;
  --color-surface-alt: #f4f6f8;
  --color-text:        #1a1a2e;
  --color-text-muted:  #6b7280;
  --color-primary:     #3b82f6;
  --color-primary-hover:#2563eb;
  --color-accent:      #06b6d4;
  --color-border:      #e5e7eb;
  --color-border-light:#f0f1f3;
  --color-gradient-start: #3b82f6;
  --color-gradient-end:   #06b6d4;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,.08), 0 8px 10px -6px rgba(0,0,0,.04);

  /* Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(.25,.46,.45,.94);
  --duration: 0.2s;

  /* Layout */
  --container-max: 1200px;
  --header-height: 64px;
}

/* ---------- Dark-theme overrides ---------- */
html[data-theme="dark"] {
  --color-bg:          #0f172a;
  --color-surface:     #1e293b;
  --color-surface-alt: #162033;
  --color-text:        #e2e8f0;
  --color-text-muted:  #94a3b8;
  --color-border:      #334155;
  --color-border-light:#1e293b;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.3);
  --shadow-md:  0 4px 6px rgba(0,0,0,.35);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.4);
}

/* ---------- 2. Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}
a:hover {
  color: var(--color-primary-hover);
}

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

/* ---------- 3. Layout ---------- */
.site-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

/* ---------- 4. Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--color-border-light);
  transition: box-shadow var(--duration) var(--ease-out);
}
html[data-theme="dark"] .site-header {
  background: rgba(15,23,42,.85);
}
.site-header.is-scrolled {
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav__brand {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: color var(--duration) var(--ease-out);
}
.nav__brand:hover {
  color: var(--color-primary);
}
.nav__brand-accent {
  background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav__links {
  display: none;
  list-style: none;
  gap: var(--space-1);
}
@media (min-width: 1024px) {
  .nav__links {
    display: flex;
    align-items: center;
  }
}

.nav__item {
  display: list-item;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--duration) var(--ease-out),
              background var(--duration) var(--ease-out);
}
.nav__link:hover,
.nav__link:focus-visible {
  color: var(--color-primary);
  background: rgba(59,130,246,.06);
}

/* Theme toggle */
.nav__theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--text-base);
  transition: background var(--duration) var(--ease-out),
              color var(--duration) var(--ease-out);
}
.nav__theme-toggle:hover {
  background: var(--color-border);
  color: var(--color-text);
}

/* Header right-side actions */
.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Mobile menu button */
.nav__mobile-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font-size: var(--text-xl);
}
@media (min-width: 1024px) {
  .nav__mobile-toggle {
    display: none;
  }
}

/* Mobile nav drawer */
.nav__mobile-menu {
  display: none;
  position: fixed;
  inset: var(--header-height) 0 0 0;
  z-index: 999;
  background: var(--color-surface);
  padding: var(--space-4);
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid var(--color-border-light);
  animation: slideDown .25s var(--ease-out);
}
.nav__mobile-menu.is-open {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.nav__mobile-menu .nav__link {
  font-size: var(--text-base);
  padding: var(--space-2) var(--space-3);
  width: 100%;
  border-radius: var(--radius-md);
}

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

/* ---------- 5. Main ---------- */
.site-main {
  flex: 1;
  padding-block: var(--space-6);
}
.site-main > .container {
  width: 100%;
}

/* ---------- 6. Sections (utility) ---------- */
.section {
  padding-block: var(--space-7);
}
.section--light {
  background: var(--color-surface);
}
.section--dark {
  background: var(--color-surface-alt);
}
.section--gradient {
  background: linear-gradient(180deg, var(--color-bg), var(--color-surface-alt));
}
.section__title {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: var(--leading-tight);
  margin-bottom: var(--space-4);
}
.section__subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 42rem;
  margin-bottom: var(--space-5);
}

/* ---------- 7. Cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card__body {
  padding: var(--space-4);
}
.card__title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
  line-height: var(--leading-tight);
}
.card__text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}
.card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.card__footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border-light);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ---------- 8. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}
.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn--outline:hover {
  background: var(--color-primary);
  color: #fff;
}
.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn--ghost:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}
.btn--sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}
.btn--lg {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}
.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* Social share buttons */
.btn--linkedin  { background: #0A66C2; color: #fff; }
.btn--linkedin:hover  { background: #004182; color: #fff; }
.btn--x         { background: #000;    color: #fff; }
.btn--x:hover         { background: #333;    color: #fff; }
.btn--facebook  { background: #1877F2; color: #fff; }
.btn--facebook:hover  { background: #0d5dc7; color: #fff; }

/* ---------- 9. Share Section ---------- */
.share {
  padding-block: var(--space-5);
  text-align: center;
  border-top: 1px solid var(--color-border-light);
}
.share__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}
.share__buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ---------- 10. Footer ---------- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  padding-block: var(--space-6);
}
.site-footer .container {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-4);
  list-style: none;
}
.footer__nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--duration) var(--ease-out);
}
.footer__nav-link:hover {
  color: var(--color-primary);
}

.footer__social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  list-style: none;
}
.footer__social-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: color var(--duration) var(--ease-out);
}
.footer__social-link:hover {
  color: var(--color-primary);
}
.footer__social-link i {
  font-size: var(--text-base);
}

.footer__copy {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}
.footer__copy a {
  font-weight: 500;
}

/* Footer divider between groups */
.footer__divider {
  width: 48px;
  height: 1px;
  background: var(--color-border);
  margin-inline: auto;
}

/* ---------- 11. Utility Classes ---------- */
.text-center { text-align: center; }
.text-muted  { color: var(--color-text-muted); }
.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;
}

.grid {
  display: grid;
  gap: var(--space-4);
}
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }

/* ---------- 12. Gradient accent line ---------- */
.accent-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--color-gradient-start), var(--color-gradient-end));
}

/* ---------- 13. Responsive helpers ---------- */
@media (min-width: 640px) {
  .container { padding-inline: var(--space-5); }
}
@media (min-width: 1024px) {
  .container { padding-inline: var(--space-6); }
}

/* ---------- 14. Smooth scroll-to-top (optional) ---------- */
.back-to-top {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}
.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ---------- 15. Print ---------- */
@media print {
  .site-header,
  .share,
  .back-to-top { display: none; }
  body { background: #fff; color: #000; }
}
