/* ============================================================
   Mightora Shared UI — Design tokens, base styles, and shared
   components (header, footer, author section).

   Serve via jsDelivr once published to mightora/shared-ui:
   https://cdn.jsdelivr.net/gh/mightora/shared-ui@main/shared.css
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --primary:        #111827;
  --primary-light:  #059669;
  --accent:         #059669;
  --accent-hover:   #047857;
  --success:        #065f46;
  --success-light:  #059669;
  --warning:        #e76f51;
  --danger:         #d62828;
  --danger-light:   #f07070;
  --info:           #0096c7;
  --text:           #111827;
  --text-muted:     #6b7280;
  --text-light:     #9ca3af;
  --bg:             #f9fafb;
  --bg-card:        #ffffff;
  --bg-hover:       #f3f4f6;
  --border:         #e5e7eb;
  --border-focus:   #059669;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow:         0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.12);
  --radius-sm:      4px;
  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;
  --font-sans:      system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:      ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --header-h:       60px;
  --transition:     .2s ease;
}

[data-theme="dark"] {
  --primary:        #1f1f1f;
  --primary-light:  #34d399;
  --accent:         #34d399;
  --accent-hover:   #6ee7b7;
  --success:        #022c22;
  --success-light:  #34d399;
  --text:           #f3f4f6;
  --text-muted:     #9ca3af;
  --text-light:     #6b7280;
  --bg:             #111827;
  --bg-card:        #1f1f1f;
  --bg-hover:       #2a2a2a;
  --border:         #374151;
  --border-focus:   #34d399;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
  --shadow:         0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.5);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

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

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

code, pre, .mono { font-family: var(--font-mono); }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { color: var(--text-muted); line-height: 1.7; }

.text-small  { font-size: .85rem; }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }

/* ── Layout Helpers ─────────────────────────────────────────── */
.container      { max-width: 1300px; margin: 0 auto; padding: 0 1.5rem; }
.container-wide { max-width: 1600px; margin: 0 auto; padding: 0 1.5rem; }

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

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap     { display: flex; align-items: center; gap: .75rem; }
.flex-wrap    { flex-wrap: wrap; }
.gap-sm       { gap: .5rem; }
.gap          { gap: 1rem; }
.gap-lg       { gap: 1.5rem; }

/* ── Header / Navigation ────────────────────────────────────── */
mightora-header,
.site-header {
  display: block;
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 2px 4px rgba(0,0,0,.02), 0 1px 0 rgba(0,0,0,.06);
}
[data-theme="dark"] mightora-header,
[data-theme="dark"] .site-header {
  background: #1f1f1f;
  border-bottom: 1px solid #2d2d2d;
  box-shadow: 0 -1px 0 rgba(255,255,255,.06) inset;
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}
.site-logo-brand-img {
  height: 32px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
.logo-dark  { display: none; }
[data-theme="dark"] .logo-dark  { display: none; }
[data-theme="dark"] .logo-light { display: block; filter: brightness(0) invert(1); opacity: .8; }

.site-logo-divider {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: #d1d5db;
  margin: 0 .5rem;
  vertical-align: middle;
  flex-shrink: 0;
}
[data-theme="dark"] .site-logo-divider { background: #4b5563; }

.site-logo-text {
  font-weight: 800;
  font-size: 1rem;
  color: #111827;
  letter-spacing: -.4px;
  white-space: nowrap;
}
[data-theme="dark"] .site-logo-text { color: #f3f4f6; }
.site-logo-text span { color: var(--accent); }

.header-nav { display: flex; align-items: center; gap: .25rem; }
.header-nav a {
  color: #6b7280;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  padding: .3rem .6rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.header-nav a:hover { color: #111827; background: #f3f4f6; text-decoration: none; }
[data-theme="dark"] .header-nav a { color: #9ca3af; }
[data-theme="dark"] .header-nav a:hover { color: #f3f4f6; background: rgba(255,255,255,.06); }
.header-nav a.ext-link { color: var(--accent); }
[data-theme="dark"] .header-nav a.ext-link { color: var(--accent); }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: .375rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.theme-toggle:hover { background: #f3f4f6; color: #111827; }
[data-theme="dark"] .theme-toggle { color: #9ca3af; }
[data-theme="dark"] .theme-toggle:hover { background: rgba(255,255,255,.06); color: #f3f4f6; }
.theme-toggle svg { width: 1.125rem; height: 1.125rem; pointer-events: none; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 1.25rem;
  cursor: pointer;
  padding: .25rem;
  border-radius: var(--radius-sm);
}
[data-theme="dark"] .mobile-menu-btn { color: #9ca3af; }

/* ── Author Section ─────────────────────────────────────────── */
mightora-author,
.author-section {
  display: block;
  background-image: url('https://raw.githubusercontent.com/TechTweedie/techtweedie.github.io/v2/assets/images/author/ian-tweedie-presenting-4.png');
  background-size: cover;
  background-position: center center;
}
.author-section-overlay { background: rgba(0,0,0,.45); padding: 5rem 1.5rem; }
.author-section-inner { max-width: 780px; margin: 0 auto; display: flex; gap: 2rem; align-items: center; }
.author-photos { display: flex; flex-direction: column; gap: 1rem; align-items: center; flex-shrink: 0; }
.author-avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255,255,255,.4); }
.author-blog-logo { width: 110px; height: auto; }
.author-heading { font-size: 1.375rem; font-weight: 800; color: #fff; margin: 0 0 .75rem; }
.author-bio { font-size: .9375rem; line-height: 1.7; color: rgba(255,255,255,.88); margin: 0 0 1.25rem; }
.author-bio strong { color: #fff; }
.author-links { display: flex; gap: .75rem; flex-wrap: wrap; }
.author-link {
  display: inline-block; background: rgba(255,255,255,.15); color: #fff;
  text-decoration: none; padding: .4rem .875rem; border-radius: .375rem;
  font-size: .875rem; font-weight: 600; border: 1px solid rgba(255,255,255,.3);
  transition: background .15s;
}
.author-link:hover { background: rgba(255,255,255,.28); color: #fff; text-decoration: none; }
@media (max-width: 600px) {
  .author-section-inner { flex-direction: column; text-align: center; }
  .author-links { justify-content: center; }
}

/* ── Footer ─────────────────────────────────────────────────── */
mightora-footer,
.site-footer {
  display: block;
  background: #111827;
  color: rgba(255,255,255,.75);
  padding: 3rem 0 0;
}
.footer-main { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-bottom: 2.5rem; }
.footer-col-sections { display: flex; flex-direction: column; gap: 1.5rem; }
.footer-section-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
  font-weight: 700;
  margin-bottom: .75rem;
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: .45rem; }
.footer-links a {
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  text-decoration: none;
  transition: color var(--transition);
}
.footer-links a:hover { color: #fff; }

.footer-brands {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 1.5rem 0;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  padding: .6rem 1rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  transition: background var(--transition);
}
.footer-brand:hover { background: rgba(255,255,255,.12); }
.footer-brand img { height: 28px; width: auto; max-width: 120px; object-fit: contain; filter: brightness(0) invert(1); opacity: .8; }
.footer-brand img[src*="TechTweedie"] { filter: none; opacity: 1; }
.footer-brand-desc { font-size: .75rem; color: rgba(255,255,255,.5); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 1.25rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
}
.footer-copy { font-size: .8rem; color: rgba(255,255,255,.4); }
.footer-copy a { color: rgba(255,255,255,.6); }
.footer-bottom-links { display: flex; gap: 1rem; }
.footer-bottom-links a { font-size: .8rem; color: rgba(255,255,255,.5); text-decoration: none; }
.footer-bottom-links a:hover { color: #fff; }

/* ── Responsive (header & footer) ───────────────────────────── */
@media (max-width: 768px) {
  .header-nav { display: none; }
  .mobile-menu-btn { display: flex; }
  .header-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: #ffffff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 8px 16px rgba(0,0,0,.08);
    z-index: 99;
  }
  [data-theme="dark"] .header-nav.open {
    background: #1f1f1f;
    border-bottom-color: #2d2d2d;
  }
  .footer-main { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
