@charset "UTF-8";
@import "modern-normalize.css";

/* Theme Variables */
:root {
  /* Light Theme (default) */
  --bg-primary: #fff;
  --text-primary: #242424;
  --text-secondary: #3e3e3e;
  --text-inverse: #fff;
  --accent-primary: #247f62;
  --border-color: #247f62;
  --focus-glow: rgba(17, 166, 119, 0.22);
  --btn-shadow: rgba(0, 0, 0, 0.1);
  --highlight-bg: #e6ff93;
  --highlight-text: #000;
  --glow-accent: rgba(230, 255, 147, 0.55);
  --link-hover: #242424;
  --project-bg: #fff;
  --tag-highlight: #eef8f5;
  --project-tag-text: #242424;
  --focus-visible-carousel: #247f62;
  --card-shadow: rgba(0, 0, 0, 0.1);

  /* SVG wave background — layered light/dark, crossfaded via opacity
     (background-image itself can't be transitioned smoothly) */
  --svg-web-bg-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 300' preserveAspectRatio='none'%3E%3Cpath d='M0,110 C300,40 500,180 800,110 C1100,40 1300,180 1600,110 L1600,0 L0,0 Z' fill='%23ecf8f5'/%3E%3C/svg%3E");
  --svg-web-bg-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 300' preserveAspectRatio='none'%3E%3Cpath d='M0,110 C300,40 500,180 800,110 C1100,40 1300,180 1600,110 L1600,0 L0,0 Z' fill='%231e2b27'/%3E%3C/svg%3E");

  /* Transitions */
  --transition-theme-color: background-color 0.5s ease, color 0.5s ease;
  --transition-theme-opacity: opacity 0.5s ease;
  --transition-transform: transform 0.25s cubic-bezier(0.59, 2.3, 0.62, 0.69);
  --transition-color: color 0.25s cubic-bezier(0.6, -0.28, 0.74, 0.05);
  --transition-shadow: box-shadow 0.25s cubic-bezier(0.6, -0.28, 0.74, 0.05);
  --transition-underline: transform 0.45s ease;
  --transition-btn:
    var(--transition-transform), var(--transition-shadow),
    var(--transition-color);

  /* Shared decorative art */
  --squiggle-underline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3'%3E%3Cpath d='M0 1.5 Q1.5 0 3 1.5 T6 1.5' fill='none' stroke='%23247F62' stroke-width='0.9'/%3E%3C/svg%3E");

  /* Fonts */
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-tag: tablet-gothic-compressed, "trumpgothicpro", sans-serif;

  /* Layout */
  --radius-card: 5px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --content-max: 62rem;
  --space-section: clamp(4rem, 3rem + 6vw, 7.5rem);

  /* Text variables */
  --font-h1-hero: clamp(2.5rem, 1rem + 6.5vw, 4.75rem);
  --font-h1-about: clamp(2.4rem, 1.4rem + 4vw, 4rem);
  --font-h1-sub: clamp(2.15rem, 1.789rem + 0.889vw, 2.65rem);
  --font-h2: clamp(1.7rem, 1.1rem + 2.4vw, 2.6rem);
  --font-h2-sub: clamp(1.3rem, 1.15rem + 0.6vw, 1.5rem);
  --font-h2-special: clamp(1.65rem, 1.397rem + 0.622vw, 2rem);
  --font-h3: clamp(1.2rem, 1rem + 1vw, 1.5rem);
  --font-body-base: clamp(1rem, 0.93rem + 0.35vw, 1.2rem);
  --font-list: clamp(1.15rem, 1.078rem + 0.178vw, 1.25rem);
  --font-a-small: 0.95rem;
  --font-toggle: 1.5em;
  --font-button-big: clamp(1.15rem, 1rem + 0.7vw, 1.45rem);
  --font-subtitle: clamp(0.85rem, 0.8rem + 0.2vw, 1rem);
  --font-button-cta: clamp(1rem, 0.856rem + 0.356vw, 1.2rem);
  --font-card-body: 0.98rem;
}

[data-theme="dark"] {
  /* Dark Theme */
  --bg-primary: #1a1a1a;
  --text-primary: #fff;
  --text-secondary: #d1d1d1;
  --text-inverse: #1a1a1a;
  --accent-primary: #11a677;
  --border-color: #11a677;
  --btn-shadow: #ffffff11;
  --highlight-bg: #c7dc80;
  --highlight-text: #1a1a1a;
  --glow-accent: rgba(17, 166, 119, 0.16);
  --link-hover: #fff;
  --project-bg: #2d2d2d;
  --project-tag-text: #242424;
  --focus-visible-carousel: #fff;
  --card-shadow: rgba(0, 0, 0, 0.4);
  --squiggle-underline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3'%3E%3Cpath d='M0 1.5 Q1.5 0 3 1.5 T6 1.5' fill='none' stroke='%2311a677' stroke-width='0.9'/%3E%3C/svg%3E");
}

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

html {
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-body);
  line-height: 1;
  transition: var(--transition-theme-color);
}

.web-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  transform: translateZ(0);
}

.web-bg::before,
.web-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-size: 100vw clamp(200px, 28vw, 380px);
  background-repeat: no-repeat;
  background-position: right top;
  transition: opacity 0.5s ease;
}

.web-bg::before {
  background-image: var(--svg-web-bg-light);
  opacity: 1;
}

.web-bg::after {
  background-image: var(--svg-web-bg-dark);
  opacity: 0;
}

[data-theme="dark"] .web-bg::before {
  opacity: 0;
}

[data-theme="dark"] .web-bg::after {
  opacity: 1;
}

[data-theme="dark"] .theme-light-only,
:root:not([data-theme="dark"]) .theme-dark-only {
  display: none;
}

::selection {
  color: var(--highlight-text);
  background-color: var(--highlight-bg);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-primary);
}

p {
  text-wrap: pretty;
}

a {
  text-decoration: none;
  color: var(--accent-primary);
  border: none;
  transition: 0.25s ease;

  &:hover {
    color: var(--link-hover);
  }

  &.backlink {
    position: relative;
    font-size: var(--font-a-small);

    &::before {
      content: "\21FD";
      display: inline-block;
      transition: var(--transition-transform);
      vertical-align: middle;
      margin-right: 0.25rem;
    }

    &::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: -0.3em;
      height: 3px;
      background-image: var(--squiggle-underline);
      background-repeat: repeat-x;
      background-size: 6px 3px;
      transform: scaleX(0);
      transform-origin: right;
      transition: var(--transition-underline);
    }
  }

  &:focus-visible {
    outline: 2px dotted var(--accent-primary);
    outline-offset: 5px;
    border-radius: 5px;
    box-shadow: 0 0 10px 0 var(--focus-glow);
  }
}

section > ul > li {
  font-size: var(--font-list);
}

/* Buttons */
.theme-toggle-icon {
  font-size: var(--font-toggle);
  color: var(--accent-primary);
  background: none;
  border: none;
  cursor: pointer;
  display: inline-block;
  line-height: 1;
  padding: 8px;
  vertical-align: middle;
  transition: var(--transition-transform);
  -webkit-tap-highlight-color: transparent;

  &:active {
    transform: scale(0.95);
  }

  &:focus-visible {
    outline: 2px dotted var(--accent-primary);
    outline-offset: 5px;
    border-radius: 5px;
    box-shadow: 0 0 10px 0 var(--focus-glow);
  }
}

.theme-toggle-icon i {
  pointer-events: none;
}

.cta-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.1rem);
  box-shadow: 0 0 0 0 var(--accent-primary) inset;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
  border-radius: 2.5px;
  display: block;
  padding: 0.325em 0.625em;
  margin: 0.33em 0;
  text-align: center;
  transition: var(--transition-btn);

  &:focus-visible {
    outline: 2px dotted var(--accent-primary);
    outline-offset: 5px;
    border-radius: 5px;
    box-shadow: 0 0 10px 0 var(--focus-glow);
  }

  &:active {
    transform: scale(0.97);
    box-shadow: 0 4.5em 0 0 var(--accent-primary) inset;
    color: var(--text-inverse);
    transition-duration: 0.08s;
  }
}

.cta-btn--primary {
  margin-top: 1.2rem;
  box-shadow:
    0 0 0 0 var(--accent-primary) inset,
    0.2em 0.15em 0 0 var(--btn-shadow);
}

/* Tags */
.tag {
  font-family: var(--font-tag);
  font-size: 1.2rem;
  color: var(--accent-primary);
  letter-spacing: 0.02em;
  line-height: 1.4;
  text-transform: uppercase;
  list-style-type: none;
  display: inline-block;
}

/* Rules */
hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: thin solid var(--border-color);
  margin: 1rem 0;
  padding: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -3rem;
  left: var(--gutter);
  z-index: 100;
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6em 1em;
  border-radius: 5px;
  transition: top 0.2s ease;

  &:focus-visible {
    top: 0.75rem;
    outline: 2px dotted var(--text-inverse);
    outline-offset: 3px;
  }
}

/* Navigation */
.site-head {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.25rem;
}

.logo {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--accent-primary);
  text-decoration: none;
  transition: var(--transition-transform);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 3vw, 1.75rem);
}

.site-nav a {
  position: relative;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.45s ease;

  &::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.35em;
    height: 3px;
    background-image: var(--squiggle-underline);
    background-repeat: repeat-x;
    background-size: 6px 3px;
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition-underline);
  }
}

.bulb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  color: var(--accent-primary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1;
  transition: var(--transition-transform);
  -webkit-tap-highlight-color: transparent;

  i {
    font-size: 1.1rem;
    pointer-events: none;
  }

  &:focus-visible {
    outline: 2px dotted var(--accent-primary);
    outline-offset: 5px;
    border-radius: 5px;
    box-shadow: 0 0 10px 0 var(--focus-glow);
  }
}

@media (max-width: 720px) {
  .site-nav a:not(:first-child):not(:last-child) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .site-nav a::after,
  .backlink::after,
  .theme-toggle-icon,
  .bulb-toggle,
  .logo {
    transition: none;
  }
}

/* === Desktop: 1550px+ — max width for site === */

@media screen and (min-width: 1550px) {
  body {
    max-width: 1550px;
    display: block;
    margin: auto;
  }
}

/* === Major Animations === */

@media (hover: hover) {
  .cta-btn--wrap:hover {
    .cta-btn--primary {
      box-shadow:
        0 4em 0 0 var(--accent-primary) inset,
        0em 0em 0 0 var(--btn-shadow);
      transform: translate(0.2em, 0.15em);
      color: var(--text-inverse);
      transition: var(--transition-btn);
    }
  }
  .cta-btn:hover {
    box-shadow: 0 4em 0 0 var(--accent-primary) inset;
    color: var(--text-inverse);
    transition: var(--transition-btn);
  }

  .backlink:hover {
    &::before {
      transform: translateX(-15%);
    }

    &::after {
      transform: scaleX(1);
    }
  }

  .theme-toggle-icon:hover {
    transform: scale(1.15);
  }

  .bulb-toggle:hover {
    transform: scale(1.08);
  }

  .site-nav a:hover {
    color: var(--accent-primary);

    &::after {
      transform: scaleX(1);
    }
  }

  .logo:hover {
    transform: scale(1.1);
  }
}

/* Higher specificity than the hover rules above so the press state actually
   shows while hovering-then-clicking (the normal desktop click sequence) */
.cta-btn--wrap:active .cta-btn--primary {
  transform: translate(0.2em, 0.15em) scale(0.97);
  box-shadow:
    0 4.5em 0 0 var(--accent-primary) inset,
    0 0 0 0 var(--btn-shadow);
  transition-duration: 0.08s;
}
