/* Purdue Hackers theme. Latest: https://components.purduehackers.com/r/ph.css */

@font-face {
  font-family: "Pixel Hackers";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PixelHackers.woff2") format("woff2");
}

@font-face {
  font-family: "Inconsolata";
  font-style: normal;
  font-weight: 200 900;
  font-stretch: 50% 200%;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/Inconsolata-latin.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inconsolata";
  font-style: normal;
  font-weight: 200 900;
  font-stretch: 50% 200%;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/Inconsolata-latin-ext.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "PolySans";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-Slim.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-SlimItalic.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-Neutral.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-NeutralItalic.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-Median.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-MedianItalic.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-Relax.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-RelaxItalic.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-Bulky.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-BulkyItalic.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-Inky.woff2") format("woff2");
}

@font-face {
  font-family: "PolySans";
  font-style: italic;
  font-weight: 900;
  font-display: swap;
  src: url("https://components.purduehackers.com/fonts/PolySans-InkyItalic.woff2") format("woff2");
}

@custom-variant dark (&:is(.dark *));

/* No rounded corners: removes Tailwind's radius scale, so rounded-* does nothing. */
@theme {
  --radius-*: initial;
}

@theme inline {
  --font-sans: var(--ph-font-sans);
  --font-mono: var(--ph-font-mono);
  --font-pixel: var(--ph-font-pixel);

  --ease-quint: cubic-bezier(0.2, 0, 0, 1);

  --color-ph-black: var(--ph-black);
  --color-ph-cream: var(--ph-cream);
  --color-ph-yellow: var(--ph-yellow);
  --color-ph-purple: var(--ph-purple);
  --color-ph-white: var(--ph-white);
  --color-ph-pink: var(--ph-pink);
  --color-ph-orange: var(--ph-orange);
  --color-ph-lime: var(--ph-lime);
  --color-ph-teal: var(--ph-teal);
  --color-ph-blue: var(--ph-blue);
  --color-ph-periwinkle: var(--ph-periwinkle);

  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-rule: var(--rule);
  --color-ring: var(--ring);
}

:root {
  --ph-font-sans: "PolySans", ui-sans-serif, system-ui, sans-serif;
  --ph-font-mono: "Inconsolata", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ph-font-pixel: "Pixel Hackers", "Inconsolata", monospace;
  --ph-ease: cubic-bezier(0.2, 0, 0, 1);

  --ph-black: #000000;
  --ph-cream: #fbf7ec;
  --ph-yellow: #fcd202;
  --ph-purple: #7d3bff;
  --ph-white: #ffffff;
  --ph-pink: #efb9ff;
  --ph-orange: #ff9300;
  --ph-lime: #a5e209;
  --ph-teal: #01beb2;
  --ph-blue: #0084ff;
  --ph-periwinkle: #7688ff;

  --background: var(--ph-cream);
  --foreground: var(--ph-black);
  --card: var(--ph-white);
  --card-foreground: var(--ph-black);
  --primary: var(--ph-purple);
  --primary-foreground: var(--ph-cream);
  --secondary: var(--ph-yellow);
  --secondary-foreground: var(--ph-black);
  --accent: var(--ph-blue);
  --accent-foreground: var(--ph-cream);
  --muted: #efebe0;
  --muted-foreground: var(--ph-black);
  --border: #e2ded4;
  --input: #c6c3ba;
  --rule: #c6c3ba;
  --ring: var(--ph-black);
}

.dark {
  --background: var(--ph-black);
  --foreground: var(--ph-white);
  --card: #0d0d0d;
  --card-foreground: var(--ph-white);
  --primary: var(--ph-yellow);
  --primary-foreground: var(--ph-black);
  --secondary: var(--ph-pink);
  --secondary-foreground: var(--ph-black);
  --accent: var(--ph-pink);
  --accent-foreground: var(--ph-black);
  --muted: #1a1a1a;
  --muted-foreground: #ffffffb3;
  --border: #262626;
  --input: #4d4d4d;
  --rule: #4d4d4d;
  --ring: var(--ph-white);
}

@layer base {
  html {
    background: var(--background);
    -webkit-text-size-adjust: 100%;
  }

  body {
    background: var(--background);
    color: var(--foreground);
    font-family: var(--ph-font-sans);
    font-size: 14px;
    line-height: 1.45;
    letter-spacing: -0.02em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  ::selection {
    background: var(--ph-yellow);
    color: var(--ph-black);
  }

  :focus-visible {
    outline: 1px solid var(--ring);
    outline-offset: 2px;
  }
}

@utility measure {
  width: 480px;
  max-width: calc(100vw - 32px);
  margin-inline: auto;
}

@utility dither-field {
  background-image: repeating-conic-gradient(var(--rule) 0% 25%, transparent 0% 50%);
  background-size: 2px 2px;
}

@utility ph-headline {
  font-family: var(--ph-font-pixel);
  line-height: 0.85;
  letter-spacing: 0;
}

@utility ph-subheadline {
  font-family: var(--ph-font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

@utility enter {
  animation: ph-enter 300ms var(--ph-ease) backwards;
  animation-delay: calc(var(--i, 0) * 40ms);

  @media (prefers-reduced-motion: reduce) {
    animation: none;
  }
}

@keyframes ph-enter {
  from {
    opacity: 0;
    filter: blur(4px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

@utility grid-bg {
  background-image:
    linear-gradient(var(--grid-color, color-mix(in oklab, var(--foreground) 10%, transparent)) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color, color-mix(in oklab, var(--foreground) 10%, transparent)) 1px, transparent 1px);
  background-size: var(--grid-size, 30px) var(--grid-size, 30px);
}

/* Moves on a transformed pseudo-element so it stays on the compositor. */
@utility grid-bg-animated {
  position: relative;
  isolation: isolate;
  overflow: clip;

  &::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: calc(-1 * var(--grid-size, 30px)) 0 0 calc(-1 * var(--grid-size, 30px));
    background-image:
      linear-gradient(var(--grid-color, color-mix(in oklab, var(--foreground) 6%, transparent)) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid-color, color-mix(in oklab, var(--foreground) 6%, transparent)) 1px, transparent 1px);
    background-size: var(--grid-size, 30px) var(--grid-size, 30px);
    animation: ph-grid-move 4s linear infinite;
  }

  @media (prefers-reduced-motion: reduce) {
    &::before {
      animation: none;
    }
  }
}

@keyframes ph-grid-move {
  to {
    transform: translate3d(var(--grid-size, 30px), var(--grid-size, 30px), 0);
  }
}
