@import url("font/font.css");

/* GENERAL */

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  margin: 0;
  overflow: hidden;
}

html {
  background-color: #ffffff;
}

body {
  background-color: #f4f4f5;
  color: #333333;
  font-synthesis: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
  font-weight: normal;
}


/* TOP NAVIGATION */

nav {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;

  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;

  width: 100%;
  height: calc(45px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);

  background-color: #ffffff;
  border-bottom: 1px solid #dddddd;

  font-family: "Medium", sans-serif;
}

nav h1 {
  position: static;
  margin-bottom: 4px;

  font-family: "Medium", sans-serif;
  font-size: 15px;
  line-height: 24px;
  font-weight: normal;
}

nav h1.ostalippu {
  justify-self: center;
  color: #007ac9;
}

nav h1.lippusi {
  justify-self: center;
  color: #333333;
}

nav hr {
  position: absolute;
  right: 10.26cqw;
  bottom: 0;

  width: 34%;
  height: 3px;
  margin: 0;

  border: none;
  background-color: #007ac9;
}


/* SCROLLABLE PAGE */

.scroll-area {
  position: fixed;
  top: calc(45px + env(safe-area-inset-top));
  right: 0;
  bottom: 84px;
  left: 0;

  overflow-x: hidden;
  overflow-y: auto;

  padding-bottom: 40px;
}


/* TICKET BACKGROUND */

.ticket {
  position: relative;

  width: calc(100% - 25px);
  aspect-ratio: 360 / 510;
  margin: 12.5px 12.5px 0;

  background-image: url("svg/ticket-bg.svg");
  background-repeat: no-repeat;
  background-position: top center;
  background-size: contain;

  /* Makes cqw units use the ticket width */
  container-type: inline-size;

  overflow: hidden;
}


/* QR SECTION */

div.qr {
  position: relative;
  height: 67.5cqw;
}

.qr-code {
  position: absolute;
  top: 11cqw;
  left: 50%;

  width: 36cqw;
  height: 36cqw;

  transform: translateX(-50%);
}

p.qr {
  position: absolute;
  top: 50.5cqw;
  left: 0;

  width: 100%;

  color: #333333;

  font-family: "Light", sans-serif;
  font-size: 4.2cqw;
  line-height: 5.5cqw;
  text-align: center;
}

.qr1 {
  font-family: "Medium", sans-serif;
}

div.qr hr {
  position: absolute;
  right: 5%;
  bottom: 0;
  left: 5%;

  width: 90%;
  height: 1px;
  margin: 0;

  border: none;
  background-color: #dddddd;
}


/* TICKET TYPE */

.ticket-type {
  position: relative;

  display: flex;
  align-items: center;

  height: 14cqw;
}

.ticket-type img {
  position: absolute;
  left: 8%;

  width: 5cqw;
  height: 5cqw;
}

.ticket-type h1 {
  position: absolute;
  left: 15.5%;

  color: #333333;

  font-family: "Bold", sans-serif;
  font-size: 5cqw;
  line-height: 6.667cqw;
}

.ticket-type hr {
  position: absolute;
  right: 5%;
  bottom: 0;
  left: 5%;

  width: 90%;
  height: 1px;
  margin: 0;

  border: none;
  background-color: #dddddd;
}


/* TICKET INFORMATION */

.ticket-info {
  position: relative;

  display: flex;
  align-items: center;

  height: 16cqw;
  margin-top: 1cqw;
}

.ticket-info p {
  position: absolute;
  top: 1.7cqw;

  color: #666666;

  font-family: "Book", sans-serif;
  font-size: 3.6cqw;
  line-height: 5cqw;
}

p.voimassa {
  left: 8.22cqw; 
}

p.asiakasryhmä {
  right: 13.7cqw;
}

.ticket-info svg {
  position: absolute;
  left: 8.22cqw;
  margin-top: 3.5cqw;

  width: 3cqw;
  height: 3cqw;

  overflow: visible;
}

.ticket-info h1 {
  position: absolute;
  margin-top: 3.7cqw;

  color: #333333;

  font-family: "Medium", sans-serif;
  font-size: 5cqw;
  line-height: 7cqw;
}

h1.voimassa {
  left: 12.88cqw;
}

h1.asiakasryhmä {
  right: 13.7cqw;
}

.ticket-info > img {
  position: absolute;
  top: 3cqw;
  right: 6.85cqw;

  width: auto;
  height: 10cqw;
}


/* SPINNER */

div.spinner {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;

  height: 38.333cqw;

  overflow: hidden;
}

img.spinner {
  position: absolute;
  top: 8%;
  display: block;

  width: 90%;
  aspect-ratio: 990 / 360;

  background: linear-gradient(to right, gray 50%, transparent 50%);
  border-radius: 0 0 12px 12px;
}

div.spinner h1 {
  position: absolute;
  margin-bottom: 5%;

  color: #333333;

  font-family: "Bold", sans-serif;
  line-height: 1;
}

/* Travel zone text — 2 letters, e.g. "AB" */
.zone-text-2 {
  right: 16cqw;
  font-size: 19cqw;
}

/* Travel zone text — 3 letters, e.g. "ABC" */
.zone-text-3 {
  right: 10cqw;
  font-size: 18cqw;
}

.zone-text-3[data-zone="CDE"] {
  right: 11cqw;
  font-size: 18cqw;
}

/* Travel zone text — 4 letters, e.g. "ABCD" */
.zone-text-4 {
  font-size: 17cqw;
}

.zone-text-4[data-zone="ABCD"] {
  right: 5.6cqw;
}

.zone-text-4[data-zone="BCDE"] {
  right: 7cqw;
}

/* Travel zone text — 5 letters, e.g. "ABCDE" */
.zone-text-5 {
  right: 5.5cqw;
  font-size: 14cqw;
}

.area {
  position: absolute;
  top: 27.5cqw;
  right: 15cqw;

  display: flex;
  align-items: center;
  gap: 3px;
}

.area h2 {
  margin: 0;

  color: #007ac9;

  font-family: "Medium", sans-serif;
  font-size: 3.8cqw;
  line-height: 5cqw;
}

.info {
  width: 4.5cqw;
  height: 4.5cqw;
}


/* NEW TICKET */

.new-ticket {
  position: relative;

  display: flex;
  justify-content: center;

  width: 100%;
  max-width: 360px;
  height: 26cqw;

  margin: 1cqw auto 0;
}

.new-ticket p {
  position: absolute;
  top: 0.8cqw;

  color: #333333;

  font-family: "Book", sans-serif;
  font-size: 3.8cqw;
}

.new-ticket button {
  position: absolute;
  top: 8.6cqw;

  width: 58cqw;
  height: 11.5cqw;

  color: #ffffff;
  background-color: #007ac9;

  border: none;
  border-radius: 5.75cqw;

  font-family: "Medium", sans-serif;
  font-size: 4.6cqw;
  line-height: 22px;
}

.new-ticket hr {
  position: absolute;
  right: 7.5%;
  bottom: 0px;
  left: 7.5%;

  width: 85%;
  height: 1px;
  margin: 0;

  border: none;
  background-color: #dddddd;
}


/* TICKET HISTORY */

.ticket-history {
  position: relative;

  display: flex;
  justify-content: center;

  width: 100%;
  height: 25cqw;

  margin: 5cqw auto;
}

.ticket-history p {
  position: absolute;
  top: 0;

  color: #333333;

  font-family: "Book", sans-serif;
  font-size: 4cqw;
}

.ticket-history h1 {
  position: absolute;
  top: 7cqw;

  color: #007ac9;

  font-family: "Medium", sans-serif;
  font-size: 4cqw;
}

.ticket-history img {
  width: 1.54cqw;
  height: 2.82cqw;
}

.empty  {
  width: 100%;
  height: 15cqw;
}

/* BOTTOM NAVIGATION */

.bottom-nav {
  position: fixed;
  z-index: 1000;
  bottom: 0;
  left: 0;

  display: flex;
  align-items: center;

  width: 100%;
  height: 84px;

  background-color: #ffffff;
  border-top: 1px solid #dddddd;
}

.nav-item {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;

  height: 100%;
  margin-top: 20px;

  gap: 1px;
}

.nav-item p {
  display: block;

  width: 100%;
  margin: 0;
  padding: 0;

  color: #666666;

  font-family: "Bold", sans-serif;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
}

.nav-icon {
  display: block;
  flex-shrink: 0;

  width: 28px;
  height: 28px;
  margin: 0 auto;

  background-color: #666666;

  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;

  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.koti {
  mask-image: url("svg/koti.svg");
  -webkit-mask-image: url("svg/koti.svg");
}

.liput {
  background-color: #007ac9;

  mask-image: url("svg/liput.svg");
  -webkit-mask-image: url("svg/liput.svg");
}

p.liput-nav {
  color: #007ac9;
}

.reittiopas {
  mask-image: url("svg/reittiopas.svg");
  -webkit-mask-image: url("svg/reittiopas.svg");
}

.lisaa {
  mask-image: url("svg/lisaa.svg");
  -webkit-mask-image: url("svg/lisaa.svg");
}

/* Keep the ticket at its intended proportions on wider landscape screens. */
@media (orientation: landscape) {
  .ticket,
  #ticketsContainer,
  .new-ticket,
  .ticket-history,
  .empty {
    width: min(calc(100% - 25px), 360px);
    margin-right: auto;
    margin-left: auto;
  }

  .new-ticket,
  .ticket-history,
  .empty {
    container-type: inline-size;
    height: 100px;
    margin: auto;
    margin-top: 20px;
  }
}
