/* ============================================================
   KMI Fastigheter — app.css
   Modern, minimal, monochrome around the black "K" mark.
   Palette is provisional — confirm brand colours with client.
   ============================================================ */

/* Self-hosted Inter (variable, latin subset incl. å ä ö). No Google Fonts CDN.
   Inter is licensed under the SIL Open Font License 1.1. See build/fonts.py. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-var-latin.woff2?v=1") format("woff2");
}

/* Brand palette (KMI Grafisk manual 2023): black / grey #6f6f6f / white only. */
:root {
  --ink: #1d1d1b;        /* brand black (matches the logo) */
  --ink-2: #3a3a38;      /* softened black for body copy */
  --muted: #6f6f6f;      /* brand grey */
  --line: #e4e4e4;
  --paper: #ffffff;
  --sand: #f4f4f4;       /* neutral light grey surface */
  --sand-2: #e7e7e7;
  --accent: #6f6f6f;     /* brand grey — subtle accents (eyebrows, meta) */
  --accent-dark: #1d1d1b;/* brand black — emphasis / links */

  --maxw: 1180px;
  --gap: clamp(1rem, 3vw, 2rem);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(29,29,27,.05), 0 12px 30px -18px rgba(29,29,27,.28);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture, iframe, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* ---------- typography ---------- */
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(2rem, 5.2vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.18rem; letter-spacing: -0.01em; }
p { text-wrap: pretty; }
.lead { font-size: clamp(1.06rem, 1.8vw, 1.3rem); color: var(--ink-2); max-width: 56ch; }
.muted { color: var(--muted); }
.eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: .76rem;
  font-weight: 600; color: var(--muted);
}

/* ---------- layout ---------- */
.wrap { width: min(var(--maxw), 100% - 2.4rem); margin-inline: auto; }
.section { padding-block: clamp(2.6rem, 6vw, 5rem); }
.page-head { padding-top: clamp(2rem, 5vw, 3.6rem); }
.page-head h1 { margin-top: .4rem; max-width: 18ch; }
.page-head .lead { margin-top: 1rem; }

/* ---------- skip link ---------- */
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px;
  transition: top .15s ease;
}
.skip:focus { top: 12px; }

:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--ink); color: #fff; padding: .8rem 1.4rem;
  border-radius: 999px; font-weight: 600; border: 1.5px solid var(--ink);
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; background: var(--ink-2); transform: translateY(-1px); }
.btn-sm { padding: .5rem 1rem; font-size: .92rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--sand); }
.btn-light { background: #fff; color: var(--ink); border-color: #fff; }
.btn-light:hover { background: var(--sand); }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.btn-ghost-light:hover { background: #fff; color: var(--ink); border-color: #fff; }
.link-arrow { font-weight: 600; color: var(--accent-dark); }
.link-arrow:hover { text-decoration: underline; }
.arrow { transition: transform .15s ease; display: inline-block; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; }
.brand { display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; opacity: .85; }
.brand-logo { height: 30px; width: auto; display: block; }
.site-nav { display: flex; align-items: center; }
.nav-list { list-style: none; padding: 0; display: flex; align-items: center; gap: .3rem; }
.nav-list a { padding: .5rem .75rem; border-radius: 8px; font-weight: 500; color: var(--ink-2); }
.nav-list a:hover { background: var(--sand); text-decoration: none; color: var(--ink); }
.nav-list a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav-cta { margin-left: .4rem; }
.nav-cta a { color: #fff; }
.nav-cta a:hover { background: var(--ink-2); color: #fff; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: .5rem; }
.nav-toggle span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: .2s; }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav-list {
    position: fixed; inset: 68px 0 auto 0; flex-direction: column; align-items: stretch;
    gap: 0; background: var(--paper); border-bottom: 1px solid var(--line);
    padding: .6rem 1.2rem 1.2rem; transition: transform .25s ease;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 68px); overflow-y: auto;
    /* move up by the panel's own height PLUS the 68px header offset, so a short
       menu is fully off-screen (a plain -120% leaves the bottom edge poking down) */
    transform: translateY(calc(-100% - 80px));
  }
  .nav-list.open { transform: translateY(0); }
  .nav-list a { padding: .85rem .5rem; border-radius: 8px; font-size: 1.05rem; }
  .nav-cta { margin: .4rem 0 0; }
  .nav-cta a { justify-content: center; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ---------- hero ---------- */
.hero { position: relative; isolation: isolate; color: #fff; }
.hero-media { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.hero-media img, .hero-media .ph { width: 100%; height: 100%; object-fit: cover; aspect-ratio: auto !important; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(10,12,15,.42) 0%, rgba(10,12,15,.72) 100%);
}
.hero-inner { padding-block: clamp(4rem, 13vw, 9rem); max-width: 42rem; }
.hero-inner .eyebrow { color: rgba(255,255,255,.85); }
.hero-inner h1 { margin: .6rem 0 1rem; }
.hero-inner .lead { color: rgba(255,255,255,.92); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.hero-short .hero-inner { padding-block: clamp(3rem, 9vw, 6rem); }

/* ---------- features (home) ---------- */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.feature {
  display: flex; flex-direction: column; gap: .9rem; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.4rem, 3vw, 1.9rem);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.feature:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow); border-color: #d9dad9; }
.feature:hover .feature-icon { background: var(--ink); color: #fff; }
.feature:hover .arrow { transform: translateX(4px); }
.feature-icon {
  width: 52px; height: 52px; flex: none; display: grid; place-items: center;
  border-radius: 13px; background: var(--sand); color: var(--ink);
  transition: background .18s ease, color .18s ease;
}
.feature-icon svg { width: 26px; height: 26px; }
.feature-body h2 { font-size: 1.25rem; display: flex; align-items: center; gap: .5rem; }
.feature-body p { margin-top: .5rem; }
@media (max-width: 820px) { .features { grid-template-columns: 1fr; } }

/* ---------- split / stats ---------- */
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.split h2 { margin: .4rem 0 1rem; }
.split p + p { margin-top: 1rem; }
.split-contact { align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.stat {
  background: var(--sand); border-radius: var(--radius-sm); padding: 1.3rem 1rem;
  text-align: center; border: 1px solid var(--sand-2);
}
.stat-n { display: block; font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; }
.stat-l { display: block; font-size: .82rem; color: var(--muted); margin-top: .2rem; }

/* ---------- band (CTA) ---------- */
.band { background: var(--ink); color: #fff; }
.band-inner { padding-block: clamp(2.6rem, 6vw, 4.4rem); text-align: center; display: grid; justify-items: center; gap: 1rem; }
.band-inner .lead { color: rgba(255,255,255,.85); }
.band-inner h2 { max-width: 20ch; }

/* ---------- property grid ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.8rem; }
.chip {
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink-2);
  padding: .45rem 1rem; border-radius: 999px; font-weight: 600; font-size: .9rem; transition: .15s;
}
.chip:hover { border-color: var(--ink); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.prop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
@media (max-width: 900px) { .prop-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .prop-grid { grid-template-columns: 1fr; } }
.prop {
  display: flex; flex-direction: column; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.prop.is-link { transition: transform .18s ease, box-shadow .18s ease; }
.prop.is-link:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow); }
.prop-media { position: relative; }
.prop-media img, .prop-media .ph { width: 100%; object-fit: cover; }
.prop-body { padding: 1rem 1.15rem 1.3rem; display: flex; flex-direction: column; gap: .25rem; }
.prop-body h3 { margin-top: .1rem; }
.prop-addr { font-weight: 600; color: var(--ink-2); font-size: .95rem; }
.prop .link-arrow { margin-top: .4rem; }
.tag {
  position: absolute; top: .7rem; left: .7rem;
  background: rgba(29,29,27,.88); color: #fff; font-size: .72rem; font-weight: 600;
  padding: .3rem .6rem; border-radius: 999px; backdrop-filter: blur(4px);
}
.tag-ghost { position: static; background: transparent; color: var(--ink-2); border: 1.5px solid var(--line); }
.vacancy-meta .tag { position: static; }

/* placeholder for missing images */
.ph {
  width: 100%; display: grid; place-items: center;
  background: repeating-linear-gradient(135deg, var(--sand), var(--sand) 14px, var(--sand-2) 14px, var(--sand-2) 28px);
  color: var(--muted);
}
.ph span { font-weight: 800; letter-spacing: .1em; font-size: 1.4rem; opacity: .5; }

/* ---------- vacancies ---------- */
.vacancy-list { display: grid; gap: var(--gap); }
.vacancy {
  display: grid; grid-template-columns: minmax(0, 1.1fr) 1.3fr; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--paper); transition: transform .18s ease, box-shadow .18s ease;
}
.vacancy:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow); }
.vacancy:hover .arrow { transform: translateX(4px); }
.vacancy-media img, .vacancy-media .ph { width: 100%; height: 100%; object-fit: cover; aspect-ratio: auto !important; }
.vacancy-body { padding: clamp(1.3rem, 3vw, 2.2rem); display: flex; flex-direction: column; gap: .7rem; }
.vacancy-meta { display: flex; gap: .5rem; }
.vacancy-meta .tag { background: var(--ink); color: #fff; }
/* the size chip stays an outline so it doesn't read dark-on-dark */
.vacancy-meta .tag-ghost { background: transparent; color: var(--ink-2); border: 1.5px solid var(--line); }
.vacancy-foot { margin-top: auto; font-weight: 600; color: var(--accent-dark); display: flex; align-items: center; gap: .5rem; }
@media (max-width: 720px) { .vacancy { grid-template-columns: 1fr; } }
.empty { text-align: center; display: grid; gap: 1.2rem; justify-items: center; padding: 3rem 1rem; background: var(--sand); border-radius: var(--radius); }

/* ---------- person / contact card ---------- */
.person-card {
  display: flex; gap: 1.1rem; align-items: center;
  background: var(--sand); border: 1px solid var(--sand-2); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; max-width: 27rem;
}
.person-photo { flex: 0 0 92px; }
.person-photo img, .person-photo .ph { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; }
.person-name { font-weight: 700; font-size: 1.1rem; margin-top: .2rem; }
.person-body p { margin: 0; line-height: 1.45; }
.person-body a { color: var(--ink); font-weight: 500; }
.person-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--gap); margin-top: 1.4rem; }
.person-grid .person-card { max-width: none; }

/* ---------- columns (etablera) ---------- */
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.col-card { background: var(--sand); border: 1px solid var(--sand-2); border-radius: var(--radius); padding: 1.6rem 1.5rem; }
.col-card h2 { font-size: 1.25rem; margin-bottom: .6rem; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }

/* ---------- prose ---------- */
.prose p + p { margin-top: 1rem; }
.prose h2 { margin: 1.8rem 0 .6rem; }
.prose.narrow { max-width: 70ch; }
.about-media img, .about-media .ph { width: 100%; border-radius: var(--radius); object-fit: cover; }

/* ---------- detail page ---------- */
.breadcrumb { padding-top: 1.4rem; font-size: .9rem; color: var(--muted); display: flex; gap: .5rem; }
.breadcrumb a { color: var(--accent-dark); font-weight: 600; }
.detail-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(1.4rem, 4vw, 3rem); align-items: center; padding-top: 1.4rem; }
.detail-hero-media img, .detail-hero-media .ph { width: 100%; border-radius: var(--radius); object-fit: cover; }
.badge { display: inline-block; background: var(--ink); color: #fff; font-weight: 600; font-size: .82rem; padding: .35rem .8rem; border-radius: 999px; margin-bottom: .8rem; }
.detail-hero-body h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
.kv { list-style: none; padding: 0; display: flex; gap: 2.2rem; margin: 1.2rem 0 1.6rem; }
.kv li { display: flex; flex-direction: column; }
.kv span { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.kv strong { font-size: 1.3rem; }
@media (max-width: 820px) { .detail-hero { grid-template-columns: 1fr; } }

.detail-body { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(1.6rem, 5vw, 4rem); align-items: start; }
.detail-text p + p { margin-top: 1rem; }
.lead-outro { margin-top: 1.4rem; font-weight: 600; color: var(--ink); }
.detail-side { position: sticky; top: 92px; display: grid; gap: 1.4rem; }
.side-h { font-size: 1.15rem; }
.feature-list { list-style: none; padding: 0; display: grid; gap: .5rem; }
.feature-list li { position: relative; padding-left: 1.5rem; color: var(--ink-2); }
.feature-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent-dark); font-weight: 700; }
@media (max-width: 820px) { .detail-body { grid-template-columns: 1fr; } .detail-side { position: static; } }

/* ---------- gallery + lightbox ---------- */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-top: 1.2rem; }
@media (max-width: 820px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
.gal-item { padding: 0; border: 0; background: none; border-radius: var(--radius-sm); overflow: hidden; }
.gal-item img { width: 100%; object-fit: cover; transition: transform .25s ease; }
.gal-item:hover img { transform: scale(1.05); }
.lightbox {
  position: fixed; inset: 0; z-index: 80; background: rgba(8,9,11,.92);
  display: grid; place-items: center; padding: 4vmin;
}
/* author display:grid above would otherwise override the [hidden] attribute */
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; display: grid; place-items: center; }
.lightbox img { max-width: 90vw; max-height: 86vh; border-radius: 8px; object-fit: contain; }
.lb-close { position: absolute; top: 1rem; right: 1.3rem; background: none; border: 0; color: #fff; font-size: 2.4rem; line-height: 1; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.12); color: #fff; font-size: 2.2rem; line-height: 1;
  display: grid; place-items: center; transition: background .15s ease;
  backdrop-filter: blur(4px);
}
.lb-nav:hover { background: rgba(255,255,255,.28); }
.lb-prev { left: clamp(.6rem, 3vw, 2rem); }
.lb-next { right: clamp(.6rem, 3vw, 2rem); }
.lb-count { position: absolute; bottom: 1.1rem; left: 0; right: 0; text-align: center;
  color: rgba(255,255,255,.85); font-size: .9rem; font-variant-numeric: tabular-nums; }
@media (max-width: 540px) {
  .lb-nav { width: 46px; height: 46px; font-size: 1.8rem; }
}

/* ---------- contact page ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(1.6rem, 5vw, 3.5rem); align-items: start; }
.contact-list { list-style: none; padding: 0; display: grid; gap: .9rem; margin-top: 1rem; }
.contact-list li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.contact-list span { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; padding-top: .15rem; }
.contact-list a { color: var(--ink); font-weight: 600; }
.contact-map { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.contact-map iframe { width: 100%; height: 100%; min-height: 340px; border: 0; }
@media (max-width: 820px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- error page ---------- */
.error-page { text-align: center; display: grid; justify-items: center; gap: 1rem; padding-block: clamp(3rem, 10vw, 7rem); }

/* ---------- footer ---------- */
.site-footer { background: var(--sand); border-top: 1px solid var(--sand-2); margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: var(--gap); padding-block: clamp(2.4rem, 5vw, 3.4rem); }
.footer-logo { height: 38px; width: auto; }
.footer-brand .muted { margin-top: .8rem; max-width: 32ch; }
.footer-h { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .8rem; }
.footer-links { list-style: none; padding: 0; display: grid; gap: .5rem; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: var(--ink); }
.footer-bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1.2rem; border-top: 1px solid var(--sand-2); }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
