/* =========================================
   共通ブランドバー（Terrasta. / ぽぴぃ / ME RIGHT）
   全ページの一番上に置く細い帯。今いる事業に色を付ける。
   ========================================= */
:root {
    --tr-bb-h: 36px;
    --tr-bb-bg: #1f2629;
    --tr-bb-text: rgba(255, 255, 255, 0.72);
    --tr-bb-line: rgba(255, 255, 255, 0.14);
    --tr-bb-corp: #d8c49a;
    --tr-bb-popi: #f08a3c;
    --tr-bb-meright: #7fd8ca;
}

.tr-brandbar {
    position: relative;
    height: var(--tr-bb-h);
    background: var(--tr-bb-bg);
    color: var(--tr-bb-text);
    font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
    font-size: 12.5px;
    line-height: 1;
    letter-spacing: 0.04em;
}

.tr-brandbar__inner {
    display: flex;
    align-items: stretch;
    height: 100%;
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.tr-brandbar__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 16px;
    color: inherit !important;
    text-decoration: none !important;
    white-space: nowrap;
    transition: color 0.2s, background-color 0.2s;
}

.tr-brandbar__item + .tr-brandbar__item {
    border-left: 1px solid var(--tr-bb-line);
}

.tr-brandbar__item:first-child {
    padding-left: 0;
}

.tr-brandbar__item::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tr-bb-c);
    flex-shrink: 0;
}

.tr-brandbar__item[data-brand="corp"] { --tr-bb-c: var(--tr-bb-corp); }
.tr-brandbar__item[data-brand="popi"] { --tr-bb-c: var(--tr-bb-popi); }
.tr-brandbar__item[data-brand="meright"] { --tr-bb-c: var(--tr-bb-meright); }

.tr-brandbar__item:hover,
.tr-brandbar__item:focus-visible {
    color: #fff !important;
}

/* 今いる事業 */
.tr-brandbar__item[aria-current="true"] {
    color: #fff !important;
    font-weight: 700;
}

.tr-brandbar__item[aria-current="true"]::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--tr-bb-c);
}

.tr-brandbar__item:first-child[aria-current="true"]::after {
    left: 0;
}

.tr-brandbar__short { display: none; }

@media (max-width: 600px) {
    :root { --tr-bb-h: 34px; }
    .tr-brandbar { font-size: 12px; letter-spacing: 0.02em; }
    .tr-brandbar__inner { justify-content: space-between; }
    .tr-brandbar__item { padding: 0 10px; gap: 5px; flex: 1 1 auto; justify-content: center; }
    .tr-brandbar__item:first-child { padding-left: 0; justify-content: flex-start; flex: 0 0 auto; }
    .tr-brandbar__item[aria-current="true"]::after { left: 10px; right: 10px; }
    .tr-brandbar__full { display: none; }
    .tr-brandbar__short { display: inline; }
}

/* 固定ヘッダー（.site-header）のページ：帯の分だけ下げ、スクロールで帯が消えたらヘッダーを上に詰める。
   読み込み直後から正しく出るようにCSSだけで判定する（insole.html のヘッダーは固定ではないので除外）。
   スクロール時の位置は js/brand-bar.js が --tr-bb-offset で更新する。 */
body:has(> .tr-brandbar):has(.site-header:not(.insole-header)) {
    border-top: var(--tr-bb-h) solid transparent;
}

body:has(.site-header:not(.insole-header)) > .tr-brandbar {
    position: absolute;
    z-index: 999; /* ヘッダー(1000)とスマホメニューより下 */
    top: 0;
    left: 0;
    right: 0;
}

body:has(> .tr-brandbar) .site-header:not(.insole-header) {
    top: var(--tr-bb-offset, var(--tr-bb-h));
    transition: all 0.3s ease, top 0s; /* スクロールに遅れずに追従させる */
}

/* =========================================
   ぽぴぃヘッダー：ロゴ横に事業名を出す
   ========================================= */
.popi-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.popi-brand img {
    height: 64px !important;
    width: auto;
}

.popi-brand__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.2;
}

.popi-brand__text small {
    font-size: 11.5px;
    letter-spacing: 0.08em;
    color: #6f5b4b;
}

.popi-brand__text strong {
    font-size: 22px;
    letter-spacing: 0.06em;
    color: var(--popi-orange, #b94d16);
}

@media (max-width: 768px) {
    .popi-brand img { height: 46px !important; }
    .popi-brand__text small { font-size: 10px; }
    .popi-brand__text strong { font-size: 18px; }
}

/* =========================================
   各事業メニュー：今いるページに色を付ける
   ========================================= */
.common-nav a[aria-current="page"]:not(.btn),
.mobile-nav-list a[aria-current="page"]:not(.btn) {
    font-weight: 700;
    color: var(--color-primary);
}

.popi-body .common-nav a[aria-current="page"]:not(.btn),
.popi-body .mobile-nav-list a[aria-current="page"]:not(.btn) {
    color: var(--popi-orange, #b94d16);
}

.meright-body .common-nav a[aria-current="page"]:not(.btn),
.meright-body .mobile-nav-list a[aria-current="page"]:not(.btn) {
    color: #00796b;
}

/* =========================================
   スマホでロゴがヘッダー(70px)からはみ出す件の修正
   style.css の「.logo img { height: 90px !important }」が header.css のスマホ用50pxを上書きしていた。
   ぽぴぃ（.popi-brand）とインソール（.insole-logo）は個別にサイズ指定があるので除外。
   ========================================= */
@media (max-width: 992px) {
    .site-header .logo:not(.popi-brand):not(.insole-logo) img {
        height: 50px !important;
        width: auto;
    }
}
