

  /* =Variables
  ----------------------------------------------- */
  :root {
    --cloud-delay-one   : 267s;
    --cloud-delay-two   : 243s;
    --cloud-delay-three : 691s;
    --cloud-delay-four  : 775s;
    --cloud-delay-five  : 168s;
    
    --sun-delay: 168s;

    --sun-position: calc(3 * 60 * 60);
    --sun-position-vertical: 1.375em;

    --device-beta: 0;
    --device-gamma: 0;

    --ship-position: var(--device-gamma);
  }

  /*
  @media (orientation: landscape) {
    :root {
      --ship-position: var(--device-beta);
    }
  }
  */



  /* =Wave Animation
  ----------------------------------------------- */

  /*
  @keyframes churning {
    0% {
      background-position: 50% 82.5%;
    }
    50% {
      background-position: 47.5% 85%;
    }
    100% {
      background-position: 50% 82.5%; 
    }           
  }
  */

  /*
  @keyframes waving {
    0% {
      background-position: -100% 100%;
    }
    100% {
      background-position: 100% 100%%;
    }
  }

  @supports (background-image: url('data:image/svg+xml;utf8,<svg></svg>')) {
    .home a.ahoy {
      animation-name: waving;
      animation-duration: 1000s; 
      animation-iteration-count: infinite;
      animation-timing-function: linear;
      animation-fill-mode: both;
    }
  }
  */


  /* =Sky
  ----------------------------------------------- */
  @keyframes floating {
    0% {
      transform: translateX(-100vw);
    }
    100% {
      transform: translateX(100vw);
    }
  }

  .container > .clouds {
    display: flex;
    position: absolute;
    z-index: 1;
    top: 0em;
    left: 0;
    width: 100vw;
    overflow: hidden;
  }
  .container > .sun {
    position: absolute;
    top: 0;
    height: 6.125em;
    width: calc(100vw - 2.8em);
    max-width: 33em;
    overflow: hidden;
  }
  .sun svg circle,
  .sun svg path {
    fill: rgb(255, 235, 80);
  }
  @keyframes sun-path {
    0% {

      /* Sunrise */
      left: 0;
      bottom: -2em;
    }
    50% {

      /* Noon */
      left: calc(50% - 1.75em);
      bottom: 4em;
    }
    100% {

      /* Sunset */
      left: calc(100% - 3.5em);
      bottom: -2em;
    }
  }

  @keyframes rotating {
    0% {
      transform: rotate(0);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  .sun svg {
    width: 3.5em;
    height: 3.5em;
    position: absolute;
    /*
    bottom: 0;
    left: 0;
    margin-left: -1.75em;
    margin-bottom: -1.75em;
    transform: translate(1.75em, 0.25em);
    transform: translate(16.5em, -5.75em);
    transform: translate(31.25em, 0.25em);
    */
    /*
    animation-name: sun-path;
    animation-duration: calc(12 * 60 * 60s);
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-delay: calc(-3 * 60 * 60s);
    animation-delay: var(--sun-position);
    */
    animation-name: rotating;
    animation-duration: 640s; 
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-iteration-count: infinite;

    animation-delay: -820s;
    animation-delay: calc(var(--sun-delay) - 1820s);

    transition: top 0.2s, left 0.2s, margin-left 0.2s;
    top: 0.375em;
    left: 1.4em;

    top: var(--sun-position-vertical);

    margin-left: calc(var(--sun-position) / 43200 * -3.5em); /* A range from zero to -3.5em (to keep the sun on stage, at sunset) */
    left: calc(var(--sun-position) / 43200 * 100%);
  }

  @supports(false) {
    .sun svg {

      /* Sunrise */
      top: 4.5em;
      left: 1.4em;

      /* Nine o’clock */
      top: 0.375em;
      left: calc(25% - 1.75em);

      /* Noon */
      top: -1.4em;
      left: calc(50% - 1.75em);

      /* Three o’clock */
      top: 0.375em;
      left: calc(75% - 1.75em);

      /* Sunset */
      top: 4.5em;
      left: calc(100% - 3.5em - 1.4em);
    }
  }

  .cloud {
    position: relative;
    z-index: 1;
    animation-name: floating;
    animation-duration: 160s; 
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    animation-fill-mode: both;
  }
  svg.cloud path {
    fill: currentColor;
  }

  .cloud {
    height: 2em;
    width: 2em;
  }
  .cloud:nth-child(2n) {
    height: 3em;
    width: 3em;
  }
  .cloud:nth-child(3n) {
    height: 4em;
    width: 4em;
  }

  @media (min-width: 45em) {
    .cloud {
      height: 2.5vmax;
      width: 2.5vmax;
    }
    .cloud:nth-child(2n) {
      height: 5vmax;
      width: 5vmax;
    }
    .cloud:nth-child(3n) {
      height: 7.5vmax;
      width: 7.5vmax;
    }
  }

  .cloud {
    color: rgba(51, 51, 51, 0.02);
    color: rgb(249, 249, 249);
    animation-duration: 800s;
  }
  .cloud:nth-child(2n+1) {
    color: rgba(51, 51, 51, 0.1);
    color: rgb(240, 240, 240);
    animation-duration: 1000s;
    /*
    animation-duration: var(--cloud-duration + 1000s);  ??
    */
  }
  .cloud:nth-child(3n+2) {
    color: rgba(51, 51, 51, 0.025);
    color: rgb(237, 237, 237);
    animation-duration: 920s; 
  }
  .cloud:nth-child(5n+3) {
    color: rgba(51, 51, 51, 0.01);
    color: rgb(246, 246, 246);
    animation-duration: 980s; 
  }
  .cloud:nth-child(2n+5) {
    color: rgba(51, 51, 51, 0.075);
    color: rgb(243, 243, 243);
    /*
    color: rgb(calc(var(--cloud-brightness) - 2), calc(var(--cloud-brightness) - 2), calc(var(--cloud-brightness) - 2));
    */
    animation-duration: 940s; 
  }

  .cloud {
    animation-delay: 0;
    animation-delay: calc(var(--cloud-delay-one) - 1000s);
  }

  .cloud:nth-child(2n) {
    animation-delay: -560s;
    animation-delay: calc(var(--cloud-delay-two) - 1560s);
  }

  .cloud:nth-child(3n-5) {
    animation-delay: -320s;
    animation-delay: calc(var(--cloud-delay-three) - 1320s);
  }

  .cloud:nth-child(5n-3) {
    animation-delay: -420s;
    animation-delay: calc(var(--cloud-delay-four) - 1420s);
  }

  .cloud:nth-child(3n-2) {
    animation-delay: -820s;
    animation-delay: calc(var(--cloud-delay-five) - 1820s);
  }

  /* Ship */
  .ahoy svg {
    height: 2.8em; /* base line height (1.4) x 2 */
    width: 3.7333333333em; /* height x 4/3 */
    fill: rgb(40, 155, 215);
    fill: currentColor;
  }

  /* KUDOS: http://www.justinaguilar.com/animations/ */
  @keyframes tossing {
    0% {
      transform: rotate(-2deg); 
    }
    50% {
      transform: rotate(2deg);
    }
    100% {
      transform: rotate(-2deg); 
    }           
  }

  .ahoy svg {
    animation-name: tossing;
    animation-duration: 8s; 
    animation-iteration-count: infinite;
  }

  @keyframes ship-left {
    100% {
      left: calc(-50% + 1.8666666667em);
    }
  }

  @keyframes ship-center {
    100% {
      left: 0;
    }
  }

  @keyframes ship-right {
    100% {
      left: calc(50% - 1.8666666667em);
    }
  }

  .movable-ship {
    display: block;
    position: relative;
    transition: transform 4s;
    transform: translateX(calc(var(--ship-position) * 15%));
    /*
    transform: translateX(calc(var(--ship-position) * 15% - var(--ship-position) * 1.8666666667em));
    */

    /*
    left: 0;
    left: calc(var(--ship-position) * 50% - var(--ship-position) * 1.8666666667em);
    left: var(--ship-position);
    */

    /*
    animation-name: var(--ship-animation);
    animation-duration: 16s;
    animation-fill-mode: both;
    */

    /*
    animation-play-state: paused;
    animation-play-state: var(--ship-play-state);
    */
  }


  /* =Night
  ----------------------------------------------- */

  .night body {
    background-color: rgb(31, 41, 51);
    color: rgb(252, 254, 249);  /* @snow */
  }
  .night .sun svg circle {
    fill: rgb(252, 254, 249);  /* @snow */
  }

  .night .sun::after {
    content: "";
    display: block;
    background-color: rgb(31, 41, 51);
    width: 1.5em;
    height: 1.5em;
    border-radius: 100%;
    position: absolute;

    /* Moon phase */
    transform: translate(32.5%, -17.5%);

    top: 0.375em;
    left: 1.4em;

    /*
    top: calc(var(--sun-position) / 21600 * 4.5em);
    */

    margin-left: calc(var(--sun-position) / 43200 * -3.5em); /* A range from zero to -3.5em (to keep the sun on stage, at sunset) */
    left: calc(var(--sun-position) / 43200 * 100%);

    /* (3.5 - 1.5) / 2 = 0.875 */
    top: calc(var(--sun-position-vertical) + 1em);
    left: calc(var(--sun-position) / 43200 * 100% + 1em);
  }
  .night .sun svg path {
    fill: transparent;
  }
  .night .cloud {
    opacity: 0;
    animation: none;
  }


  @keyframes twinkle {
    0% {
      opacity: 0.8;
    }
    4.5% {
      opacity: 0.8;
    }
    5% {
      opacity: 1;
    }
    5.5% {
      opacity: 0.8;
    }
    14.5% {
      opacity: 0.625;
    }
    15% {
      opacity: 1;
    }
    15.5% {
      opacity: 0.625;
    }
    19.5% {
      opacity: 0.8;
    }
    20% {
      opacity: 1;
    }
    20.5% {
      opacity: 0.8;
    }
    24.5% {
      opacity: 0.625;
    }
    25% {
      opacity: 1;
    }
    25.5% {
      opacity: 0.625;
    }
    29.5% {
      opacity: 0.8;
    }
    30% {
      opacity: 1;
    }
    30.5% {
      opacity: 0.8;
    }
    39.5% {
      opacity: 0.9;
    }
    40% {
      opacity: 1;
    }
    40.5% {
      opacity: 0.9;
    }
    49.5% {
      opacity: 0.95;
    }
    50% {
      opacity: 1;
    }
    50.5% {
      opacity: 0.95;
    }
    54.5% {
      opacity: 0.625;
    }
    55% {
      opacity: 1;
    }
    55.5% {
      opacity: 0.625;
    }
    59.5% {
      opacity: 0.8;
    }
    60% {
      opacity: 1;
    }
    60.5% {
      opacity: 0.8;
    }
    79.5% {
      opacity: 0.8;
    }
    80% {
      opacity: 1;
    }
    80.5% {
      opacity: 0.8;
    }
    84.5% {
      opacity: 0.625;
    }
    85% {
      opacity: 1;
    }
    85.5% {
      opacity: 0.625;
    }
    89.5% {
      opacity: 0.9;
    }
    90% {
      opacity: 1;
    }
    90.5% {
      opacity: 0.9;
    }
    94.5% {
      opacity: 0.625;
    }
    95% {
      opacity: 1;
    }
    95.5% {
      opacity: 0.625;
    }
    100% {
      opacity: 0.625;
    }
  }

  .night .stars div {
    position: absolute;
    z-index: 1;
    top: 2.1em;
    left: 55%;
  }
  .night .stars div:nth-child(2n) {
    top: 0.375em;
  }
  .night .stars div:nth-child(3n) {
    top: 1em;
  }
  .night .stars div:nth-child(5n) {
    top: 0.7em;
  }
  .night .stars div::after,
  .night .stars div::before {
    content: "";
    display: block;
    width: 0.1em;
    height: 0.1em;
    background-color: rgb(252, 254, 249);
    border-radius: 100%;
    position: relative;
    left: -1.4em;
    top: 0.7em;

    animation-name: twinkle;
    animation-duration: 24s; 
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
    animation-fill-mode: both;
  }
  .night .stars div::after {
    left: 0.7em;
    top: 0.375em;
  }
  .night .stars div:nth-child(2n+1)::before {
    left: -5em;
    top: 0.27em;
  }
  .night .stars div:nth-child(3n+5)::before {
    left: -2.8em;
    top: .27em;
  }
  .night .stars div:nth-child(2n)::after {
    left: -0.1em;
    top: 1.1em;
  }
  .night .stars div:nth-child(3n)::before {
    left: -1.5em;
    top: 1.8em;
  }
  .night .stars div:nth-child(3n)::after {
    left: 2.1em;
    top: 1.2em;
  }
  .night .stars div:nth-child(5n)::before {
    left: .2em;
    top: 2em;
  }
  .night .stars div:nth-child(5n)::after {
    left: 0.4em;
    top: 2.5em;
  }


  .night .stars div:nth-child(2n-3)::before {
    animation-delay: -.9s;
  }
  .night .stars div:nth-child(4n+3)::after {
    animation-delay: -.5s;
  }
  .night .stars div:nth-child(3n-5)::before {
    animation-delay: -.824s;
  }
  .night .stars div:nth-child(2n+9)::after {
    animation-delay: -.9s;
  }
  .night .stars div:nth-child(3n-7)::before {
    animation-delay: -.34s;
  }
  .night .stars div:nth-child(7n+3)::after {
    animation-delay: -.4s;
  }

  .night .stars div:nth-child(7n-1)::before {
    animation-delay: -1.2s;
  }
  .night .stars div:nth-child(2n+1)::after {
    animation-delay: -1s;
  }
  .night .stars div:nth-child(2n-1)::before {
    animation-delay: -1.4s;
  }
  .night .stars div:nth-child(3n+1)::after {
    animation-delay: -.9s;
  }
  .night .stars div:nth-child(8n-1)::before {
    animation-delay: -.4s;
  }
  .night .stars div:nth-child(5n+1)::after {
    animation-delay: -.5s;
  }

  .night .stars div:nth-child(1) {
    left: 12%;
    opacity: 0.99;
  }
  .night .stars div:nth-child(2) {
    left: 28%;
    opacity: 0.73;
  }
  .night .stars div:nth-child(3) {
    left: 34%;
    opacity: 0.82;
  }
  .night .stars div:nth-child(4) {
    left: 45%;
    opacity: 0.57;
  }
  .night .stars div:nth-child(5) {
    left: 57%;
    opacity: 0.31;
  }
  .night .stars div:nth-child(6) {
    left: 69%;
    opacity: 0.92;
  }
  .night .stars div:nth-child(7) {
    left: 73%;
    opacity: 0.73;
  }
  .night .stars div:nth-child(8) {
    left: 85%;
    opacity: 0.84;
  }
  .night .stars div:nth-child(9) {
    left: 92%;
    opacity: 0.46;
  }
  .night .stars div:nth-child(10) {
    left: 100%;
    opacity: 0.5;
  }
