:root {
  interpolate-size: allow-keywords;
}

.project-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--cms-media-shadow);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.project-card.in-view {
  border-color: var(--accent-border-soft, rgba(var(--accent-color-rgb), 0.30));
}

@media (hover: hover) and (pointer: fine) {
  .project-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-border-soft, rgba(var(--accent-color-rgb), 0.35));
  }
}

.writing-card .project-content {
  background: transparent !important;
}

.project-card img {
  position: relative;
  z-index: 1;
  width: calc(100% - 1.3rem);
  height: auto;
  margin: 0.65rem 0.65rem 0 0.65rem;
  border-radius: 10px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid rgba(var(--text-color-rgb), 0.11);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.06);
  filter: grayscale(100%);
  transition: filter 0.5s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

body.dark .project-card img {
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.36), 0 2px 4px rgba(0, 0, 0, 0.20);
}

.project-card.img-in-view img {
  filter: grayscale(0%);
}

.project-card .project-content {
  position: relative;
  z-index: 1;
  padding: 1.25rem 1.35rem 1.4rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.project-card h3 {
  color: var(--heading-color, var(--text-color));
  margin-bottom: 0.55rem;
}

.project-card .youtube-video {
  margin-top: 1rem;
  margin-bottom: 1rem;
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
}

.project-card .youtube-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.project-card .project-links a {
  background: var(--accent-color);
  color: var(--accent-contrast-color);
}

.project-card .project-links a:hover {
  background: var(--btn-hover-bg);
}

@media (max-width: 576px) {
  /* De-nesting Inner Cards (#projects & #services) */
  .project-card {
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(var(--text-color-rgb), 0.09);
  }

  body.dark .project-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    border-color: rgba(var(--text-color-rgb), 0.10);
  }

  .project-card .project-content {
    padding: 0.95rem 0.9rem 1.05rem;
  }

  .project-card img {
    width: calc(100% - 0.9rem);
    margin: 0.45rem 0.45rem 0 0.45rem;
    border-radius: 8px;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .project-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }

  #projects-container > .col-md-6,
  #services-container > .col-md-6,
  section[data-module-type="plugin:block-cards:card_grid"] .row > .col-md-6 {
    margin-bottom: 1rem !important;
  }

  #projects-container > .col-md-6:last-child,
  #services-container > .col-md-6:last-child,
  section[data-module-type="plugin:block-cards:card_grid"] .row > .col-md-6:last-child {
    margin-bottom: 0 !important;
  }
}

@media (max-width: 360px) {
  .project-card .project-content {
    padding: 0.85rem 0.75rem;
  }
}

/* ========================================================
   Theme-Driven Inner Card Styles (data-inner-card-style)
   1. editorial   — Magazine columns without inner card boxes
   2. soft_panel  — Subtle surface tint without border or shadow
   3. mobile_flat — Bordered cards on desktop, open columns on mobile
   4. cards       — Pronounced inner cards with border & shadow
   ======================================================== */

/* 1. Editorial Columns (No inner card borders, boxes, or shadows) */
html[data-inner-card-style="editorial"] .project-card,
html[data-inner-card-style="editorial"] body.dark .project-card,
html[data-inner-card-style="editorial"] .project-card.in-view {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
}

html[data-inner-card-style="editorial"] .project-card img {
  width: 100% !important;
  margin: 0 0 1.1rem 0 !important;
  border-radius: 12px !important;
  height: auto;
  aspect-ratio: 16 / 9;
}

html[data-inner-card-style="editorial"] .project-card .project-content {
  padding: 0.1rem 0.15rem 0.35rem 0.15rem !important;
}

@media (min-width: 768px) {
  html[data-inner-card-style="editorial"] section[data-module-type="card_grid"] > .row > .col-md-6:nth-child(odd),
  html[data-inner-card-style="editorial"] section[data-module-type="card_grid"] > .container > .row > .col-md-6:nth-child(odd),
  html[data-inner-card-style="editorial"] section[data-module-type="plugin:block-cards:card_grid"] > .row > .col-md-6:nth-child(odd),
  html[data-inner-card-style="editorial"] section[data-module-type="plugin:block-cards:card_grid"] > .container > .row > .col-md-6:nth-child(odd),
  html[data-inner-card-style="editorial"] section > .row > .col-md-6:nth-child(odd):has(.project-card),
  html[data-inner-card-style="editorial"] section > .container > .row > .col-md-6:nth-child(odd):has(.project-card) {
    padding-right: 1.85rem;
    border-right: none;
  }

  html[data-inner-card-style="editorial"] section[data-module-type="card_grid"] > .row > .col-md-6:nth-child(even),
  html[data-inner-card-style="editorial"] section[data-module-type="card_grid"] > .container > .row > .col-md-6:nth-child(even),
  html[data-inner-card-style="editorial"] section[data-module-type="plugin:block-cards:card_grid"] > .row > .col-md-6:nth-child(even),
  html[data-inner-card-style="editorial"] section[data-module-type="plugin:block-cards:card_grid"] > .container > .row > .col-md-6:nth-child(even),
  html[data-inner-card-style="editorial"] section > .row > .col-md-6:nth-child(even):has(.project-card),
  html[data-inner-card-style="editorial"] section > .container > .row > .col-md-6:nth-child(even):has(.project-card) {
    padding-left: 1.85rem;
  }
}

@media (max-width: 767.98px) {
  html[data-inner-card-style="editorial"] section[data-module-type="card_grid"] > .row > [class*="col-"]:not(:last-child),
  html[data-inner-card-style="editorial"] section[data-module-type="card_grid"] > .container > .row > [class*="col-"]:not(:last-child),
  html[data-inner-card-style="editorial"] section[data-module-type="plugin:block-cards:card_grid"] > .row > [class*="col-"]:not(:last-child),
  html[data-inner-card-style="editorial"] section[data-module-type="plugin:block-cards:card_grid"] > .container > .row > [class*="col-"]:not(:last-child),
  html[data-inner-card-style="editorial"] section > .row > [class*="col-"]:not(:last-child):has(.project-card),
  html[data-inner-card-style="editorial"] section > .container > .row > [class*="col-"]:not(:last-child):has(.project-card) {
    padding-bottom: 1.35rem;
    margin-bottom: 1.35rem !important;
    border-bottom: none;
  }
}

/* 2. Soft Panel (Tinted surface without border or drop-shadow) */
html[data-inner-card-style="soft_panel"] .project-card,
html[data-inner-card-style="soft_panel"] .project-card.in-view {
  background: rgba(var(--text-color-rgb), 0.048) !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  border-radius: var(--theme-inner-card-radius, 18px) !important;
}

html[data-inner-card-style="soft_panel"] body.dark .project-card,
html[data-inner-card-style="soft_panel"] body.dark .project-card.in-view {
  background: rgba(255, 255, 255, 0.055) !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
}

/* 3. Mobile Flat (Pronounced cards on desktop, open editorial columns on mobile) */
@media (max-width: 767.98px) {
  html[data-inner-card-style="mobile_flat"] .project-card,
  html[data-inner-card-style="mobile_flat"] body.dark .project-card,
  html[data-inner-card-style="mobile_flat"] .project-card.in-view {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  html[data-inner-card-style="mobile_flat"] .project-card img {
    width: 100% !important;
    margin: 0 0 0.9rem 0 !important;
    border-radius: 10px !important;
  }

  html[data-inner-card-style="mobile_flat"] .project-card .project-content {
    padding: 0.1rem 0 0.35rem 0 !important;
  }

  html[data-inner-card-style="mobile_flat"] section[data-module-type="card_grid"] > .row > [class*="col-"]:not(:last-child),
  html[data-inner-card-style="mobile_flat"] section[data-module-type="card_grid"] > .container > .row > [class*="col-"]:not(:last-child),
  html[data-inner-card-style="mobile_flat"] section[data-module-type="plugin:block-cards:card_grid"] > .row > [class*="col-"]:not(:last-child),
  html[data-inner-card-style="mobile_flat"] section[data-module-type="plugin:block-cards:card_grid"] > .container > .row > [class*="col-"]:not(:last-child),
  html[data-inner-card-style="mobile_flat"] section > .row > [class*="col-"]:not(:last-child):has(.project-card),
  html[data-inner-card-style="mobile_flat"] section > .container > .row > [class*="col-"]:not(:last-child):has(.project-card) {
    padding-bottom: 1.3rem;
    margin-bottom: 1.3rem !important;
    border-bottom: none;
  }
}

/* ========================================================
   Service Cards Accordion ("Läs mer / Visa mindre")
   Smooth intrinsic expansion across desktop & mobile
   ======================================================== */
.service-desc-body {
  text-wrap: pretty;
}

.service-desc-wrapper {
  position: relative;
  margin-bottom: 0.75rem;
}

.service-card .service-desc-wrapper {
  block-size: 168px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 66%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 66%, transparent 100%);
  transition: block-size 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.service-card.is-expanded .service-desc-wrapper {
  block-size: auto;
  -webkit-mask-image: none;
  mask-image: none;
}

@supports not (interpolate-size: allow-keywords) {
  .service-card .service-desc-wrapper {
    block-size: auto;
    max-height: 168px;
    transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .service-card.is-expanded .service-desc-wrapper {
    max-height: 3000px;
  }
}

.service-desc-fade,
body.dark .service-desc-fade {
  display: none !important;
  background: transparent !important;
  pointer-events: none;
  opacity: 0;
}

.service-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  align-self: flex-start;
  margin-top: auto;
  padding: 0.42rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-text-color, var(--accent-color));
  background: var(--accent-tint-soft);
  border: 1px solid var(--accent-border-soft);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.service-toggle-btn:hover,
.service-toggle-btn:active {
  background: var(--accent-tint-hover);
  border-color: rgba(var(--accent-color-rgb), 0.45);
  color: var(--accent-text-color, var(--accent-color));
  transform: translateY(-1px);
}

.service-toggle-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.service-toggle-icon {
  display: inline-flex;
  transition: transform 0.3s ease;
}

.service-card.is-expanded .service-toggle-icon {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .service-card .service-desc-wrapper,
  .service-toggle-icon {
    transition: none !important;
  }
}

/* ========================================================
   Editorial Simple Section Framing & Card Quotes
   Extracted from Core style.css into block-cards
   ======================================================== */
html[data-section-card-style="editorial_simple"] main > section[data-module-type="card_grid"],
html[data-section-card-style="editorial_simple"] main > section[data-module-type="plugin:block-cards:card_grid"],
html[data-section-card-style="editorial_simple"] main > section:has(.project-card),
html[data-section-card-style="editorial_simple"] body.dark main > section[data-module-type="card_grid"],
html[data-section-card-style="editorial_simple"] body.dark main > section[data-module-type="plugin:block-cards:card_grid"],
html[data-section-card-style="editorial_simple"] body.dark main > section:has(.project-card),
html[data-section-card-style="editorial_simple"][data-color-mode="light"] main > section[data-module-type="card_grid"],
html[data-section-card-style="editorial_simple"][data-color-mode="light"] main > section[data-module-type="plugin:block-cards:card_grid"],
html[data-section-card-style="editorial_simple"][data-color-mode="light"] main > section:has(.project-card),
html[data-section-card-style="editorial_simple"] body:not(.dark) main > section[data-module-type="card_grid"],
html[data-section-card-style="editorial_simple"] body:not(.dark) main > section[data-module-type="plugin:block-cards:card_grid"],
html[data-section-card-style="editorial_simple"] body:not(.dark) main > section:has(.project-card) {
  background: var(--card-bg-alt) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 16px !important;
  box-shadow: var(--section-shadow) !important;
  padding: 2.25rem;
  margin-top: 2rem !important;
  margin-bottom: 2rem !important;
}

@media (max-width: 768px) {
  html[data-section-card-style="editorial_simple"] main > section[data-module-type="card_grid"],
  html[data-section-card-style="editorial_simple"] main > section[data-module-type="plugin:block-cards:card_grid"],
  html[data-section-card-style="editorial_simple"] main > section:has(.project-card) {
    padding: 1.65rem 1.35rem;
  }
}

@media (max-width: 576px) {
  html[data-section-card-style="editorial_simple"] main > section[data-module-type="card_grid"],
  html[data-section-card-style="editorial_simple"] main > section[data-module-type="plugin:block-cards:card_grid"],
  html[data-section-card-style="editorial_simple"] main > section:has(.project-card) {
    padding: 1.25rem 0.95rem;
    border-radius: 14px !important;
    margin-top: 1.5rem !important;
    margin-bottom: 1.5rem !important;
  }

  .writing-quote {
    font-size: 1.18rem;
    line-height: 1.38;
    margin: 0.25rem 0 0.75rem;
    padding-left: 0.75rem;
  }
}

.writing-quote {
  font-family: 'Dancing Script', 'Caveat', 'Marck Script', cursive;
  font-size: 1.28rem;
  line-height: 1.38;
  font-style: italic;
  color: var(--ed-ink, var(--text-color));
  border-left: 4px solid var(--accent-color);
  padding-left: 0.9rem;
  margin: 0.25rem 0 0.85rem;
  background: transparent !important;
}

.writing-quote footer,
.service-desc-body blockquote footer {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.82rem;
  text-align: right;
  margin-top: 0.35rem;
  background: transparent !important;
  border-top: none !important;
  color: var(--ed-ink-soft, var(--text-muted-color, var(--text-color)));
}

.writing-quote footer cite {
  font-style: italic;
}

/* Editorial Asymmetric Plate Layout & Kicker Row (block-cards v1.1) */
.cards-editorial-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.35rem;
}

.cards-editorial-item {
  min-width: 0;
}

@media (min-width: 992px) {
  .cards-editorial-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: stretch;
  }

  .cards-editorial-item {
    grid-column: span 5;
  }

  .cards-editorial-item:first-child {
    grid-column: span 7;
    grid-row: span 2;
  }

  .cards-editorial-item:first-child .project-card img {
    aspect-ratio: 16 / 10;
  }
}

.project-kicker-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted-color);
  margin-bottom: 0.65rem;
  padding-bottom: 0.45rem;
}

.project-kicker-row::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background-color: var(--accent-color);
  transition: width 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.project-card.img-in-view .project-kicker-row::after,
.project-card:has(.is-bloomed) .project-kicker-row::after {
  width: 48px;
}

@media (prefers-reduced-motion: reduce) {
  .project-kicker-row::after {
    transition: none;
    width: 48px;
  }
}
