/* Custom styles for GWexpy documentation */

/* --- 1. Typography & General Layout --- */
:root {
    --gw-primary: #2980B9;
    --gw-secondary: #3498DB;
    --gw-accent: #E67E22;
    --gw-bg-dark: #1A1A1B;
    --gw-text-dark: #D7DADC;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Root docs page logo, used because the index page hides the RTD sidebar. */
.gw-home-brand {
    padding: 1.5rem 1rem 0.5rem;
    text-align: center;
}

.gw-home-brand img {
    display: block;
    width: min(72vw, 280px);
    max-width: 280px;
    height: auto;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .gw-home-brand {
        padding-top: 1.1rem;
    }

    .gw-home-brand img {
        width: min(78vw, 220px);
        max-width: 220px;
    }
}

/* Brand logo sizing for the RTD sidebar/header */
.wy-side-nav-search > a,
.wy-side-nav-search > a:hover,
.wy-side-nav-search > a:focus,
.wy-nav-top > a {
    display: block;
}

.wy-side-nav-search > a img,
.wy-nav-top > a img {
    display: block;
    width: 100%;
    max-width: 200px;
    height: auto;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .wy-side-nav-search > a img,
    .wy-nav-top > a img {
        max-width: 160px;
    }
}

/* Sidebar indentation and spacing */
.wy-menu-vertical li.toctree-l1 > a {
    font-weight: bold;
    color: #444;
}

.wy-menu-vertical li.current > a {
    background: #f0f0f0;
    color: var(--gw-primary);
    border-right: 4px solid var(--gw-primary);
}

.wy-menu-vertical li.toctree-l2 a {
    padding-left: 2.5em;
}

.wy-menu-vertical li.toctree-l3 a {
    padding-left: 3.5em;
}

/* --- 2. Advanced Interactive Elements --- */

/* Grid card styling tweaks for Sphinx Design */
.sd-card {
    border-radius: 12px !important;
    border: 1px solid #eee !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}

.sd-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.12) !important;
    border-color: var(--gw-primary) !important;
}

/* Hero section spacing */
.grid-container {
    margin-top: 3em;
    margin-bottom: 3em;
}

/* --- 3. Code Blocks & Tables --- */

/* Code block "premium" look */
.highlight {
    border-radius: 8px;
    padding: 2px;
    background: #fdfdfd;
}

.gw-copy-wrap {
    position: relative;
}

.gw-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    color: #35506b;
    font-size: 0.8rem;
    line-height: 1;
    padding: 0.45rem 0.6rem;
    cursor: pointer;
}

.gw-copy-btn:hover {
    background: #ffffff;
    border-color: var(--gw-primary);
    color: var(--gw-primary);
}

/* Table overflow handling & Scroll wrapper style */
.wy-table-responsive {
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 2em;
}

.wy-table-responsive table {
    width: 100%;
    table-layout: auto;
}

.wy-table-responsive table td, 
.wy-table-responsive table th {
    white-space: normal !important;
    padding: 12px !important;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
}

.wy-table-responsive table thead th {
    background-color: #f4f4f4 !important;
    border-bottom: 2px solid #ddd !important;
}

@media (max-width: 768px) {
    .wy-table-responsive {
        display: block;
        max-width: 100%;
        border-radius: 10px;
    }

    .wy-table-responsive table {
        min-width: 36rem;
    }

    .wy-table-responsive table td,
    .wy-table-responsive table th {
        padding: 10px !important;
        font-size: 0.95rem;
        line-height: 1.45;
    }
}

/* Notebook-rendered pandas dataframes do not get the RTD responsive wrapper. */
.output_area.rendered_html {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.output_area.rendered_html > div {
    max-width: 100%;
}

.output_area.rendered_html table.dataframe {
    width: 100%;
    max-width: 100%;
    table-layout: auto;
}

.output_area.rendered_html table.dataframe td,
.output_area.rendered_html table.dataframe th {
    white-space: normal !important;
    padding: 12px !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    vertical-align: top;
}

@media (max-width: 768px) {
    .output_area.rendered_html table.dataframe {
        table-layout: fixed;
    }

    .output_area.rendered_html table.dataframe td,
    .output_area.rendered_html table.dataframe th {
        padding: 10px !important;
        font-size: 0.95rem;
        line-height: 1.45;
    }
}

/* --- 4. Language Switcher & Web Landing Page --- */

#lang-pill {
    position: fixed;
    top: 12px;
    right: 20px;
    z-index: 9999;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 16px;
    padding: 4px 14px;
    font-size: 0.82em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.6;
    white-space: nowrap;
}

#lang-pill a {
    color: #2980B9;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

#lang-pill a:hover {
    color: #1a5f8c;
    text-decoration: underline;
}

#lang-pill .lang-sep {
    color: #bbb;
}

#lang-pill .lang-current {
    color: #333;
    font-weight: 700;
}

@media (max-width: 768px) {
    #lang-pill {
        right: 12px;
        padding: 4px 10px;
        font-size: 0.78em;
    }
}

@media (prefers-color-scheme: dark) {
    #lang-pill {
        background: #2c2c2e;
        border-color: #3a3a3c;
        color: #efeff4;
    }

    #lang-pill .lang-current {
        color: #efeff4;
    }

    #lang-pill .lang-sep {
        color: #636366;
    }
}

.gw-hub-lang-switch {
    display: flex;
    justify-content: flex-end;
    margin: 0.5rem 0 1rem;
}

.gw-hub-lang-switch #lang-pill {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    margin: 0;
    width: fit-content;
    max-width: 100%;
}

.gw-hub-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 1.25rem;
    margin: 0 0 2rem;
    align-items: stretch;
}

.gw-hub-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    border: 1px solid #d7e3ef;
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(15, 42, 74, 0.08);
}

.gw-hub-copy {
    padding: 1.5rem;
}

.gw-hub-eyebrow {
    margin: 0 0 0.65rem;
    color: #0f6cbd;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gw-hub-title {
    margin: 0;
    font-size: 2.35rem;
    line-height: 1.02;
    letter-spacing: -0.03em;
    color: #10243a;
}

.gw-hub-lede {
    margin: 0.9rem 0 0;
    color: #566779;
    line-height: 1.8;
}

.gw-hub-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1.1rem;
}

.gw-hub-meta div {
    padding: 0.85rem 0.9rem;
    background: rgba(255,255,255,0.82);
    border: 1px solid #d7e3ef;
    border-radius: 14px;
}

.gw-hub-meta dt {
    margin: 0;
    color: #61758a;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gw-hub-meta dd {
    margin: 0.35rem 0 0;
    color: #10243a;
    font-size: 0.92rem;
    font-weight: 700;
}

.gw-hub-figure {
    padding: 1rem;
}

.gw-hub-figure img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 14px;
    border: 1px solid #d7e3ef;
    background: #fff;
}

.gw-hub-figure p {
    margin: 0.75rem 0 0;
    color: #5c6d80;
    font-size: 0.88rem;
    line-height: 1.65;
}

.gw-hub-duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 0 0 2rem;
}

.gw-hub-duo section {
    padding: 1.15rem 1.2rem;
}

.gw-hub-duo p {
    margin: 0 0 0.65rem;
    color: #0f6cbd;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gw-hub-duo pre {
    margin: 0;
    padding: 0.95rem 1rem;
    border: 1px solid #d7e3ef;
    border-radius: 14px;
    background: #f8fbfe;
    overflow-x: auto;
}

@media (max-width: 900px) {
    .gw-hub-lang-switch {
        margin-bottom: 0.85rem;
    }

    .gw-hub-hero,
    .gw-hub-duo {
        grid-template-columns: 1fr;
    }

    .gw-hub-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .gw-hub-lang-switch {
        justify-content: flex-start;
    }

    .gw-hub-lang-switch #lang-pill {
        width: 100%;
        justify-content: center;
    }
}

/* --- 5. Gateway LP: highlighted cards (Phase 2 用) --- */

/* カード 7・8 の強調スタイル（目玉機能） */
.sd-card.gw-highlight {
    border-color: var(--gw-primary) !important;
    background-color: #f0f7fd !important;
}

.sd-card.gw-highlight .sd-card-title {
    color: var(--gw-primary);
}

/* External link icons */
.reference.external:after {
    content: "\f08e";
    font-family: FontAwesome;
    font-size: 0.8em;
    padding-left: 4px;
    vertical-align: super;
}

/* De-emphasize the GitHub edit link in the breadcrumb header. */
.wy-breadcrumbs-aside {
    font-size: 0.82em;
    opacity: 0.62;
}

.wy-breadcrumbs-aside a {
    font-weight: 400;
}

.wy-breadcrumbs-aside:hover,
.wy-breadcrumbs-aside:focus-within {
    opacity: 0.9;
}

/* --- 6. Layout fixes --- */

/* Fix header overlap: the fixed lang-pill (top: 12px; right: 20px) can overlap
   the RTD breadcrumb/license row. Push the breadcrumb aside below the pill. */
.wy-nav-content-wrap .wy-nav-content {
    padding-top: 1.5em;
}

.wy-breadcrumbs {
    padding-right: 160px; /* leave room for the fixed lang-pill */
}

/* Relax right-side whitespace: RTD default caps content at 800px.
   Widen it so wide tables and plots are not cramped. */
.wy-nav-content {
    max-width: 1100px;
}

/* Copy button: prevent the button from being clipped when the highlight
   container has overflow:hidden set by some Sphinx themes. */
div[class^="highlight"] {
    overflow: visible;
}

.copybutton,
button.copybtn {
    top: 0.4em !important;
    right: 0.4em !important;
}
