/* ================================================================
   Refia Group — rnet.se
   Static site, no external dependencies (fonts, CDNs, trackers).
   Theme: auto dark/light via prefers-color-scheme,
   manual override via [data-theme] set by assets/site.js.
   ================================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg: #f6f7f9;
  --bg-alt: #eef0f4;
  --surface: #ffffff;
  --text: #10141f;
  --muted: #5b6472;
  --hairline: rgba(16, 20, 31, 0.10);
  --grid-line: rgba(16, 20, 31, 0.055);
  --accent-a: #0d9f6e;   /* emerald  — greentech   */
  --accent-b: #2563eb;   /* blue     — it / fintech */
  --accent-grad: linear-gradient(120deg, var(--accent-a), var(--accent-b));
  --glow-a: rgba(13, 159, 110, 0.16);
  --glow-b: rgba(37, 99, 235, 0.14);
  --card-shadow: 0 1px 2px rgba(16, 20, 31, 0.05), 0 12px 32px -12px rgba(16, 20, 31, 0.12);
  --card-shadow-hover: 0 2px 4px rgba(16, 20, 31, 0.06), 0 20px 44px -12px rgba(16, 20, 31, 0.20);
  --btn-text: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070b14;
    --bg-alt: #0a0f1c;
    --surface: #0d1322;
    --text: #e9edf5;
    --muted: #8b95a9;
    --hairline: rgba(233, 237, 245, 0.10);
    --grid-line: rgba(233, 237, 245, 0.045);
    --accent-a: #2fd39a;
    --accent-b: #5c93ff;
    --glow-a: rgba(47, 211, 154, 0.13);
    --glow-b: rgba(92, 147, 255, 0.13);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 36px -14px rgba(0, 0, 0, 0.6);
    --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.45), 0 22px 48px -14px rgba(0, 0, 0, 0.7);
    --btn-text: #06101d;
    color-scheme: dark;
  }
}

/* Manual override beats system preference */
:root[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-alt: #eef0f4;
  --surface: #ffffff;
  --text: #10141f;
  --muted: #5b6472;
  --hairline: rgba(16, 20, 31, 0.10);
  --grid-line: rgba(16, 20, 31, 0.055);
  --accent-a: #0d9f6e;
  --accent-b: #2563eb;
  --glow-a: rgba(13, 159, 110, 0.16);
  --glow-b: rgba(37, 99, 235, 0.14);
  --card-shadow: 0 1px 2px rgba(16, 20, 31, 0.05), 0 12px 32px -12px rgba(16, 20, 31, 0.12);
  --card-shadow-hover: 0 2px 4px rgba(16, 20, 31, 0.06), 0 20px 44px -12px rgba(16, 20, 31, 0.20);
  --btn-text: #ffffff;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #070b14;
  --bg-alt: #0a0f1c;
  --surface: #0d1322;
  --text: #e9edf5;
  --muted: #8b95a9;
  --hairline: rgba(233, 237, 245, 0.10);
  --grid-line: rgba(233, 237, 245, 0.045);
  --accent-a: #2fd39a;
  --accent-b: #5c93ff;
  --glow-a: rgba(47, 211, 154, 0.13);
  --glow-b: rgba(92, 147, 255, 0.13);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 36px -14px rgba(0, 0, 0, 0.6);
  --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.45), 0 22px 48px -14px rgba(0, 0, 0, 0.7);
  --btn-text: #06101d;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; font-weight: 700; }

.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 1rem;
}

/* ---------- Scroll reveal (only hidden when JS is present) ---------- */
html.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Header / nav ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.site-header.scrolled { border-bottom-color: var(--hairline); }

.nav {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.mark {
  width: 26px;
  height: 26px;
}
/* orbit mark: ring in ink color, planet in the accent gradient (inline defs) */
.mark ellipse {
  fill: none;
  stroke: currentColor;
  stroke-width: 5.5;
  opacity: 0.85;
}
.brand-name {
  font-weight: 750;
  letter-spacing: 0.12em;
  font-size: 0.98rem;
}
.brand-name em {
  font-style: normal;
  font-weight: 350;
  color: var(--muted);
  margin-left: 0.45em;
  letter-spacing: 0.18em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  list-style: none;
}
.nav-links a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-portal {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
}

.theme-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.theme-btn:hover { color: var(--text); border-color: var(--muted); }
.theme-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .icon-sun { display: none; }
  :root:not([data-theme]) .icon-moon { display: block; }
}

.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7rem 1.5rem 4rem;
  overflow: hidden;
}

.hero-bg { position: absolute; inset: 0; z-index: -1; }
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.6s ease;
  pointer-events: none;
}
.hero-video.playing { opacity: 0.55; }
:root[data-theme="light"] .hero-video.playing { opacity: 0.5; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .hero-video.playing { opacity: 0.5; }
}
/* The video is only ever loaded on desktop-sized, motion-tolerant devices
   (see site.js), but hide it defensively on small screens too. */
@media (max-width: 899px) {
  .hero-video { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-video { display: none; }
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 75%);
}
.blob {
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}
.blob-a {
  background: var(--glow-a);
  top: -180px;
  left: -140px;
  animation: drift-a 22s ease-in-out infinite alternate;
}
.blob-b {
  background: var(--glow-b);
  bottom: -220px;
  right: -160px;
  animation: drift-b 26s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(120px, 90px) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-140px, -70px) scale(1.08); } }
@media (prefers-reduced-motion: reduce) {
  .blob-a, .blob-b { animation: none; }
}

.hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  width: 100%;
}
.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 4.9rem);
  letter-spacing: -0.03em;
  margin-bottom: 1.4rem;
}
.lede {
  max-width: 40rem;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--muted);
  margin-bottom: 2.4rem;
}
.lede strong { color: var(--text); font-weight: 600; }

.hero-actions { display: flex; gap: 0.9rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.8rem 1.7rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--accent-grad);
  color: var(--btn-text);
  box-shadow: 0 8px 24px -8px var(--glow-b), 0 8px 24px -8px var(--glow-a);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -8px var(--glow-b), 0 14px 32px -8px var(--glow-a); }
.btn-ghost {
  border: 1px solid var(--hairline);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--muted); transform: translateY(-2px); }
.btn-lg { padding: 1rem 2.4rem; font-size: 1.08rem; }

.hero-foot {
  max-width: 1160px;
  margin: 4rem auto 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: var(--muted);
}
.hero-foot .tick {
  flex: 0 0 60px;
  height: 1px;
  background: var(--hairline);
}

/* ---------- Sections ---------- */
.section {
  max-width: 1160px;
  margin: 0 auto;
  padding: 6.5rem 1.5rem;
}
.section-head { max-width: 44rem; margin-bottom: 3.4rem; }
.section h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin-bottom: 1rem; }
.section-lede { color: var(--muted); font-size: 1.08rem; }

.section-alt {
  max-width: none;
  background: var(--bg-alt);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  transition: background 0.35s ease;
}

/* ---------- Sector cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.4rem;
}
.cards .card { grid-column: span 2; }
/* five cards: center the second row (3 + 2 layout) */
.cards .card:nth-child(4) { grid-column: 2 / span 2; }
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 2rem 1.8rem 2.2rem;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
  border-color: color-mix(in srgb, var(--accent-b) 35%, var(--hairline));
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent-grad);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.card:hover::before { opacity: 1; }
.card h3 { font-size: 1.25rem; margin-bottom: 0.7rem; }
.card p { color: var(--muted); font-size: 0.97rem; }
.card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  margin-bottom: 1.4rem;
  background: color-mix(in srgb, var(--accent-b) 10%, transparent);
  color: var(--accent-b);
}
.card:nth-child(2) .card-icon,
.card:nth-child(4) .card-icon {
  background: color-mix(in srgb, var(--accent-a) 12%, transparent);
  color: var(--accent-a);
}
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card-index {
  position: absolute;
  top: 1.4rem;
  right: 1.6rem;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  opacity: 0.55;
}

/* ---------- Approach ---------- */
.approach-grid {
  max-width: 1160px;
  margin: 0 auto;
  padding: 6.5rem 1.5rem;
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 4rem;
  align-items: start;
}
.principles { display: grid; gap: 1.2rem; }
.principle {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  grid-template-rows: auto auto;
  column-gap: 1rem;
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--surface);
  transition: border-color 0.25s ease;
}
.principle:hover { border-color: color-mix(in srgb, var(--accent-a) 35%, var(--hairline)); }
.principle-no {
  grid-row: 1 / 3;
  font-size: 1.5rem;
  font-weight: 300;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  align-self: start;
  line-height: 1.3;
}
.principle h3 { font-size: 1.08rem; margin-bottom: 0.25rem; }
.principle p { color: var(--muted); font-size: 0.95rem; grid-column: 2; }

/* ---------- Presence ---------- */
.locations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.4rem;
}
.location {
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 1.9rem 1.8rem;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}
.loc-dot {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-a);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-a) 20%, transparent);
  margin-bottom: 1.2rem;
  animation: pulse 2.6s ease-in-out infinite;
}
.location:nth-child(2) .loc-dot { animation-delay: 0.8s; }
.location:nth-child(3) .loc-dot { animation-delay: 1.6s; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-a) 20%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-a) 8%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .loc-dot { animation: none; } }
.location h3 { font-size: 1.2rem; margin-bottom: 0.4rem; }
.loc-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 1.02rem;
}
.loc-time small { font-size: 0.72rem; letter-spacing: 0.14em; margin-left: 0.3rem; }

/* ---------- Contact ---------- */
.section-contact { padding-bottom: 7.5rem; }
.contact-box {
  position: relative;
  text-align: center;
  padding: 4.5rem 2rem;
  border-radius: 26px;
  border: 1px solid var(--hairline);
  background:
    radial-gradient(60% 120% at 20% 0%, var(--glow-a), transparent 60%),
    radial-gradient(60% 120% at 80% 100%, var(--glow-b), transparent 60%),
    var(--surface);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.contact-box .section-lede { max-width: 30rem; margin: 0 auto 2.2rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  background: var(--bg-alt);
  transition: background 0.35s ease;
}
.footer-top {
  max-width: 1160px;
  margin: 0 auto;
  padding: 3.2rem 1.5rem 2.4rem;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.footer-brand { display: flex; gap: 0.8rem; align-items: flex-start; }
.footer-brand .mark { width: 24px; height: 24px; margin-top: 0.2rem; }
.footer-brand strong { letter-spacing: 0.06em; }
.footer-brand p { color: var(--muted); font-size: 0.86rem; margin-top: 0.3rem; }
.footer-links {
  list-style: none;
  display: flex;
  gap: 1.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.footer-links a {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.2s ease;
}
.footer-links a:hover { color: var(--text); }

.footer-bottom {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.2rem 1.5rem 1.6rem;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.webmail {
  display: inline-grid;
  place-items: center;
  opacity: 0.45;
  transition: opacity 0.2s ease;
}
.webmail:hover { opacity: 1; }
.webmail svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Portal page ---------- */
.portal-main {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 7rem 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}
.portal-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  padding: 2.8rem 2.4rem;
  box-shadow: var(--card-shadow);
  text-align: center;
}
.portal-lock {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.4rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent-b) 10%, transparent);
  color: var(--accent-b);
}
.portal-lock svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.portal-card h1 { font-size: 1.6rem; margin-bottom: 0.6rem; }
.portal-card > p { color: var(--muted); font-size: 0.95rem; margin-bottom: 1.8rem; }
.portal-form { display: grid; gap: 0.8rem; text-align: left; }
.portal-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}
.portal-form input:focus { outline: none; border-color: var(--accent-b); }
.portal-form .btn { width: 100%; text-align: center; border: none; cursor: pointer; font-family: inherit; }
.portal-note {
  margin-top: 1.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  display: none;
}
.portal-note.show { display: block; }
.portal-back {
  margin-top: 2rem;
  font-size: 0.88rem;
}
.portal-back a { color: var(--muted); text-decoration: none; }
.portal-back a:hover { color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .cards, .locations { grid-template-columns: 1fr; }
  .cards .card { grid-column: auto; }
  .approach-grid { grid-template-columns: 1fr; gap: 2.4rem; }
  .section { padding: 4.5rem 1.5rem; }
  .approach-grid { padding: 4.5rem 1.5rem; }
}

@media (max-width: 760px) {
  .menu-btn {
    display: grid;
    gap: 5px;
    place-content: center;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    cursor: pointer;
  }
  .menu-btn span {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 0.25s ease;
  }
  .menu-btn[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

  .nav { flex-wrap: wrap; }
  .nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.1rem;
    padding: 1.2rem 0.2rem 0.8rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 1.02rem; }

  .hero { padding-top: 6rem; }
  .hero-foot { margin-top: 3rem; }
  .footer-bottom { flex-direction: row; }
}
