/*
 * PlanetJudo - Custom Styles
 * Modern, accessible design inspired by dojo aesthetics
 */

/* ==========================================================================
   1. Reset & Base
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  line-height: 1.5;
  font-size: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif, "Noto Sans CJK JP", "Noto Sans SC",
    "Noto Sans TC";
  color: #1a1a1a;
  background-color: #ffffff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: #2c3e50;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: #e74c3c;
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: #111827;
  margin-top: 0;
}

h1 { font-size: 2rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* ==========================================================================
   2. Skip to Content
   ========================================================================== */

#skip-to-content {
  position: absolute;
  top: -10000px;
  left: 0;
  right: 0;
  background: #e74c3c;
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  z-index: 10000;
  font-weight: 600;
  text-align: center;
  border-radius: 0 0 0.375rem 0.375rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-decoration: none;
}

#skip-to-content:focus {
  top: 0;
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

/* ==========================================================================
   3. Layout
   ========================================================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

header, footer {
  padding: 1.5rem 0;
}

footer {
  border-top: 1px solid #e5e7eb;
  margin-top: auto;
}

section {
  margin-bottom: 2.5rem;
}

.language-selector {
  max-width: 600px;
  margin: 4rem auto;
  text-align: center;
}

.language-selector h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.language-selector p {
  font-size: 1.125rem;
  color: #6b7280;
  margin-bottom: 2rem;
}

.language-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.language-list li {
  margin: 0;
}

.language-list a {
  display: inline-block;
  padding: 0.875rem 1.5rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  color: #111827;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.language-list a:hover,
.language-list a:focus {
  background: #e74c3c;
  color: #ffffff;
  border-color: #e74c3c;
  text-decoration: none;
}

.language-list a:focus-visible {
  outline: 3px solid #2c3e50;
  outline-offset: 2px;
}

/* ==========================================================================
   4. Header / Logo
   ========================================================================== */

.site-logo {
  display: inline-flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  text-decoration: none;
  padding: 0.75rem 0;
  letter-spacing: -0.025em;
}

.site-logo:hover,
.site-logo:focus {
  color: #e74c3c;
}

.site-logo:focus-visible {
  outline: 3px solid #2c3e50;
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* ==========================================================================
   5. Cards (Blog Entries)
   ========================================================================== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 100%;
}

.card:hover,
.card:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-header h3 {
  font-size: 1rem;
  margin: 0;
  color: #374151;
  font-weight: 500;
}

.card-meta-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-meta-row > * {
  font-size: 0.8125rem;
  color: #6b7280;
}

.card-author {
  font-weight: 500;
  color: #4b5563;
}

.card-date {
  font-size: 0.8125rem;
  color: #9ca3af;
}

.card-reading-time {
  font-size: 0.8125rem;
  color: #e74c3c;
  font-weight: 600;
}

.card-title {
  font-size: 1.25rem;
  margin: 0 0 0.75rem 0;
}

.card-title a {
  color: #111827;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.3;
}

.card-title a:hover,
.card-title a:focus {
  color: #e74c3c;
  text-decoration: underline;
}

.card-title a:focus-visible {
  outline: 3px solid #e74c3c;
  outline-offset: 2px;
  border-radius: 0.25rem;
}

.card-excerpt {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #374151;
  margin-bottom: 1rem;
  flex: 1;
}

.card-image {
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  display: block;
  margin: 0 auto 1rem auto;
}

.read-more {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2c3e50;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
  margin-top: auto;
}

.read-more:hover,
.read-more:focus {
  color: #e74c3c;
  border-bottom-color: #e74c3c;
  text-decoration: none;
}

.read-more:focus-visible {
  outline: 3px solid #2c3e50;
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* Featured article */
.featured-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #e74c3c;
  padding: 2rem;
  margin-bottom: 2rem;
}

.featured-card h1 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.featured-card .card-meta-row {
  margin-bottom: 1rem;
}

.featured-card .card-excerpt {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: #374151;
  margin-bottom: 1.5rem;
}

.featured-card .read-more {
  font-size: 0.9375rem;
  padding: 0.625rem 1.25rem;
  background: #e74c3c;
  color: #ffffff;
  border: none;
  border-radius: 0.375rem;
  text-decoration: none;
}

.featured-card .read-more:hover,
.featured-card .read-more:focus {
  background: #c0392b;
  color: #ffffff;
  border-bottom: none;
}

/* ==========================================================================
   6. Events
   ========================================================================== */

.events-section {
  margin-top: 3rem;
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  transition: box-shadow 0.2s ease;
}

.event-item:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.event-date {
  flex-shrink: 0;
  font-weight: 700;
  color: #2c3e50;
  font-size: 0.875rem;
  white-space: nowrap;
}

.event-summary {
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.25rem 0;
}

.event-description {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0;
}

.event-description:empty {
  display: none;
}

/* ==========================================================================
   7. Donate
   ========================================================================== */

.donate-section {
  margin-top: 3rem;
  padding: 2rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  text-align: center;
}

.donate-section form {
  display: inline-block;
}

/* ==========================================================================
   8. Forms
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #2c3e50;
  outline-offset: 1px;
  border-color: #2c3e50;
}

button,
input[type="submit"] {
  background: #2c3e50;
  color: #ffffff;
  border: none;
  padding: 0.625rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.375rem;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.2s ease;
}

button:hover,
input[type="submit"]:hover {
  background: #1a252f;
}

button:focus-visible,
input[type="submit"]:focus-visible {
  outline: 3px solid #2c3e50;
  outline-offset: 2px;
}

/* ==========================================================================
   9. Footer
   ========================================================================== */

footer {
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
}

footer p {
  margin: 0;
  font-size: 0.875rem;
  color: #6b7280;
}

footer a {
  color: #2c3e50;
  text-decoration: underline;
}

footer a:hover,
footer a:focus {
  color: #e74c3c;
}

/* ==========================================================================
   10. Accessibility Utilities
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 0.75rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ==========================================================================
   11. Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .card:hover {
    transform: none;
  }
}

/* ==========================================================================
   12. Responsive
   ========================================================================== */

@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.375rem; }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   13. Print
   ========================================================================== */

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  header, footer {
    display: none;
  }

  .card {
    border: 1px solid #000000;
    box-shadow: none;
    break-inside: avoid;
  }

  a {
    text-decoration: underline;
    color: #000000;
  }
}
