/* =====================================================
   HVALREKI — Stafrænt stúdíó
   Single source of truth: css/main.css
   ===================================================== */

:root {
  /* Palette */
  --bg:    #413C3F;            /* eini dökki liturinn */
  --cream: #EBEBEB;            /* light grey (card 1) */
  --blue:  #B8C5CC;            /* dusty blue (card 3) */
  --ink:   #413C3F;            /* sami og --bg */
  --line:  rgba(65, 60, 63, 0.05);

  /* Type */
  --font: 'Google Sans Flex', 'Inter', system-ui, -apple-system, sans-serif;
  --h-size: clamp(22px, 1.92vw, 29px);
  --body-size: 14px;

  /* Geometry */
  --radius: 10px;
  --gap: clamp(12px, 1.5vw, 24px);
  --page-pad: clamp(12px, 1.5vw, 24px);
  --card-pad: clamp(32px, 4vw, 56px);
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

/* =====================================================
   GRID
   ===================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr;
  gap: var(--gap);
  padding: var(--page-pad);
  min-height: 100vh;
  min-height: 100dvh;
}

/* =====================================================
   CARD — base
   ===================================================== */
.card {
  position: relative;
  padding: var(--card-pad);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--page-pad) * 2);
  min-height: calc(100dvh - var(--page-pad) * 2);
  overflow: hidden;
  isolation: isolate;
}

.card--cream { background: var(--cream); }
.card--blue  { background: var(--blue); }

/* Hairline diagonal pattern — subtle texture matching base color */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0,
    transparent 7px,
    var(--line) 7px,
    var(--line) 8px
  );
  pointer-events: none;
  z-index: 1;
}
.card > * { position: relative; z-index: 2; }

/* =====================================================
   CARD top — logo / meta labels
   ===================================================== */
.card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.logo {
  display: inline-flex;
  width: 38px;
  height: 35px;
  color: var(--ink);
  flex-shrink: 0;
}
.logo svg { width: 100%; height: 100%; display: block; }

.meta {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin-left: auto;
  white-space: nowrap;
}
.meta--right { text-align: right; }
.meta__sep { padding: 0 6px; }

/* =====================================================
   CARD bottom — headline + body + cta
   ===================================================== */
.card__bottom {
  margin-top: auto;
  max-width: 36ch;
}

.card__headline {
  font-size: var(--h-size);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.018em;
  margin-bottom: 18px;
  text-wrap: balance;
  max-width: 16ch;
}

.card__lede {
  font-size: var(--body-size);
  font-weight: 400;
  line-height: 1.55;
  margin-bottom: 24px;
  color: var(--ink);
}

.card__mail {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.25s ease, gap 0.3s ease;
}
.card__mail svg {
  width: 15px;
  height: 13px;
  display: block;
  flex-shrink: 0;
}
.card__mail-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  transition: max-width 0.4s ease, opacity 0.25s ease 0.05s;
}
.card__mail:hover,
.card__mail:focus-visible {
  color: #FFFFFF;
  gap: 8px;
  outline: none;
}
.card__mail:hover .card__mail-label,
.card__mail:focus-visible .card__mail-label {
  max-width: 220px;
  opacity: 1;
}
.card__mail:active {
  color: var(--ink);
}

/* =====================================================
   PIXX — static dot-wave decoration on card 3
   Aspect ratio preserved (151 × 415 source)
   ===================================================== */
.pixx {
  position: absolute;
  top: 50%;
  right: -4%;
  width: 36%;
  z-index: 1;
  pointer-events: none;
  transform: translateY(-50%);
}
.pixx img {
  width: 100%;
  height: auto;
  display: block;
}

/* =====================================================
   WAVE CELL — Card 2: no frame, dots float on page bg
   ===================================================== */
.wave-cell {
  position: relative;
  min-height: calc(100vh - var(--page-pad) * 2);
  min-height: calc(100dvh - var(--page-pad) * 2);
}
.wave {
  display: block;
  width: 100%;
  height: 100%;
}

/* =====================================================
   MOBILE
   ===================================================== */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: 0;
  }
  .card,
  .wave-cell {
    min-height: 70vh;
    min-height: 70dvh;
  }
  :root {
    --h-size: clamp(24px, 4.08vw, 31px);
    --card-pad: clamp(28px, 6vw, 40px);
  }
  .pixx {
    width: 30%;
    right: -2%;
  }
}

@media (max-width: 480px) {
  :root {
    --card-pad: 24px;
    --page-pad: 10px;
    --h-size: clamp(24px, 6.48vw, 29px);
  }
  .pixx {
    width: 38%;
  }
}

/* =====================================================
   REDUCED MOTION
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  .card__mail { transition: none; }
}
