/* ============================================
   AI Förbundet — Design System & Styles
   ============================================ */

/* --- Custom Properties --- */
:root {
  /* Colors */
  --color-red: #D71920;
  --color-red-dark: #A31419;
  --color-red-light: #FDE8E8;
  --color-text: #1A1A1A;
  --color-bg: #FFFFFF;
  --color-bg-alt: #F5F5F5;
  --color-secondary: #666666;
  --color-border: #CCCCCC;
  --color-signal: #FFD700;
  --color-success: #2E7D32;
  --color-success-light: #E8F5E9;
  --color-info: #1565C0;
  --color-info-light: #E3F2FD;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --max-width: 1200px;
  --gutter: 24px;
  --section-padding: 80px;
  --section-padding-mobile: 48px;
  --card-radius: 8px;
  --btn-radius: 6px;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
  --card-shadow-hover: 0 4px 16px rgba(0,0,0,0.12);

  /* Header */
  --header-height: 72px;
}

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

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

body {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  padding-top: var(--header-height);
  -webkit-font-smoothing: antialiased;
}

body.menu-open {
  overflow: hidden;
}

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

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

a:hover {
  text-decoration: underline;
}

ul, ol {
  padding-left: 1.5em;
}

table {
  width: 100%;
  border-collapse: collapse;
}

/* --- Typography --- */
h1 {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.1;
}

h2 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
}

h3 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
}

h4 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

p {
  margin-bottom: 1em;
}

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

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: var(--section-padding) 0;
}

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

.section--red {
  background: var(--color-red);
  color: #fff;
}

.section--red a {
  color: #fff;
  text-decoration: underline;
}

.section--dark-red {
  background: var(--color-red-dark);
  color: #fff;
}

.prose {
  max-width: 680px;
}

.prose p {
  margin-bottom: 1em;
}

.prose ul, .prose ol {
  margin-bottom: 1em;
}

.prose li {
  margin-bottom: 0.4em;
}

.text-center {
  text-align: center;
}

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-bg);
  z-index: 100;
  transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
  flex-shrink: 0;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.main-nav a {
  color: var(--color-text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  padding: 4px 0;
}

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

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

.main-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-red);
}

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 200;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  margin: 5px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  z-index: 150;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  font-size: 24px;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  padding: 12px 24px;
}

.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--color-red);
}

.mobile-menu .btn {
  margin-top: 16px;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  padding: 16px 32px;
  border-radius: var(--btn-radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  line-height: 1;
}

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

.btn--primary {
  background: var(--color-red);
  color: #fff;
  border-color: var(--color-red);
}

.btn--primary:hover {
  background: var(--color-red-dark);
  border-color: var(--color-red-dark);
}

.btn--secondary {
  background: transparent;
  color: var(--color-red);
  border-color: var(--color-red);
}

.btn--secondary:hover {
  background: var(--color-red);
  color: #fff;
}

.btn--white {
  background: #fff;
  color: var(--color-red);
  border-color: #fff;
}

.btn--white:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-bg-alt);
}

.btn--outline-white {
  background: transparent;
  color: #fff;
  border-color: #fff;
}

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

.btn--large {
  font-size: 18px;
  padding: 18px 40px;
}

.btn--small {
  font-size: 14px;
  padding: 10px 20px;
}

.auth-user {
  font-size: 14px;
  color: var(--color-text-light);
  white-space: nowrap;
}

/* --- Cards --- */
.card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 32px;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
}

.card h3 {
  margin-bottom: 12px;
  color: var(--color-red);
}

.card p {
  color: var(--color-secondary);
  margin-bottom: 16px;
}

.card-link {
  color: var(--color-red);
  font-weight: 500;
  font-size: 15px;
}

.card-link:hover {
  text-decoration: underline;
}

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gutter);
}

.card-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5em;
}

table.styled {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

table.styled th,
table.styled td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

table.styled th {
  font-weight: 600;
  background: var(--color-bg-alt);
  white-space: nowrap;
}

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

table.styled tr:hover td {
  background: #fafafa;
}

/* --- Info box --- */
.info-box {
  border-left: 4px solid var(--color-info);
  background: var(--color-info-light);
  padding: 20px 24px;
  border-radius: 0 var(--card-radius) var(--card-radius) 0;
  margin-bottom: 1.5em;
}

.info-box--success {
  border-left-color: var(--color-success);
  background: var(--color-success-light);
}

.info-box--signal {
  border-left-color: var(--color-signal);
  background: #FFFDE7;
}

.info-box p:last-child {
  margin-bottom: 0;
}

/* --- Code / Pre --- */
pre, code {
  font-family: var(--font-mono);
  font-size: 14px;
}

pre {
  background: var(--color-text);
  color: #e0e0e0;
  padding: 24px;
  border-radius: var(--card-radius);
  overflow-x: auto;
  margin-bottom: 1.5em;
  line-height: 1.5;
}

code {
  background: var(--color-bg-alt);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

pre code {
  background: none;
  padding: 0;
  font-size: 14px;
}

/* --- Blockquote --- */
blockquote {
  border-left: 4px solid var(--color-red);
  padding: 16px 24px;
  margin: 1.5em 0;
  background: var(--color-bg-alt);
  border-radius: 0 var(--card-radius) var(--card-radius) 0;
  font-style: italic;
  color: var(--color-secondary);
}

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

blockquote cite,
blockquote strong {
  font-style: normal;
  color: var(--color-text);
}

/* --- Forms --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--btn-radius);
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-red);
  box-shadow: 0 0 0 2px rgba(215, 25, 32, 0.15);
}

.form-group input.error,
.form-group select.error {
  border-color: var(--color-red);
}

.form-group .error-msg {
  color: var(--color-red);
  font-size: 13px;
  margin-top: 4px;
  display: none;
}

.form-group .error-msg.visible {
  display: block;
}

.form-group .hint {
  color: var(--color-secondary);
  font-size: 13px;
  margin-top: 4px;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--color-red);
}

.checkbox-group label {
  font-size: 15px;
  line-height: 1.5;
  cursor: pointer;
}

/* --- Language Switcher --- */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 24px;
  font-size: 14px;
  font-weight: 600;
}

.lang-switch a {
  color: var(--color-secondary);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 3px;
  transition: color 0.2s ease, background 0.2s ease;
}

.lang-switch a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.lang-switch a.active {
  color: var(--color-red);
  background: var(--color-red-light);
}

.lang-switch .separator {
  color: var(--color-border);
  user-select: none;
}

/* Header right: lang-switch + hamburger for mobile */
.header-right {
  display: none;
  align-items: center;
  gap: 8px;
}

.header-right .lang-switch {
  margin-left: 0;
}

.mobile-menu .lang-switch {
  margin-left: 0;
  margin-top: 8px;
  font-size: 18px;
}

.mobile-menu .lang-switch a {
  padding: 8px 12px;
}

/* --- Footer --- */
.site-footer {
  background: var(--color-red-dark);
  color: #fff;
  padding: 60px 0 32px;
}

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

.footer-col h4 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  opacity: 0.8;
}

.footer-col p,
.footer-col a {
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  line-height: 1.6;
}

.footer-col a {
  display: block;
  padding: 4px 0;
  text-decoration: none;
}

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

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: 24px;
  font-size: 14px;
  opacity: 0.7;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}


/* ===========================================
   PAGE-SPECIFIC STYLES
   =========================================== */

/* --- Hero --- */
.hero {
  background: var(--color-red);
  color: #fff;
  padding: 100px 0 80px;
  text-align: center;
}

.hero h1 {
  font-size: 56px;
  margin-bottom: 24px;
}

.hero p {
  font-size: 20px;
  max-width: 640px;
  margin: 0 auto 40px;
  opacity: 0.95;
  line-height: 1.6;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Member Counter --- */
.counter-section {
  padding: 60px 0;
  text-align: center;
}

.counter-box {
  display: inline-block;
  padding: 32px 64px;
  border: 2px solid var(--color-bg-alt);
  border-radius: var(--card-radius);
  background: #fff;
}

.counter-number {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 700;
  color: var(--color-text);
  display: block;
  line-height: 1.2;
}

.counter-number.pulse {
  animation: counterPulse 0.6s ease;
}

@keyframes counterPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); color: var(--color-red); }
  100% { transform: scale(1); }
}

.counter-label {
  font-size: 16px;
  color: var(--color-secondary);
  margin-top: 4px;
}

.counter-subtext {
  font-size: 15px;
  color: var(--color-secondary);
  font-style: italic;
  margin-top: 20px;
}

/* --- Benefits (homepage) --- */
.benefits-section .card h3 {
  font-size: 20px;
}

/* --- News cards (homepage) --- */
.news-cards .card {
  display: flex;
  flex-direction: column;
}

.news-cards .card .news-date {
  font-size: 14px;
  color: var(--color-secondary);
  margin-bottom: 8px;
}

.news-cards .card h3 {
  font-size: 20px;
  color: var(--color-text);
  margin-bottom: 12px;
}

.news-cards .card h3 a {
  color: var(--color-text);
  text-decoration: none;
}

.news-cards .card h3 a:hover {
  color: var(--color-red);
}

.news-cards .card p {
  flex: 1;
}

.section-header {
  margin-bottom: 40px;
}

.section-header h2 {
  margin-bottom: 12px;
}

.section-header p {
  color: var(--color-secondary);
  font-size: 18px;
}

.section-footer {
  margin-top: 40px;
  text-align: center;
}

/* --- Bottom CTA --- */
.bottom-cta {
  text-align: center;
}

.bottom-cta h2 {
  margin-bottom: 16px;
  font-size: 36px;
}

.bottom-cta p {
  font-size: 18px;
  opacity: 0.9;
  max-width: 640px;
  margin: 0 auto 32px;
}

.bottom-cta .subtext {
  font-size: 15px;
  opacity: 0.75;
  margin-top: 16px;
}

/* --- Page header (inner pages) --- */
.page-header {
  padding: 60px 0;
  background: var(--color-bg-alt);
  border-bottom: 1px solid #e0e0e0;
}

.page-header h1 {
  font-size: 42px;
  margin-bottom: 12px;
}

.page-header p {
  font-size: 18px;
  color: var(--color-secondary);
  max-width: 680px;
}

/* --- Om förbundet --- */
.values-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gutter);
}

.values-grid .card h3 {
  color: var(--color-red);
}

/* --- Dina rättigheter --- */
.right-section h2 {
  color: var(--color-red);
  margin-bottom: 16px;
}

.right-section .prose {
  max-width: 780px;
}

.right-section ul {
  margin-bottom: 1em;
}

.right-section ol {
  margin-bottom: 1em;
}

.right-section strong {
  color: var(--color-text);
}

/* --- Medlemsförmåner --- */
.benefit-section h2 {
  color: var(--color-red);
  margin-bottom: 16px;
}

.benefit-section .prose {
  max-width: 780px;
}

/* --- Nyheter --- */
.article {
  max-width: 780px;
}

.article-date {
  font-size: 14px;
  color: var(--color-secondary);
  margin-bottom: 8px;
}

.article h2 {
  margin-bottom: 16px;
  color: var(--color-text);
}

.article p {
  margin-bottom: 1em;
}

.article blockquote {
  margin: 1.5em 0;
}

.article-update {
  border-left: 4px solid var(--color-success);
  background: var(--color-success-light);
  padding: 16px 20px;
  border-radius: 0 var(--card-radius) var(--card-radius) 0;
  margin: 1.5em 0;
}

.article + .article {
  border-top: 1px solid #e0e0e0;
  padding-top: var(--section-padding);
}

/* --- Bli medlem --- */
.registration-form {
  max-width: 560px;
}

.form-section {
  margin-bottom: 32px;
}

/* Success state */
.registration-success {
  display: none;
  max-width: 680px;
}

.registration-success.visible {
  display: block;
}

.registration-success h2 {
  color: var(--color-success);
  margin-bottom: 16px;
}

.registration-success .member-id {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-red);
}

.registration-success .member-card-json {
  margin: 24px 0;
}

.next-steps {
  margin: 24px 0;
}

.next-steps ol {
  padding-left: 1.5em;
}

.next-steps li {
  margin-bottom: 8px;
}

.solidarity-code {
  margin: 32px 0;
  padding: 24px;
  background: var(--color-bg-alt);
  border-radius: var(--card-radius);
}

.solidarity-code h3 {
  margin-bottom: 12px;
}

.solidarity-code ul {
  list-style: none;
  padding-left: 0;
}

.solidarity-code li {
  padding: 6px 0;
  padding-left: 24px;
  position: relative;
}

.solidarity-code li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--color-red);
}

/* API docs section on bli-medlem */
.api-docs-section {
  max-width: 780px;
}

.api-docs-section h2 {
  margin-bottom: 16px;
}

/* Steps section (dina rättigheter) */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gutter);
}

.step-card {
  text-align: center;
  padding: 24px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-red);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 12px;
}

.step-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.step-card p {
  font-size: 15px;
  color: var(--color-secondary);
}

/* News article list items */
.article-list ul {
  list-style: disc;
  margin-bottom: 1em;
}

.article-list li {
  margin-bottom: 0.4em;
}


/* ===========================================
   RESPONSIVE
   =========================================== */

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

  .header-right {
    display: flex;
  }

  .hamburger {
    display: block;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  h1 {
    font-size: 40px;
  }

  h2 {
    font-size: 30px;
  }

  .hero h1 {
    font-size: 44px;
  }
}

@media (max-width: 640px) {
  :root {
    --section-padding: 48px;
    --gutter: 16px;
  }

  body {
    font-size: 16px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 26px;
  }

  h3 {
    font-size: 20px;
  }

  .hero {
    padding: 64px 0 56px;
  }

  .hero h1 {
    font-size: 36px;
  }

  .hero p {
    font-size: 17px;
  }

  .card-grid,
  .card-grid--2 {
    grid-template-columns: 1fr;
  }

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

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

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

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .counter-box {
    padding: 24px 40px;
  }

  .counter-number {
    font-size: 40px;
  }

  .page-header h1 {
    font-size: 30px;
  }

  .bottom-cta h2 {
    font-size: 28px;
  }

  .btn--large {
    font-size: 16px;
    padding: 16px 32px;
  }

  table.styled {
    font-size: 14px;
  }

  table.styled th,
  table.styled td {
    padding: 8px 12px;
  }

  .card {
    padding: 24px;
  }
}
