/* ============================================
   Bara Fiber - Hemsida
   ============================================ */

:root {
  --color-primary: #0a3d62;
  --color-primary-dark: #052c4a;
  --color-primary-light: #dde9f3;
  --color-accent: #00b8a9;
  --color-accent-dark: #008f82;
  --color-bg: #ffffff;
  --color-bg-alt: #f7f9fc;
  --color-bg-card: #ffffff;
  --color-text: #1a2332;
  --color-text-muted: #5a6577;
  --color-border: #e5e9f0;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  --shadow-sm: 0 1px 2px rgba(10, 61, 98, 0.05);
  --shadow-md: 0 4px 12px rgba(10, 61, 98, 0.08);
  --shadow-lg: 0 12px 32px rgba(10, 61, 98, 0.12);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --container: 1200px;
  --container-narrow: 860px;

  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-text);
}

h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

p { margin-bottom: 1rem; }

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

a:hover {
  color: var(--color-accent);
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li { margin-bottom: 0.375rem; }

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

/* ============================================
   Layout
   ============================================ */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 4rem 0;
}

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

/* ============================================
   Header / Navigation
   ============================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--color-border);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--color-primary);
  letter-spacing: -0.01em;
}

.logo:hover { color: var(--color-primary); }

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1rem;
}

.nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav a {
  padding: 0.5rem 0.875rem;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.9375rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav a:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.nav a.active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1.5rem;
  color: var(--color-text);
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: white;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    gap: 0;
  }
  .nav.open { display: flex; }
  .nav a {
    width: 100%;
    padding: 0.75rem 1rem;
  }
}

/* ============================================
   Hero
   ============================================ */

.hero {
  position: relative;
  padding: 5rem 0 6rem;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 184, 169, 0.25), transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 184, 169, 0.15), transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero h1 {
  color: white;
  margin-bottom: 1.25rem;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
}

.hero p.lead {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2rem;
  max-width: 580px;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.stat .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-accent);
  display: block;
  letter-spacing: -0.02em;
}

.stat .stat-label {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Page hero (smaller, for sub-pages) */
.page-hero {
  padding: 3.5rem 0 2.5rem;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 184, 169, 0.2), transparent 70%);
  pointer-events: none;
}

.page-hero h1 {
  color: white;
  position: relative;
  z-index: 1;
}

.page-hero p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.125rem;
  max-width: 640px;
  margin-top: 0.75rem;
  position: relative;
  z-index: 1;
}

.breadcrumb {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}

.breadcrumb a {
  color: rgba(255, 255, 255, 0.85);
}

.breadcrumb a:hover {
  color: white;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--color-accent);
  color: white;
}

.btn-primary:hover {
  background: var(--color-accent-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: white;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================================
   Cards / Grid
   ============================================ */

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-link {
  display: block;
  color: inherit;
}

.card-link:hover { color: inherit; }

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.card h3 {
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

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

.card-arrow {
  margin-top: 1rem;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.9375rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ============================================
   Content / Prose
   ============================================ */

.prose {
  max-width: var(--container-narrow);
  margin: 0 auto;
}

.prose h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary-light);
}

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

.prose h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
}

.prose ul, .prose ol { margin-bottom: 1.25rem; }

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--color-primary-light);
  text-underline-offset: 3px;
}

.prose a:hover {
  text-decoration-color: var(--color-accent);
}

/* ============================================
   Tables
   ============================================ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

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

th, td {
  padding: 0.875rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  background: var(--color-bg-alt);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--color-bg-alt); }

/* ============================================
   Notices / Callouts
   ============================================ */

.notice {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  border-left: 4px solid var(--color-primary);
  background: var(--color-primary-light);
}

.notice.warning {
  border-left-color: var(--color-warning);
  background: #fff8e1;
}

.notice.danger {
  border-left-color: var(--color-danger);
  background: #fee2e2;
}

.notice strong { color: var(--color-primary); }

/* ============================================
   Documents (Drive sync)
   ============================================ */

.documents-section {
  margin-top: 2rem;
}

.doc-category {
  margin-bottom: 2.5rem;
}

.doc-category h3 {
  font-size: 1.25rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* Fällbar år-grupp (<details>) */
.doc-year {
  margin-bottom: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-card);
}

.doc-year-summary {
  cursor: pointer;
  padding: 0.875rem 1.25rem;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background var(--transition);
  list-style: none;
  user-select: none;
}

.doc-year-summary::-webkit-details-marker {
  display: none;
}

.doc-year-summary::marker {
  content: '';
}

.doc-year-summary::after {
  content: '+';
  color: var(--color-text-muted);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
  transition: transform var(--transition);
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.doc-year[open] > .doc-year-summary::after {
  content: '−';
}

.doc-year-summary:hover {
  background: var(--color-primary-light);
}

.doc-year-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.01em;
}

.doc-year-count {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-left: auto;
  margin-right: 0.5rem;
}

.doc-year > .doc-list {
  padding: 0.5rem;
}

.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
  color: var(--color-text);
}

.doc-item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-text);
  transform: translateX(2px);
}

.doc-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.doc-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.doc-name {
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--color-text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.doc-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* Mobil: gör tabeller till kort-layout per rad istället för horisontell scroll */
@media (max-width: 768px) {
  .table-wrapper {
    border: none !important;
    background: transparent !important;
    overflow: visible !important;
    border-radius: 0 !important;
    margin: 1rem 0 !important;
  }
  .table-wrapper table {
    width: 100% !important;
    border-collapse: separate !important;
  }
  .table-wrapper thead {
    display: none !important;
  }
  .table-wrapper tbody {
    display: block !important;
  }
  .table-wrapper tr {
    display: block !important;
    margin-bottom: 0.75rem !important;
    padding: 1rem 1.125rem !important;
    background: var(--color-bg-card) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-md) !important;
  }
  .table-wrapper tr:hover {
    background: var(--color-bg-card) !important;
  }
  .table-wrapper td {
    display: block !important;
    padding: 0.125rem 0 !important;
    border: none !important;
    text-align: left !important;
    white-space: normal !important;
  }
  /* Första cellen (namn/etikett) blir stor och i primärfärg */
  .table-wrapper td:first-child {
    font-size: 1.0625rem !important;
    font-weight: 600 !important;
    color: var(--color-primary) !important;
    margin-bottom: 0.375rem !important;
  }
  /* Andra cellen (huvudbelopp) blir extra stor och bold */
  .table-wrapper td:nth-child(2) {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: var(--color-text) !important;
  }
  /* Tredje cellen (notering/ordinarie pris) är liten och dämpad */
  .table-wrapper td:nth-child(3) {
    font-size: 0.875rem !important;
    color: var(--color-text-muted) !important;
    margin-top: 0.375rem !important;
  }
  /* Doc-items: lite mer padding och inget hover-translate på mobil */
  .doc-item {
    padding: 1rem;
  }
  .doc-item:hover {
    transform: none;
  }
}

.doc-arrow {
  color: var(--color-text-muted);
  font-size: 1rem;
  flex-shrink: 0;
}

.doc-loading, .doc-error, .doc-empty {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
}

/* ============================================
   Contact card
   ============================================ */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.contact-item {
  padding: 1.25rem;
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.contact-item-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.contact-item-value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
}

.contact-item-value a {
  color: var(--color-primary);
}

/* ============================================
   Board members
   ============================================ */

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.board-member {
  padding: 1.25rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.board-member-role {
  font-size: 0.8125rem;
  color: var(--color-accent-dark);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.board-member-name {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text);
}

/* ============================================
   Footer
   ============================================ */

.site-footer {
  background: var(--color-primary-dark);
  color: rgba(255, 255, 255, 0.8);
  padding: 3.5rem 0 1.5rem;
  margin-top: 4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 700px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.footer-brand .logo {
  color: white;
  margin-bottom: 1rem;
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9375rem;
  max-width: 360px;
}

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

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

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

.footer-col a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9375rem;
}

.footer-col a:hover { color: var(--color-accent); }

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   Anchor nav (TOC for long pages)
   ============================================ */

.toc {
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--color-border);
}

.toc-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.625rem;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.toc li { margin: 0; }

.toc a {
  font-size: 0.9375rem;
  color: var(--color-text);
  font-weight: 500;
}

.toc a:hover { color: var(--color-accent); }

/* ============================================
   Utilities
   ============================================ */

.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }
