/* ================= ROOT ================= */

:root {
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --primary: #0f172a;
    
    --accent: #0d9488; 
    --accent-soft: rgba(13, 148, 136, 0.05);
    --accent-strong: #0f766e;
    
    --text-main: #1e293b;
    --text-sub: #64748b;
    --border: #e2e8f0;

    --search-bg: #f2f5f8;

    --shadow-premium: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-soft: 0 8px 24px rgba(0,0,0,0.06);

    --selection-bar-height: 110px;
}

/* ================= BASE ================= */

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Noto Sans JP", "Hiragino Sans", sans-serif;
    color: var(--text-main);

    background:
        radial-gradient(900px 500px at 50% -50px, rgba(31,95,107,0.14), transparent 65%),
        radial-gradient(1200px 600px at 50% 120%, rgba(31,95,107,0.05), transparent 70%),
        radial-gradient(circle at 1px 1px, rgba(0,0,0,0.04) 1px, transparent 0),
        linear-gradient(to bottom, #eef2f6, #dde4ea);
    background-size: auto, auto, 24px 24px, auto;
}

/* ================= HEADER ================= */

header {
    padding: 50px 20px 30px;
    text-align: center;
    background: var(--bg);
}

.brand-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    perspective: 1200px;
    margin-bottom: 40px; 
}

.logo-main {
    position: relative;
    z-index: 20;
    font-size: 4rem;
    font-weight: 900;
    color: var(--primary);
    display: flex;
    align-items: baseline; 
    gap: 6px;
    margin-left: -3px;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

.card-wrapper {
    position: relative;
    display: inline-block;
    perspective: 1200px;   
}

.card-frame {
    display: inline-flex;
    align-items: center;
    padding: 0.15em 0.3em;
    border: 2px solid var(--accent);
    border-radius: 6px;
    background: white;
    color: var(--accent);
    font-size: 0.75em;
    line-height: 1;
    position: relative;
    z-index: 5;
    transform: translateY(-0.13em);
}

.logo-card-under {
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: white;
    border: 1.2px solid var(--border);
    top: 0.15em;


    opacity: 0;
    z-index: 1;

    transform-origin: left center;
    transition: transform 0.45s cubic-bezier(0.34,1.56,0.64,1),
                opacity 0.3s ease;
}

.logo-stack {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    cursor: default;
    padding: 10px 0; 
    align-items: center;
    text-align: center;   
    justify-content: center;  
    min-width: fit-content;
    perspective: 800px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    flex-shrink: 0;
    width: max-content;
}

.brand-tagline {
    font-size: 0.65rem; 
    letter-spacing: 0.5em;
    font-weight: 400; 
    text-transform: uppercase;
    color: var(--text-sub); 
    margin-top: 15px; 
    margin-left: 0.5em; 
    z-index: 10;
    opacity: 0.7;
    width: 100%;
}

.tagline {
    font-size: 1rem;
    letter-spacing: 0.15em;
    color: var(--text-sub);
    margin: 0px -10px 0 0; 
    font-weight: 500;
    opacity: 0.9;
}

/* --- ANIMATION --- */

.logo-stack:hover .logo-main,
.logo-stack.is-active .logo-main { 
    transform: translateZ(50px) rotateX(8deg) rotateY(-10deg); 
    transition: all 0.45s cubic-bezier(0.34, 1.25, 0.64, 1), visibility 0s 0s;
}

.logo-stack:hover .card-frame {
    transform: rotateY(-10deg) translateZ(40px);
}

.logo-stack:hover .logo-card-under.first,
.logo-stack.is-active .logo-card-under.first {
    opacity: 0.9;
    width: 95%;
    transform:
        translateX(4px)
        translateY(-4.5px)
        rotateY(-20deg)
        rotateZ(3deg);
    box-shadow: var(--shadow-premium), 2px 4px 8px rgba(0,0,0,0.1);
}

.logo-stack:hover .logo-card-under.second,
.logo-stack.is-active .logo-card-under.second {
    opacity: 0.6;
    width: 90%;
    transform:
        translateX(4px)
        translateY(-4.5px)
        rotateY(-30deg)
        rotateZ(6deg);
    box-shadow: var(--shadow-premium), 2px 4px 8px rgba(0,0,0,0.1);
}

.logo-stack:hover .card-frame,
.logo-stack.is-animating .card-frame,
.logo-stack.is-active .card-frame{ 
    background: var(--accent); 
    color: white; 
    box-shadow: var(--shadow-premium), 2px 2px 6px rgba(0, 0, 0, 0.2);
    transform: translateY(-5px) rotateY(-10deg);
}
/* ================= SEARCH ================= */

.search-container {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
    position: relative;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 520px;
}

.search-container input {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: white;
    font-size: 0.95rem;
    outline: none;
    box-shadow: var(--shadow-soft);
    transition: all 0.2s ease;
    padding: 14px 48px 14px 20px !important;
}

.search-hint {
    position: absolute;
    left: 20px !important;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa3af;
    font-size: 0.95rem;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.search-hint-container {
    min-height: 1.5em; 
}

.search-container input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft); 
}

.search-icon-svg {
    position: absolute;
    right: 18px;
    color: #9aa3af;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 10;
}

.search-icon-svg.hidden {
    opacity: 0;
    transform: translateX(10px);
}

.suggest-btn {
    margin: 6px;
    padding: 8px 16px; 
    border-radius: 20px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.suggest-btn:active {
    transform: scale(0.95);
    background: var(--accent-soft);
}

.empty-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-premium);
}

.suggestions {
    margin-top: 16px;
}

.suggest-btn {
    margin: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--accent);
    background: var(--accent-strong);
    cursor: pointer;
    font-size: 14px;
    color: white;
}

.suggest-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-premium);
}


/* ================= FILTER ROW ================= */

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    max-width: 800px;
    padding: 0 20px;
    margin: 0 auto;
}

.quick-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter-btn:hover {
    transform: translateY(-2px);
    background: var(--accent-soft);
    border-color: var(--accent);
}

.filter-btn.active {
    background: var(--accent);
    color: white;
    transform: translateY(0) scale(0.97);
}

.floating-btn {
    position: fixed;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    z-index: 3000;
}

.floating-btn:focus {
    outline: none;
}

.multi-select-fab:hover {
    transform: translateY(-3px);
}

.multi-select-fab.active {
    background: #e74c3c;
}

.multi-select-fab {
    bottom: 30px;
    background: var(--accent);
    color: white;
    transition: all 0.25s ease;
}

/* ================= GRID ================= */

#translationGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 40px 20px 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ================= SHOW MORE ================= */

#showMoreContainer {
    margin: 20px 0 50px;
    display: none; 
    width: 100%;
    justify-content: center;
}

#showMoreBtn {
    background: white;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 12px 36px;
    cursor: pointer;
    transition: all 0.25s ease;
}

#showMoreBtn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
}

/* ================= CARD ================= */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 16px 18px;
    position: relative;
    z-index: 1;
    animation: cardFadeIn 0.4s ease forwards;

    opacity: 0;
    transform: translateY(20px); 

    transition: 
        opacity 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 0.25s ease,
        background 0.25s ease,
        border-color 0.25s ease;
    
    will-change: transform, opacity;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.card.show {
    opacity: 1;
    transform: translateY(0);
}


.card.menu-open {
    z-index: 5000;
}

.card.selected {
    transform: scale(0.98);
    outline: 3px solid var(--accent);
    outline-offset: -2px;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card.hide {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.jp-text { 
    font-weight: 600; 
    font-size: 0.98rem;
    color: var(--primary);
    margin-bottom: auto;
    margin-top: auto;
}
.en-text { 
    font-size: 0.88rem; 
    margin-top: 6px;
    font-weight: 500;
    color: var(--accent);
}
.context-text { 
    font-size: 0.78rem; 
    color: var(--text-sub); 
    margin-top: 4px; 
}

/* ================= COPY ================= */

.copy-btn {
    align-self: flex-start;
    margin-top: auto;
    padding: 6px 14px;
    font-size: 0.75rem;
    border-radius: 10px;
    background: var(--search-bg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ================= MENU ================= */

.menu-container {
    position: relative;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-sub);
    transition: background 0.2s ease;
}

.menu-btn:hover {
    background: var(--accent-soft);
}

.menu-content {
    display: none;
    position: absolute;
    right: 0;
    top: 110%;
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-hover);
    min-width: 180px;
    overflow: hidden;
    z-index: 9999;
}

.menu-content.show {
    display: block;
}

.menu-content a {
    display: block;
    padding: 14px 18px;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.2s ease;
}

.menu-content a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ================= FULLSCREEN ================= */

#fullscreenOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 8vw;
}

#fs-en {
    font-weight: 800;
    font-size: clamp(2.6rem, 6vw, 4.4rem);
    margin-bottom: 1.5rem;
}

#fs-jp {
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
    color: var(--text-sub);
    line-height: 1.2;
    word-break: keep-all;
}

#fs-content {
    width: 85%;
}

.close-fs {
    position: absolute;
    top: 28px;
    right: 28px;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-sub);
}

.print-branding {
    position: absolute;
    top: 28px;
    left: 32px;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    font-weight: 700;
    color: var(--accent);
    opacity: 0.7;
}

/* ================= CONTACT / CTA ================= */

.contact-section {
    padding: 30px 20px;
    text-align: center;
    background: var(--bg);
}

.contact-container {
    background: white;
    border-radius: 22px;
    max-width: 720px;
    margin: 0 auto;
    padding: clamp(30px, 6vw, 50px) clamp(20px, 5vw, 36px);
    box-shadow: var(--shadow-soft);
}

.contact-container h2 {
    font-size: clamp(1.3rem, 4vw, 1.6rem);
    margin-bottom: 14px;
    
}

.contact-container p {
    color: var(--text-sub);
    margin-bottom: 30px;
    
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cta-button {
    padding: 14px 28px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    background: var(--accent);
    color: white;
}

.mail-button {
    padding: 14px 28px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    background: white;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.cta-button, .mail-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cta-button:hover, .mail-button:hover {
    transform: translateY(-2px); 
    box-shadow: var(--shadow-hover);
    filter: brightness(1.1); 
}

.cta-button:active, .mail-button:active {
    transform: translateY(0) scale(0.97);
}

.secondary-button {
    padding: 14px 28px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    background: white;
    color: var(--accent);
    border: 1px solid var(--accent);
    transition: all 0.25s ease;
}

.secondary-button:hover {
    background: var(--accent-soft);
}

/* ================= FOOTER ================= */

.site-footer {
    padding: 30px 10px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.footer-links a {
    color: var(--text-sub);
    text-decoration: none;
    font-weight: 600;
}

/* ================= PAGE OVERLAY ================= */

.page-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.page-content {
    background: white;
    width: 90%;
    max-width: 600px;
    padding: 40px;
    border-radius: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.close-overlay-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    border: none;
    background: none;
    cursor: pointer;
}
/* ================= SELECTION BAR ================= */

.selection-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translate(-50%, 150%);
    
    background: white;
    border-radius: 24px;
    padding: 16px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    width: calc(100% - 40px);
    max-width: 720px;

    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    transition: 
        transform 0.35s ease, 
        width 0.3s ease, 
        left 0.3s ease, 
        border-radius 0.3s ease,
        bottom 0.3s ease;
    z-index: 4000;
    flex-wrap: nowrap;
}

.selection-bar.show {
    transform: translate(-50%, 0);
}

.selection-info {
    font-weight: 600;
    white-space: nowrap;
}

.selection-actions {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
}

.selection-actions button {
    white-space: nowrap;
}

.selection-actions button:enabled {
    opacity: 1;
}

.selection-actions button:disabled {
    opacity: 0.4;
    pointer-events: none;
}

.primary-action {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
}

.ghost-action {
    background: transparent;
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
}

.selection-bar button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 999px;
    cursor: pointer;
}

@media (max-width: 880px) {

    .card-frame{
        transform: translateY(-0.11em);
    }

    .selection-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;

        transform: translate(0, 100%);
        width: 100%;
        max-width: 100%;

        border-radius: 24px 24px 0 0;

        flex-direction: column;
        align-items: stretch;

        padding: 16px;
        gap: 16px;
    }

    .selection-bar.show {
        transform: translate(0, 0);
    }

    .filter-btn {
        padding: 10px 18px;
    }

    .selection-actions {
        flex-direction: column;
        gap: 14px;
        width: 100%;
        padding: 12px;
        border-radius: 16px;
        font-size: 15px;
    }

    .selection-actions button {
        width: 100%;
    }

    .selection-info {
        font-size: 18px;
        margin-bottom: 8px;
    }

    body.selection-mode .multi-select-fab {
        bottom: 220px;
    }

    body.selection-mode .back-to-top {
        bottom: 290px;
    }
    .contact-section {
        padding: 20px 15px; 
    }

    .contact-container {
        padding: 30px 20px; 
        border-radius: 16px; 
    }

    .contact-container h2 {
        font-size: 1.3rem;
    }

    .contact-links {
        gap: 10px;
    }

    .cta-button, .mail-button {
        flex: 1 1 100%; 
        max-width: 100%;
        width: 100%; 
        padding: 12px 20px;
        font-size: 15px;
    }

    .brand-shell {
        perspective: 800px;
    }
}

/* ================= BACK TO TOP ================= */

.back-to-top {
    bottom: 110px;
    background: var(--accent);
    color: white;

    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.25s ease;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* App version */

.app-version {
    margin-left: 8px;
    font-size: 0.65rem;
    color: var(--text-sub);
    opacity: 0; 
    transition: opacity 0.3s ease;
    font-family: monospace;
}

.site-footer:hover .app-version {
    opacity: 0.5; 
}

/* ================= PRINT ================= */

@page {
  size: A4 landscape;
  margin: 0;
}

@media print {
    header,
    .contact-section,
    .site-footer,
    .menu-container,
    .copy-btn,
    .selection-bar,
    .back-to-top {
        display: none !important;
    }

    html, body {
    width: 297mm;
    height: 210mm;
    margin: 0 !important;
    padding: 0 !important;
    background: white;
  }

    body * {
        visibility: hidden;
    }

    body {
        font-family: "Noto Sans JP", sans-serif;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #a4-template {
        position: absolute;
        top: 0; left: 0;
        width: 297mm; height: 210mm;
        background: white;
        display: flex; flex-direction: column;
        justify-content: center; align-items: center;
        padding: 10mm; 
        box-sizing: border-box;
    }
}



@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.a4-wrapper {
  width: 297mm;
  height: 210mm;
  transform-origin: top left;
}

@media screen and (max-width: 1000px) {
  .a4-wrapper {
    transform: scale(0.35);
  }
}