/*
Theme Name: Algorithm 2026
Theme URI: https://www.algo.cce.i.kyoto-u.ac.jp/
Author: Minato Lab
Description: A modern WordPress theme for Minato Lab (Group of Computer Algorithms), Kyoto University. Features a two-column layout with Kyoto University blue color scheme, language switcher, and responsive design.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: algorithm2026
Tags: two-columns, right-sidebar, custom-header, custom-menu, featured-images, translation-ready
*/

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

:root {
    --color-primary: #003366;
    --color-primary-light: #1a5276;
    --color-primary-dark: #002244;
    --color-accent: #2980b9;
    --color-accent-hover: #1f6da0;
    --color-text: #333;
    --color-text-light: #555;
    --color-text-muted: #888;
    --color-bg: #fff;
    --color-bg-alt: #f5f7fa;
    --color-bg-nav: #002b55;
    --color-border: #dde3ea;
    --color-border-light: #e8ecf1;
    --font-body: "Meiryo", "メイリオ", "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN", sans-serif;
    --font-heading: "Meiryo", "メイリオ", "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN", sans-serif;
    --max-width: 1200px;
    --content-width: 800px;
    --sidebar-width: 320px;
    --gap: 2.5rem;
    --radius: 6px;
}

/* ===========================
   Base
   =========================== */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg-alt);
    line-height: 1.8;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover,
a:focus {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    line-height: 1.4;
    font-weight: 700;
}

/* ===========================
   Layout
   =========================== */
.site-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-inner {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    gap: var(--gap);
    flex: 1;
}

.site-content {
    flex: 1;
    min-width: 0;
}

/* ===========================
   Header
   =========================== */
.site-header {
    background-color: var(--color-primary);
    background-size: cover;
    background-position: center;
    color: #fff;
    position: relative;
}

.site-header.has-header-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 51, 102, 0.85);
}

.header-inner {
    position: relative;
    z-index: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding .site-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.02em;
}

.site-branding .site-title a {
    color: #fff;
    text-decoration: none;
}

.site-branding .site-title a:hover {
    opacity: 0.9;
    text-decoration: none;
}

.site-description {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.lang-switcher a,
.lang-switcher span {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 3px;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-switcher a {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
}

.lang-switcher a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

.lang-switcher .current-lang {
    color: var(--color-primary);
    background: #fff;
}

/* Bogo language switcher styling */
.lang-switcher ul {
    list-style: none;
    display: flex;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
}

.lang-switcher li {
    margin: 0;
    padding: 0;
}

.lang-switcher li a {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 3px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-switcher li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

.lang-switcher li.current a {
    color: var(--color-primary);
    background: #fff;
}

.lang-switcher .bogoflags {
    display: none !important;
}

/* ===========================
   Navigation
   =========================== */
.main-navigation-wrap {
    background-color: var(--color-bg-nav);
    border-bottom: 3px solid var(--color-accent);
}

.main-navigation {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
}

.main-navigation > div {
    flex: 1;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

.main-navigation li {
    position: relative;
}

.main-navigation li.menu-item-right {
    margin-left: auto;
}

.main-navigation a {
    display: block;
    padding: 0.85rem 1.2rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
}

.main-navigation a:hover,
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
    border-bottom-color: var(--color-accent);
    text-decoration: none;
}

/* Dropdown */
.main-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background-color: var(--color-primary-dark);
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex-direction: column;
}

.main-navigation li:hover > ul {
    display: flex;
}

.main-navigation ul ul a {
    padding: 0.7rem 1.2rem;
    font-size: 0.85rem;
    border-bottom: none;
    margin-bottom: 0;
    border-left: 3px solid transparent;
}

.main-navigation ul ul a:hover {
    border-left-color: var(--color-accent);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: var(--radius);
    font-family: var(--font-body);
}

.menu-toggle:hover {
    border-color: #fff;
}

/* ===========================
   Content Area
   =========================== */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-border);
}

.page-title {
    font-size: 1.6rem;
    color: var(--color-primary);
}

/* Lab Introduction Section */
.lab-intro {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2.5rem;
    line-height: 1.9;
}

.lab-intro h2 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

/* Posts / News List */
.post,
.news-entry {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.25rem;
    transition: box-shadow 0.2s ease;
}

.post:hover,
.news-entry:hover {
    box-shadow: 0 2px 8px rgba(0, 51, 102, 0.06);
}

.entry-header {
    margin-bottom: 0.75rem;
}

.entry-title {
    font-size: 1.4rem;
    line-height: 1.4;
}

.entry-title a {
    color: var(--color-primary);
    text-decoration: none;
}

.entry-title a:hover {
    color: var(--color-accent);
    text-decoration: none;
}

.entry-meta {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.entry-meta a {
    color: var(--color-text-muted);
}

.entry-meta a:hover {
    color: var(--color-accent);
}

.entry-content {
    font-size: 0.98rem;
    line-height: 1.9;
}

.entry-content p {
    margin-bottom: 1.25rem;
}

.entry-content h2 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--color-border);
}

.entry-content h3 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.entry-content ul,
.entry-content ol {
    margin: 0.75rem 0 1.25rem 1.75rem;
}

.entry-content li {
    margin-bottom: 0.4rem;
}

.entry-content blockquote {
    border-left: 4px solid var(--color-accent);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background-color: var(--color-bg-alt);
    color: var(--color-text-light);
}

.entry-content pre {
    background-color: #1e2a38;
    color: #e8ecf1;
    padding: 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.25rem 0;
    font-size: 0.88rem;
}

.entry-content code {
    font-size: 0.9em;
    background: var(--color-bg-alt);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

.entry-content pre code {
    background: none;
    padding: 0;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
}

.entry-content th,
.entry-content td {
    border: 1px solid var(--color-border);
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-size: 0.92rem;
}

.entry-content th {
    background: var(--color-bg-alt);
    font-weight: 600;
    color: var(--color-primary);
}

.entry-footer {
    margin-top: 1.25rem;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

/* Read More */
.read-more {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.4rem 1.2rem;
    background-color: var(--color-primary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

.read-more:hover {
    background-color: var(--color-accent);
    color: #fff;
    text-decoration: none;
}

/* Single Post */
.single .entry-title,
.page .entry-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.single .entry-content,
.page .entry-content {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: 2rem;
}

/* Post Navigation */
.post-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    gap: 1rem;
    font-size: 0.9rem;
}

.post-navigation .nav-previous,
.post-navigation .nav-next {
    flex: 1;
}

.post-navigation .nav-next {
    text-align: right;
}

.nav-subtitle {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-bottom: 0.2rem;
}

/* ===========================
   Sidebar
   =========================== */
.widget-area {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.widget {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.widget-title {
    font-size: 1rem;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-accent);
}

.widget ul {
    list-style: none;
}

.widget li {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.9rem;
}

.widget li:last-child {
    border-bottom: none;
}

.widget li a {
    color: var(--color-text);
}

.widget li a:hover {
    color: var(--color-accent);
}

/* ===========================
   Footer
   =========================== */
.site-footer {
    background-color: var(--color-primary);
    color: rgba(255, 255, 255, 0.8);
    padding: 2.5rem 1.5rem 1.5rem;
    font-size: 0.88rem;
    line-height: 1.9;
    margin-top: auto;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer-content {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-section h3 {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
}

.footer-section a:hover {
    color: #fff;
    text-decoration: underline;
}

.footer-rooms {
    list-style: none;
}

.footer-rooms li {
    padding: 0.15rem 0;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.footer-bottom a {
    color: rgba(255, 255, 255, 0.6);
}

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

.pagination .page-numbers {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 0.88rem;
    background: var(--color-bg);
}

.pagination .page-numbers.current {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.pagination .page-numbers:hover:not(.current) {
    border-color: var(--color-accent);
    color: var(--color-accent);
    text-decoration: none;
}

/* ===========================
   Comments
   =========================== */
.comments-area {
    margin-top: 2rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: 2rem;
}

.comments-title {
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
}

.comment-list {
    list-style: none;
}

.comment-body {
    padding: 1.25rem;
    margin-bottom: 1rem;
    background-color: var(--color-bg-alt);
    border-radius: var(--radius);
}

.comment-meta {
    margin-bottom: 0.5rem;
    font-size: 0.82rem;
}

.comment-author .fn {
    font-weight: 600;
    color: var(--color-primary);
}

.comment-respond {
    margin-top: 1.5rem;
}

.comment-form label {
    display: block;
    margin-bottom: 0.2rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.9rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.comment-form textarea {
    min-height: 130px;
    resize: vertical;
}

.comment-form .submit {
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0.65rem 1.8rem;
    font-size: 0.95rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-body);
    transition: background-color 0.2s ease;
}

.comment-form .submit:hover {
    background-color: var(--color-accent);
}

/* ===========================
   Search Form
   =========================== */
.search-form {
    display: flex;
    gap: 0.4rem;
}

.search-form .search-field {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font-body);
}

.search-form .search-field:focus {
    outline: none;
    border-color: var(--color-accent);
}

.search-form .search-submit {
    padding: 0.6rem 1.2rem;
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font-body);
}

.search-form .search-submit:hover {
    background-color: var(--color-accent);
}

/* ===========================
   404
   =========================== */
.error-404 {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
}

.error-404 .page-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.error-404 .search-form {
    max-width: 400px;
    margin: 1.5rem auto 0;
}

/* ===========================
   Accessibility
   =========================== */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: var(--color-primary);
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ===========================
   WordPress Alignment
   =========================== */
.alignleft {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.alignright {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
}

.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    text-align: center;
    padding-top: 0.4rem;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 960px) {
    .site-inner {
        flex-direction: column;
    }

    .widget-area {
        width: 100%;
    }

    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .lang-switcher {
        justify-content: center;
    }

    /* Mobile menu */
    .menu-toggle {
        display: block;
        width: 100%;
        margin: 0;
    }

    .main-navigation {
        flex-direction: column;
        padding: 0.5rem 1.5rem;
    }

    .main-navigation ul {
        display: none;
        flex-direction: column;
        width: 100%;
    }

    .main-navigation.toggled ul {
        display: flex;
    }

    .main-navigation a {
        padding: 0.7rem 1rem;
        border-bottom: none;
        margin-bottom: 0;
    }

    .main-navigation ul ul {
        position: static;
        box-shadow: none;
        min-width: 0;
    }

    .main-navigation ul ul a {
        padding-left: 2rem;
        border-left: none;
    }

    .site-branding .site-title {
        font-size: 1.5rem;
    }

    .entry-title {
        font-size: 1.2rem;
    }

    .single .entry-title,
    .page .entry-title {
        font-size: 1.5rem;
    }

    .single .entry-content,
    .page .entry-content {
        padding: 1.25rem;
    }

    .post,
    .news-entry {
        padding: 1rem 1.25rem;
    }

    .post-navigation {
        flex-direction: column;
    }

    .post-navigation .nav-next {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .site-inner {
        padding: 1rem;
    }

    .site-branding .site-title {
        font-size: 1.3rem;
    }

    .footer-section {
        min-width: 100%;
    }
}
