@charset "utf-8";
/* フォント: 端末に関係なく同じ見た目にするため Google Fonts から読み込む（英数字 Inter / 日本語 Noto Sans JP） */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Noto+Sans+JP:wght@400;700&display=swap');

/*
    配色: 遠藤研究室ウェブサイト（https://www.robotics.mech.e.titech.ac.jp/gendo/）の
    青（#005c92 / #3193cc）をアクセントにしたダークテーマ
*/
:root {
    --bg: #1b1f23;          /* ページ背景 */
    --surface: #252b31;     /* 本文の箱 */
    --surface-2: #2e353c;   /* タブの中・表の見出し */
    --border: #46515b;
    --text: #dde3e8;
    --text-strong: #ffffff;
    --muted: #9aa5ae;
    --primary: #005c92;     /* 研究室サイトのナビゲーションの青 */
    --primary-light: #3193cc; /* 研究室サイトの選択中・ホバーの青 */
    --link: #5fb3e6;        /* 暗い背景で読めるように明るくした青 */
    --link-hover: #9ad0f2;
}

/* Body */
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    font-family: 'Inter', 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    color: var(--text);
}

/* ヘッダ */
header {
    background: #14181c;
    border-bottom: 6px solid var(--primary);
    padding: 14px 0;
    text-align: center;
}

/* 大学ロゴ｜タイトル｜（空き）の3列．タイトルは常に中央 */
#header-container {
    display: grid;
    /* 左右の列を同じ幅に固定し，タイトルを画面の中央に置く */
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 大学ロゴは画像に余白（アイソレーション）が含まれているため，そのまま表示する */
.header-logo {
    display: block;
    justify-self: start;
    line-height: 0;
}

.header-logo img {
    display: block;
    width: auto;
    height: 64px;
}

.header-logo:hover {
    opacity: 0.85;
}

header h1 {
    margin: 4px 0;
    font-size: 34px;
    font-weight: bold;
    line-height: 1.2;
    letter-spacing: 0.04em;
}

/* 幅が狭いときは，ロゴを上の段，タイトルを下の段にする */
@media screen and (max-width: 900px) {
    #header-container {
        grid-template-columns: 1fr;
        justify-items: center;
        row-gap: 4px;
    }

    .header-logo {
        justify-self: center;
    }
}

header h1 a,
header h1 a:hover {
    color: var(--text-strong);
    text-decoration: none;
}

/* 日本語 / English の切り替え（ヘッダの右端．js_includes/i18n.js）
   地球儀アイコン＋切り替え先の言語名だけを表示する（日本語のページでは「English」，英語のページでは「日本語」）．
   白の文字と枠線（角丸はタブ・検索欄と同じ）にし，マウスを乗せると研究室の青になる */
.lang-switch {
    justify-self: end;
    display: flex;
}

.lang-switch button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.lang-switch button::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cellipse cx='12' cy='12' rx='4.2' ry='9.5'/%3E%3Cpath d='M2.5 12h19M4 7h16M4 17h16'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cellipse cx='12' cy='12' rx='4.2' ry='9.5'/%3E%3Cpath d='M2.5 12h19M4 7h16M4 17h16'/%3E%3C/svg%3E") center / contain no-repeat;
}

.lang-switch button:hover,
.lang-switch button:focus-visible {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    outline: none;
}

/* 今の言語のボタンは隠す（JS が aria-pressed を付けるまでは両方隠しておく） */
.lang-switch button:not([aria-pressed="false"]) {
    display: none;
}

/* 幅が狭いとき（ロゴとタイトルが2段のとき）は，ヘッダの右上に小さく置く（アイコンの下に文字） */
@media screen and (max-width: 900px) {
    header {
        position: relative;
    }

    .lang-switch {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    .lang-switch button {
        flex-direction: column;
        gap: 2px;
        padding: 4px 6px;
        font-size: 11px;
        line-height: 1.2;
    }
}

/* 内容 */
#content {
    width: 80%;
    max-width: 800px;
    margin: 24px auto;
    padding: 20px;
    background: var(--surface);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    color: var(--text);
}

#content h2 {
    color: var(--text-strong);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

footer {
    background-color: #111418;
    text-align: center;
    padding: 20px 0;
    font-size: 14px;
    color: var(--muted);
}

/* リンク */
a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* 一覧へ戻るボタン */
.back-to-top-button {
    display: inline-block;
    padding: 10px 20px;
    margin-top: 20px;
    background-color: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.back-to-top-button:hover {
    background-color: var(--primary-light);
    color: #fff;
    text-decoration: none;
}

/* 論文用，表のスタイル */
.publication-table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    border: 2px solid var(--border);
    position: relative;
}

.publication-table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: var(--primary);
    margin-top: -20px;
}

.publication-table::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: var(--primary);
    margin-bottom: -20px;
}

.publication-table th,
.publication-table td {
    border: 1px solid var(--border);
    padding: 10px;
    text-align: left;
}

.publication-table th:first-child,
.publication-table td:first-child {
    text-align: center;
    width: 120px;
}

.publication-table th {
    background-color: var(--surface-2);
    color: var(--text-strong);
}

/* 論文リンクボタン */
.paper-link-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background-color: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 16px;
    transition: background-color 0.3s ease;
    width: fit-content;
    margin: 20px auto;
}

.paper-link-button:hover {
    background-color: var(--primary-light);
    color: #fff;
    text-decoration: none;
}

/* PDFダウンロードボタン（ページ最下部．T2R2 / 機関リポジトリへのリンク） */
.pdf-download-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background-color: transparent;
    color: #fff;
    border: 2px solid var(--primary-light);
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s ease;
    width: fit-content;
    margin: 30px auto 10px;
}

.pdf-download-button:hover {
    background-color: var(--primary);
    color: #fff;
    text-decoration: none;
}

.pdf-download-note {
    text-align: center;
    font-size: 0.8em;
    color: var(--muted);
    margin: 0 0 20px;
}

/* 研究業績（タブ形式） */
.publication-tabs {
    margin-top: 20px;
}

.pub-tablist {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    border-bottom: 3px solid var(--primary);
}

/* 全件表示タブ（左端に固定） */
.pub-tablist > button {
    flex: none;
}

/* 年タブ（多いときは横スクロール） */
.pub-year-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    /* スクロールバーは隠し，続きがある側を薄くぼかして示す（js_includes/publications.js が more-left / more-right を付ける） */
    scrollbar-width: none;
}

.pub-year-tabs::-webkit-scrollbar {
    display: none;
}

.pub-year-tabs.more-right {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
}

.pub-year-tabs.more-left {
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent);
}

.pub-year-tabs.more-left.more-right {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
}

.pub-tablist button {
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-family: inherit;
    font-size: 1em;
    font-weight: bold;
    /* 日本語（全件表示）と数字（年）で行の高さが変わらないように固定する */
    line-height: 1.5;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.pub-tablist button:hover {
    background: var(--surface-2);
    color: #fff;
}

.pub-tablist button[aria-selected="true"] {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pub-count {
    font-size: 0.75em;
    font-weight: normal;
    padding: 1px 7px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
}

.pub-panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-top: none;
    padding: 10px 20px 20px;
    border-radius: 0 0 8px 8px;
    min-height: 200px;
}

.pub-category {
    font-size: 1.05em;
    color: #fff;
    margin: 20px 0 8px;
    padding-left: 10px;
    border-left: 4px solid var(--primary-light);
}

.publication-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 各業績（項目全体が個別ページへのリンク） */
.publication-list li {
    border-bottom: 1px solid var(--border);
}

.pub-item {
    display: block;
    padding: 10px 12px 10px 14px;
    line-height: 1.6;
    color: var(--text);
    border-left: 2px solid transparent;
    transition: background 0.2s, border-color 0.2s, padding 0.2s;
}

a.pub-item:hover {
    background: rgba(49, 147, 204, 0.12);
    border-left-color: var(--primary-light);
    padding-left: 20px;
    color: var(--text);
    text-decoration: none;
}

.pub-title {
    font-weight: bold;
    color: var(--link);
    transition: color 0.2s;
}

a.pub-item:hover .pub-title {
    color: #fff;
}

.pub-meta {
    display: block;
    margin-top: 2px;
    font-size: 0.85em;
    color: var(--muted);
}

.pub-year {
    display: inline-block;
    margin-right: 8px;
    padding: 0 6px;
    font-size: 0.8em;
    color: #fff;
    background: var(--primary);
    border-radius: 4px;
}

.pub-tag {
    display: inline-block;
    margin-right: 8px;
    padding: 0 6px;
    font-size: 0.8em;
    color: var(--text);
    border: 1px solid var(--muted);
    border-radius: 4px;
}

.pub-empty {
    color: var(--muted);
}

/* 研究業績の検索欄 */
.pub-search {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 10px 0 0;
    padding: 10px 14px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1em;
}

.pub-search:focus {
    outline: none;
    border-color: var(--primary-light);
}

.pub-search[hidden] {
    display: none;
}

/* スマホ対応 */
@media screen and (max-width: 800px) {
    header h1 {
        font-size: 26px;
    }

    .header-logo img {
        height: 48px;
    }

    #content {
        width: auto;
        margin: 16px 10px;
    }

    .pub-tablist button {
        padding: 6px 12px;
    }

    .pub-panel {
        padding: 8px 12px 16px;
    }
}
