/* Gallery */
.script-gallery {
    display: grid;
    grid-template-columns:
        repeat(auto-fill, minmax(130px, 1fr));
    gap: .75rem;
}

/* Cards */
.script-card {
    background-color:#202020;
    padding:.5rem;
    text-align:center;
    border-radius:var(--radius);
    transition:
        background-color .25s ease,
        opacity .25s ease,
        transform .25s ease;
}

.script-card.highlighted{
    background: #6f2822;
}

.script-card.dimmed {
    opacity:.25;
    transform:scale(.96);
}

/* Script name */
.script-card h2 {
    font-size:.85rem;
    margin:.25rem 0;
    letter-spacing:.05em;
}

/* Thumbnail */
.script-card img {
    width:80px;
    height:80px;
    object-fit:contain;
    background:white;
    padding:10px;
    border-radius: 10px;;
    margin:.5rem auto;
    display:block;
}

/* Tags */
.script-tags {
    display:flex;
    justify-content:center;
    align-items:center;
    gap:.25rem;
}

.script-tag {
    border:none;
    background:none;
    color:rgba(255,255,255,.7);
    padding:0;
    font-size:.65rem;
    font-family:inherit;
    cursor:pointer;
    letter-spacing:.05em;
}

.script-tag:hover {
    color:white;
}

/* Optional separator */
.script-tag + .script-tag::before {
    content:"•";
    margin-right:.25rem;
    opacity:.5;
}

/* Modal */

.hidden {
  display: none !important;
}

.filter-label {
  background-color:#6f2822;
  color:#fff;
  border-radius: 10px;
  padding:10px;
  margin-bottom: 0.75rem;
}

.back-button {
  background:0;
  color:#fff;
  text-transform: uppercase;
  font-family: 'OswaldLight';
  font-size:24px;
  border:0;
}

/* OVERLAY */
.orthography-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;

  display: flex;
  align-items:flex-start;
  justify-content: center;

  padding: 2rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);

  max-height: 100vh;
    overflow-y: auto;
  }

.script-family, .script-title, .script-year {
  font-size: 24px;
  color: #cccccc;
}

.script-title {
  font-weight: bold;
  font-family:'Michroma';
  text-transform: uppercase;
  color: #ffffff;
}




.modal-tabs{
    display:flex;
     justify-content:left;
    align-items: center;
    width: 100%;
    gap:.5rem;
    margin:0;
}

.modal-tab{
    padding:.4rem .9rem;
    cursor:pointer;
    border: 0;
    border-radius: 10px 10px 0 0;
    background:#96372E;
    color:#fff;
}

.modal-tab.active{
    background:#fff;
    color:#000;
}

.modal-image{
    display: flex;
    justify-content: left;
    align-items: center;
    width: 100%;
}

.modal-image img {
    max-height: 90vh;
    height: auto;
    padding: clamp(20px, 5vw, 80px);
    border-radius: 0 10px 10px 10px;
    background-color: #fff;
    box-sizing: border-box;
}

/* Tablets */
@media screen and (max-width: 900px) {
    .modal-image img {
        max-width: 90%;
        padding: 40px;
    }
}


/* Phones */
@media screen and (max-width: 600px) {
    .modal-image img {
        max-width: 95%;
        max-height: 70vh;
        padding: 20px;
        border-radius: 0 8px 8px 8px;
    }
}


/* Very small phones */
@media screen and (max-width: 400px) {
    .modal-image img {
        max-width: 100%;
        padding: 10px;
        border-radius: 0 5px 5px 5px;
    }
}


/* =====================================================
   TIER 1 SLAB
===================================================== */

.tier1-slab {
    margin: 0 0 12px 0;
    display: flex;
    align-items: stretch;
}

/* =====================================================
   BACK ZONE (LEFT SEGMENT)
===================================================== */

.tier1-back {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 3.25rem;

    background: rgba(255, 255, 255, 0.12);

    border-radius: 18px 0 0 18px;

    text-decoration: none;
    color: inherit;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.tier1-back:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-2px);
}

.tier1-back:active {
    transform: translateY(0);
}

.tier1-back-arrow {
    font-size: clamp(1.5rem, 2vw, 2rem);
    opacity: 0.75;
    line-height: 1;
}

/* =====================================================
   MAIN SLAB LINK (RIGHT SEGMENT)
===================================================== */

.tier1-link {
    display: flex;
    justify-content: space-between;
    align-items: center;

    flex: 1;

    padding: 1.25rem 1.5rem;

    background: rgba(255, 255, 255, 0.2);

    border: none;
    border-radius: 0 18px 18px 0;

    color: inherit;
    text-decoration: none;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.tier1-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tier1-link:active {
    transform: translateY(0);
}

/* =====================================================
   TEXT ELEMENTS
===================================================== */

.tier1-title {
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
}

.tier1-arrow {
    flex-shrink: 0;
    margin-left: 1rem;
    font-size: clamp(1.5rem, 2vw, 2rem);
    opacity: 0.65;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 768px) {

    .tier1-back {
        width: 3rem;
        border-radius: 16px 0 0 16px;
    }

    .tier1-link {
        padding: 1.1rem 1.25rem;
        border-radius: 0 16px 16px 0;
    }

}

@media (max-width: 480px) {

    .tier1-back {
        width: 2.75rem;
        border-radius: 14px 0 0 14px;
    }

    .tier1-link {
        padding: 1rem 1.1rem;
        border-radius: 0 14px 14px 0;
    }

}


/* =========================
   TIER 2 SLAB
========================= */

.tier2-slab {
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    color: #111;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.tier2-header {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* BACK LINK */
.tier2-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    text-decoration: none;
    color: #444;

    font-size: 0.95rem;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

    opacity: 0.8;

    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tier2-back:hover {
    opacity: 1;
    transform: translateX(-2px);
}

.tier2-back-arrow {
    font-size: 1.2rem;
    line-height: 1;
}


.tier2-title {
    font-size: 1.9rem;
    font-family: 'Michroma';
    margin: 0;
    text-transform: uppercase;
}

.tier2-description {
    margin: 14px 0 18px;
    font-size: 1rem;
    line-height: 1.6;
    color: #222;
}

.example-gloss {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    color: #444;
    padding-left: 10px;
    border-left: 3px solid #e0e0e0;
    margin-bottom: 16px;
}

.tier2-examples-title {
    font-size: 1.2rem;
    margin: 10px 0 12px;
}

.tier2-example {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eee;
}

.example-explanation {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 10px;
}

.interlinear-block {
    padding-left: 12px;
    border-left: 3px solid #eaeaea;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* SURFACE */
.gloss-line.surface {
    font-family: "CormorantGaramond";
    font-size: 1.2rem;
    color: #111;
}

/* MORPHEMES */
.gloss-line.morphemes {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    color: #444;
}

/* LEIPZIG GLOSS */
.gloss-line.gloss {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    color: #666;
}

/* ENGLISH TRANSLATION */
.gloss-line.translation {
    font-family: "CormorantGaramond";
    font-style: italic;
    color: #333;
    font-size: 1.2rem;
}

.focus-morph {
    background: rgba(0, 0, 0, 0.12);
    padding: 2px 5px;
    border-radius: 5px;
    font-weight: 600;
}

.tier3-link-wrapper {
    margin-top: 18px;
}

.tier3-link {
    font-family: 'Oswald';
    display: inline-block;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #111;
    font-weight: 600;
}

.tier3-link:hover {
    background: #f6f6f6;
}




/* =========================
   TIER 3 SLAB
========================= */

.tier3-slab {
    max-width: 1200px;
    margin: 0;
    padding: 28px;

    background: #fff;
    border-radius: 18px;

    color: #111;

    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

    overflow: hidden;
}

/* HEADER */
.tier3-header {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* BACK LINK */
.tier3-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    text-decoration: none;
    color: #444;

    font-size: 0.95rem;

    opacity: 0.8;

    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tier3-back:hover {
    opacity: 1;
    transform: translateX(-2px);
}

.tier2-back-arrow {
    font-size: 1.2rem;
    line-height: 1;
}

/* TITLE */
.tier3-title {
    font-size: 1.9rem;
    font-family: 'Michroma';
    margin: 0;
    text-transform: uppercase;
}

/* DESCRIPTION */
.tier3-description {
    margin-bottom: 24px;

    font-size: 1rem;
    line-height: 1.8;

    color: #222;

    max-width: 950px;
}

/* =========================
   TABLE WRAPPER
========================= */

.tier3-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
}

/* TABLE BASE */
.tier3-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}

.tier3-table thead {
    background: #f6f6f6;
}

.tier3-table th {
    text-align: left;

    padding: 16px 14px;

    font-size: 0.9rem;
    font-weight: 700;

    color: #222;

    border-bottom: 1px solid #e4e4e4;
}

/* SAFE TEXT WRAPPING FIX */
.tier3-table td {
    padding: 16px 14px;

    font-size: 0.95rem;
    line-height: 1.7;

    color: #333;

    border-bottom: 1px solid #efefef;

    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;

    min-width: 0;
}

/* COLUMN WIDTHS */
.tier3-table th:nth-child(1),
.tier3-table td:nth-child(1) {
    width: 90px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.tier3-table th:nth-child(2),
.tier3-table td:nth-child(2) {
    width: 120px;
    font-style: italic;
}

.tier3-table th:nth-child(3),
.tier3-table td:nth-child(3) {
    width: 180px;
}

.tier3-table th:nth-child(4),
.tier3-table td:nth-child(4) {
    width: 260px;
}

.tier3-table tbody tr:hover {
    background: #fafafa;
}



/* =========================
   DESKTOP MODE (821px and up)
========================= */

@media (min-width: 821px) {

    .tier3-table {
        display: table;
        table-layout: fixed;
    }

    .tier3-table thead {
        display: table-header-group;
    }

    .tier3-table tbody {
        display: table-row-group;
    }

    .tier3-table tr {
        display: table-row;
    }

    .tier3-table td,
    .tier3-table th {
        display: table-cell;
    }
}

/* =========================
   MOBILE CARD MODE (820px and below)
========================= */

@media (max-width: 820px) {

    .tier3-slab {
        padding: 20px;
    }

    .tier3-table thead {
        display: none;
    }

    .tier3-table tbody {
        display: block;
    }

    .tier3-table tr {
        display: flex;
        flex-direction: column;

        width: 100%;
        box-sizing: border-box;

        margin-bottom: 16px;
        border-bottom: 1px solid #ececec;
        background: #fff;
        border-radius: 12px;
    }

    .tier3-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;

        padding: 10px 12px;

        border: none;

        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .tier3-table td::before {
        content: attr(data-label);

        display: block;
        margin-bottom: 4px;

        font-weight: 700;
        color: #111;
    }
}

/* =========================
   SMALL MOBILE (560px and below)
========================= */

@media (max-width: 560px) {

    .tier3-slab {
        padding: 16px;
        border-radius: 14px;
    }

    .tier3-table tr {
        padding: 14px;
    }

    .tier3-table td {
        padding: 18px 0 10px 0;
    }
}