/* ============================================================
   Pig Company – pigcompany.se
   Main stylesheet
   ============================================================ */

/* ----------------------------------------------------------
   1. CSS Custom Properties (Design tokens)
   ---------------------------------------------------------- */
:root {
  /* Colors */
  --color-pig-pink:    #F4A5B0;
  --color-pig-pink-dk: #E8849A;
  --color-carrot:      #FF6B35;
  --color-carrot-dk:   #E55A24;
  --color-green:       #4CAF50;
  --color-green-dk:    #388E3C;

  --color-bg:          #FDFAF6;
  --color-bg-dark:     #1A1A1A;
  --color-bg-darker:   #111111;
  --color-bg-accent:   #2C1A0E;

  --color-text:        #1A1A1A;
  --color-text-muted:  #5C5C5C;
  --color-text-light:  #F5F5F0;
  --color-text-light-muted: rgba(245,245,240,0.7);

  --color-surface:     #FFFFFF;
  --color-border:      #E8E0D5;

  /* Typography */
  --font-body:    'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono:    'Space Mono', 'Courier New', monospace;

  /* Scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;
  --text-6xl:  3.75rem;
  --text-7xl:  4.5rem;
  --text-8xl:  6rem;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Layout */
  --container-max:   1200px;
  --container-px:    var(--space-6);

  /* Effects */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl:  0 20px 25px rgba(0,0,0,.10), 0 10px 10px rgba(0,0,0,.04);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;
  --transition-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Nav */
  --nav-height: 72px;
}

/* ----------------------------------------------------------
   2. Reset & Base
   ---------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

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

/* Focus styles for accessibility */
:focus-visible {
  outline: 3px solid var(--color-carrot);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ----------------------------------------------------------
   3. Layout utilities
   ---------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-px);
  padding-right: var(--container-px);
}

/* ----------------------------------------------------------
   4. Navigation
   ---------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background-color: rgba(253, 250, 246, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-base), background-color var(--transition-base);
}

.site-header.scrolled {
  border-bottom-color: var(--color-border);
  background-color: rgba(253, 250, 246, 0.98);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  max-width: var(--container-max);
  margin: auto;
  padding: 0 var(--container-px);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
  transition: opacity var(--transition-fast);
}

.nav__logo:hover {
  opacity: 0.75;
}

.nav__logo-icon {
  font-size: var(--text-2xl);
  line-height: 1;
}

.nav__logo-text {
  font-family: var(--font-mono);
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-carrot);
  transition: width var(--transition-base);
}

.nav__link:hover {
  color: var(--color-text);
}

.nav__link:hover::after {
  width: 100%;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  padding: var(--space-2);
}

.nav__toggle span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: var(--radius-full);
  transition: transform var(--transition-base), opacity var(--transition-base);
}

/* ----------------------------------------------------------
   5. Buttons
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-8);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  transition: transform var(--transition-spring), box-shadow var(--transition-base), background-color var(--transition-fast);
  cursor: pointer;
  border: 2px solid transparent;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background-color: var(--color-carrot);
  color: #fff;
  border-color: var(--color-carrot);
}

.btn--primary:hover {
  background-color: var(--color-carrot-dk);
  border-color: var(--color-carrot-dk);
}

.btn--outline-light {
  background-color: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.6);
}

.btn--outline-light:hover {
  background-color: rgba(255,255,255,0.12);
  border-color: #fff;
}

/* ----------------------------------------------------------
   6. Hero Section
   ---------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: var(--nav-height);
  overflow: hidden;
  background-color: var(--color-bg-dark);
  color: var(--color-text-light);
}

.hero__bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Pixel grid background */
.hero__bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,107,53,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,107,53,0.05) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Gradient overlay */
.hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(44,26,14,0.3) 0%, rgba(26,26,26,0.8) 100%);
}

.hero__pixels {
  position: absolute;
  inset: 0;
}

/* Animated pixel blocks */
.hero__pixels::before,
.hero__pixels::after {
  content: '';
  position: absolute;
  border-radius: var(--radius-sm);
}

.hero__pixels::before {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, var(--color-pig-pink) 0%, var(--color-carrot) 100%);
  opacity: 0.12;
  top: 15%;
  right: 8%;
  animation: float 6s ease-in-out infinite;
}

.hero__pixels::after {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--color-green) 0%, var(--color-carrot) 100%);
  opacity: 0.1;
  bottom: 20%;
  left: 6%;
  animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(8deg); }
}

.hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-carrot);
  margin-bottom: var(--space-4);
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.2s;
}

.hero__heading {
  font-size: clamp(var(--text-6xl), 14vw, var(--text-8xl));
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-6);
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.4s;
}

.hero__sub {
  font-size: clamp(var(--text-base), 2.5vw, var(--text-xl));
  color: var(--color-text-light-muted);
  margin-bottom: var(--space-10);
  line-height: 1.7;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.6s;
}

.hero__sub em {
  font-style: italic;
  color: var(--color-pig-pink);
}

.hero .btn {
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.8s;
}

.hero__scroll {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}

.hero__scroll-line {
  display: block;
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, transparent, var(--color-text-light-muted));
  margin: auto;
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes scrollLine {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(0.5); opacity: 0.3; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------
   7. Sections
   ---------------------------------------------------------- */
.section {
  padding: var(--space-24) 0;
}

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

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

.section--accent {
  background-color: var(--color-bg-accent);
  color: var(--color-text-light);
}

.section__eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-carrot);
  margin-bottom: var(--space-4);
}

.section__eyebrow--light {
  color: var(--color-pig-pink);
}

.section__heading {
  font-size: clamp(var(--text-3xl), 5vw, var(--text-6xl));
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-6);
}

.section__heading--light {
  color: var(--color-text-light);
}

.section__body {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.75;
  margin-bottom: var(--space-4);
  max-width: 56ch;
}

.section__body--light {
  color: var(--color-text-light-muted);
}

.section__body--wide {
  max-width: 72ch;
}

.section__inner {
  display: flex;
  gap: var(--space-16);
  align-items: center;
}

.section__inner--split {
  flex-direction: row;
}

.section__inner--centered {
  flex-direction: column;
  align-items: flex-start;
  max-width: 800px;
}

.section__text {
  flex: 1 1 55%;
}

.section__media {
  flex: 0 0 45%;
  display: flex;
  justify-content: center;
}

/* ----------------------------------------------------------
   8. Tags
   ---------------------------------------------------------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ----------------------------------------------------------
   9. Pixel Game Preview
   ---------------------------------------------------------- */
.game-preview {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl), 0 0 0 1px var(--color-border);
  background: #1a1a2e;
}

.pixel-scene {
  position: relative;
  height: 280px;
  overflow: hidden;
  image-rendering: pixelated;
}

.pixel-scene__sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #0d1b2a 0%, #1b2a4a 40%, #2d4a6b 100%);
}

.pixel-scene__ground {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(180deg, #3a5a2a 0%, #2a4020 100%);
}

.pixel-scene__ground::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: #4a7a34;
}

.pixel-scene__cloud {
  position: absolute;
  background: rgba(255,255,255,0.12);
  border-radius: 0;
}

.pixel-scene__cloud::before,
.pixel-scene__cloud::after {
  content: '';
  position: absolute;
  background: inherit;
}

.pixel-scene__cloud--1 {
  width: 64px;
  height: 16px;
  top: 30px;
  left: 40px;
  animation: cloudMove 12s linear infinite;
}

.pixel-scene__cloud--1::before {
  width: 32px;
  height: 16px;
  bottom: 100%;
  left: 8px;
}

.pixel-scene__cloud--2 {
  width: 48px;
  height: 12px;
  top: 55px;
  right: 60px;
  animation: cloudMove 18s linear infinite reverse;
}

.pixel-scene__cloud--2::before {
  width: 24px;
  height: 12px;
  bottom: 100%;
  left: 12px;
}

@keyframes cloudMove {
  0% { transform: translateX(0); }
  100% { transform: translateX(20px); }
}

.pixel-scene__tree {
  position: absolute;
  bottom: 80px;
}

.pixel-scene__tree::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 24px;
  background: #5a3820;
}

.pixel-scene__tree::after {
  content: '';
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 32px solid #2d7a1e;
}

.pixel-scene__tree--1 {
  left: 30px;
}

.pixel-scene__tree--2 {
  right: 40px;
}

.pixel-scene__character {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  animation: pigBounce 1s ease-in-out infinite;
}

@keyframes pigBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

.pixel-scene__carrot {
  position: absolute;
  bottom: 90px;
  right: 80px;
  animation: carrotPulse 2s ease-in-out infinite;
}

@keyframes carrotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1) rotate(5deg); }
}

.game-preview__caption {
  text-align: center;
  padding: var(--space-3);
  background: var(--color-bg-darker);
  color: var(--color-pig-pink);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ----------------------------------------------------------
   10. Story Section
   ---------------------------------------------------------- */
.story {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-8);
  margin-top: var(--space-12);
}

.story__block {
  display: flex;
  gap: var(--space-5);
  padding: var(--space-8);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  transition: background var(--transition-base), border-color var(--transition-base);
}

.story__block:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,107,53,0.3);
}

.story__icon {
  font-size: var(--text-3xl);
  line-height: 1;
  flex-shrink: 0;
}

.story__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-pig-pink);
  margin-bottom: var(--space-2);
}

.story__text p {
  font-size: var(--text-base);
  color: var(--color-text-light-muted);
  line-height: 1.7;
}

/* ----------------------------------------------------------
   11. Footer
   ---------------------------------------------------------- */
.footer {
  background-color: var(--color-bg-darker);
  color: var(--color-text-light);
  padding: var(--space-16) 0 var(--space-8);
}

.footer__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-8);
  align-items: start;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: var(--space-8);
  margin-bottom: var(--space-6);
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer__logo {
  font-size: var(--text-4xl);
  line-height: 1;
}

.footer__name {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
}

.footer__tagline {
  font-size: var(--text-sm);
  color: var(--color-text-light-muted);
}

.footer__nav ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: right;
}

.footer__nav a {
  font-size: var(--text-sm);
  color: var(--color-text-light-muted);
  transition: color var(--transition-fast);
}

.footer__nav a:hover {
  color: var(--color-text-light);
}

.footer__copy {
  grid-column: 1 / -1;
  font-size: var(--text-xs);
  color: rgba(245,245,240,0.4);
}

/* ----------------------------------------------------------
   12. Scroll-reveal animations
   ---------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ----------------------------------------------------------
   13. Responsive
   ---------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --container-px: var(--space-5);
  }

  .nav__menu {
    display: none;
    position: fixed;
    inset: var(--nav-height) 0 0 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    background: rgba(26,26,26,0.97);
    backdrop-filter: blur(12px);
  }

  .nav__menu.open {
    display: flex;
  }

  .nav__menu .nav__link {
    font-size: var(--text-2xl);
    color: var(--color-text-light);
    letter-spacing: 0;
  }

  .nav__toggle {
    display: flex;
  }

  .nav__toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav__toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .nav__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .section {
    padding: var(--space-16) 0;
  }

  .section__inner--split {
    flex-direction: column;
    gap: var(--space-10);
  }

  .section__media {
    flex: unset;
    width: 100%;
  }

  .game-preview {
    max-width: 100%;
  }

  .story {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .footer__inner {
    grid-template-columns: 1fr;
  }

  .footer__nav ul {
    text-align: left;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-4);
  }

  .footer__copy {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .hero__heading {
    font-size: clamp(var(--text-5xl), 18vw, var(--text-6xl));
  }

  .tags {
    gap: var(--space-1);
  }

  .story__block {
    flex-direction: column;
  }
}

/* ----------------------------------------------------------
   14. Print
   ---------------------------------------------------------- */
@media print {
  .site-header,
  .hero__scroll,
  .nav__toggle,
  .btn {
    display: none !important;
  }

  .hero {
    min-height: auto;
    padding: var(--space-16) 0;
  }
}
