/* ATG V75: kampanjsida (t-shirt)
   Typsnitt: ATG Rubrik (hero-rubrik), ATG Text (allt annat).

   Skalning: skissen är ritad i 390 px. Alla mått anges i designpixlar (var(--u))
   och växer med kolumnen, från 390 px upp till max 560 px. Då ser sidan ut exakt
   som Claude Design-skissen på varje bredd. Under 390 px står måtten still och
   texten bryts fritt i stället. */

@font-face { font-family: "ATG Rubrik"; src: url("fonts/ATGRubrik.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "ATG Text"; src: url("fonts/ATGText-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "ATG Text"; src: url("fonts/ATGText-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "ATG Text"; src: url("fonts/ATGText-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "ATG Text"; src: url("fonts/ATGText-BoldItalic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "ATG Text"; src: url("fonts/ATGText-ExtraBold.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "ATG Text"; src: url("fonts/ATGText-ExtraBoldItalic.woff2") format("woff2"); font-weight: 800; font-style: italic; font-display: swap; }

:root {
  --bg: #FCF3E8;        /* cream */
  --ink: #1A1A1A;
  --ink-hover: #000000;
  --white: #FFFFFF;
  --hero-fallback: #3A3630;
  --backdrop-dim: rgba(0, 0, 0, 0.62);   /* mörkning av helskärmsbilden bakom kolumnen */
  --chip-hover: #F2E6D8;
  --peach: #F3B692;     /* färgprov t-shirt */
  --offwhite: #F3EBD6;
  --swatch-edge: rgba(26, 26, 26, 0.35);
  --lightbox-bg: rgba(10, 8, 6, 0.94);
  --notice-backdrop: rgba(10, 8, 6, 0.6);

  --column: 560px;                                                   /* kolumnens maxbredd */
  --u: clamp(1px, calc(100vw / 390), calc(var(--column) / 390));     /* 1 designpixel */
  --gutter: calc(32 * var(--u));                                     /* sidomarginal */

  --font-display: "ATG Rubrik", "ATG Text", Arial, sans-serif;
  --font-text: "ATG Text", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); }

body {
  font-family: var(--font-text);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Bredare skärmar än kolumnen: hero-bilden i helskärm, mörkad, bakom kolumnen */
@media (min-width: 561px) {
  html { background: var(--hero-fallback); }
  body { background: transparent; }   /* annars målas body-färgen över bilden */

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-color: var(--hero-fallback);
    background-image: linear-gradient(var(--backdrop-dim), var(--backdrop-dim)), url("img/hero@2x.jpg");
    background-size: cover;
    background-position: 50% 70%;
    background-repeat: no-repeat;
  }

  .page { box-shadow: 0 0 60px rgba(0, 0, 0, 0.5); }
}

.page {
  position: relative;
  width: 100%;
  max-width: var(--column);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* Hero */
.hero {
  position: relative;
  height: calc(230 * var(--u));
  padding: calc(24 * var(--u)) var(--gutter) calc(32 * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--hero-fallback);
  background-image: url("img/hero.jpg");
  background-image: -webkit-image-set(url("img/hero.jpg") 1x, url("img/hero@2x.jpg") 2x);
  background-image: image-set(url("img/hero.jpg") 1x, url("img/hero@2x.jpg") 2x);
  background-size: 136% auto;       /* samma utsnitt som mockupen */
  background-position: 49% 100%;
  background-repeat: no-repeat;
}

.hero__logo {
  position: absolute;
  top: calc(16 * var(--u));
  left: calc(16 * var(--u));
  width: calc(54 * var(--u));
  height: auto;
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: calc(25 * var(--u));
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  color: var(--white);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

/* Innehåll */
.content {
  display: flex;
  flex-direction: column;
  gap: calc(20 * var(--u));
  padding: calc(28 * var(--u)) var(--gutter) calc(32 * var(--u));
}

.content--soldout { padding: calc(40 * var(--u)) var(--gutter) calc(48 * var(--u)); }

/* Medan sidan frågar databasen om t-shirtarna är slut: dölj innehållet, behåll hero och layout */
.kollar .content { visibility: hidden; }
.content[hidden] { display: none; }   /* start- eller slutinnehållet, bara ett i taget */

.intro { display: flex; flex-direction: column; gap: calc(14 * var(--u)); }

.intro__title {
  margin: 0;
  font-weight: 800;
  font-style: italic;
  font-size: calc(20 * var(--u));
  line-height: 1.25;
  white-space: nowrap;
}

.intro__text {
  margin: 0;
  font-size: calc(17.3 * var(--u));
  line-height: 1.35;
  white-space: nowrap;
}

.intro__title--wrap { white-space: normal; line-height: 1.3; }
.intro__text--wrap { white-space: normal; }

/* Foton */
.photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(10 * var(--u));
}

.photo {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  border-radius: calc(4 * var(--u));
  cursor: zoom-in;
  display: block;
}
.photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 60%;
  border-radius: calc(4 * var(--u));
  display: block;
}
.photo:hover img { filter: brightness(0.95); }
.photo:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Lightbox: fast i px, den täcker hela skärmen och följer inte kolumnen */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--lightbox-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox[hidden] { display: none; }

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  cursor: zoom-out;
}

.lightbox__img {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox__close:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

/* Färg- och storleksval */
.form { display: flex; flex-direction: column; gap: calc(22 * var(--u)); }

.choice { margin: 0; padding: 0; border: 0; min-width: 0; }

.choice__legend {
  padding: 0;
  margin: 0 0 calc(8 * var(--u));
  font-size: calc(11 * var(--u));
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.choice__row { display: flex; gap: calc(8 * var(--u)); }

.chip { flex: 1 1 0; min-width: 0; position: relative; }

.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.chip__face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(10 * var(--u));
  min-height: calc(48 * var(--u));
  border: calc(1 * var(--u)) solid var(--ink);
  border-radius: calc(4 * var(--u));
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  font-size: calc(15 * var(--u));
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, transform 0.1s;
}
.chip:hover input:not(:checked):not(:disabled) + .chip__face { background: var(--chip-hover); }
.chip:active input:not(:disabled) + .chip__face { transform: translateY(1px); }
.chip input:checked + .chip__face { background: var(--ink); color: var(--white); }
.chip input:focus-visible + .chip__face { outline: 2px solid var(--ink); outline-offset: 2px; }
.chip input:disabled + .chip__face { cursor: default; }

.swatch {
  width: calc(16 * var(--u));
  height: calc(16 * var(--u));
  border-radius: 50%;
  border: calc(1 * var(--u)) solid var(--swatch-edge);
  flex: 0 0 auto;
}
.swatch--peach { background: var(--peach); }
.swatch--offwhite { background: var(--offwhite); }

/* Fält */
.fields { display: flex; flex-direction: column; gap: calc(10 * var(--u)); }

.field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: calc(6 * var(--u));
  min-height: calc(60 * var(--u));
  padding: calc(12 * var(--u)) calc(10 * var(--u)) calc(8 * var(--u));
  background: var(--white);
}
.field:focus-within { box-shadow: 0 0 0 2px var(--ink); }

.field input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--font-text);
  font-size: calc(16 * var(--u));   /* aldrig under 16 px, annars zoomar iOS vid fokus */
  color: var(--ink);
}

.field label { font-size: calc(10 * var(--u)); line-height: 1; }

/* Spamfälla: utanför skärmen, aldrig synlig */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Lagertext, villkor och knapp */
.stock {
  margin: 0;
  font-weight: 700;
  font-style: italic;
  font-size: calc(14 * var(--u));
  line-height: 1.4;
  text-align: center;
}

.disclaimer {
  margin: calc(-8 * var(--u)) 0 0;
  font-size: calc(10 * var(--u));   /* samma som fältetiketterna */
  line-height: 1.4;
  text-align: center;
}

.submit {
  appearance: none;
  width: 100%;
  min-height: calc(52 * var(--u));
  border: 0;
  border-radius: calc(4 * var(--u));
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-text);
  font-weight: 800;
  font-size: calc(16 * var(--u));
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.submit:hover:not(:disabled) { background: var(--ink-hover); }
.submit:active:not(:disabled) { transform: translateY(1px); }
.submit:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.submit:disabled { cursor: default; }

/* Fält eller val som ska rättas (markeras när popupen visas, försvinner vid ändring) */
.field.fel { box-shadow: 0 0 0 2px var(--ink); }
.choice.fel .chip__face { box-shadow: inset 0 0 0 calc(1 * var(--u)) var(--ink); }

/* Popup i mitten för meddelanden vid Skicka */
.notice {
  width: min(calc(326 * var(--u)), calc(100vw - 32px));
  max-width: none;
  padding: calc(24 * var(--u));
  border: 0;
  border-radius: calc(4 * var(--u));
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.notice::backdrop { background: var(--notice-backdrop); }
.notice[open] { animation: notice-in 0.18s ease-out; }
@keyframes notice-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { .notice[open] { animation: none; } }

.notice__title {
  margin: 0 0 calc(10 * var(--u));
  font-weight: 800;
  font-style: italic;
  font-size: calc(20 * var(--u));
  line-height: 1.25;
}
.notice__text {
  margin: 0 0 calc(22 * var(--u));
  font-size: calc(16 * var(--u));
  line-height: 1.4;
}

/* Tacksidans sammanfattning */
.receipt {
  padding: calc(14 * var(--u)) calc(16 * var(--u)) calc(16 * var(--u));
  background: var(--white);
}
.receipt__label {
  margin: 0 0 calc(8 * var(--u));
  font-size: calc(11 * var(--u));
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.receipt__text {
  margin: 0;
  font-size: calc(16 * var(--u));
  line-height: 1.45;
}
.receipt__item { font-weight: 700; }

.nobr { white-space: nowrap; }   /* bryt aldrig "t-shirten" vid bindestrecket */

/* Smalare skärmar än 390 px: måtten står still (1 designpixel = 1 px) och texterna bryts naturligt.
   Hero-rubriken behåller sin brytning efter "tillbaka." men får radbrytas om den inte ryms.
   Mellanslaget före varje <br> i HTML:en håller isär orden när brytningen tas bort. */
@media (max-width: 389px) {
  .hero__title, .intro__title, .intro__text { white-space: normal; }
  .intro__title br, .intro__text br { display: none; }
}
