/* Terralys — terralys.se
   Design: 04 Horisont. Lato Bold headings, IBM Plex Sans text, deep green accent. */

/* Fonts (latin subsets, SIL Open Font License) */
@font-face {
  font-family: "Lato";
  src: url("../fonts/lato-700.woff2?v=c447dd7677b419db") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-400.woff2?v=3b646991d30055a9") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Tokens */
:root {
  --paper: oklch(0.993 0.003 128);
  --band: oklch(0.963 0.009 129);
  --card: oklch(0.997 0.002 128);
  --ink: oklch(0.302 0.032 150);
  --muted: oklch(0.516 0.02 145);
  --line: oklch(0.894 0.013 131);
  --accent: oklch(0.377 0.054 154);
  --accent-hover: oklch(0.43 0.06 154);
  --focus: oklch(0.609 0.1 72);
  --on-photo: oklch(0.99 0.004 128);
  --shade: 13 28 17; /* rgb channels for the hero overlay */

  --font-heading: "Lato", Arial, sans-serif;
  --font-text: "IBM Plex Sans", Arial, sans-serif;

  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;
  --section: clamp(44px, 2.5rem + 2.6vw, 72px);

  --page-max: 1480px;
  --page-pad: max(20px, 6%);
  --radius: 5px;
  --radius-lg: 8px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--space-xl); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.125rem/1.65 var(--font-text); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, figure, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; overflow-wrap: break-word; hyphens: manual; text-wrap: balance; }
h1 { font-size: clamp(2.125rem, 1.4rem + 3.6vw, 4.75rem); line-height: 1.1; letter-spacing: -0.035em; }
h2 { font-size: clamp(2rem, 1.3rem + 1.9vw, 3rem); line-height: 1.15; letter-spacing: -0.025em; }
h3 { font-size: clamp(1.4375rem, 1.3rem + .3vw, 1.5625rem); line-height: 1.25; letter-spacing: -0.015em; }
p { text-wrap: pretty; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 6px; border-radius: 2px; }

.wrap { width: 100%; max-width: var(--page-max); margin-inline: auto; padding-inline: var(--page-pad); }
.eyebrow { font-size: 1rem; color: var(--muted); }

.skip { position: absolute; left: var(--space-lg); top: -100px; z-index: 20; padding: var(--space-sm) var(--space-md); background: var(--paper); color: var(--ink); border: 1px solid var(--ink); }
.skip:focus { top: var(--space-sm); }

/* Buttons and links */
.button { display: inline-flex; align-items: center; min-height: 48px; padding: 0 var(--space-lg); border-radius: var(--radius); background: var(--accent); color: var(--on-photo); font-size: 1rem; transition: background-color .2s var(--ease-out); }
.button:hover { background: var(--accent-hover); }
.button-light { background: var(--on-photo); color: var(--ink); }
.button-light:hover { background: var(--band); }
.text-link { display: inline-block; padding-block: var(--space-xs); border-bottom: 1px solid var(--ink); font-size: 1rem; transition: border-color .2s var(--ease-out), color .2s var(--ease-out); }
.text-link:hover { color: var(--accent); border-color: var(--accent); }

/* Header */
.site-header { position: relative; z-index: 10; background: var(--paper); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xl); min-height: 104px; }
.brand { display: block; flex: none; }
.brand img { width: 252px; }
.menu { display: flex; align-items: center; gap: 30px; font-size: 1rem; }
.menu a { display: inline-block; padding-block: var(--space-xs); }
.menu a:hover { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.menu .menu-contact { padding: 10px 20px; border: 1px solid var(--accent); border-radius: var(--radius); text-decoration: none; transition: border-color .2s var(--ease-out); }
.menu .menu-contact:hover { text-decoration: none; border-color: var(--ink); }
.menu-toggle { display: none; align-items: center; gap: var(--space-sm); min-height: 44px; padding: 0 var(--space-md); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: 400 1rem var(--font-text); cursor: pointer; }
.menu-toggle-icon { position: relative; width: 16px; height: 10px; border-block: 1.5px solid currentColor; transition: border-color .2s; }
.menu-toggle-icon::before, .menu-toggle-icon::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; margin-top: -.75px; background: currentColor; transition: transform .25s var(--ease-out); }
.menu-toggle[aria-expanded="true"] .menu-toggle-icon { border-color: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle-icon::before { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-icon::after { transform: rotate(-45deg); }

/* Hero */
.hero { position: relative; isolation: isolate; display: grid; align-items: center; min-height: 600px; overflow: hidden; color: var(--on-photo); background: oklch(0.38 0.03 150); }
.hero-image { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: center 56%; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgb(var(--shade) / .79), rgb(var(--shade) / .35) 54%, rgb(var(--shade) / .08)); }
.hero-copy { max-width: 740px; padding-block: 65px 75px; }
.hero-copy .eyebrow { margin-bottom: 22px; color: var(--on-photo); }
.hero-copy h1 { font-size: clamp(3.25rem, 1.6rem + 5.4vw, 6rem); line-height: 1.02; }
.hero-lead { margin-block: var(--space-lg) var(--space-xl); font-size: clamp(1.25rem, 1.1rem + .5vw, 1.4375rem); max-width: 30em; }

/* Welcome */
.welcome { display: grid; grid-template-columns: 1fr 1fr; gap: 8%; padding-block: var(--space-3xl); }
.welcome p { margin-bottom: 20px; color: var(--muted); font-size: 1.25rem; max-width: 34em; }

/* Analyses */
.services { background: var(--band); }
.services .wrap { padding-block: var(--section); }
.section-heading { display: grid; grid-template-columns: 1fr 2fr; gap: 35px; margin-bottom: 40px; }
.section-heading .eyebrow { align-self: start; padding-top: 6px; }
.service-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xl); }
.service { padding: 30px; border-radius: 7px; background: var(--card); }
.service p { margin-top: 14px; color: var(--muted); max-width: 22em; }
.service h3 a:hover { text-decoration: underline; text-underline-offset: 5px; }

/* About */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 8%; align-items: center; padding-block: 82px var(--section); }
.about-image { overflow: hidden; border-radius: var(--radius-lg); }
.about-image img { width: 100%; aspect-ratio: 1.1; object-fit: cover; }
.about h2 { margin-block: 18px var(--space-lg); }
.about p:not(.eyebrow) { margin-bottom: 22px; color: var(--muted); max-width: 29em; }

/* Process */
.process, .contact { display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-2xl); padding-block: var(--section); border-top: 1px solid var(--line); }
.process h2 { margin-top: var(--space-lg); }
.process > *, .contact > *, .section-heading > *, .welcome > *, .about > * { min-width: 0; }
.steps details { padding-block: 21px; border-bottom: 1px solid var(--line); }
.steps details:first-child { border-top: 1px solid var(--line); }
.steps summary { display: flex; align-items: center; gap: 18px; list-style: none; cursor: pointer; font: 700 1.4375rem/1.3 var(--font-heading); letter-spacing: -0.01em; }
.steps summary::-webkit-details-marker { display: none; }
.steps summary::after { content: ""; flex: none; width: 14px; height: 14px; margin-left: auto; background: linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat, linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat; transition: background-size .3s var(--ease-out); }
.steps details[open] summary::after { background-size: 100% 1.5px, 1.5px 0; }
.steps summary:hover { color: var(--accent); }
.steps details p { margin-top: var(--space-md); color: var(--muted); max-width: 34em; }
.steps details[open] p { animation: unfold .4s var(--ease-out) both; }
@keyframes unfold { from { opacity: 0; transform: translateY(-4px); } }

/* Contact */
.contact { gap: 35px; }
.contact p { max-width: 32em; margin-top: 22px; color: var(--muted); }
.contact-pending { display: inline-block; font-size: .9375rem; padding-bottom: var(--space-xs); border-bottom: 1px solid var(--line); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--band); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-xs) var(--space-lg); padding-block: 25px; color: var(--muted); font-size: .875rem; }
.site-footer h2 { font: 700 1rem/1.4 var(--font-heading); letter-spacing: 0; margin-bottom: 16px; }
.site-footer nav a { display: block; width: fit-content; padding-block: 5px; font-size: .9375rem; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 5px; }
.site-footer address { font-size: .9375rem; font-style: normal; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr .7fr; gap: 7%; padding-block: 56px 48px; }
.footer-grid > * { min-width: 0; }
.footer-brand img { width: 230px; max-width: 100%; }
.footer-brand p { margin-top: 20px; font-size: .9375rem; color: var(--muted); }
.footer-mail { display: inline-block; font-size: 1rem; padding-block: 4px; margin-bottom: 18px; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 12px 32px; padding-block: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }
.footer-legal a { margin-left: auto; }
/* 404 */
.not-found { padding-block: var(--space-4xl) calc(var(--space-4xl) * 1.5); }
.not-found h1 { max-width: 14em; }
.not-found p { margin-block: var(--space-lg) var(--space-xl); color: var(--muted); font-size: 1.25rem; max-width: 32em; }

/* Tablet */
@media (max-width: 1080px) {
  .footer-grid { gap: 32px; }
  .brand img { width: 225px; }
  .hero { min-height: 530px; }
  .section-heading, .process, .contact { grid-template-columns: 1fr 1.6fr; gap: var(--space-xl); }
  .service-list { gap: 26px; }
  .service { padding: 22px; }
  .about { gap: 6%; }

  /* Collapsible menu (only when JavaScript is available; otherwise links stay visible) */
  .js .menu-toggle { display: inline-flex; }
  .js .menu { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; padding: var(--space-xs) var(--page-pad) var(--space-lg); background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 18px 30px -24px oklch(0.3 0.03 150 / .35); }
  .js .site-nav.open .menu { display: flex; animation: unfold .3s var(--ease-out) both; }
  .js .menu a { display: flex; align-items: center; min-height: 52px; border-bottom: 1px solid var(--line); font-size: 1.125rem; }
  .js .menu li:last-child a { border-bottom: 0; }
  .js .menu .menu-contact { justify-content: center; margin-top: var(--space-md); border: 0; background: var(--accent); color: var(--on-photo); }
  .js .menu a:hover { text-decoration: none; color: var(--accent); }
  .js .menu .menu-contact:hover { color: var(--on-photo); background: var(--accent-hover); }
  html:not(.js) .menu { flex-wrap: wrap; justify-content: flex-end; gap: 0 var(--space-lg); }
}

/* Phone */
@media (max-width: 720px) {
  .hero { min-height: 540px; }
  .hero-copy { padding-block: var(--space-2xl); }
  .hero-copy .eyebrow { font-size: .875rem; }
  .hero-copy h1 { font-size: clamp(2.75rem, 1rem + 8vw, 4.625rem); }
  .hero-lead { font-size: 1.25rem; max-width: 16em; }
  .welcome, .about { grid-template-columns: 1fr; gap: 30px; }
  .welcome { padding-block: 44px; }
  .welcome p { font-size: 1.125rem; }
  .service-list { grid-template-columns: 1fr; gap: var(--space-md); }
  .about { padding-top: 50px; }
  .about-image img { aspect-ratio: 1.3; }
}
@media (max-width: 620px) {
  .footer-grid { grid-template-columns: 1fr; gap: 28px; padding-block: 32px; }
  .footer-brand img { width: 210px; }
  .footer-legal { gap: 12px; flex-direction: column; }
  .footer-legal a { margin-left: 0; padding-block: 6px; }
  .site-footer nav a { min-height: 40px; }
  body { font-size: 1.0625rem; }
  .header-inner { min-height: 84px; gap: var(--space-md); }
  .brand img { width: 184px; }
  .button { padding-inline: 20px; }
  .section-heading, .process, .contact { grid-template-columns: 1fr; gap: 22px; }
  .section-heading { margin-bottom: 30px; }
  .service p { max-width: none; margin-top: 10px; }
  .steps summary { font-size: 1.375rem; }
  .footer-inner { flex-direction: column; }
}
@media (max-width: 360px) {
  .brand img { width: 158px; }
  .menu-toggle { padding-inline: var(--space-sm); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Keep language choice visible when the main navigation is collapsed. */
.site-nav { display: flex; flex: none; align-items: center; gap: 24px; }
.language-switch { display: flex; flex: none; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; font-size: .8125rem; line-height: 1; }
.language-switch a { display: grid; place-items: center; min-width: 34px; min-height: 34px; border-radius: 50%; }
.language-switch a:hover { background: var(--band); }
.language-switch a[aria-current="true"] { background: var(--accent); color: var(--on-photo); }
@media (max-width: 1080px) {
  .site-nav { gap: 14px; }
}
@media (max-width: 620px) {
  .header-inner { gap: 10px; }
  .brand img { width: 160px; }
  .site-nav { gap: 8px; }
  .menu-toggle { justify-content: center; width: 44px; padding: 0; }
  .menu-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  html:not(.js) .header-inner { flex-wrap: wrap; padding-block: 16px; }
  html:not(.js) .site-nav { flex-wrap: wrap; }
  html:not(.js) .menu { justify-content: flex-start; }
}
@media (max-width: 360px) { .brand img { width: 124px; } }
