/*
 * AI Career Japan - Custom Styles
 * https://ai-career-japan.jp
 * Version: 2.0.0
 */

/* ==========================================================================
   Google Fonts Import
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&family=Roboto:wght@400;500;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap');

/* ==========================================================================
   CSS Variables - Design System
   ========================================================================== */
:root {
  /* Colors - Primary Palette */
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;

  /* Colors - Secondary Palette */
  --secondary: #10b981;
  --accent: #f59e0b;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --info: #3b82f6;

  /* Colors - Text */
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --text-white: #ffffff;

  /* Colors - Background */
  --bg-white: #ffffff;
  --bg-light: #f9fafb;
  --bg-gray: #f3f4f6;
  --bg-dark: #111827;

  /* Colors - Border */
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --border-dark: #d1d5db;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Typography */
  --font-sans: 'Noto Sans JP', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', 'Consolas', 'Monaco', monospace;

  /* Font Sizes */
  --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: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  --text-5xl: 3rem;       /* 48px */

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

  /* Border Radius */
  --radius-sm: 0.25rem;   /* 4px */
  --radius: 0.5rem;       /* 8px */
  --radius-md: 0.75rem;   /* 12px */
  --radius-lg: 1rem;      /* 16px */
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;

  /* Layout */
  --container-max: 1200px;
  --content-max: 800px;
  --sidebar-width: 320px;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

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

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  margin-bottom: var(--space-4);
  line-height: 1.8;
}

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

a:hover {
  color: var(--primary-dark);
}

/* ==========================================================================
   Layout - Container
   ========================================================================== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: var(--space-8);
  margin-top: var(--space-8);
}

@media (max-width: 992px) {
  .content-wrapper {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

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

.site-branding {
  flex-shrink: 0;
}

.site-title {
  font-size: var(--text-2xl);
  font-weight: 900;
  margin: 0;
}

.site-title a {
  color: var(--text-primary);
}

.site-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.main-navigation {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--space-6);
  margin: 0;
}

.nav-menu a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  transition: all var(--transition-base);
}

.nav-menu a:hover,
.nav-menu .current-menu-item a {
  color: var(--primary);
  background: var(--bg-light);
}

/* ==========================================================================
   Main Content
   ========================================================================== */
.main-content {
  padding: var(--space-8) 0;
  min-height: 60vh;
}

.content-area {
  flex: 1;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--bg-dark);
  color: var(--text-white);
  padding: var(--space-12) 0 var(--space-8);
  margin-top: var(--space-16);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-info p {
  color: var(--text-light);
  margin: 0;
}

.footer-navigation .footer-menu {
  display: flex;
  list-style: none;
  gap: var(--space-4);
}

.footer-navigation a {
  color: var(--text-light);
  font-size: var(--text-sm);
}

.footer-navigation a:hover {
  color: var(--text-white);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: var(--space-4);
  }

  .nav-menu {
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-navigation .footer-menu {
    flex-direction: column;
  }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none; }

/* ==========================================================================
   Material Symbols Configuration
   ========================================================================== */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ==========================================================================
   Tailwind Prose Styling for Article Content
   ========================================================================== */
.prose {
    color: var(--text-primary);
    max-width: 65ch;
}

.prose h2 {
    color: #003366;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2.5em;
    margin-bottom: 1em;
    line-height: 1.3;
}

.prose h3 {
    color: #003366;
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.6em;
    margin-bottom: 0.6em;
}

.prose p {
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    line-height: 1.75;
}

.prose a {
    color: #00529B;
    text-decoration: underline;
    font-weight: 500;
}

.prose strong {
    color: var(--text-primary);
    font-weight: 600;
}

.prose ul,
.prose ol {
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    padding-left: 1.625em;
}

.prose li {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.prose code {
    color: #d63384;
    background-color: #f8f9fa;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.prose pre {
    background-color: #2d2d2d;
    color: #ffffff;
    overflow-x: auto;
    margin-top: 1.7143em;
    margin-bottom: 1.7143em;
    border-radius: 0.375rem;
    padding: 0.8571em 1.1429em;
}

.prose pre code {
    background-color: transparent;
    border-width: 0;
    border-radius: 0;
    padding: 0;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    line-height: inherit;
}

.prose img {
    margin-top: 2em;
    margin-bottom: 2em;
    border-radius: 0.5rem;
}

.prose figure {
    margin-top: 2em;
    margin-bottom: 2em;
}

.prose figcaption {
    color: #6b7280;
    font-size: 0.875em;
    line-height: 1.4286;
    margin-top: 0.8571em;
    text-align: center;
}

.prose blockquote {
    font-weight: 500;
    font-style: italic;
    color: var(--text-primary);
    border-left-width: 0.25rem;
    border-left-color: #e5e7eb;
    quotes: "\201C""\201D""\2018""\2019";
    margin-top: 1.6em;
    margin-bottom: 1.6em;
    padding-left: 1em;
}

/* ==========================================================================
   Code Block Styling (matching the design)
   ========================================================================== */
.code-block-wrapper {
    background-color: #2d2d2d;
    border-radius: 0.5rem;
    overflow: hidden;
    margin: 2em 0;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #1e1e1e;
}

.code-block-language {
    color: #9ca3af;
    font-size: 0.875rem;
    font-family: var(--font-sans);
}

.code-block-copy-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #9ca3af;
    font-size: 0.875rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.code-block-copy-btn:hover {
    color: #ffffff;
}

.code-block-content {
    padding: 1rem;
    font-size: 0.875rem;
    overflow-x: auto;
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */
.dark .prose {
    color: #e0e0e0;
}

.dark .prose h2,
.dark .prose h3,
.dark .prose h4 {
    color: #ffffff;
}

.dark .prose a {
    color: #60a5fa;
}

.dark .prose code {
    background-color: rgba(55, 65, 81, 0.5);
    color: #fbbf24;
}

.dark .prose blockquote {
    border-left-color: #374151;
    color: #d1d5db;
}

/* ==========================================================================
   Navigation Menu Item Styling
   ========================================================================== */
nav a {
    text-decoration: none;
    transition: color 0.2s ease;
}

/* ==========================================================================
   Responsive Utilities
   ========================================================================== */
@media (max-width: 768px) {
    .prose {
        font-size: 1rem;
    }

    .prose h2 {
        font-size: 1.5rem;
    }

    .prose h3 {
        font-size: 1.25rem;
    }
}

/* ==========================================================================
   Dark Mode - Full Support
   ========================================================================== */
.dark {
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --bg-white: #111827;
    --bg-light: #1f2937;
    --bg-gray: #374151;
    --border: #374151;
}

.dark body {
    background-color: #111827;
    color: #f3f4f6;
}

.dark .site-header {
    background-color: #1f2937;
    border-color: #374151;
}

.dark .site-footer {
    background-color: #0f172a;
}

.dark .post-card,
.dark .bg-white {
    background-color: #1f2937 !important;
}

.dark .border-gray-100,
.dark .border-gray-200 {
    border-color: #374151 !important;
}

.dark .text-gray-900 {
    color: #f3f4f6 !important;
}

.dark .text-gray-600,
.dark .text-gray-500 {
    color: #9ca3af !important;
}

.dark .text-gray-400 {
    color: #6b7280 !important;
}

.dark .bg-gray-50,
.dark .bg-gray-100 {
    background-color: #374151 !important;
}

.dark .hover\:bg-orange-50:hover {
    background-color: rgba(245, 166, 35, 0.1) !important;
}

.dark .from-yellow-50,
.dark .to-orange-50,
.dark .from-yellow-100 {
    --tw-gradient-from: #2d2006 !important;
    --tw-gradient-to: #2d1b06 !important;
}

.dark .toc {
    background: linear-gradient(135deg, #2d2006 0%, #2d1b06 100%) !important;
    border-color: #4a3006 !important;
}

.dark .highlight-box {
    background: linear-gradient(135deg, #2d2006 0%, #2d1b06 100%) !important;
}

.dark input,
.dark textarea {
    background-color: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.dark input::placeholder,
.dark textarea::placeholder {
    color: #6b7280;
}

.dark .shadow-sm,
.dark .shadow-md,
.dark .shadow-lg {
    --tw-shadow-color: rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Reading Progress Bar
   ========================================================================== */
#reading-progress {
    height: 3px;
    background: linear-gradient(90deg, #F5A623, #FF6B35);
    width: 0%;
    transition: width 0.1s ease-out;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slide-in-right {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slide-in-left {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-up {
    animation: fade-up 0.5s ease-out forwards;
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out forwards;
}

.animate-slide-in-right {
    animation: slide-in-right 0.3s ease-out forwards;
}

.animate-slide-in-left {
    animation: slide-in-left 0.3s ease-out forwards;
}

.animate-scale-in {
    animation: scale-in 0.2s ease-out forwards;
}

/* Stagger animation delays */
[data-animate]:nth-child(1) { animation-delay: 0ms; }
[data-animate]:nth-child(2) { animation-delay: 50ms; }
[data-animate]:nth-child(3) { animation-delay: 100ms; }
[data-animate]:nth-child(4) { animation-delay: 150ms; }
[data-animate]:nth-child(5) { animation-delay: 200ms; }
[data-animate]:nth-child(6) { animation-delay: 250ms; }

/* ==========================================================================
   Mobile Menu Overlay & Slide-in
   ========================================================================== */
#mobile-menu-overlay {
    transition: opacity 0.3s ease-out;
}

#mobile-menu {
    transition: transform 0.3s ease-out;
}

/* ==========================================================================
   Search Modal
   ========================================================================== */
#search-modal {
    transition: opacity 0.2s ease-out;
}

#search-modal .search-content {
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

/* ==========================================================================
   Back to Top Button
   ========================================================================== */
#back-to-top {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#back-to-top:hover {
    transform: translateY(-4px);
}

/* ==========================================================================
   Card Thumbnail Images
   ========================================================================== */
.post-card-thumbnail {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    width: 100%;
}

.post-card-thumbnail-placeholder {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #FFE066 0%, #F5A623 50%, #FF6B35 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.post-card-thumbnail-placeholder::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 50%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(-25%, -25%) rotate(0deg); }
    50% { transform: translate(-25%, -25%) rotate(180deg); }
}

.post-card-thumbnail-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

/* Category-specific thumbnail backgrounds */
.thumbnail-ai-news {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.thumbnail-school {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.thumbnail-career {
    background: linear-gradient(135deg, #FF6B35 0%, #F5A623 100%);
}

.thumbnail-programming {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.thumbnail-data-science {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.thumbnail-tools {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

/* Dark mode thumbnail adjustments */
.dark .post-card-thumbnail-placeholder {
    opacity: 0.9;
}

/* ==========================================================================
   Hero Section Enhancement
   ========================================================================== */
.hero-illustration {
    max-width: 400px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination a {
    background-color: #f3f4f6;
    color: #374151;
}

.pagination a:hover {
    background-color: #F5A623;
    color: white;
}

.pagination .current {
    background-color: #F5A623;
    color: white;
}

.pagination .dots {
    background: transparent;
}

.dark .pagination a {
    background-color: #374151;
    color: #f3f4f6;
}

.dark .pagination a:hover {
    background-color: #F5A623;
}

/* ==========================================================================
   Related Posts Section
   ========================================================================== */
.related-posts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-posts h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* ==========================================================================
   Improved Focus States for Accessibility
   ========================================================================== */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid #F5A623;
    outline-offset: 2px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .site-header,
    .site-footer,
    .ad-container,
    #back-to-top,
    #reading-progress,
    .share-buttons {
        display: none !important;
    }

    .prose {
        max-width: 100%;
    }
}
