:root {
  --ced-font-mono: 'Fira Mono', monospace;
  --ced-font-sans: -apple-system, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell;
  --ced-primary: #ff3e00;
  --ced-secondary: #676778;
  --ced-heading: #222;
  --ced-text: #444;
  --ced-bg: white;
  --ced-bg-alt: #f9f9f9;
  --ced-border: #e2e8f0;
  --ced-shadow: rgba(0, 0, 0, .1);
  --ced-radius: 1rem;
  --ced-padding: clamp(2rem, 5vw, 6rem);
}

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

html {
  font-family: var(--ced-font-sans);
  scroll-behavior: smooth;
  line-height: 1.5;
  font-size: 16px;
  color: var(--ced-text);
}

body {
  background-color: var(--ced-bg);
  margin: 0;
  overflow-x: hidden;
}

body > *:not(header):not(footer):nth-child(odd) {
  background-color: var(--ced-bg-alt);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--ced-heading);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1rem 0;
}

h1 {
  font-size: clamp(2.5rem, 4vw, 4rem);
  font-weight: 900;
}

h2 {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

h3 {
  font-size: 1.5rem;
}

p {
  margin: 0 0 1.5em 0;
}

a {
  text-decoration: none;
}

ul {
  list-style: none;
}

a, label, ced-phone {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

:is(h1, h2) span {
  color: #ff7548;
}

::selection {
  color: white;
  background-color: var(--ced-primary);
}


/* COMPONENTS ----------------------------------------------------------------*/
/* Header */
header {
  position: fixed;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
  border-bottom: 1px solid var(--ced-border);
  transition: box-shadow .2s;
  padding: 0 var(--ced-padding);
  z-index: 1;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4rem;

  /* Company Name */
  & > a {
    color: var(--ced-primary);
    font-weight: 900;
    font-size: 1.8rem;
  }

  /* Menu */
  ul {
    display: flex;
    gap: 2rem;
  }

  /* Links */
  ul a {
    & {
     color: var(--ced-text);
     font-weight: 500;
     transition: color 0.2s;
     position: relative;
    }

    &:hover {
      color: var(--ced-primary);
      text-decoration: none;
    }

    &::after {
      content: '';
      position: absolute;
      bottom: -2px;
      left: 0;
      width: 0;
      height: 2px;
      background-color: var(--ced-primary);
      transition: width 0.2s;
    }

    &:hover::after {
      width: 100%;
    }
  }

  /* Toggle */
  label {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--ced-text);
    user-select: none;
  }
}

/* Section */
section {
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  align-items: center;
  padding: 6rem var(--ced-padding);

  &:first-of-type {
    background-image: url('../img/particles.svg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }

  ced-header {
    display: block;
  }
}

/* Hero */
ced-hero {
  display: grid;
  width: clamp(768px, 50%, 800px);

  h1 {
    margin-bottom: 1.5rem;
  }

  p {
    font-size: 1.6rem;
    color: var(--ced-secondary);
    margin-bottom: 2.5rem;
    font-weight: 400;
  }

  ced-links {
    display: flex;
    gap: 1rem;
  }

  a {
    white-space: nowrap;
    background-color: var(--ced-primary);
    color: white;
    font-weight: 600;
    padding: .8rem 2rem;
    border-radius: 2rem;
    transition: background-color 0.2s, transform 0.2s;
  }

  a:hover {
    background-color: #d9340b;
    transform: translateY(-2px);
  }

  a:last-child {
    background-color: transparent;
    color: var(--ced-text);
    border: 1px solid var(--ced-border);
  }

  a:last-child:hover {
    background-color: #f5f5f5;
  }
}

/* Gallery */
ced-gallery {
  display: grid;

  img {
    width: 100%;
    border-radius: var(--ced-radius);
  }
}

/* Grid */
ced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  justify-content: center;
}

/* Card */
ced-card {
  display: block;
  background-color: white;
  border-radius: var(--ced-radius);
  padding: 2rem;
  box-shadow: 0 4px 12px var(--ced-shadow);
  transition: transform .3s, box-shadow .3s;
  position: relative;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--ced-primary);
    opacity: 0;
    transition: opacity .3s;
  }

  &:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--ced-shadow);
  }

  &:hover::before {
    opacity: 1;
  }

  h3 {
    margin-bottom: 1rem;
  }

  p {
    color: var(--secondary);
    margin-bottom: 1.5rem;
  }

  a {
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    color: var(--ced-primary);
  }

  span {
    margin-left: .25rem;
    transition: transform .2s;
  }

  a:hover span {
    transform: translateX(4px);
  }
}

/* Icon */
ced-icon {
  display: block;
  font-size: 2.5rem;
  color: var(--ced-primary);
  margin-bottom: 1rem;
}

/* Phone */
ced-phone {
  display: block;
  position: relative;
  max-width: 300px;
  margin: 20px auto;
  border-radius: 40px;
  border: 5px solid var(--ced-heading);
  transition: transform .3s, box-shadow .3s, border-color .3s;
  background-color: #f6f6f6;
  cursor: pointer;

  &:hover {
    border-color: var(--ced-primary);

    &::before, &::after {
      background-color: var(--ced-primary);
    }
  }

  &::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 8px;
    background: var(--ced-heading);
    border-radius: 4px;
  }

  &::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 25%;
    height: 60px;
    width: 5px;
    background: var(--ced-heading);
    border-radius: 2px;
  }

  img {
    display: block;
    width: 100%;
    border-radius: 30px;
    margin-top: 25px;
    margin-bottom: 5px;
  }
}

/* Slider */
ced-slider {
  display: block;
  overflow: hidden;
  padding: clamp(2rem, 2vw, 2.5rem) 0;

  ced-list {
    display: flex;
    width: 100%;
    height: var(--ced-height);
    min-width: calc(var(--ced-width) * var(--ced-n));
    mask-image: linear-gradient(to right, transparent, black 10% 90%, transparent);
    position: relative;
    justify-content: space-around; /* fallback if we remove infinite slider */

    img {
      width: var(--ced-width);
      height: var(--ced-height);
      transition: filter .5s;
    }

    &:hover img {
      filter: grayscale(1);
    }

    img:hover {
      filter: grayscale(0);
    }
  }
}

/* List */
ced-list {
  h2 {
    margin-bottom: 1.5rem;
  }

  li {
    position: relative; /* needed for absolute positioning */
    padding-left: 2rem; /* space for checkmark */
  }

  li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--ced-primary);
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.2rem;
    margin-bottom: .5rem;
  }
}

/* Flip */
ced-flip {
  display: block;
  perspective: 1000px;
  width: 300px;
  height: 300px;
  margin: 40px;
  position: relative;
  transform-style: preserve-3d;

  input {
    display: none;
  }

  label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 10;
  }

  &:has(input:checked) ced-front {
    transform: rotateY(-180deg);
  }

  &:has(input:checked) ced-back {
    transform: rotateY(0deg);
  }

  ced-front, ced-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, .1);
    transition: transform .8s cubic-bezier(.175, .885, .32, 1.275);
  }

  ced-front {
    background: linear-gradient(135deg, #42a5f5, #2196f3);
    color: white;
    z-index: 2;
    transform: rotateY(0deg);
  }

  ced-back {
    background: white;
    color: #333;
    transform: rotateY(180deg);
  }
}

/* Whatsapp */
ced-whatsapp {
  display: block;

  img {
    width: 100px;
    transition: transform .3s ease;
  }

  img:hover {
    transform: scale(1.2);
  }
}

/* Footer */
footer {
  display: grid;
  background-color: #2e3440;
  color: var(--ced-border);
  padding: 3rem var(--ced-padding);
  gap: 2rem;

  ced-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  ced-links {
    h3 {
      color: var(--ced-border);
      font-size: 1.2rem;
      margin-bottom: 1.5rem;
    }
    li {
      margin-bottom: .75rem;
    }
    a {
      color: var(--ced-border);
      transition: color .2s;
    }
    a:hover {
      color: white;
    }
  }
}

/* Copyright */
ced-copyright {
  display: block;
  padding-top: 2rem;
  border-top: 1px solid var(--ced-secondary);
  text-align: center;
  color: #9199a6;
}

/* CLASSES ------------------------------------------------------------------*/
.center {
  text-align: center;
  align-self: center;
}

.column {
  flex-direction: column;
}

/* MEDIA QUERIES ------------------------------------------------------------*/
@media (width < 768px) {
  nav {
    label {
      display: block;
    }

    label::after {
      content: '☰';
    }

    input {
      display: none;
    }

    ul {
      position: fixed;
      top: 4rem;
      right: -100%;
      width: 100%;
      height: calc(100vh - 4rem);
      flex-direction: column;
      background-color: var(--ced-bg);
      padding: 2rem;
      transition: right 0.3s;
    }

    &:has(input:checked) ul {
      right: 0;
    }

    &:has(input:checked) label::after {
      content: '✕'
    }
  }

  section {
    flex-direction: column;
    gap: 2rem;
  }

  .mobile-reverse {
    flex-direction: column-reverse;
  }

  ced-hero {
    max-width: 100%;
    text-align: center;

    p {
      font-size: 1.2rem;
    }

    ced-links {
      display: grid;
    }
  }

  ced-gallery {
    place-items: center;
    max-width: 100%;
  }
}


/* ANIMATIONS ----------------------------------------------------------------*/
/* Shadow fully appears after scrolling 100px */
header {
  animation: header_shadow linear both;
  animation-timeline: scroll(); /* links the animation to page scrolling */
  animation-range: 0 100px;
}

@keyframes header_shadow {
  from {
    box-shadow: 0 0 0 transparent;
  }
  to {
    box-shadow: 0 2px 8px var(--ced-shadow);
  }
}

/*  Fade in when first load */
ced-hero, ced-gallery, ced-header, ced-card, ced-list, ced-whatsapp {
  animation: fade_in .6s ease-out forwards;
}

ced-card:nth-child(1) {
  animation-delay: .1s;
}

ced-card:nth-child(2) {
  animation-delay: .2s;
}

ced-card:nth-child(3) {
  animation-delay: .3s;
}

ced-list, ced-whatsapp {
  animation-delay: .1s;
}

@keyframes fade_in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stacked images with infinite loop effect */
ced-gallery img {
  grid-area: 1/1; /* all images in same grid cell */
  opacity: 0; /* all images hide by default */
}

ced-gallery img:nth-child(1) {
  animation: fade_in_out 9s infinite;
}

ced-gallery img:nth-child(2) {
  animation: fade_in_out 9s infinite 3s;
}

ced-gallery img:nth-child(3) {
  animation: fade_in_out 9s infinite 6s;
}

@keyframes fade_in_out {
  0%, 100% {
    opacity: 0;
    transform: translateZ(-50px) scale(.9);
  }
  3%, 33% {
    opacity: 1;
    transform: translateZ(0) scale(1);
  }
  36%, 97% {
    opacity: 0;
    transform: translateZ(50px) scale(.9);
  }
}

/* Infinite slider */
ced-slider {
  img {
    position: absolute;
    left: 100%;
    animation: auto_run 20s linear infinite;
    animation-delay: calc(20s / var(--ced-n) * (var(--ced-pos) - 1) - 20s) !important;
  }

  &:hover img {
    animation-play-state: paused;
  }
}

@keyframes auto_run {
  from { left: 100%; }
  to { left: calc(var(--ced-width) * -1); }
}

ced-slider[reverse=true] {
  img {
    animation: auto_run_reverse 20s linear infinite;
  }

  &:hover img {
    animation-play-state: paused;
  }
}

@keyframes auto_run_reverse {
  from { left: calc(var(--ced-width) * -1); }
  to { left: 100%; }
}

/* Floating */
ced-phone {
  animation: float 3s ease-in-out infinite;

  &:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--ced-shadow);
    animation-play-state: paused;
  }
}

@keyframes float {
  0%, 100% { transform: translateY(25px); }
  50% { transform: translateY(-25px); }
}
