/* ============================================================
   PAPERPIXEL PORTFOLIO — Main Stylesheet
   File: style.css
   Author: ImajikoStudio
   Version: 1.0.0
============================================================ */

/* --- Import Fonts from HTML Link Tags (Parallel Loading) --- */

:root {
  /* --- Design Tokens (Light Mode Default) --- */
  --color-bg-base:       #f4f0e6;   /* Warm cream paper background */
  --color-bg-surface:    #ffffff;   /* Clean white card background */
  --color-bg-raised:     #faf8f5;   /* Light cream elevated elements */
  
  --color-border:        #2b2d42;   /* Solid charcoal grey borders */
  --color-border-rgb:    43, 45, 66;
  
  /* Text Color System */
  --color-text-primary:   #2b2d42;
  --color-text-secondary: #5c5e73;
  --color-text-muted:     #8e90a6;
  --color-text-inverse:   #f4f0e6;
  
  /* Aesthetic Colors (Calm Muted Palette) */
  --color-accent-blue:    #5887ff;   /* Soft slate blue */
  --color-accent-peach:   #f4a261;   /* Warm peachy orange */
  --color-accent-green:   #8ac926;   /* Muted pixel green */
  --color-accent-purple:  #9b5de5;   /* Pastel violet */
  --color-accent-red:     #e76f51;   /* Pastel red */
  
  /* Typography Scale */
  --font-display:         'Press Start 2P', monospace;
  --font-body:            'Space Grotesk', sans-serif;
  
  --text-xs:              0.75rem;    /* 12px */
  --text-sm:              0.875rem;   /* 14px */
  --text-base:            1rem;       /* 16px */
  --text-lg:              1.125rem;   /* 18px */
  --text-xl:              1.25rem;    /* 20px */
  --text-2xl:             1.5rem;     /* 24px */
  --text-3xl:             2rem;       /* 32px */
  --text-hero:            clamp(1.75rem, 4vw, 3rem); /* Fluid title */
  
  /* Shadow & Border Style Tokens */
  --border-width:         2px;
  --border-radius:        8px;
  --border-radius-sm:     4px;
  
  /* Skeuomorphic Scrapbook Shadows */
  --shadow-flat:          0 0 0 var(--color-border);
  --shadow-sm:            2px 2px 0 0 var(--color-border);
  --shadow-md:            4px 4px 0 0 var(--color-border);
  --shadow-lg:            8px 8px 0 0 var(--color-border);
  
  /* Animations */
  --transition-fast:      0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-normal:    0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  
  /* Sound Toggle State and Layout Constants */
  --container-max-width:  1200px;
  --navbar-height:        70px;
}

/* ============================================================
   GLOBAL RESET & INITIALIZATION
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  image-rendering: auto;
}

/* Accessibility: Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-accent-blue);
  color: var(--color-text-inverse);
  padding: 8px 16px;
  border: var(--border-width) solid var(--color-border);
  border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  z-index: 9999;
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
  outline: none;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-text-primary);
  font-weight: 700;
  line-height: 1.3;
}

.pixel-text {
  font-family: var(--font-display);
  font-weight: normal;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  line-height: 1.5;
}

/* ============================================================
   LAYOUT COMPONENTS & HELPERS
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-right: auto;
  margin-left: auto;
  padding-right: 24px;
  padding-left: 24px;
}

.section {
  padding-top: 80px;
  padding-bottom: 80px;
  position: relative;
}

/* Helper styles for layouts */
.u-text-center { text-align: center; }
.u-mt-1 { margin-top: 8px; }
.u-mt-2 { margin-top: 16px; }
.u-mt-3 { margin-top: 24px; }
.u-mt-4 { margin-top: 32px; }

/* Grid Layout Helpers (Mobile First) */
.grid-2, .grid-3, .grid-4 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

/* ============================================================
   HEADER & NAVIGATION BAR
   ============================================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--navbar-height);
  background-color: var(--color-bg-base);
  border-bottom: var(--border-width) dashed var(--color-border);
  z-index: 1000;
  transition: background-color var(--transition-normal);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.navbar__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  transition: transform var(--transition-fast);
}

.navbar__brand:hover {
  transform: rotate(-1deg) scale(1.02);
}

.navbar__brand-logo {
  display: inline-block;
  padding: 4px 8px;
  background-color: var(--color-accent-peach);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius-sm);
  color: var(--color-text-primary);
  margin-right: 8px;
  box-shadow: var(--shadow-sm);
}

.navbar__menu {
  display: none; /* Desktop will show, mobile will use toggle drawer */
  list-style: none;
  align-items: center;
  gap: 20px;
}

.navbar__link {
  text-decoration: none;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  border: var(--border-width) solid transparent;
  transition: all var(--transition-fast);
}

.navbar__link:hover,
.navbar__link--active {
  border-color: var(--color-border);
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Interactive control buttons */
.control-btn {
  background: var(--color-bg-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius-sm);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  color: var(--color-text-primary);
}

.control-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background-color: var(--color-bg-raised);
}

.control-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Mobile Toggle Hamburger */
.navbar__toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 20px;
  z-index: 1010;
}

.navbar__toggle-bar {
  width: 100%;
  height: var(--border-width);
  background-color: var(--color-border);
  transition: all var(--transition-normal);
}

/* Hamburger animations */
.navbar__toggle--active .navbar__toggle-bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.navbar__toggle--active .navbar__toggle-bar:nth-child(2) {
  opacity: 0;
}
.navbar__toggle--active .navbar__toggle-bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Mobile Drawer Overlay */
.mobile-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100vh;
  background-color: var(--color-bg-base);
  border-left: var(--border-width) solid var(--color-border);
  z-index: 999;
  padding: 100px 30px 40px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: right var(--transition-normal);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.05);
}

.mobile-nav--open {
  right: 0;
}

.mobile-nav__menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mobile-nav__link {
  text-decoration: none;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-lg);
  display: block;
  padding: 10px 16px;
  border: var(--border-width) solid transparent;
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
}

.mobile-nav__link:hover,
.mobile-nav__link--active {
  border-color: var(--color-border);
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-sm);
  transform: translateX(5px);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--border-radius);
  background-color: var(--color-bg-surface);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  text-align: center;
}

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

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn--primary {
  background-color: var(--color-accent-blue);
  color: var(--color-text-inverse);
}

.btn--primary:hover {
  background-color: #4073ff; /* slightly darker blue */
}

.btn--secondary {
  background-color: var(--color-accent-peach);
  color: var(--color-text-primary);
}

.btn--secondary:hover {
  background-color: #f19248; /* slightly darker peach */
}

.btn--pixel {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  padding: 14px 20px;
}

/* ============================================================
   PRELOADER / LOADER SCREEN
   ============================================================ */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--color-bg-base);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader__spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--color-bg-surface);
  border-top-color: var(--color-accent-blue);
  border-bottom-color: var(--color-accent-peach);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.preloader__text {
  margin-top: 20px;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  letter-spacing: 1px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Desktop layout overrides */
@media (min-width: 992px) {
  .navbar__menu {
    display: flex;
  }
  .navbar__toggle {
    display: none;
  }
}
