/* ==========================================================================
   BASE — heyamychen.com
   Font-face, reset, global styles.
   ========================================================================== */

@import './tokens.css';


/* --------------------------------------------------------------------------
   FONT FACE
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Host Grotesk';
  src: url('../assets/font/Host_Grotesk/HostGrotesk-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Host Grotesk';
  src: url('../assets/font/Host_Grotesk/HostGrotesk-Italic-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Sans Mono';
  src: url('../assets/font/Noto_Sans_Mono/NotoSansMono-VariableFont_wdth,wght.ttf') format('truetype');
  font-weight: 100 900;
  font-stretch: 62.5% 100%;
  font-style: normal;
  font-display: swap;
}


/* --------------------------------------------------------------------------
   RESET
   -------------------------------------------------------------------------- */

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-body-lg);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking);
  color: var(--color-text);
  background-color: var(--color-bg);
  cursor: default;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-link);
  text-decoration: none;
  cursor: pointer;
}

em {
  font-style: normal;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

ul,
ol {
  list-style: none;
}

button {
  cursor: default;
  border: none;
  background: none;
  font: inherit;
}

input,
textarea {
  font: inherit;
}


/* --------------------------------------------------------------------------
   SECTION RULE
   Full-width 1px Grass rule — architectural section divider.
   -------------------------------------------------------------------------- */

.section-rule {
  display: block;
  width: 100%;
  height: 1px;
  background-color: var(--color-rule);
  border: none;
  margin: 0;
}


/* --------------------------------------------------------------------------
   BODY COPY LINK HOVER — animated squiggle underline
   -------------------------------------------------------------------------- */

.bodycopy a:hover {
  color: rgba(40, 51, 21, 0.85);
  text-decoration: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 4'%3E%3Cstyle type='text/css'%3E.squiggle%7Banimation:shift .3s linear infinite%7D%40keyframes shift%7Bfrom%7Btransform:translateX(0)%7Dto%7Btransform:translateX(-20px)%7D%7D%3C/style%3E%3Cpath fill='none' stroke='%23283315' stroke-width='1' class='squiggle' d='M0,3.5 c 5,0,5,-3,10,-3 s 5,3,10,3 c 5,0,5,-3,10,-3 s 5,3,10,3'/%3E%3C/svg%3E");
  background-position: 0 100%;
  background-size: auto 5px;
  background-repeat: repeat-x;
  padding-bottom: 5px;
  transition: color 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .bodycopy a:hover {
    background-image: none;
    text-decoration: underline;
  }
}


/* --------------------------------------------------------------------------
   SCROLL REVEAL — .fade-in gains .is-visible via IntersectionObserver
   -------------------------------------------------------------------------- */

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}


/* --------------------------------------------------------------------------
   LAYOUT CONTAINER
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--grid-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--grid-margin);
  padding-right: var(--grid-margin);
}


/* --------------------------------------------------------------------------
   REDUCED MOTION
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* --------------------------------------------------------------------------
   RESPONSIVE — grid margin overrides
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  :root {
    --grid-margin: 2rem;     /* 32px */
    --grid-gutter: 1.25rem;
  }
}

@media (max-width: 639px) {
  :root {
    --grid-margin: 1.25rem;  /* 20px */
    --grid-gutter: 1rem;
  }
}
