/**
 * Portfolio Utilities
 * Common utility classes extracted from styles.css for better organization
 * and to eliminate duplication.
 */

/* =====================================================
   VISIBILITY & LAYOUT UTILITIES
   ===================================================== */

.hidden {
  display: none !important;
}

.visible {
  visibility: visible;
}

.invisible {
  visibility: hidden;
}

.opacity-0 {
  opacity: 0;
}

.opacity-50 {
  opacity: 0.5;
}

.opacity-100 {
  opacity: 1;
}

/* =====================================================
   SECTION & CONTAINER LAYOUT
   ===================================================== */

.section {
  padding: 80px 0;
  position: relative;
  z-index: 2;
}

:root[data-theme="dark"] .section {
  background-color: transparent;
}

.js .section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 480ms var(--transition), transform 520ms var(--transition);
}

.js .section.revealed {
  opacity: 1;
  transform: translateY(0);
}

.container {
  width: min(92%, var(--max-width));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* =====================================================
   GRID & FLEX UTILITIES
   ===================================================== */

.grid {
  display: grid;
  gap: 48px;
}

.flex {
  display: flex;
  gap: 24px;
}

.between {
  justify-content: space-between;
}

.center {
  align-items: center;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-start {
  display: flex;
  align-items: flex-start;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  display: flex;
  flex-wrap: wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* =====================================================
   POSITION UTILITIES
   ===================================================== */

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

/* =====================================================
   OVERFLOW UTILITIES
   ===================================================== */

.overflow-hidden {
  overflow: hidden;
}

.overflow-auto {
  overflow: auto;
}

.overflow-x-hidden {
  overflow-x: hidden;
}

.overflow-y-auto {
  overflow-y: auto;
}

/* =====================================================
   BUTTON BASE STYLES
   ===================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-family: var(--font-body);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  border: none;
  cursor: pointer;
  text-decoration: none !important;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

.btn:hover,
.btn:focus,
.btn:active {
  text-decoration: none !important;
  color: inherit;
}

/* SBHM (Shadow Border Harmony Method) - Primary Button */
.btn.primary {
  background: linear-gradient(130deg, var(--accent), var(--accent-2));
  color: var(--color-charcoal);
  border: none;
  background-clip: padding-box;
  box-shadow: var(--shadow-soft);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn.primary:hover {
  box-shadow: var(--shadow-strong);
  transform: translateY(-1px);
}

.btn.primary:focus {
  outline: none;
  box-shadow: var(--shadow-strong), 0 0 0 3px var(--glow);
}

.btn.secondary {
  background: var(--surface-1);
  color: var(--color-text);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.btn.secondary:hover {
  background: var(--surface-2);
  box-shadow: var(--shadow-soft);
  transform: translateY(1px) scale(0.99);
  border-color: var(--accent-2);
  color: var(--accent);
}

.btn.secondary:active {
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.05);
  transform: translateY(2px) scale(0.97);
}

.btn.secondary:focus {
  outline: none;
  box-shadow: var(--shadow-soft), 0 0 0 3px var(--glow);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: var(--color-charcoal);
  padding-inline: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px) saturate(200%);
  -webkit-backdrop-filter: blur(16px) saturate(200%);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.btn.tertiary {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(240, 248, 255, 0.6));
  color: rgba(27, 27, 31, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  font-weight: 600;
}

.btn.tertiary:hover,
.btn.tertiary:focus {
  transform: translateY(-3px);
  box-shadow:
    0 16px 32px rgba(15, 23, 42, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(240, 248, 255, 0.7));
  border-color: rgba(255, 255, 255, 0.8);
}

/* Button Size Utilities */
.btn-base {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-semibold);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-smooth);
  border: none;
  text-decoration: none;
}

.btn-sm {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
}

.btn-md {
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
}

.btn-lg {
  padding: 1.25rem 2rem;
  font-size: 1.125rem;
}

.btn-xl {
  padding: 1.25rem 3rem;
  font-size: 1.25rem;
}

/* =====================================================
   GAP UTILITIES
   ===================================================== */

.gap-xs {
  gap: 0.5rem;
}

.gap-sm {
  gap: 0.75rem;
}

.gap-md {
  gap: 1rem;
}

.gap-lg {
  gap: 1.5rem;
}

.gap-xl {
  gap: 2rem;
}

.gap-2xl {
  gap: 3rem;
}

/* =====================================================
   SPACING UTILITIES
   ===================================================== */

.p-sm {
  padding: 0.75rem;
}

.p-md {
  padding: 1rem;
}

.p-lg {
  padding: 1.5rem;
}

.p-xl {
  padding: 2rem;
}

.px-md {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.py-md {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.py-lg {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.mb-sm {
  margin-bottom: 0.75rem;
}

.mb-md {
  margin-bottom: 1.5rem;
}

.mb-lg {
  margin-bottom: 2rem;
}

.mb-xl {
  margin-bottom: 3rem;
}

.section-spacing {
  padding: 3rem 0;
}

/* =====================================================
   BORDER RADIUS UTILITIES
   ===================================================== */

.rounded-sm {
  border-radius: 0.375rem;
}

.rounded-md {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-xl {
  border-radius: var(--radius-xl);
}

.rounded-pill {
  border-radius: var(--radius-pill);
}

.rounded-circle {
  border-radius: 50%;
}

/* =====================================================
   SHADOW UTILITIES
   ===================================================== */

.shadow-xs {
  box-shadow: var(--shadow-xs);
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.shadow-xl {
  box-shadow: var(--shadow-xl);
}

.shadow-2xl {
  box-shadow: var(--shadow-2xl);
}

/* =====================================================
   TRANSITION UTILITIES
   ===================================================== */

.transition-fast {
  transition: all var(--duration-fast) var(--ease-smooth);
}

.transition-normal {
  transition: all var(--duration-normal) var(--ease-smooth);
}

.transition-slow {
  transition: all var(--duration-slow) var(--ease-smooth);
}

.transition-bounce {
  transition: all var(--duration-normal) var(--ease-bounce);
}

.transition-opacity {
  transition: opacity var(--duration-normal) var(--ease-smooth);
}

.transition-transform {
  transition: transform var(--duration-normal) var(--ease-smooth);
}

/* =====================================================
   HOVER UTILITIES
   ===================================================== */

.hover-lift {
  transition: all var(--duration-normal) var(--ease-smooth);
}

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

.hover-scale {
  transition: transform var(--duration-normal) var(--ease-smooth);
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: all var(--duration-normal) var(--ease-smooth);
}

.hover-glow:hover {
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* =====================================================
   TEXT UTILITIES
   ===================================================== */

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

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

.text-accent {
  color: var(--accent);
}

.font-display {
  font-family: var(--font-display);
}

.font-heading {
  font-family: var(--font-heading);
}

.font-body {
  font-family: var(--font-body);
}
