:root {
  --dark: #161A1D;
  --neutral-dark: #454F59; /*Tertiary neutral color to be used on dark backgrounds, such as borders*/
  --neutral-light: #738496; /* Secondary neutral color to be used as text */
  --light: #feffff;
  --blue: #1D7AFC;
  --blue-light: #579DFF; /* Secondary blue to be used on dark backgrounds */
  --blue-dark: #0055CC;
  
  /* Animation variables */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s ease;
  --transition-slow: 0.8s ease-out;
}

/* COLOR VARIABLES */
.dark { color: var(--dark); }
.n-dark { color: var(--neutral-dark); }
.n-light { color: var(--neutral-light); }
.light { color: var(--light); }
.blue { color: var(--blue); }
.b-dark { color: var(--blue-dark); }
.b-light { color: var(--blue-light); }

/* Font loading states */
.wf-loading * { 
  opacity: 0; 
}
.wf-active *,
.wf-inactive * {
  opacity: 1;
  transition: opacity var(--transition-slow);
}

/* Base styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--light);
  color: var(--dark);
  font-display: optional;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-feature-settings: "ss03" on, "zero" on, "calt" on, "case" on, "salt" on;
  font-weight: 400;
  line-height: 1.3;
  margin: 0 auto;
  max-width: calc(105rem + 4vw);
  padding: 4vw;
  text-rendering: optimizeLegibility;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bg-dark { 
  background-color: var(--dark); 
}

/* Typographic styles */
h1, h2, h3, h4, h5 {
  letter-spacing: -0.0117em;
  margin: 0;
  padding: 0;
}

p {
  font-kerning: normal;
  font-size: inherit;
  font-weight: 400;
  margin: 0;
}

/* CUSTOM LINK STYLING */
.link {
  cursor: pointer;
  position: relative;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.link.active {
  color: var(--neutral-light);
  box-shadow: 0 1px var(--neutral-light);
}

.link:hover {
  color: var(--blue);
  cursor: pointer;
}

.link:focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

.link::before,
.link::after {
  position: absolute;
  width: 100%;
  height: 1px;
  background: currentColor;
  top: 100%;
  left: 0;
  pointer-events: none;
}

.link::before {
  content: '';
  /* show by default */
}

.link--underline::before {
  transform-origin: 100% 50%;
  transform: scale3d(0, 2, 2);
  transition: transform var(--transition-medium);
}

.link--underline:hover::before {
  transform-origin: 0% 50%;
  transform: scale3d(1, 2, 2);
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--blue);
  color: var(--light);
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

/* END CUSTOM LINK STYLING */

/* PORTFOLIO STYLING */
.case-study p { 
  margin: 0 0 1rem; 
}

.call { 
  border-color: var(--dark); 
  border-width: 1px; 
}

blockquote { 
  border-color: var(--blue); 
}

.wide { 
  margin-left: -4rem; 
  margin-right: -4rem; 
  text-align: center; 
}

.principles {
  background-color: #E9F2FF;
  border-radius: 8px;
  border: 1px solid #CCE0FF;
  box-shadow: inset 0 -1px #fff;
  margin-left: -4rem;
  margin-right: -4rem;
}
/* END PORTFOLIO STYLING */

/* MOBILE OVERRIDES */
@media screen and (max-width: 30em) {
  figure.wide { 
    margin-left: 0; 
    margin-right: 0; 
  }
  
  .one { order: 1; }
  .two { order: 2; }
  .three { order: 3; }
  .four { order: 4; }
  .five { order: 5; }
  .six { order: 6; }
  .seven { order: 7; }
  .eight { order: 8; }
  .nine { order: 9; }
  .ten { order: 10; }
  .eleven { order: 11; }

  .principles {
    margin-right: 0;
    margin-left: 0;
  }
  
  /* Improve touch targets on mobile */
  .link {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .link--underline::before {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .link:hover {
    color: var(--light);
    background-color: var(--blue);
  }
  
  .link--underline::before {
    height: 2px;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
    color: black;
    padding: 0;
  }
  
  .link::before,
  .link::after {
    display: none;
  }
}
