/* =============================================================================
   Snacka tro – huvudstilmall
   -----------------------------------------------------------------------------
   Ljus, varm och modern design med en cyan signaturfärg (#49d0f5).
   Byggd för att vara supersnygg men stilren, fullt responsiv och tillgänglig
   (WCAG 2.2 AA). Alla färgkontraster är valda för att klara AA.

   Innehåll:
     1. Designtokens (färger, typografi, avstånd)
     2. Grund & tillgänglighet
     3. Sidhuvud / navigering
     4. Hero + chatt (startsidans hjärta)
     5. FAQ, Om oss, formulär, sidor
     6. Sidfot
     7. Cookie-banner
     8. Responsivitet & rörelsehänsyn
   ========================================================================== */

/* 1. ---------- Designtokens ------------------------------------------------ */
:root {
  /* Cyan-palett. --brand används på ytor med vit text (WCAG-säker, 5.7:1). */
  --brand:        #0a6e93;   /* primär (knappar med vit text) */
  --brand-dark:   #075e7d;   /* hover / accenttext på ljust (7.2:1) */
  --brand-bright: #49d0f5;   /* ljus accent, dekor, fokusglow */
  --brand-050:    #eef8fd;   /* mycket ljus tonad bakgrund */
  --brand-100:    #d6eefb;   /* ljusa kanter/chips */

  --ink:      #14181c;       /* primär text (nära svart) */
  --muted:    #4a5a63;       /* sekundär text (7.1:1 på vitt) */
  --line:     #e4edf2;       /* hårfina linjer */
  --bg:       #f7fbfd;       /* sidbakgrund, svagt blåtonad */
  --card:     #ffffff;       /* kort/ytor */

  --ok:       #0f7a52;
  --err:      #b3261e;

  --radius:   14px;
  --radius-lg:24px;
  --shadow-sm: 0 1px 3px rgba(16,42,60,.06), 0 1px 2px rgba(16,42,60,.04);
  --shadow-md: 0 10px 30px rgba(16,60,80,.10), 0 2px 8px rgba(16,60,80,.06);
  --shadow-lg: 0 24px 60px rgba(12,58,80,.16);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          Helvetica, Arial, "Helvetica Neue", sans-serif;
  --maxw: 1140px;
}

/* 2. ---------- Grund & tillgänglighet -------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Sticky footer: sidfoten sitter alltid längst ner även om sidan är kort,
     så det aldrig blir en tom bakgrundsyta under sidfoten. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
/* Subtil bibelbakgrund bakom hela sidan. Ett ljust överlägg gör bilden svag
   så att texten förblir lättläst (WCAG), samtidigt som sidan känns levande.
   Ligger som ett fast lager (position: fixed) bakom allt innehåll. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(247, 251, 253, 0.62), rgba(247, 251, 253, 0.78)),
    url('/assets/img/Bibel.jpeg') center / cover no-repeat;
}
main { flex: 1 0 auto; }

h1, h2, h3 { line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1rem; }

a { color: var(--brand-dark); text-decoration-color: var(--brand-100); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--brand); }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.muted { color: var(--muted); }
.lead  { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }

/* Endast för skärmläsare (osynligt visuellt) */
.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;
}
/* Hoppa-till-innehåll-länk, syns vid tangentbordsfokus */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

/* Tydlig, konsekvent fokusmarkering för tangentbord (WCAG) */
:focus-visible {
  outline: 3px solid var(--brand-bright);
  outline-offset: 2px;
  border-radius: 6px;
}

/* 3. ---------- Sidhuvud ---------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247, 251, 253, .82);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; height: 34px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 8px; }
.brand { flex-shrink: 0; }
.site-nav { flex-shrink: 0; }
.site-nav a {
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px;
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: var(--brand-050); }
.site-nav a[aria-current="page"] { color: var(--brand-dark); }
/* Språkväxlaren – diskret pill med jordglob, matchar övrig design */
.site-nav .lang-toggle {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
  transition: color .12s, background .12s, border-color .12s;
}
.site-nav .lang-toggle:hover { color: var(--brand-dark); background: var(--brand-050); border-color: var(--brand-100); }
.site-nav .lang-toggle svg { opacity: .85; }

/* 4. ---------- Hero + chatt ------------------------------------------------ */
.hero { position: relative; padding: clamp(28px, 5vw, 64px) 0 clamp(32px, 5vw, 56px); overflow: hidden; }
/* Mjuk cyan "aura" bakom innehållet – subtil, ger djup utan att störa. */
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 620px; height: 620px;
  background: radial-gradient(closest-side, rgba(73,208,245,.28), rgba(73,208,245,0) 70%);
  pointer-events: none; z-index: 0;
}
.hero-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.hero-copy { max-width: 34rem; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--brand-100); color: var(--brand-dark);
  font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-bright); }
.hero-title { margin-bottom: .3em; }
.hero-sub { font-size: 1.2rem; color: var(--muted); margin-bottom: 24px; }

/* Centrerad hero (rubrik + trygghetsrad ovanför den stora chatten) */
.hero-center { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; text-align: center; }
.hero-center .hero-title { margin-bottom: .35em; }
.hero-center .hero-sub { margin-left: auto; margin-right: auto; max-width: 52ch; }

/* Trygghetsrad – syns direkt högt upp */
.trust-row {
  list-style: none; display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px 14px; padding: 0; margin: 26px 0 0;
}
.trust-row li {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 500; color: var(--brand-dark);
  background: #fff; border: 1px solid var(--brand-100);
  padding: 9px 16px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.trust-row svg { color: var(--brand); flex: 0 0 auto; }

/* Chatt-sektionen – stor och central */
.chat-section { padding: clamp(22px, 4vw, 38px) 0 clamp(36px, 6vw, 64px); }

.suggestions { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  background: #fff; color: var(--brand-dark); border: 1px solid var(--brand-100);
  padding: 9px 16px; border-radius: 999px; transition: transform .12s, background .12s;
}
.chip:hover { background: var(--brand-050); transform: translateY(-1px); }
.chip:active { transform: translateY(0); }

/* Chattkortet */
.chat-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  max-width: 960px; margin: 0 auto;   /* stor och central */
}
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.chat-orb {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--brand-bright), var(--brand));
  box-shadow: 0 0 0 4px rgba(73,208,245,.16);
}
.chat-head-title { font-weight: 600; }
.chat-restart {
  margin-left: auto; font: inherit; font-size: 14px; font-weight: 500;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.chat-restart:hover { color: var(--brand-dark); background: var(--brand-050); }

.chat-log {
  flex: 1; overflow-y: auto; padding: 22px 22px 8px; display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth; min-height: 46vh; max-height: 64vh;
}

/* Exempelfrågor inne i chatten */
.chat-starters { margin: 6px 2px 4px; }
.starters-label { display: block; font-size: 13.5px; color: var(--muted); margin: 0 2px 10px; }
.starters-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.starter {
  font: inherit; font-size: 15px; text-align: left; cursor: pointer;
  background: #fff; color: var(--brand-dark); border: 1px solid var(--brand-100);
  border-radius: 14px; padding: 13px 16px;
  transition: transform .12s, background .12s, border-color .12s;
}
.starter:hover { background: var(--brand-050); border-color: var(--brand); transform: translateY(-1px); }
.starter:active { transform: translateY(0); }
.msg { max-width: 85%; padding: 12px 16px; border-radius: 18px; font-size: 16px; }
.msg p { margin: 0; }
.msg p + p { margin-top: .6em; }
/* Ren, enkel formatering av AI-svar (som Claude/Gemini) */
.msg strong { font-weight: 600; }
.msg em { font-style: italic; }
.msg code { background: rgba(10,60,80,.08); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.msg a { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
.msg-user a { color: #fff; }
.msg .md-h { font-weight: 600; margin-top: .7em; }
.msg .md-h:first-child { margin-top: 0; }
.msg ul, .msg ol { margin: .4em 0; padding-left: 1.25em; }
.msg li { margin: .2em 0; }
.msg li::marker { color: var(--brand); }
.msg-bot  { align-self: flex-start; background: var(--brand-050); color: var(--ink); border-bottom-left-radius: 6px; }
.msg-user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.msg-source {
  align-self: flex-start; font-size: 12px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; margin: -6px 0 0 4px;
}
.msg-source::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-bright); }

/* "Tänker"-indikator med tre prickar */
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); opacity: .5; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100% { opacity: .3; } 30% { opacity: 1; } }

.chat-input {
  display: flex; align-items: flex-end; gap: 10px; padding: 14px 16px;
  border-top: 1px solid var(--line); background: #fff;
}
.chat-input textarea {
  flex: 1; resize: none; font: inherit; font-size: 16px; line-height: 1.5;
  border: 1px solid var(--line); border-radius: 16px; padding: 11px 15px;
  max-height: 140px; background: var(--bg); color: var(--ink);
}
.chat-input textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(73,208,245,.3); background: #fff; }
.chat-send {
  flex: 0 0 auto; width: 46px; height: 46px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  transition: background .15s, transform .12s;
}
.chat-send:hover { background: var(--brand-dark); }
.chat-send:active { transform: scale(.94); }
.chat-send:disabled { background: #9fc3d2; cursor: default; }

.chat-disclaimer { font-size: 12.5px; color: var(--muted); padding: 0 20px 16px; margin: 0; }

/* 5. ---------- FAQ, Om oss, formulär, sidor -------------------------------- */
.faq { padding: clamp(36px, 6vw, 72px) 22px; }
.faq h2 { text-align: center; margin-bottom: 28px; }
.faq-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.faq-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.faq-item h3 { margin-bottom: 6px; }

.page { padding: clamp(32px, 5vw, 60px) 22px; max-width: 900px; }
.page .lead { margin-bottom: 2rem; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 2rem; }

.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin: 1.5rem 0; }
.about-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.about-card h3 { color: var(--brand-dark); }
.link { font-weight: 600; text-decoration: none; }
.about-together { font-size: 1.15rem; color: var(--muted); margin: 1.5rem 0 2.5rem; max-width: 60ch; }

.contact-form { max-width: 560px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(73,208,245,.3); }
.hp { position: absolute; left: -9999px; }   /* honeypot: dolt för människor */
.form-status { min-height: 1.4em; font-size: 15px; margin-top: 12px; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--err); }

/* Knappar */
.btn { font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; border: 0; border-radius: 12px; padding: 12px 22px; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--brand-dark); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--brand-050); }

/* 6. ---------- Sidfot ------------------------------------------------------ */
.site-footer { border-top: 1px solid var(--line); background: #fff; margin-top: 40px; flex-shrink: 0; }
.footer-inner { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 28px 22px; }
.footer-brand img { height: 32px; }
.footer-nav { display: flex; gap: 20px; }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.footer-nav a:hover { color: var(--brand-dark); }
.footer-copy { margin: 0 0 0 auto; color: var(--muted); font-size: 14px; }

/* 7. ---------- Cookie-banner ---------------------------------------------- */
.cookie-consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-width: 720px; margin: 0 auto;
}
.cc-inner { display: flex; align-items: center; gap: 20px; padding: 18px 22px; flex-wrap: wrap; }
.cc-text { flex: 1 1 320px; }
.cc-text strong { display: block; margin-bottom: 4px; }
.cc-text p { margin: 0; font-size: 14.5px; color: var(--muted); }
.cc-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cc-actions .btn { padding: 10px 18px; font-size: 15px; }

/* 8. ---------- Responsivitet & rörelsehänsyn ------------------------------ */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { max-width: none; order: 1; }
  .chat-card { order: 2; max-height: none; }
  .about-grid { grid-template-columns: 1fr; }
  .faq-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .header-inner { height: 58px; }
  .brand img { height: 28px; }
  .site-nav { gap: 5px; }
  .site-nav a { padding: 6px 8px; font-size: 14px; }
  .site-nav .lang-toggle { padding: 6px 10px; gap: 5px; }
  .chat-log { max-height: 56vh; }
  .starters-grid { grid-template-columns: 1fr; }
  .trust-row li { font-size: 13.5px; padding: 8px 13px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-copy { margin: 0; }
}
/* På riktigt smala skärmar: visa bara jordgloben i språkknappen (spar plats). */
@media (max-width: 420px) {
  .brand img { height: 26px; }
  .site-nav .lang-toggle span { display: none; }
  .site-nav .lang-toggle { padding: 7px; }
}

/* Respektera användare som vill ha mindre rörelse */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
