/* (Append to existing sections.css or create new rules for the rest of sections) */

/* ==========================================================================
   背景の壁紙の上に直接置かれるテキストの可読性確保
   body / courses-section に敷いたレンガ壁の目地と細いドットフォントが
   干渉して読めなくなるため、テキストの下に半透明の下地を敷く
   ========================================================================== */
.bg-readable,
.bg-readable-block {
    background-color: rgba(255, 255, 255, 0.92);
    padding: 10px 18px;
}

.bg-readable {
    /* 親の text-align に依存せず中央に置くため inline-block ではなく fit-content */
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.bg-readable-block {
    display: block;
}

body.dark-mode .bg-readable,
body.dark-mode .bg-readable-block {
    background-color: rgba(11, 19, 43, 0.85);
}

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

.mt-2 {
    margin-top: 1rem;
}

.text-large {
    font-size: 1.2rem;
}

/* ==========================================================================
   Courses Section
   ========================================================================== */
.courses-section {
    margin: 4rem 0;
}

.course-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.course-card {
    padding: 0;
    overflow: hidden;
}

.course-header {
    background-color: var(--color-border);
    color: var(--bg-color);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.course-icon {
    font-size: 2rem;
}

.course-header h3 {
    font-size: 1.5rem;
    margin: 0;
}

.course-body {
    padding: 20px;
}

.course-catch {
    color: var(--color-main);
    font-size: 1.2rem;
    margin-bottom: 15px;
    line-height: 1.4;
}

.course-desc {
    margin-bottom: 20px;
}

.learn-list-box {
    background-color: var(--bg-secondary);
    border: 2px dashed var(--color-border);
    padding: 15px;
}

.learn-list-box h5 {
    color: var(--color-accent);
    margin-bottom: 10px;
    text-shadow: 1px 1px 0 #000;
}

/* Ensure text on highlight is readable */
body.light-mode .learn-list-box h5 {
    text-shadow: none;
    color: #d35400;
    /* Darker orange for light mode readable text */
}

.learn-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
}

.learn-list li::before {
    content: '▶';
    position: absolute;
    left: 0;
    color: var(--color-main);
    font-size: 0.8rem;
    top: 3px;
}

/* ==========================================================================
   Instructors Section (3 Cols x 2 Rows Flex Fallback Configuration)
   ========================================================================== */
.instructors-section {
    margin: 4rem 0;
}

.instructor-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.instructor-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px;
    margin-bottom: 0;
    /* Override pixel-box default margin */
}

@media (min-width: 768px) {
    .instructor-card {
        width: calc(33.333% - 14px);
        /* 3 cols accounting for 20px gap */
    }
}

/* .pixel-avatar は display:block を持たないインライン画像なので、
   標準モードだと下にベースライン分（約6〜7px）の隙間ができてカードが伸びる。
   line-height:0 で行ボックスを潰して隙間を消している（DOCTYPE 追加前と同じ高さになる）。
   消すと講師カードだけ縦に伸びるので注意。 */
.instructor-icon {
    line-height: 0;
}

.pixel-avatar {
    border-radius: 5px;
    /* Slight roundness for modern pop */
    border: 3px solid var(--color-border);
    image-rendering: pixelated;
    margin-bottom: 10px;
    width: 100%;
    max-width: 80px;
    /* Keep icon size compact consistently */
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.instructor-name {
    color: var(--color-main);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.instructor-prof {
    font-size: 0.9rem;
    margin-bottom: 15px;
    flex-grow: 1;
}

.youtube-thumb {
    position: relative;
    width: 100%;
    border: 2px solid var(--color-border);
    cursor: pointer;
    overflow: hidden;
}

.youtube-thumb img {
    width: 100%;
    display: block;
    transition: transform 0.3s;
}

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

.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: #ff0000;
    text-shadow: 2px 2px 0 #fff;
    pointer-events: none;
}

/* ==========================================================================
   Final Call & FAQ
   ========================================================================== */
.final-call {
    margin: 4rem 0;
    background-color: var(--bg-secondary);
}

.final-call h2 {
    color: var(--color-accent);
    margin-bottom: 15px;
    text-shadow: 1px 1px 0 #000;
}

body.light-mode .final-call h2 {
    text-shadow: none;
    color: #d35400;
    /* Readability adjustment */
}

.faq-section {
    margin: 4rem 0;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.faq-item {
    margin-bottom: 0;
    /* Override pixel-box margin */
}

.faq-q {
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    list-style: none;
    /* Hide default arrow in some browsers */
    position: relative;
    padding-left: 25px;
    color: var(--color-main);
}

.faq-q::-webkit-details-marker {
    display: none;
}

.faq-q::before {
    content: '▶';
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.faq-item[open] .faq-q::before {
    transform: rotate(90deg);
}

.faq-a {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px dashed var(--color-border);
}
