/*───────────────────────────────────────────────────────────────────────────
  RESET & BASE
───────────────────────────────────────────────────────────────────────────*/
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body, #app {
  height: 100%;
  overflow-y: auto;      /* scroll here */
  font-family: sans-serif;
  font-weight: 300;
  font-size: 2vw;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
  transition: background .3s, color .3s;
}

h1, h2 {
  all: unset;
}

/* user-set CSS vars for light/dark */
:root {
  --bg: rgb(238, 238, 238);
  --fg: rgb(17, 17, 17);
  --link: rgba(17, 17, 17, .5);
  --media-bg: rgb(238, 238, 238);
  --pill-bg: rgb(17, 17, 17);
  --pill-fg: rgb(238, 238, 238);
  --pill-border: rgb(17, 17, 17);
}
/*
@media (prefers-color-scheme: dark) {
  :root {
    --bg: rgb(17, 17, 17);
    --fg: rgb(238, 238, 238);
    --link: rgba(238, 238, 238, .5);
    --media-bg: rgb(17, 17, 17);
    --pill-bg: rgb(238, 238, 238);
    --pill-fg: rgb(17, 17, 17);
    --pill-border: rgb(238, 238, 238);
  }
}*/

ul, li {
  display: inline-block;
  list-style: none;
}

/*───────────────────────────────────────────────────────────────────────────
  LAYOUT
───────────────────────────────────────────────────────────────────────────*/
#app {
  display: flex;
  flex-direction: column;
}
header {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: nowrap;
  flex-direction: row-reverse;
  gap: 3vw;
  padding: 3vw;
  font-size: 4vw;
}
header h1 {
  max-width: 75vw;
}
#socials {
  height: 100%;
}
header ul {
  display: flex;
  flex-direction: row;
  gap: 1vw;
}
header ul li {
  width: .5em;
  height: .5em;
}
header ul li img {
  width: 100%;
  height: 100%;
}
#projects {
  flex: 1 1 auto;
  min-height: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  margin: 0 0 0 0;
  /*border: 1px solid var(--fg);*/
}

/* make “home” and emoji share that header */
#project-title {
  font-weight: 200;
}
#home-link {
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  opacity: 0.5;
}

#home-link:hover {
  opacity: 1;
}

/*───────────────────────────────────────────────────────────────────────────
  MEDIA + BADGE
───────────────────────────────────────────────────────────────────────────*/
#fun {
  pointer-events: none;
}

#media {
  display: none;
  flex: 1;
  position: relative;
  width: calc(100% - 6vw);
  height: 100%;
  border-radius: 1vw;
  margin: 0 3vw calc(3vw + env(safe-area-inset-bottom)) 3vw;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  opacity: 0;
  transition: opacity .3s ease;
}

#media img,
#media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#projects #media > *,
#projects .project-link {
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

#projects.open {
  display: flex;
}


#projects.open #media,
#projects.open #media > *,
#projects.open .project-link {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

#about.visible ~ #projects #media {
  display: none;
}

#emoji {
  cursor: pointer;
  display: inline-block;
  animation: ring 3s ease-in-out infinite;
  position: relative;
}
#emoji-counter {
  position: absolute;
  top: -0.0vw;
  right: -0.8vw;
  min-width: 2vw;
  height: 2vw;
  padding: 0 0.4vw;
  background: linear-gradient(to bottom, #ff5f57 0%, #e33e34 60%, #c1271f 100%);
  color: #fff;
  font-size: 1.2vw;
  line-height: 2vw;
  text-align: center;
  border-radius: 999px;
  box-shadow: inset 0 -0.1em 0.1em rgba(0,0,0,0.2),
              0 0.05em 0.15em rgba(0,0,0,0.2);
  pointer-events: none;
  transition: transform .2s ease-out;
  will-change: transform;
}
#emoji-counter.pop {
  animation: badge-pop .3s ease-out;
}

/*───────────────────────────────────────────────────────────────────────────
  ABOUT
───────────────────────────────────────────────────────────────────────────*/
#about,
#experience {
  display: none;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas: aside | main | main;
  column-gap: 3vw;
  justify-items: start;
  align-items: start;
  padding: 3vw;
}

#about {
  flex-grow: 1;
  overflow: visible;     /* allow it to grow */
  background: var(--bg);
  color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
  scroll-margin-top: 2vw;
}

#about.visible,
#experience.visible {
  display: grid;
  opacity: 1;
  pointer-events: auto;
}

#about > main > * {
  margin-bottom: 2vw;
}

#about > main,
#experience > main {
  width: 100%;
  grid-column: 2 / span 2;
}

#about > aside,
#experience > aside {
  grid-column: 1 / span 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 2vw 0;
  font-size: 0.5em;
}

#about > aside img {
  max-width: 6vw;
  position: sticky;
  top: 3vw;
  padding-bottom: 3vw;
}

#experience h2 {
  margin-bottom: 3vw;
}

hr {
  border: .1vw solid var(--fg);
}

a,
button span {
  color: var(--fg);
  text-decoration: none;
  opacity: 0.5;
}

a:hover,
button:hover,
button:hover span {
  opacity: 1;
  cursor: pointer;
}

button.active::after {
  content: "";
  display: inline-block;
  width: 1em;               /* icon size */
  height: 1em;
  margin-left: .2em;          /* space before icon */
  vertical-align: -0.2em;
  background: no-repeat center/contain
    url('data:image/svg+xml;utf8,\
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\
    <circle cx="12" cy="12" r="10" fill="rgba(0,0,0,0.25)"/>\
    <path d="M8 8l8 8M16 8l-8 8" stroke="currentColor" stroke-width="1" stroke-linecap=""/>\
  </svg>');
}

button.active:hover::after {
    background: no-repeat center/contain
    url('data:image/svg+xml;utf8,\
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\
    <circle cx="12" cy="12" r="10" fill="rgba(0,0,0,1)"/>\
    <path d="M8 8l8 8M16 8l-8 8" stroke="white" stroke-width="1" stroke-linecap=""/>\
  </svg>');
}

/*───────────────────────────────────────────────────────────────────────────
  PILL LINKS & TEXT
───────────────────────────────────────────────────────────────────────────*/
/* style the “View project” pill inside your media container */
.project-link {
  display: inline-block;
  cursor: pointer;
  text-decoration: none;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: .75vw 1vw;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  text-decoration: none;
  text-align: center;
}

.project-link {
  display: inline-block;
  position: absolute;
  bottom: 1vw;
  right:  1vw;
  padding: 1vw;
  border-radius: .6vw;
  background: var(--bg);
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
  font-size: 2vw;
  z-index: 1;
}

.project-link::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: 0.25em;
  transform: scale(0.75) translate(0%, 25%);
  transition: transform 0.25s ease;
  background: no-repeat center / contain
    url("data:image/svg+xml;utf8,\
      <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='.1em' stroke-linecap='round' stroke-linejoin='round'>\
        <!-- left and bottom sides of square -->\
        <polyline points='3,21 3,3 10,3'/>\
        <!-- stop top side at center (12,3) -->\
        <!-- stop right side at center (21,12) -->\
        <line x1='21' y1='14' x2='21' y2='21'/>\
        <line x1='21' y1='21' x2='3' y2='21'/>\
        <!-- arrow from center to top right -->\
        <line x1='12' y1='12' x2='21' y2='3'/>\
        <polyline points='15,3 21,3 21,9'/>\
      </svg>");
}

button {
  all: unset;
}

button span {
  pointer-events: none;
  border-bottom: 0.05em solid currentColor;
}

.quote-text {
  display: inline-block;
  width: calc(100% - 6vw);
  position: relative;
  padding: 3vw;
  border-radius: 1vw;
  background: rgba(0,0,0,.05);
  z-index: 0;
}

.quote-face {
  display: inline-block;
  float: left;
  position: sticky;
  top: 4vw; bottom: 4vw;
  width: 6vw;
  margin-bottom: 6vw;
  transform: translate(2vw, 2vw);
  z-index: 1;
}

.quote-face img {
  max-width: 100%;
  height: auto;
}

#media .project-link:hover::after {
  transform: scale(1) translate(0%, 18.75%);
  background: no-repeat center / contain
  url("data:image/svg+xml;utf8,\
    <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='.075em' stroke-linecap='round' stroke-linejoin='round'>\
      <!-- left and bottom sides of square -->\
      <polyline points='3,21 3,3 10,3'/>\
      <!-- stop top side at center (12,3) -->\
      <!-- stop right side at center (21,12) -->\
      <line x1='21' y1='14' x2='21' y2='21'/>\
      <line x1='21' y1='21' x2='3' y2='21'/>\
      <!-- arrow from center to top right -->\
      <line x1='12' y1='12' x2='21' y2='3'/>\
      <polyline points='15,3 21,3 21,9'/>\
    </svg>");
}

#media .project-link:hover {
  background: white;
  color: black;
  border: none;
}

.pill {
  border: .2vw solid var(--pill-border);
  background: transparent;
  color: var(--pill-border);
  font-size: 2vw;
}

.pill:hover,
.pill.active {
  background: var(--pill-bg);
  color: var(--pill-fg);
}

#approach-toggle {
  display: flex;
  gap: .5vw;
  align-items: center;
  flex-wrap: wrap;
}
#approach-toggle span {
  flex-shrink: 0;
}
#approach-content p:not(.quote-text p) {
  margin: 1.5vw 0;
}

/*───────────────────────────────────────────────────────────────────────────
  EXPERIENCE
───────────────────────────────────────────────────────────────────────────*/
#experience {
  background: var(--fg);
  color: var(--bg);
}

#experience-list {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-items: baseline;
}

#experience-list li {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  column-gap: 3vw;
  justify-items: start;
  align-items: baseline;
  width: 100%;
  padding: 1.5vw 0;
}

#experience-list li:not(:first-child) {
  border-top: 1px solid currentColor;
}

#experience-list li span:first-child {
  width: 100%;
  grid-column: 1 / span 2;
}

#experience-list li span:not(:first-child) {
  width: 100%;
  grid-column: span 1;
}

#experience-list li span:last-child {
  text-align: right;
}

#experience-list .experience-employer {
  flex: 2;
}

#experience-list .experience-place {
  flex: 1;
}

#experience-list .experience-place,
#experience-list .experience-duration {
  font-size: 0.5em;
  line-height: 1;
  opacity: 0.5;
}

/*───────────────────────────────────────────────────────────────────────────
  ANIMATIONS + KEYFRAMES
───────────────────────────────────────────────────────────────────────────*/
@keyframes ring {
  0%,15%,100% { transform: rotate(0) scale(1); }
  2%   { transform: rotate(15deg) scale(1.05); }
  4%   { transform: rotate(-15deg); }
  6%   { transform: rotate(10deg); }
  8%   { transform: rotate(-10deg); }
 10%   { transform: rotate(5deg) scale(1.05); }
 12%   { transform: rotate(-5deg); }
}
@keyframes badge-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
 100%  { transform: scale(1); }
}

/*───────────────────────────────────────────────────────────────────────────
  MOBILE ADJUSTMENTS
───────────────────────────────────────────────────────────────────────────*/
@media (max-width: 992px) {
  html, body, #app {
    font-size: 6vw !important;
  }
  html {
    padding-top: env(safe-area-inset-top);
  }
  header {
    display: flex;
    flex-direction: column;
    padding: 2.75vw;
    font-size: 8vw;
    line-height: 1.5;
  }
  header h1 {
    max-width: unset;
  }
  header ul {
    width: 100%;
    justify-content: flex-end;
    margin-bottom: 2.75vw;
  }
  header ul li {
    width: 1em;
    height: 1em;
    padding: 0.125em;
  }
  #media {
    border-radius: 3vw;
  }
  #about > main,
  #experience > main {
    width: 100%;
    grid-column: 1 / span 3;
  }
  #about > aside,
  #experience > aside {
    grid-column: 1 / span 2;
  }
  .quote-text {
    width: calc(100% - 12vw);
    padding: 6vw;
    font-size: 85%;
  }
  .quote-face {
    top: 8vw; bottom: 8vw;
    width: 12vw;
    margin-bottom: 12vw;
    transform: translate(4vw, 4vw);
  }
  #experience-list li {
    padding: 3vw 0;
  }
  #experience-list li span:first-child {
    width: 100%;
    grid-column: 1 / span 4;
  }

  #experience-list li span:not(:first-child) {
    width: 100%;
    grid-column: span 3;
  }
  #experience-list li span:last-child {
    width: 100%;
    grid-column: 4 / span 1;
  }
  hr {
    margin-top: 10vw;
    margin-bottom: 8vw !important;
  }
  .project-link {
    right: 50%;
    bottom: 3vw;
    border-radius: 2vw;
    transform: translateX(50%);
  }
  .pill,
  .project-link {
    font-size: 6vw;
    border-width: .5vw;
    padding: 2vw 4vw;
    white-space: nowrap;
  }
  #about > * {
    margin-bottom: 10vw;
  }
  #emoji-counter {
    top: -1vw; right: -3vw;
    min-width: 6vw; height: 6vw;
    font-size: 3.5vw; line-height: 6vw;
  }
}