/**
Theme Name: CogWork Astra Child
Author: CogWork AB
Author URI: https://cogwork.se/
Description: Child theme för Astra utvecklat av CogWork AB.
Version: 1.0.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cogwork-astra-child
Template: astra
*/

/* ========================================
   VÄNDBART KORT
======================================== */

.dh-flip-card {
	position: relative;
	z-index: 1;

	width: 100%;
	max-width: 100% !important;
	aspect-ratio: 4 / 5;

	perspective: 1200px;
	-webkit-perspective: 1200px;

	box-sizing: border-box;
	flex: 0 1 22.5rem;
	overflow: visible;
}

/*
 * Det aktiva kortet placeras framför
 * övriga kort och sidans innehåll.
 */
.dh-flip-card.is-flipped {
	z-index: 9999;
}

/* ========================================
   KORTETS INRE DEL
======================================== */

.dh-flip-card__inner {
	position: absolute;
	inset: 0;

	width: 100%;
	height: 100%;

	transform-style: preserve-3d;
	-webkit-transform-style: preserve-3d;

	transform-origin: top center;
	-webkit-transform-origin: top center;

	transition:
		transform 0.65s cubic-bezier(0.2, 0.75, 0.2, 1),
		height 0.3s ease;

	will-change: transform, height;
}

/*
 * Endast innerdelen blir högre.
 * Kortets ursprungliga plats i layouten
 * ändras därför inte.
 */
.dh-flip-card.is-flipped .dh-flip-card__inner {
	height: var(--flip-height, 100%);

	transform: rotateY(180deg);
	-webkit-transform: rotateY(180deg);
}

/* ========================================
   GEMENSAMT FÖR FRAM- OCH BAKSIDA
======================================== */

.dh-flip-card__face {
	position: absolute !important;
	inset: 0;

	width: 100%;
	height: 100%;
	margin: 0 !important;
	box-sizing: border-box;

	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

/* ========================================
   FRAMSIDA
======================================== */

.dh-flip-card__front {
	overflow: hidden;
	cursor: pointer;
	pointer-events: auto;

	transform: rotateY(0deg);
	-webkit-transform: rotateY(0deg);

	touch-action: manipulation;
}

/*
 * Bilden fångar inte klicket själv.
 * Klicket går till hela framsidan i stället.
 */
.dh-flip-card__front img {
	display: block;
	width: 100%;
	height: 100%;

	object-fit: cover;
	pointer-events: none;
}

/* ========================================
   BAKSIDA
======================================== */

.dh-flip-card__back {
	width: 100%;
	height: 100%;

	overflow: hidden;
	pointer-events: none;

	transform: rotateY(180deg);
	-webkit-transform: rotateY(180deg);

	transform-origin: center;
	-webkit-transform-origin: center;
}

/*
 * När kortet är vänt blir baksidan klickbar
 * och framsidan slutar fånga klick.
 */
.dh-flip-card.is-flipped .dh-flip-card__front {
	pointer-events: none;
}

.dh-flip-card.is-flipped .dh-flip-card__back {
	pointer-events: auto;
}

/* ========================================
   TEXT PÅ BAKSIDAN
======================================== */

.dh-flip-card__back > * {
	margin-block-start: 0 !important;
}

.dh-flip-card__back > h3 {
	font-size: clamp(1.5rem, 2vw, 1.5rem);
	line-height: 1.2;
}

.dh-flip-card__back > p {
	margin: 0 0 0.8em !important;
	font-size: clamp(1.25rem, 1.5vw, 1.25rem);
	line-height: 1.4;
}

.dh-flip-card__back .dh-flip-card__note {
	margin-bottom: 0 !important;
	font-size: clamp(0.85rem, 0.9vw, 1rem);
	line-height: 1.35;
}

/* ========================================
   TILLGÄNGLIGHET
======================================== */

.dh-flip-card:focus-visible {
	outline: 3px solid var(--ast-global-color-0);
	outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
	.dh-flip-card__inner {
		transition: none;
	}
}

/* =========================================================
   DANSHUSET – SPECIALEN TVÅKOLUMNSKORT
========================================================= */

.dh-specialen-2-col-card {
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  border-radius: 18px;
}

.dh-specialen-2-col-card > .wp-block-column {
  min-width: 0;
  margin: 0;
}

/* Bildkolumn */

.dh-specialen-2-col-card__media {
  display: flex;
}

.dh-specialen-2-col-card__image {
  width: 100%;
  height: 100%;
  margin: 0;
}

.dh-specialen-2-col-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Textkolumn */

.dh-specialen-2-col-card__content {
  align-self: stretch;
}


/* =========================================================
   MOBIL
========================================================= */

@media (max-width: 781px) {
  .dh-specialen-2-col-card {
    gap: 1.25rem;
    overflow: visible;
  }

  .dh-specialen-2-col-card__media,
  .dh-specialen-2-col-card__image {
    display: block;
    height: auto;
  }

  .dh-specialen-2-col-card__image {
    overflow: hidden;
    border-radius: 18px;
  }

  .dh-specialen-2-col-card__image img {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
    object-fit: contain;
  }
}

