/* ===== SNÄLL ARKITEKTER — stylesheet ===== */
/* Mobile-first. Base rules target phones; min-width queries build up to desktop. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&display=swap');

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

:root {
  --black: #111;
  --white: #fff;
  --gray: #767676; /* 4.54:1 on white — WCAG AA for small text (#888 was 3.54:1) */
  --accent: #e05c7a;
  --font: 'Inter', sans-serif;

  /* Fluid type — each upper bound is the original desktop value,
     so nothing changes on large screens. */
  --nav-size:   clamp(0.6875rem, 0.62rem + 0.25vw, 0.75rem);
  --body-size:  clamp(0.6875rem, 0.65rem + 0.18vw, 0.75rem);
  --label-size: clamp(0.625rem,  0.58rem + 0.20vw, 0.6875rem);

  /* Fluid spacing — one page gutter shared by header, main and footer,
     replacing the old fixed margin-left:6rem / margin-right:4rem. */
  --page-pad: clamp(1.25rem, 5vw, 6rem);
  --grid-gap: clamp(1.5rem, 4vw, 5rem);

  /* Bulletin-board controls */
  --grid-cols: 1;   /* stepped up at each breakpoint */
  --pin-step: 0rem; /* vertical stagger; flat on phones, enabled from 600px */
}

html {
  font-family: var(--font);
  font-size: 16px;
  color: var(--black);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
}

html, body {
  overflow-x: clip; /* safety net: nothing may push the page sideways */
  /* Paint white explicitly rather than leaving body transparent. A
     transparent body shows whatever sits behind the document — an embedding
     page, a host default, a reader mode — which is where the #faf9f5 cream
     came from. The site is white, so say so. */
  background: var(--white);
}

a {
  color: inherit;
  text-decoration: none;
}

img, video, svg {
  max-width: 100%;
}

/* Every <img> carries width/height attributes so the browser can reserve the
   right space and avoid layout shift. Those attributes also set a used height,
   so any rule that sets only a CSS width would leave the attribute's pixel
   height in force and squash the picture. This keeps the aspect ratio.
   More specific rules (.project-media > img, .img-crop img) still win. */
img {
  height: auto;
}

/* ===== HEADER / NAV ===== */

/* Sticky rather than fixed: the header occupies flow, so <main> needs no
   hardcoded padding-top to compensate for its height at every breakpoint. */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
}

header .container {
  display: flex;
  flex-wrap: wrap;            /* phones: nav drops to its own row */
  align-items: flex-start;
  justify-content: space-between;
  row-gap: 0.85rem;
  max-width: none;
  margin: 0;
  padding: clamp(1rem, 2.5vw, 27px) var(--page-pad);
}

.logo {
  line-height: 1;
}

.logo-img {
  height: clamp(30px, 5vw, 50px);
  width: auto;
  display: block;
  max-width: 400px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: clamp(0.9rem, 2vw, 24px);
  flex-basis: 100%;           /* own row on phones */
}

nav a {
  font-size: var(--nav-size);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 400;
  transition: color 0.15s;
}

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

/* Language switch — the current language is black, the other one grey */
.lang-switch {
  font-size: var(--nav-size);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.lang-switch a,
.lang-switch .sep {
  color: var(--gray);
}

.lang-switch .sep {
  margin: 0 1px;
}

.lang-switch a.is-active {
  color: var(--black);
}

/* ===== PAGE WRAPPER ===== */

main {
  min-height: 60vh;
}

/* Content container — centred, with the shared fluid gutter */
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

/* Full-bleed variant used by the landing-page grid */
.container--wide {
  max-width: none;
  margin: 0;
}

/* ===== PROJECT GRID — the bulletin board (index) ===== */

.project-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  grid-auto-flow: dense;  /* backfills the gap a span2 card leaves at any column count */
  gap: var(--grid-gap);
  align-items: start;
  padding: clamp(2rem, 6vw, 3rem) 0 clamp(4rem, 10vw, 8rem);
}

.project-item {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.35s cubic-bezier(.22,.61,.36,1), opacity 0.2s ease;
}

/* --- Card modifiers -------------------------------------------------- */

/* Width: a double-width anchor card. Disabled at one column. */
@media (min-width: 600px) {
  .project-item.pi--span2 { grid-column: span 2; }
}

/* Pin: the vertical stagger that breaks the row rhythm.
   --pin-step is 0 on phones, so cards align flush there. */
.project-item.pi--drop1 { margin-top: var(--pin-step); }
.project-item.pi--drop2 { margin-top: calc(var(--pin-step) * 2); }

/* --- Media frame ----------------------------------------------------- */

.project-media {
  width: 100%;
  overflow: hidden;
  aspect-ratio: var(--ar, auto);
}

.project-media > img,
.project-media > video {
  display: block;
  width: 100%;
  height: var(--media-h, auto);
  object-fit: var(--media-fit, cover);
  transition: transform 0.45s cubic-bezier(.22,.61,.36,1), filter 0.45s ease;
}

/* Shape: a fixed ratio for the frame, media cropped to fill it.
   No ar-* class means the image keeps its natural proportions — the
   differing intrinsic heights are part of the pinned-up look. */
.project-media.ar-tall      { --ar: 2 / 3;  --media-h: 100%; }
.project-media.ar-portrait  { --ar: 3 / 4;  --media-h: 100%; }
.project-media.ar-square    { --ar: 1 / 1;  --media-h: 100%; }
.project-media.ar-landscape { --ar: 3 / 2;  --media-h: 100%; }
.project-media.ar-wide      { --ar: 16 / 9; --media-h: 100%; }

/* Line drawings and SVG plans: letterbox, never crop through the linework. */
.project-media.is-contain {
  --media-fit: contain;
  background: var(--white);
}

/* Focal point overrides for individual crops */
.project-media.pos-top    > img { object-position: center top; }
.project-media.pos-right  > img { object-position: right center; }

/* --- Label ------------------------------------------------------------ */

.project-label {
  margin-top: 0.65rem;
  font-size: var(--label-size);
  letter-spacing: 0.03em;
  color: var(--black);
  line-height: 1.4;
  text-align: left;   /* aligns with the image's left edge */
}

.project-label .name {
  font-weight: 400;
}

.project-label .dash {
  margin: 0 0.4em;
  color: var(--gray);
}

.project-label .type {
  font-weight: 400;
  color: var(--gray);
}

/* --- Interaction ------------------------------------------------------ */

/* Hover is gated on a real pointer, so touch devices never latch a
   sticky hover state after a tap. */
@media (hover: hover) and (pointer: fine) {
  .project-item:hover {
    will-change: transform;
    transform: translateY(-6px);
  }
  .project-item:hover .project-media > img,
  .project-item:hover .project-media > video {
    will-change: transform;
    transform: scale(1.04);
    filter: brightness(1.04);
  }
}

/* Touch: a brief, unambiguous tap state instead */
.project-item:active {
  opacity: 0.72;
}

.project-item:focus-visible {
  outline: 1px solid var(--black);
  outline-offset: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .project-item:hover,
  .project-item:hover .project-media > img,
  .project-item:hover .project-media > video {
    transform: none !important;
  }
}

/* --- Legacy classes: still used by index-en.html and the detail pages -- */

.project-item.w-large    { width: 100%; }
.project-item.w-medium   { width: 85%; }
.project-item.w-small    { width: 60%; }
.project-item.w-portrait { width: 55%; }

.img-crop {
  width: 100%;
  overflow: hidden;
}

.img-crop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== PROJECT DETAIL PAGE ===== */

.project-detail {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 2.5rem 8rem;
}

.project-detail .hero-image {
  width: 100%;
  max-width: 520px;
  display: block;
  margin: 0 auto 4rem;
}

.project-detail .project-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.project-detail .project-type {
  font-size: var(--body-size);
  font-weight: 400;
  margin-bottom: 3rem;
}

.project-detail .project-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0 3rem;
  align-items: start;
}

.project-detail .meta {
  font-size: var(--body-size);
  line-height: 1.8;
}

.project-detail .meta-row {
  margin-bottom: 0.6rem;
}

.project-detail .meta-label {
  font-weight: 400;
  color: var(--black);
  font-size: var(--label-size);
}

.project-detail .meta-value {
  font-weight: 400;
  font-size: 0.75rem;
}

.project-detail .description {
  font-size: var(--body-size);
  line-height: 1.75;
  font-weight: 400;
}

/* extra images in detail */
.project-detail .extra-images {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project-detail .extra-images img {
  width: 100%;
  display: block;
}

/* ===== OM SNÄLL PAGE ===== */

.about-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 2.5rem 8rem;
}

.about-page h2 {
  font-size: var(--body-size);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.about-page p {
  font-size: var(--body-size);
  line-height: 1.85;
  max-width: 640px;
  margin-bottom: 1.5rem;
}

.about-page .about-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
}

.about-page .about-images img {
  width: 100%;
  display: block;
}

/* ===== TJÄNSTER PAGE ===== */

.services-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 2.5rem 8rem;
}

.services-page h2 {
  font-size: var(--body-size);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.services-page p {
  font-size: var(--body-size);
  line-height: 1.85;
  max-width: 640px;
  margin-bottom: 2.5rem;
}

.services-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem 3rem;
  margin-top: 2rem;
}

.service-item h3 {
  font-size: var(--body-size);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.service-item p {
  font-size: var(--label-size);
  line-height: 1.7;
  color: #333;
  margin-bottom: 0;
}

.slide-credit {
  font-size: 0.6rem !important;
}

/* ===== FOOTER ===== */

/* Phones: sits at the end of the document, stacked. It only becomes a
   fixed three-column bar once there is room for one (see 900px below). */
footer {
  padding: 0;
  font-size: var(--label-size);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--black);
  line-height: 1.6;
  background: var(--white);
}

footer .container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  max-width: none;
  margin: 0;
  padding: 1.5rem var(--page-pad);
}

.footer-left {
  display: flex;
  flex-direction: column;
}

.footer-name {
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.footer-contact {
  font-weight: 400;
}

.footer-center,
.footer-right {
  text-align: left;
}

footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ===== BREAKPOINTS ===== */

/* 600px — two columns, header back on one line, stagger switches on */
@media (min-width: 600px) {
  :root {
    --grid-cols: 2;
    --pin-step: clamp(1rem, 3vw, 3.5rem);
  }
  header .container {
    flex-wrap: nowrap;
    align-items: flex-end;
  }
  nav {
    flex-basis: auto;
    flex-wrap: nowrap;
  }
}

/* 900px — three columns; the footer becomes the fixed desktop bar */
@media (min-width: 900px) {
  :root {
    --grid-cols: 3;
  }
  main {
    min-height: 100vh;
    padding-bottom: 80px; /* clear the fixed footer */
  }
  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
  }
  footer .container {
    grid-template-columns: 1fr 1fr 1fr;
    align-items: end;
    gap: 0;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
  .footer-center { text-align: center; }
  .footer-right  { text-align: right; }
}

/* 1200px — the full four-column board */
@media (min-width: 1200px) {
  :root {
    --grid-cols: 4;
  }
}

/* Inner-page stacking (unchanged behaviour, kept for the other pages) */
@media (max-width: 600px) {
  .project-detail,
  .about-page,
  .services-page {
    padding: 1rem 1.2rem 4rem;
  }
  .project-detail .project-body {
    grid-template-columns: 1fr;
    gap: 1.5rem 0;
  }
  .about-page .about-images {
    grid-template-columns: 1fr;
  }
  .services-list {
    grid-template-columns: 1fr;
  }
}

/* Screen-reader-only heading: gives each page a single <h1> for structure
   and search results without changing the visual design. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
