/* =========================================================
   blog-theme-trad.css (v1.0)
   Optimized CSS for Traditional Mongolian vertical layout
   Based on blog-theme.css but with vertical-first approach
   ========================================================= */

/* --- Local Font Definition --- */
@font-face {
  font-family: 'TraMN_Blog_Font';
  src: url('../fonts/noto-sans-mongolian-v23-latin_mongolian-regular.woff2') format('woff2');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    font-family: "Noto Sans JP", sans-serif;
    color: #1b1a19;
}

/* === SKIP TO CONTENT LINK === */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: #e07a00;
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 9999;
  font-weight: 600;
}
.skip-to-content:focus {
  top: 1rem;
}

/* === HEADER === */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 3px solid #e07a00;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.site-title a {
    color: #3b2411;
    text-decoration: none;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 1.8rem); 
    font-family: "Noto Serif JP", serif;
    letter-spacing: 0.02em;
    flex: 1;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Language Navigation */
.lang-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e07a00;
    border-radius: 20px;
}

.lang-nav-label {
    font-size: 0.8rem;
    color: #5a4943;
    font-weight: 600;
}

.lang-nav-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #5a4943;
    font-size: 0.8rem;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Noto Sans JP", sans-serif;
    text-decoration: none;
    display: inline-block;
}

.lang-nav-btn:hover:not(.active) {
    background: rgba(224, 122, 0, 0.1);
    text-decoration: none;
}

.lang-nav-btn.active {
    background: #e07a00;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    cursor: default;
}

.nav-toggle {
    appearance: none;
    border: 0;
    background: none;
    color: #3b2411;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
}
.nav-toggle:hover {
    color: #e07a00;
    transform: rotate(90deg);
}

/* === OVERLAY NAV === */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27, 20, 18, 0.97);
    color: #f4f0e8;
    display: none;
    z-index: 999;
    overflow-y: auto;
    padding: 80px 40px 40px;
}
.nav-overlay.open {
    display: block;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.nav-panel {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
}
.nav-close {
    position: fixed;
    top: 20px;
    right: 30px;
    appearance: none;
    border: 0;
    background: rgba(224, 122, 0, 0.9);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}
.nav-close:hover {
    background: #e07a00;
    transform: scale(1.1);
}
.nav-section h3 {
    color: #e07a00;
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e07a00;
    font-family: "Noto Serif JP", serif;
}
.nav-section ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.nav-section a {
    display: block;
    padding: 10px 0;
    color: #f4f0e8;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    font-size: 1rem;
}
.nav-section a:hover {
    color: #e07a00;
    padding-left: 12px;
    border-color: #e07a00;
}

/* Search and archive styles */
.nav-search {
    margin-bottom: 28px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.25);
}
.nav-search-form {
    display: flex;
    gap: 8px;
}
.nav-search-input {
    flex: 1;
    padding: 10px 12px 10px 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(244, 240, 232, 0.12);
    color: #f4f0e8;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f4f0e8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 18px 18px;
}
.nav-search-input::placeholder {
    color: rgba(244, 240, 232, 0.7);
}
.nav-search-input:focus {
    outline: 2px solid #e07a00;
    outline-offset: 2px;
}
.nav-search-submit {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: linear-gradient(135deg, #e07a00, #f28b1a);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(224, 122, 0, 0.25);
}
.nav-search-submit:hover {
    background: #f28b1a;
}

/* === DESK STAGE === */
.desk-stage {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    background: #6b5847 url(http://itako999.com/blog/bg/) repeat; 
}

/* === PARCHMENT - OPTIMIZED FOR HORIZONTAL SCROLL === */
.parchment-container {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: min(90%, 900px);
    height: calc(100vh - 140px);   
    z-index: 2;
    background: transparent; 
    border: none; 
    padding: 0; /* No padding - mid handles it */    
    display: flex;
    flex-direction: row;
}

.parchment-container.parchment-wide {
    width: 95vw;
}

.parchment-top,
.parchment-bot {
    flex: 0 0 var(--parchment-cap-height, 50px);
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

.parchment-top {
    background-image: url(https://itako999.com/blog/bg_paper_trad_top/);
}

.parchment-mid {
    flex: 1;
    overflow-y: hidden;
    overflow-x: auto;
    background-image: url(https://itako999.com/blog/bg_paper_trad_mid/);
    background-repeat: repeat-x;
    background-size: auto 100%;
    padding: 35px 10px;
}

.parchment-bot {
    background-image: url(https://itako999.com/blog/bg_paper_trad_bot/);
}

.parchment-mid > * {
    position: relative;
    z-index: 1;
}

.parchment-content {
    height: 100%; /* Fill container */
    display: inline-flex;
    min-width: 100%;
}

.parchment-mid::-webkit-scrollbar {
    width: 8px;
    height: 12px; /* Wider for horizontal scroll */
}
.parchment-mid::-webkit-scrollbar-track {
    background: rgba(233, 220, 200, 0.3);
}
.parchment-mid::-webkit-scrollbar-thumb {
    background: rgba(224, 122, 0, 0.5);
    border-radius: 4px;
}

/* === POST STRUCTURE - 4-COLUMN VERTICAL LAYOUT === */
.latest-post {
    display: flex; 
    flex-direction: row;
    align-items: flex-start; 
    gap: 20px;
    height: 100%;
    width: auto; /* Grow horizontally */
    min-width: 100%; /* At least fill the viewport */
}

/* === COLUMN 1: TITLE (Vertical) === */
.latest-post .post-title,
.latest-post h2 {
    writing-mode: vertical-lr;
    text-orientation: mixed;
    font-family: "TraMN_Blog_Font", sans-serif;
    color: #e07a00;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.4;
    
    border-right: 2px solid #e9dcc8;
    padding-right: 12px;
    margin: 0;
    
    flex-shrink: 0; 
    height: 100%;
}

.latest-post .post-title a {
    color: inherit;
    text-decoration: none;
}

.latest-post .post-title a:hover {
    color: #3b2411;
}

/* === WRAPPER FOR COLUMNS 2, 3, 4 === */
.post-main-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    gap: 20px;
    height: 100%;
}

/* === COLUMN 2: METADATA (Vertical) === */
.post-meta {
    flex-shrink: 0; 
    writing-mode: vertical-lr;
    text-orientation: mixed;
    
    border-right: 2px solid #e9dcc8;
    padding-right: 12px;
    margin: 0;
    
    display: flex;
    flex-direction: column;
    gap: 16px;
    
    font-size: 0.85rem;
    color: #777;
    height: 100%;
}

.post-meta span {
    display: block;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    margin-bottom: 16px; 
}

.post-meta span:last-child {
    margin-bottom: 0;
}

.post-meta .date::before { content: "\1F4C5\20 "; }
.post-meta .categories::before { content: "\1F3F7\FE0F\20 "; }
.post-meta .categories a { 
    color: #777; 
    text-decoration: none; 
}
.post-meta .categories a:hover { 
    color: #e07a00; 
}

/* === COLUMN 3: CONTENT (Vertical Mongolian text) === */
.post-content {
    flex: 1; 
    min-width: 0;
    height: 100%;
    overflow-y: hidden;
}

/* Traditional Mongolian text formatting */
.lang-content {
    display: block;
    margin-bottom: 1rem;
}

.lang-content.lang-mn-mong {
    font-family: "TraMN_Blog_Font", sans-serif;
    font-size: 1.3rem;
    line-height: 1.8;
    text-align: justify;

    width: 100%; 
    height: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    white-space: nowrap;
}

/* Each paragraph is a vertical column */
.lang-content.lang-mn-mong p {
    display: inline-block; 
    vertical-align: top;
    
    width: auto;
    height: 100%;
    margin-right: 1.5rem; /* Gap between columns */
    
    overflow-y: hidden; 
    padding-right: 10px;

    writing-mode: vertical-lr;
    direction: ltr;
    text-orientation: sideways;
    white-space: normal;
}

/* === COLUMN 4: COMMENTS === */
.comments-area {
    color: #3b2411;
    flex: 0 0 320px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    border-left: 2px solid #e9dcc8;
    padding-left: 16px;
    margin: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.comments-title {
    margin: 0;
    padding-right: 12px;
    border-right: 2px solid #e9dcc8;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: "Noto Serif JP", serif;
    color: #e07a00;
    font-size: 1.5rem;
    font-weight: 700;
}

.comment-reply-title {
    display: none; /* Hidden in vertical layout */
}

.comment-panel {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-left: 12px;
    height: 100%;
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 20px;
    white-space: nowrap;
}

.comment {
    display: inline-block;
    white-space: normal;
    height: 100%;
    max-height: 90%;
    margin: 0;
    padding: 0;
    border: none;
}

.comment-body {
    min-width: 2em;
    line-height: 1.9;
    padding: 8px;
    border-radius: 6px;
    background: rgba(240, 235, 220, 0.45);
    height: 100%;
    overflow-y: auto;
}

/* Comment content - vertical by default for Traditional Mongolian */
.comment-content p {
    writing-mode: vertical-rl;
    text-orientation: sideways;
    font-family: "TraMN_Blog_Font", sans-serif;
}

/* Specific overrides for JP/CYR comments */
.cm-jp .comment-content p {
    text-orientation: upright;
    font-family: "Noto Sans JP", sans-serif;
}

.cm-mn .comment-content p {
    font-family: "Noto Sans", sans-serif;
}

/* Comment Form */
#respond {
    display: inline-block;
    vertical-align: top;
    height: 100%;
    white-space: normal;
}

#commentform {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
}

#commentform p {
    margin-bottom: 0;
}

#commentform .comment-form-comment {
    flex-grow: 1;
    display: flex;
}

#commentform .comment-form-comment textarea {
    width: 12rem;
    height: 100%;
    min-height: 20rem;
    resize: both;
    padding: 8px;
    border: 1px solid #e9dcc8;
    border-radius: 4px;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: "Noto Sans JP", sans-serif;
    line-height: 1.8;
}

#commentform .form-submit {
    flex-shrink: 0;
    margin-top: 8px;
}

#commentform .form-submit input[type="submit"] {
    background: #e07a00;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    font-family: "Noto Sans JP", sans-serif;
    border-radius: 4px;
    cursor: pointer;
}

#commentform .form-submit input[type="submit"]:hover {
    background: #3b2411;
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
    .parchment-container {
        width: 100%; 
        top: 60px; 
        height: calc(100vh - 60px);
        padding: 20px 15px;
        overflow-y: auto; 
        overflow-x: hidden;
    }
    
    .parchment-content { 
        height: auto; 
        padding: 0; 
    }
    
    .lang-nav { 
        display: flex; 
    }

    /* Reset to vertical scroll on mobile */
    .latest-post {
        flex-direction: column;
        height: auto; 
        min-width: 0;
    }
    
    .latest-post .post-title,
    .latest-post h2 {
        writing-mode: horizontal-tb;
        border-right: none;
        border-bottom: 2px solid #e9dcc8;
        padding-right: 0; 
        padding-bottom: 12px;
        margin-bottom: 20px; 
        max-height: none;
        height: auto; 
    }
    
    .post-main-content-wrapper {
        display: block; 
        height: auto;
    }
    
    .post-meta {
        writing-mode: horizontal-tb;
        border-right: none;
        border-bottom: 2px solid #e9dcc8;
        padding-right: 0; 
        padding-bottom: 12px;
        margin-bottom: 20px;
        display: flex;
        flex-direction: row;
        gap: 16px;
        height: auto;
    }
    
    .post-meta span {
        writing-mode: horizontal-tb;
        margin-bottom: 0;
    }
    
    .post-content {
        height: auto; 
        overflow-y: visible;
    }
    
    .lang-content.lang-mn-mong {
        height: 70vh;
    }
    
    /* Mobile Comments Reset */
    .comments-area {
        flex-basis: auto;
        display: block;
        border-left: none;
        border-top: 2px solid #e9dcc8;
        padding-left: 0;
        padding-top: 2rem;
        margin-top: 3rem;
        height: auto; 
        overflow-y: visible;
    }
    
    .comments-title {
        writing-mode: horizontal-tb;
        border-right: none;
        border-bottom: 2px solid #e9dcc8;
        padding-right: 0;
    }
    
    .comment-reply-title {
        display: block;
    }
    
    .comment-panel {
        display: block;
        overflow: visible;
        white-space: normal;
        padding-left: 0;
    }
    
    .comment-list {
        display: block;
    }
    
    .comment {
        display: block;
        height: auto;
        max-height: none;
        margin-bottom: 1.5rem;
    }
    
    .comment-body {
        height: auto;
        overflow-y: visible;
    }
    
    .comment-content p,
    .cm-jp .comment-content p,
    .cm-mn .comment-content p {
        writing-mode: horizontal-tb;
    }
    
    #respond {
        display: block;
        height: auto;
    }
    
    #commentform .comment-form-comment textarea {
        writing-mode: horizontal-tb;
        width: 100%;
        height: 10rem;
        min-height: 0;
    }
}

@media (max-width: 480px) {
    .lang-nav-label {
        display: none;
    }
    
    .lang-nav {
        gap: 4px;
        padding: 4px 8px;
    }
}

/* =========================================================
   LANGUAGE NAVIGATION (v3.0)
   Replaces script-selector with homepage navigation links
   ========================================================= */

.lang-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e07a00;
    border-radius: 20px;
}

.lang-nav-label {
    font-size: 0.8rem;
    color: #5a4943;
    font-weight: 600;
}

.lang-nav-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #5a4943;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Noto Sans JP", sans-serif;
    text-decoration: none;
    display: inline-block;
}

.lang-nav-btn:hover:not(.active) {
    background: rgba(224, 122, 0, 0.1);
}

.lang-nav-btn.active {
    background: #e07a00;
    color: #fff;
    font-weight: 600;
    cursor: default;
}

/* Hide on mobile (optional - keep if you want it on mobile too) */
@media (max-width: 768px) {
    .lang-nav {
        display: flex; /* Keep visible on mobile */
    }
}

/* Alternative: Hide on small mobile */
@media (max-width: 480px) {
    .lang-nav-label {
        display: none; /* Hide label text on very small screens */
    }
    
    .lang-nav {
        gap: 4px;
        padding: 4px 8px;
    }
}