/**
 * HTG International Summer School Platform
 * Premium Shared Styles
 */

/* CSS Variables */
:root {
  /* Colors - Sophisticated Palette */
  --color-primary: #0a1628;
  --color-primary-light: #1a2d4a;
  --color-accent: #c9a962;
  --color-accent-light: #dfc89a;
  --color-accent-dark: #9f7f3d;
  --color-bg: #fafaf8;
  --color-bg-white: #ffffff;
  --color-text: #1a1a1a;
  --color-text-secondary: #6b6b6b;
  --color-text-muted: #9a9a9a;
  --color-border: #e8e6e1;
  --color-success: #2d6a4f;
  --color-error: #9b2c2c;

  /* Spacing */
  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 32px;
  --spacing-lg: 64px;
  --spacing-xl: 96px;

  /* Layout */
  --max-width: 1200px;
  --nav-height: 72px;

  /* System fonts avoid render-blocking third-party font downloads. */
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-serif: ui-serif, Georgia, "Times New Roman", "Songti SC", "STSong", serif;

  /* Transitions */
  --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

h1 { font-size: 3.5rem; font-weight: 600; }
h2 { font-size: 2.5rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.25rem; }

p {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-sm);
}

a {
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition-fast);
}

button,
input,
select,
textarea {
  font: inherit;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(201, 169, 98, 0.75);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 2000;
  padding: 10px 14px;
  color: #fff;
  background: var(--color-primary);
  border-radius: 4px;
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.nav-placeholder {
  height: var(--nav-height);
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: all var(--transition-smooth);
  text-decoration: none;
}

.btn-primary {
  background: var(--color-text);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary);
  transform: translateY(-2px);
}

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

.btn-accent:hover {
  background: var(--color-accent-light);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-text);
}

.btn-outline:hover {
  background: var(--color-text);
  color: white;
}

/* Cards */
.card {
  background: var(--color-bg-white);
  border-radius: 4px;
  padding: var(--spacing-md);
  transition: all var(--transition-smooth);
}

/* Sections */
.section {
  padding: var(--spacing-xl) 0;
}

/* Form Elements */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 52px;
  padding: 16px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.1);
}

.form-textarea {
  height: auto;
  min-height: 120px;
  resize: vertical;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: 0.3px;
}

.form-label .required {
  color: var(--color-error);
  margin-left: 2px;
}

/* Grid */
.grid {
  display: grid;
  gap: var(--spacing-md);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.animate-fade-in {
  animation: fadeInUp var(--transition-slow) ease forwards;
  opacity: 0;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }

/* Utility */
.text-center { text-align: center; }
.text-accent { color: var(--color-accent); }
.text-muted { color: var(--color-text-muted); }

/* Mobile Menu - Global Styles (hidden on desktop) */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mobile-menu.active {
  display: flex;
  opacity: 1;
}

body.menu-open {
  overflow: hidden;
}
.mobile-menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: var(--spacing-md);
}
.mobile-menu a {
  display: block;
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--color-text);
  padding: var(--spacing-sm) var(--spacing-xl);
  text-align: center;
  position: relative;
  transition: color 0.3s ease, transform 0.2s ease, opacity 0.4s ease;
  opacity: 0;
  transform: translateY(10px);
}
.mobile-menu.active a {
  opacity: 1;
  transform: translateY(0);
}
.mobile-menu.active a:nth-child(1) { transition-delay: 0.05s; }
.mobile-menu.active a:nth-child(2) { transition-delay: 0.1s; }
.mobile-menu.active a:nth-child(3) { transition-delay: 0.15s; }
.mobile-menu.active a:nth-child(4) { transition-delay: 0.2s; }
.mobile-menu.active a:nth-child(5) { transition-delay: 0.25s; }
.mobile-menu.active a:nth-child(6) { transition-delay: 0.3s; }
.mobile-menu a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
  transition: width 0.3s ease;
}
.mobile-menu a:hover {
  color: var(--color-accent);
  transform: translateY(-2px);
}
.mobile-menu a:hover::after {
  width: 50%;
}
.mobile-menu a.active {
  color: var(--color-accent);
}
.mobile-menu a.active::after {
  width: 50%;
}
.mobile-menu-apply {
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-xl) !important;
  background: var(--color-accent);
  color: white !important;
  border-radius: 8px;
  font-size: 1.1rem;
  text-align: center;
  width: 100%;
  max-width: 280px;
  margin: var(--spacing-sm) auto 0;
  transition: background 0.3s ease, transform 0.2s ease;
}
.mobile-menu-apply:hover {
  background: var(--color-accent-dark);
  transform: translateY(-2px);
}

/* Hamburger Menu */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  gap: 5px;
  z-index: 1001;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.nav-hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-hamburger.active span:nth-child(2) {
  opacity: 0;
}
.nav-hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Navigation Styles */
.main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(232, 230, 225, 0.6);
  z-index: 1000;
  transition: all 0.4s ease;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 var(--spacing-md);
}
.nav-logo {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
}
.nav-logo-icon { width: 34px; height: 34px; flex-shrink: 0; transition: transform 0.3s ease; }
.nav-logo:hover .nav-logo-icon { transform: scale(1.05); }
.nav-logo-icon svg { width: 100%; height: 100%; }
.nav-logo-text { display: flex; flex-direction: column; }
.nav-logo-name {
  font-family: var(--font-sans); font-size: 15px; font-weight: 700;
  color: var(--color-text); letter-spacing: 1px; line-height: 1.2;
}
.nav-logo-name em { font-style: normal; color: var(--color-accent); }
.nav-logo-sub { font-family: var(--font-sans); font-size: 10px; color: var(--color-text-muted); letter-spacing: 0.5px; }
.nav-menu { display: flex; list-style: none; gap: 48px; }
.nav-menu li a {
  font-size: 13px; font-weight: 500; letter-spacing: 1px;
  text-transform: uppercase; color: var(--color-text); position: relative; padding: 8px 0;
}
.nav-menu li a::after {
  content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 1.5px;
  background: var(--color-accent); transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-menu li a:hover::after,
.nav-menu li a.active::after { width: 100%; }
.nav-right { display: flex; align-items: center; gap: 24px; }
.nav-login-link { font-size: 12px; font-weight: 600; letter-spacing: 0.5px; }
.nav-apply-btn { padding: 10px 24px; font-size: 12px; letter-spacing: 1px; }

/* Responsive */
@media (max-width: 1024px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
}

@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }

  .nav-hamburger { display: flex; }
  .nav-right { display: none; }
  .nav-menu { display: none; }

  .nav-inner {
    padding: 0 20px;
  }

  .nav-logo {
    min-width: 0;
  }

  .nav-logo-text {
    min-width: 0;
  }

  .nav-logo-name,
  .nav-logo-sub {
    white-space: nowrap;
  }

  .section {
    padding: var(--spacing-lg) 0;
  }
}

@media (max-width: 420px) {
  .nav-logo-name em,
  .nav-logo-sub {
    display: none;
  }
}

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

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
