/* Transliterator Styles - Aligned with Wiki Theme */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Egyptian+Hieroglyphs&display=swap');

html, body {
    width: 100%;
    overflow-x: hidden;
}

/* Hieroglyph Font */
.hieroglyph {
    font-family: 'Noto Sans Egyptian Hieroglyphs', 'Segoe UI Historic', Arial, sans-serif;
    line-height: 1.2;
    font-variant-ligatures: normal;
    -webkit-font-feature-settings: "kern" 1;
    font-feature-settings: "kern" 1;
}

/* Layout */
.transliterator-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .transliterator-container {
        padding: 1rem 0.5rem;
        width: 100vw;
        margin-left: calc(-50vw + 50%);
    }
}

/* Header */
.transliterator-header {
    margin-bottom: 2rem;
}

.transliterator-header h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.5rem, 5vw, 2rem);
    color: var(--gold);
    text-shadow: 0 0 30px rgba(212,175,55,0.4), 0 0 60px rgba(212,175,55,0.1);
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.transliterator-header > p {
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Features Box */
.features-box {
    background: rgba(212,175,55,0.04);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.features-box h3 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.features-box ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.features-box li {
    color: var(--text);
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.features-box li::before {
    content: "•";
    color: var(--gold);
    font-weight: bold;
    margin-right: 0;
    flex-shrink: 0;
}

.features-box strong {
    color: var(--text-bright);
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

@media (max-width: 640px) {
    .features-box {
        padding: 0.8rem;
        margin-bottom: 1rem;
    }

    .features-box h3 {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .features-box li {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        word-break: break-word;
        min-width: 0;
    }

    .features-box ul {
        padding: 0;
    }
}

@media (max-width: 480px) {
    .features-box li {
        font-size: 0.75rem;
        word-spacing: -0.05em;
    }
}

/* Main Grid */
.transliterator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .transliterator-grid {
        grid-template-columns: 1fr;
    }
}

/* Input/Output Panels */
.input-panel,
.output-panel {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevents grid items from expanding past container */
}

.input-panel label,
.output-panel label {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--gold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.input-header,
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0.5rem;
}

.input-header button {
    font-family: 'VT323', monospace;
    font-size: 0.75rem;
    color: var(--cyan-dim);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.input-header button:hover {
    color: var(--cyan);
}

textarea {
    background-color: rgba(15,13,8,0.9);
    border: 1px solid rgba(212,175,55,0.2);
    color: var(--text);
    font-family: 'VT323', monospace;
    padding: 0.8rem;
    border-radius: 0.3rem;
    resize: none;
    width: 100%;
    height: 250px; /* Locked height for symmetry */
    box-sizing: border-box;
    transition: border-color 0.3s;
    font-size: 0.9rem;
}

textarea:focus {
    outline: none;
    border-color: rgba(212,175,55,0.4);
    box-shadow: inset 0 0 10px rgba(212,175,55,0.1);
}

textarea::placeholder {
    color: var(--cyan-dim);
    opacity: 0.6;
}

#output-field {
    font-family: 'Noto Sans Egyptian Hieroglyphs', 'Segoe UI Historic', sans-serif;
    text-align: center;
    background-color: rgba(15,13,8,0.95);
    padding: 1.2rem;
    width: 100%;
    height: 250px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 0.3rem;
    overflow-y: auto;
    cursor: default;
    user-select: text;
}

/* ── Quadrat Layout Engine Styles ─────────────────────────────────── */

.q-sequence {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    row-gap: 12px;
}

.q-quadrat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.q-vstack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.q-hgroup {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.q-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-shadow: 0 0 20px var(--gold-glow);
    font-family: 'Noto Sans Egyptian Hieroglyphs', 'Segoe UI Historic', sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: "calt" 1, "liga" 1, "kern" 1;
    font-feature-settings: "calt" 1, "liga" 1, "kern" 1;
}

.q-unknown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan-dim);
    font-family: 'VT323', monospace;
    opacity: 0.7;
    flex-shrink: 0;
}

.output-placeholder {
    color: var(--cyan-dim);
    opacity: 0.4;
    font-size: 3.5rem;
    pointer-events: none;
    font-family: 'Noto Sans Egyptian Hieroglyphs', 'Segoe UI Historic', sans-serif;
}

/* ── Phonetic Preview Panel ──────────────────────────────────────────── */
.phonetic-preview-panel {
    background: rgba(0, 209, 255, 0.03);
    border: 1px solid rgba(0, 209, 255, 0.15);
    border-radius: 0.3rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.phonetic-preview-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 209, 255, 0.1);
    padding-bottom: 0.4rem;
}

.phonetic-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: var(--cyan);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.9;
}

.phonetic-hint {
    font-family: 'VT323', monospace;
    font-size: 0.75rem;
    color: var(--cyan-dim);
    opacity: 0.6;
}

.phonetic-output {
    font-family: 'Crimson Pro', 'Gentium Plus', Georgia, serif;
    font-size: 1.4rem;
    color: var(--text-bright);
    letter-spacing: 0.12em;
    line-height: 1.5;
    min-height: 2rem;
    white-space: pre-wrap;
    word-break: break-word;
    /* Egyptological diacritics render better with these settings */
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: "kern" 1, "liga" 1;
    font-feature-settings: "kern" 1, "liga" 1;
}

/* Action Bar */
.action-bar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .action-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* Checkbox */
.format-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    font-family: 'VT323', monospace;
    text-transform: uppercase;
    color: var(--cyan);
}

.format-checkbox-label input {
    cursor: pointer;
    accent-color: var(--cyan);
}

/* Copy Button */
#copy-btn {
    font-family: 'Cinzel', serif;
    background-color: var(--gold-dim);
    color: #f0e68c;
    border: 1px solid var(--gold);
    padding: 0.6rem 1.2rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

@media (min-width: 640px) {
    #copy-btn {
        width: auto;
    }
}

#copy-btn:hover {
    background-color: var(--gold);
    color: var(--bg);
    text-shadow: none;
}

#copy-btn svg {
    width: 1.2rem;
    height: 1.2rem;
    stroke: currentColor;
}

/* Reference Table */
.reference-table {
    background-color: rgba(15,13,8,0.8);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 0.3rem;
    padding: 1.5rem;
    overflow-x: hidden;
}

.reference-table h3 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--gold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(212,175,55,0.2);
    padding-bottom: 0.7rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.reference-table > p {
    font-size: 0.85rem;
    color: var(--cyan-dim);
    margin-bottom: 1rem;
    font-family: 'VT323', monospace;
}

/* Stacking Legend Extension */
.stacking-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    background: rgba(0, 209, 255, 0.03);
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 209, 255, 0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.symbol-code {
    font-family: 'VT323', monospace;
    color: var(--cyan);
    font-size: 1.4rem;
    min-width: 40px;
}

.symbol-desc {
    font-size: 0.85rem;
    color: var(--text);
}

.cheat-sheet {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

@media (max-width: 640px) {
    .cheat-sheet {
        grid-template-columns: repeat(2, 1fr);
    }
}

.cheat-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem;
    background: rgba(212,175,55,0.04);
    border: 1px solid rgba(212,175,55,0.15);
    border-radius: 0.2rem;
    transition: border-color 0.2s;
}

.cheat-item:hover {
    border-color: rgba(212,175,55,0.3);
}

.cheat-glyph {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.cheat-code {
    font-family: 'VT323', monospace;
    color: var(--cyan);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

/* ── Reference mode grid (two-column: MdC + phonetic) ───────────────── */
.ref-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 720px) {
    .ref-mode-grid {
        grid-template-columns: 1fr;
    }
}

.ref-mode-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ref-mode-title {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--gold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.85;
    border-bottom: 1px solid rgba(212,175,55,0.15);
    padding-bottom: 0.4rem;
}

.ref-mode-hint {
    font-family: 'VT323', monospace;
    font-size: 0.8rem;
    color: var(--cyan-dim);
    opacity: 0.6;
    margin: 0 0 0.5rem;
}

/* Phonetic diacritic cheat sheet — wider items to show glyph + chars */
.cheat-sheet--phonetic {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.cheat-phonetic-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cheat-phon {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1.15rem;
    color: var(--text-bright);
    letter-spacing: 0.1em;
    line-height: 1.2;
}

.cheat-also {
    font-family: 'VT323', monospace;
    font-size: 0.72rem;
    color: var(--cyan-dim);
    opacity: 0.55;
    letter-spacing: 0.04em;
}
/* ── Sign-Type Badge Row (V3 addition) ───────────────────────────────────── */

.type-output {
    margin-top: 0.6rem;
    min-height: 0;
    transition: min-height 0.2s;
}

.type-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    font-family: 'VT323', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    padding: 0.1rem 0.4rem;
    border-radius: 0.2rem;
    border: 1px solid;
    opacity: 0.85;
    transition: opacity 0.15s;
    cursor: default;
    white-space: nowrap;
}

.type-badge:hover {
    opacity: 1;
}

.type-badge.type-phon  { border-color: var(--gold);  color: var(--gold);  background: rgba(212,175,55,0.06); }
.type-badge.type-det   { border-color: var(--cyan);  color: var(--cyan);  background: rgba(0,209,255,0.06);  }
.type-badge.type-log   { border-color: #c9a0dc;      color: #c9a0dc;      background: rgba(201,160,220,0.06);}
.type-badge.type-num   { border-color: #90ee90;      color: #90ee90;      background: rgba(144,238,144,0.06);}
.type-badge.type-unknown { border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.4); }

/* ── Type legend below cheat-sheet ──────────────────────────────────────── */
.type-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(212,175,55,0.1);
    font-family: 'VT323', monospace;
    font-size: 0.8rem;
}

.type-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    opacity: 0.75;
}

.type-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* EMBEDDED REFERENCE WINDOW */
/* ─────────────────────────────────────────────────────────────────────────── */

.reference-window-section {
    max-width: 1000px;
    margin: 2rem auto;
    background: rgba(15,13,8,0.8);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 0.3rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.reference-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(10,9,6,0.9);
    border-bottom: 1px solid rgba(212,175,55,0.15);
}

.reference-window-header h3 {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: var(--gold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 0;
    opacity: 0.9;
}

.reference-toggle-btn {
    background: none;
    border: 1px solid rgba(212,175,55,0.3);
    color: var(--gold);
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-family: 'VT323', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    border-radius: 0.2rem;
    transition: all 0.2s;
    text-transform: uppercase;
}

.reference-toggle-btn:hover {
    border-color: rgba(212,175,55,0.6);
    background: rgba(212,175,55,0.1);
    color: #f0e68c;
}

.reference-window-viewport {
    height: 600px;
    overflow: hidden;
    position: relative;
    background: #0a0a0a;
}

.reference-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #0a0a0a;
    display: block;
}

.reference-window-section.collapsed .reference-window-viewport {
    display: none;
    height: 0;
}

.reference-window-section.collapsed {
    border-bottom: none;
}

@media (max-width: 768px) {
    .reference-window-viewport {
        height: 500px;
    }
}
/* ============================================================
   SITE SEARCH BAR — the .site-search form at the top of every
   page in every hub (see egyptology/GEMINI.md, Technical
   Conventions §4). One identical block in each hub stylesheet.
   ============================================================ */
.site-search {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    max-width: 800px;
    margin: 0 auto 2.5rem;
    padding: 0 1rem;
}
.site-search input {
    flex: 1;
    min-width: 0;
    background: var(--bg2);
    border: 1px solid var(--gold-dim);
    color: var(--text-bright);
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1rem;
    padding: 0.55rem 0.9rem;
}
.site-search input::placeholder { color: var(--text); opacity: 0.55; }
.site-search input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 12px var(--gold-glow);
}
.site-search button {
    background: rgba(20,18,10,0.4);
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    font-family: 'VT323', monospace;
    font-size: 1.05rem;
    letter-spacing: 0.12em;
    padding: 0.55rem 1.4rem;
    cursor: pointer;
    transition: all 0.3s;
}
.site-search button:hover { background: var(--gold-glow); border-color: var(--gold); }
