@layer base, layout, components, utilities;

@layer base {
  :root {
    --primary: oklch(0.65 0.2 250);
    --secondary: oklch(0.7 0.15 150);
    --accent: oklch(0.6 0.25 30);
    --bg: oklch(0.12 0.03 260);
    --surface: rgba(255, 255, 255, 0.05);
    --text-primary: #f0f0f0;
    --text-secondary: #999;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 20px;
    --radius: 16px;
    --radius-sm: 10px;
  }

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

  body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  ::selection {
    background: rgba(100, 160, 255, 0.3);
    color: #fff;
  }

  ::-webkit-scrollbar {
    width: 8px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
  }
}

@layer layout {
  .board-body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    min-height: 100vh;
    background:
      radial-gradient(ellipse at 20% 50%, oklch(0.25 0.08 250 / 0.3), transparent 60%),
      radial-gradient(ellipse at 80% 20%, oklch(0.2 0.06 150 / 0.2), transparent 50%),
      radial-gradient(ellipse at 50% 80%, oklch(0.2 0.06 300 / 0.15), transparent 50%),
      var(--bg);
  }

  .main-content {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
  }

  .board-container {
    max-width: 1100px;
    margin: 0 auto;
  }

  .board-page {
    width: 100%;
    max-width: 760px;
  }

  .go-home-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 20px;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.2s ease;
  }
  .go-home-link:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
  }
}

@layer components {
  .gallery-hero {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 32px;
    background: linear-gradient(135deg, rgba(100, 160, 255, 0.08), rgba(160, 100, 255, 0.08));
    border: 1px solid rgba(100, 160, 255, 0.15);
  }
  .gallery-hero-bg {
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse at 20% 0%, rgba(100, 160, 255, 0.2), transparent 50%),
      radial-gradient(ellipse at 80% 100%, rgba(160, 100, 255, 0.15), transparent 50%),
      radial-gradient(ellipse at 50% 50%, rgba(100, 200, 255, 0.06), transparent 60%);
    opacity: 0.8;
  }
  .gallery-hero-content {
    position: relative;
    padding: 48px 32px 40px;
    text-align: center;
  }
  .gallery-hero-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(100, 160, 255, 0.7);
    margin-bottom: 12px;
  }
  .gallery-hero-title {
    margin: 0 0 10px;
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 40%, rgba(100, 160, 255, 0.9), rgba(160, 100, 255, 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
  }
  .gallery-hero-sub {
    margin: 0 0 28px;
    font-size: 1rem;
    color: var(--text-secondary, #999);
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
  }
  .gallery-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .gallery-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 14px;
    border: none;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
  }
  .gallery-action-btn.primary {
    background: linear-gradient(135deg, rgba(100, 160, 255, 0.9), rgba(80, 130, 255, 1));
    color: #fff;
    box-shadow: 0 4px 16px rgba(100, 160, 255, 0.35);
  }
  .gallery-action-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(100, 160, 255, 0.5);
  }
  .gallery-action-btn.accent {
    background: linear-gradient(135deg, rgba(160, 100, 255, 0.85), rgba(130, 80, 255, 1));
    color: #fff;
    box-shadow: 0 4px 16px rgba(160, 100, 255, 0.3);
  }
  .gallery-action-btn.accent:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(160, 100, 255, 0.45);
  }
  .btn-icon {
    font-size: 1.15rem;
    line-height: 1;
  }

  .board-card {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 32px;
    box-shadow:
      0 8px 32px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }

  .board-header {
    text-align: center;
    margin-bottom: 28px;
  }

  .board-title {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .board-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 6px;
  }

  .board-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
  }

  .write-btn {
    padding: 10px 24px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary), oklch(0.6 0.18 270));
    color: #fff;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 12px oklch(0.65 0.2 250 / 0.3);
  }
  .write-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px oklch(0.65 0.2 250 / 0.4);
  }

  .pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
  }
  .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
  }
  .page-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
  }
  .page-btn.active {
    background: oklch(0.65 0.2 250 / 0.3);
    border-color: oklch(0.65 0.2 250 / 0.5);
    color: #fff;
  }
}

@layer utilities {
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  board-list, board-post, gallery-list, gallery-post {
    animation: fadeIn 0.3s ease;
  }
}

@media (max-width: 600px) {
  .board-card { padding: 20px; }
  .board-title { font-size: 1.4rem; }
  .main-content { padding: 0 12px; }
}
