/* V157 Typography Engine: stable Turkish text flow, readable scale and controlled wrapping. */
:root{
    --ia-type-font-body:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    --ia-type-font-heading:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    --ia-type-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;
    --ia-type-size-xs:.75rem;
    --ia-type-size-sm:.875rem;
    --ia-type-size-md:1rem;
    --ia-type-size-lg:1.125rem;
    --ia-type-size-xl:1.25rem;
    --ia-type-size-h4:clamp(1.05rem,1.3vw,1.25rem);
    --ia-type-size-h3:clamp(1.2rem,1.8vw,1.55rem);
    --ia-type-size-h2:clamp(1.55rem,2.8vw,2.35rem);
    --ia-type-size-h1:clamp(2rem,4.6vw,3.75rem);
    --ia-type-line-tight:1.12;
    --ia-type-line-heading:1.2;
    --ia-type-line-body:1.7;
    --ia-type-line-ui:1.35;
    --ia-type-weight-regular:400;
    --ia-type-weight-medium:600;
    --ia-type-weight-strong:700;
    --ia-type-weight-heading:850;
    --ia-type-measure-copy:72ch;
    --ia-type-measure-lead:62ch;
    --ia-type-tracking-heading:-.025em;
    --ia-type-tracking-label:.045em;
    --ia-font-sans:var(--ia-type-font-body);
}

body.ia-typography-v157{
    font-family:var(--ia-type-font-body);
    font-size:var(--ia-type-size-md);
    line-height:var(--ia-type-line-body);
    font-synthesis:none;
    text-rendering:optimizeLegibility;
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
}

/* Every grid/flex text child must be allowed to shrink before text is broken. */
body.ia-typography-v157 :where(
    main,section,article,aside,header,footer,nav,form,fieldset,
    [class*="grid"],[class*="card"],[class*="panel"],[class*="content"],
    [class*="body"],[class*="head"],[class*="title"],[class*="meta"]
){min-width:0}

/* Human-readable content: normal Turkish word flow, never vertical letter stacks. */
body.ia-typography-v157 :where(
    h1,h2,h3,h4,h5,h6,p,li,dt,dd,blockquote,figcaption,label,legend,
    .entry-title,.page-title,.section-title,.card-title,
    [class*="__title"],[class*="__heading"],[class*="__description"],[class*="__summary"]
){
    writing-mode:horizontal-tb;
    text-orientation:mixed;
    word-break:normal;
    overflow-wrap:break-word;
    hyphens:manual;
}

body.ia-typography-v157 :where(h1,h2,h3,h4,h5,h6,.entry-title,.page-title,.section-title,[class*="__title"]){
    font-family:var(--ia-type-font-heading);
    font-weight:var(--ia-type-weight-heading);
    line-height:var(--ia-type-line-heading);
    letter-spacing:var(--ia-type-tracking-heading);
    text-wrap:balance;
}
body.ia-typography-v157 :where(h1,.entry-title,.page-title){font-size:var(--ia-type-size-h1);line-height:var(--ia-type-line-tight)}
body.ia-typography-v157 :where(h2,.section-title){font-size:var(--ia-type-size-h2)}
body.ia-typography-v157 h3{font-size:var(--ia-type-size-h3)}
body.ia-typography-v157 h4{font-size:var(--ia-type-size-h4)}
body.ia-typography-v157 :where(p,li,dd,blockquote,.entry-content){text-wrap:pretty}

/* Long-form copy remains readable instead of stretching across wide screens. */
body.ia-typography-v157 :where(
    .entry-content>p,.entry-content>ul,.entry-content>ol,
    .district-content p,.province-content p,.region-content p,
    .ia-card-data__lead p,.ia-data-card p,.district-section p
){max-width:var(--ia-type-measure-copy)}
body.ia-typography-v157 :where(.lead,.hero-subtitle,[class*="__lead"],[class*="__intro"] p){max-width:var(--ia-type-measure-lead)}

/* Cards: balanced titles, stable metadata and no single-character columns. */
body.ia-typography-v157 :where(
    .ia-district-card,.archive-card,.province-card,.province-district-card,
    .region-province-card,.district-related-card,.ia-data-card,.ia-link-card,
    .ia-attraction-card,.topic-card,.latest-card
){min-width:0}
body.ia-typography-v157 :where(
    .ia-district-card__title,.archive-card-title,.archive-card h2,.archive-card h3,
    .province-card h2,.province-card h3,.province-district-card h3,
    .region-province-card h2,.region-province-card h3,.district-related-card strong,
    .ia-data-card h3,.ia-link-card strong,.ia-attraction-card h3
){
    max-width:100%;
    word-break:normal;
    overflow-wrap:break-word;
    text-wrap:balance;
}
body.ia-typography-v157 :where(.ia-district-card__meta,.archive-meta,[class*="__meta"]){line-height:var(--ia-type-line-ui)}

/* Short UI actions stay intact; their parent is responsible for wrapping. */
body.ia-typography-v157 :where(
    .button,button,input[type="submit"],input[type="button"],
    [role="button"],.ia-button,.ia-btn,a[class*="__cta"],button[class*="__cta"],a[class*="__action"],button[class*="__action"],
    .ia-meta-chip,.archive-active-filters a,.archive-pagination .page-numbers
){
    max-width:100%;
    line-height:var(--ia-type-line-ui);
    text-align:center;
    white-space:nowrap;
    word-break:normal;
    overflow-wrap:normal;
}
body.ia-typography-v157 :where(
    .button-group,.actions,[class*="__actions"],[class*="-actions"],
    .archive-active-filters,.archive-pagination,.ia-chip-list
){flex-wrap:wrap;min-width:0}

/* Forms and filter controls grow/shrink without squeezing labels into vertical text. */
body.ia-typography-v157 :where(form,label,fieldset,.archive-filter-form,.archive-search,.province-search){min-width:0}
body.ia-typography-v157 :where(input,select,textarea){max-width:100%;font:inherit;line-height:var(--ia-type-line-ui)}
body.ia-typography-v157 :where(.archive-filter-form label,.archive-search label,[class*="filter"] label){white-space:normal;overflow-wrap:break-word}

/* Comparison values: labels may wrap by words, numbers remain stable. */
body.ia-typography-v157 :where(.district-compare-table,.archive-compare-panel,.district-compare-results){min-width:0}
body.ia-typography-v157 .district-compare-table :where(span,strong){
    min-width:0;
    word-break:normal;
    overflow-wrap:break-word;
    writing-mode:horizontal-tb;
}
body.ia-typography-v157 :where(
    .ia-stat-value,.stat-value,[class*="__value"],
    .district-compare-table strong[data-value-type="number"],
    time,.archive-results-count
){font-variant-numeric:tabular-nums lining-nums}

/* Navigation keeps short destinations readable and scrolls rather than crushing text. */
body.ia-typography-v157 :where(.breadcrumb,[aria-label="Breadcrumb"],.ia-section-nav,[class*="__tabs"]){min-width:0}
body.ia-typography-v157 :where(.breadcrumb a,[aria-label="Breadcrumb"] a,.ia-section-nav a,[class*="__tabs"] button){word-break:normal;overflow-wrap:normal}

/* Machine text and user-provided URLs are the only places allowed to break anywhere. */
body.ia-typography-v157 :where(pre,code,kbd,samp,.ia-source-url,[data-ia-machine-text]){
    font-family:var(--ia-type-font-mono);
    max-width:100%;
    overflow-wrap:anywhere;
    word-break:break-word;
}
body.ia-typography-v157 :where(pre){overflow:auto;white-space:pre-wrap}

/* Explicitly neutralize the historical print-only break-all rule. */
body.ia-typography-v157 .ia-interactive-map__comparison::after{word-break:normal;overflow-wrap:break-word}

@media(max-width:640px){
    body.ia-typography-v157{font-size:1rem;line-height:1.65}
    body.ia-typography-v157 :where(h1,.entry-title,.page-title){font-size:clamp(1.85rem,8.5vw,2.75rem)}
    body.ia-typography-v157 :where(h2,.section-title){font-size:clamp(1.4rem,6.2vw,2rem)}
    body.ia-typography-v157 :where(.district-compare-table div:not(.district-compare-table__head)>strong){
        grid-template-columns:minmax(5.5rem,.85fr) minmax(0,1.15fr);
    }
    body.ia-typography-v157 :where(.button-group,.actions,[class*="__actions"],[class*="-actions"]){gap:.65rem}
}

@media(max-width:360px){
    body.ia-typography-v157 :where(
        .button,button,input[type="submit"],input[type="button"],[role="button"],
        .ia-button,.ia-btn,a[class*="__cta"],button[class*="__cta"],a[class*="__action"],button[class*="__action"]
    ){font-size:.875rem;padding-inline:.75rem}
}

@media(prefers-reduced-motion:reduce){body.ia-typography-v157{text-rendering:auto}}
