/*
 * ioann-karpovka UI primitives (task 2). BEM, "ik-" prefix.
 * Tokens: tokens.css. Hover rules live in @media (hover:hover); :active only
 * changes colour (never a transform). Motion: var(--dur) var(--ease).
 */

/* ---------- Hit area: visuals stay as designed, tap target >= 44px ---------- */
.ik-btn,
.ik-link,
.ik-icon-btn { position: relative; }
.ik-btn::after,
.ik-link::after,
.ik-icon-btn::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
}

/* ---------- Icon ---------- */
.ik-icon { display: block; flex-shrink: 0; }

/* ---------- Button ---------- */
.ik-btn {
    --ik-btn-bg: var(--iskm-navy);
    --ik-btn-fg: var(--iskm-cream-50);
    --ik-btn-bd: var(--iskm-navy);
    --ik-btn-hbg: var(--iskm-navy-800);
    --ik-btn-hfg: var(--iskm-cream-50);
    --ik-btn-hbd: var(--iskm-navy-800);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 52px;
    padding: 0 30px;
    border-radius: var(--radius-pill);
    border: var(--stroke) solid var(--ik-btn-bd);
    background: var(--ik-btn-bg);
    color: var(--ik-btn-fg);
    font: 500 var(--fs-ui)/1 var(--font-body);
    letter-spacing: .01em;
    text-decoration: none;
    white-space: nowrap;
    max-width: 100%;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ik-btn--secondary {
    --ik-btn-bg: transparent; --ik-btn-fg: var(--iskm-navy); --ik-btn-bd: var(--iskm-navy);
    --ik-btn-hbg: var(--iskm-navy); --ik-btn-hfg: var(--iskm-cream-50); --ik-btn-hbd: var(--iskm-navy);
}
.ik-btn--soft {
    --ik-btn-bg: var(--iskm-cream); --ik-btn-fg: var(--iskm-navy); --ik-btn-bd: var(--iskm-cream);
    --ik-btn-hbg: var(--iskm-cream-300); --ik-btn-hfg: var(--iskm-navy); --ik-btn-hbd: var(--iskm-cream-300);
}
.ik-btn--on-inverse {
    --ik-btn-bg: var(--iskm-cream); --ik-btn-fg: var(--iskm-navy); --ik-btn-bd: var(--iskm-cream);
    --ik-btn-hbg: var(--iskm-ochre); --ik-btn-hfg: var(--iskm-navy-800); --ik-btn-hbd: var(--iskm-ochre);
}
.ik-btn--sm { height: 40px; padding: 0 20px; font-size: 14px; }
.ik-btn--block { display: flex; width: 100%; }
.ik-btn__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Keep the resting colour on sticky :hover (touch) where the hover media rule does not apply. */
.ik-btn:hover { color: var(--ik-btn-fg); }
.ik-btn:active:not(.is-disabled):not([disabled]) {
    background: var(--ik-btn-hbg); color: var(--ik-btn-hfg); border-color: var(--ik-btn-hbd);
}
.ik-btn.is-disabled,
.ik-btn[disabled] { opacity: .45; cursor: default; pointer-events: none; }
@media (hover: hover) {
    .ik-btn:hover:not(.is-disabled):not([disabled]) {
        background: var(--ik-btn-hbg); color: var(--ik-btn-hfg); border-color: var(--ik-btn-hbd);
    }
}

/* ---------- TextLink ---------- */
.ik-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: 500 15px/1.3 var(--font-body);
    color: var(--iskm-navy);
    text-decoration: underline;
    text-decoration-color: var(--iskm-ochre);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 6px;
    transition: color var(--dur) var(--ease), text-decoration-thickness var(--dur) var(--ease);
}
.ik-link__arrow { display: inline-flex; transition: transform var(--dur) var(--ease); }
.ik-link--inverse,
.ik-link--inverse:hover { color: var(--iskm-cream); }
.ik-link:active { color: var(--iskm-mauve-700); text-decoration-thickness: 2.5px; }
.ik-link--inverse:active { color: var(--iskm-cream); }
@media (hover: hover) {
    .ik-link:hover { color: var(--iskm-mauve-700); text-decoration-thickness: 2.5px; }
    .ik-link--inverse:hover { color: var(--iskm-cream); }
    .ik-link:hover .ik-link__arrow { transform: translateX(4px); }
}

/* ---------- ReadMore (<x-ik-read-more>): «Читать далее →» / «Свернуть ↑» on a <details>, a second «Свернуть ↑» at the end ---------- */
.ik-more { align-self: stretch; }
.ik-more__toggle {
    width: fit-content;
    cursor: pointer;
    list-style: none;
}
.ik-more__toggle::-webkit-details-marker { display: none; }
.ik-more__less-label { display: none; }
.ik-more[open] > .ik-more__toggle .ik-more__more-label { display: none; }
.ik-more[open] > .ik-more__toggle .ik-more__less-label { display: inline; }
.ik-more[open] > .ik-more__toggle .ik-link__arrow,
.ik-more__close .ik-link__arrow { transform: rotate(-90deg); }
.ik-more__close {
    margin-top: 24px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.ik-more__close[hidden] { display: none; }
/* --end (service descriptions): with JS the opened toggle hides and the text reads on into the end «Свернуть ↑». */
.ik-more--end[open]:has(> .ik-more__close:not([hidden])) > .ik-more__toggle { display: none; }
.ik-more--end:not([open]) > .ik-more__toggle .ik-link__arrow { transform: rotate(90deg); }
@media (hover: hover) {
    .ik-more--end:not([open]) > .ik-more__toggle:hover .ik-link__arrow { transform: rotate(90deg) translateX(4px); }
}
@media (hover: hover) {
    .ik-more[open] > .ik-more__toggle:hover .ik-link__arrow,
    .ik-more__close:hover .ik-link__arrow { transform: rotate(-90deg) translateX(4px); }
}

/* ---------- IconButton ---------- */
.ik-icon-btn {
    width: var(--ik-icon-btn-size, 44px);
    height: var(--ik-icon-btn-size, 44px);
    flex-shrink: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: var(--stroke) solid var(--iskm-navy);
    background: transparent;
    color: var(--iskm-navy);
    text-decoration: none;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ik-icon-btn:hover { color: var(--iskm-navy); }
.ik-icon-btn--inverse:hover { color: var(--iskm-cream); }
.ik-icon-btn.is-active,
.ik-icon-btn:active { background: var(--iskm-navy); color: var(--iskm-cream-50); }
.ik-icon-btn--inverse { border-color: rgba(237, 233, 220, .4); color: var(--iskm-cream); }
.ik-icon-btn--inverse.is-active,
.ik-icon-btn--inverse:active { background: var(--iskm-cream); color: var(--iskm-navy); }
@media (hover: hover) {
    .ik-icon-btn:hover { background: var(--iskm-navy); color: var(--iskm-cream-50); }
    .ik-icon-btn--inverse:hover { background: var(--iskm-cream); color: var(--iskm-navy); }
}

/* Unavailable action (e.g. «previous page» on the first page): same dimming as .ik-btn[disabled]. */
.ik-icon-btn[disabled] { opacity: .45; cursor: default; pointer-events: none; }

/* ---------- Tag ---------- */
.ik-tag {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    font: 500 13px/1 var(--font-body);
    white-space: nowrap;
    background: var(--iskm-cream);
    color: var(--iskm-navy);
}
.ik-tag--feast { background: var(--tag-feast); color: var(--iskm-navy-800); }
.ik-tag--fast { background: var(--tag-fast); color: var(--iskm-navy-800); }
.ik-tag--memory { background: var(--tag-memory); color: var(--iskm-navy-800); }
.ik-tag--neutral { background: var(--iskm-cream); color: var(--iskm-navy); }
.ik-tag--inverse { background: rgba(237, 233, 220, .14); color: var(--iskm-cream); }

/* ---------- ArchFrame ---------- */
.ik-arch {
    width: 100%;
    height: var(--ik-arch-h, auto);
    aspect-ratio: var(--ik-arch-ratio, 4 / 5);
    padding: var(--arch-inset);
    border: var(--stroke) solid var(--iskm-navy);
    border-radius: 50% 50% 20px 20px / 27% 27% 20px 20px;
}
.ik-arch--plain { padding: 0; border: 0; }
.ik-arch--inverse { border-color: var(--iskm-cream); }
.ik-arch__inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 50% 50% 12px 12px / 26% 26% 12px 12px;
    background: var(--iskm-cream-300);
}
.ik-arch--inverse .ik-arch__inner { background: var(--iskm-navy-600); }
.ik-arch__img { width: 100%; height: 100%; object-fit: cover; object-position: center 12%; }
.ik-arch__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
}
.ik-arch__placeholder img { width: 56px; height: 56px; opacity: .7; }
.ik-arch__label { font: 400 13px/1.4 var(--font-body); color: var(--iskm-mauve-700); max-width: 200px; }
.ik-arch--inverse .ik-arch__label { color: var(--iskm-navy-200); }

/* ---------- Eyebrow ---------- */
.ik-eyebrow {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font: 500 var(--fs-eyebrow)/1.2 var(--font-body);
    letter-spacing: var(--ls-eyebrow);
    text-transform: uppercase;
    color: var(--iskm-mauve-700);
}
.ik-eyebrow--inverse { color: var(--iskm-ochre); }
/* Flower marker: DS 18px enlarged by 40% (task 68, client D1). Its layout box stays the DS 18px (negative block
   margins), so the eyebrow row height and the spacing to the title do not move. Nav / menu marks and calendar
   bullets are other components and keep their sizes. */
.ik-eyebrow { --ik-eyebrow-flower: 25px; --ik-eyebrow-flower-box: 18px; }
.ik-eyebrow > .ik-flower {
    width: var(--ik-eyebrow-flower);
    height: var(--ik-eyebrow-flower);
    margin-block: calc((var(--ik-eyebrow-flower-box) - var(--ik-eyebrow-flower)) / 2);
}

/* ---------- SectionHeading ---------- */
.ik-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 48px;
}
.ik-section-heading__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    max-width: 760px;
    min-width: 0;
}
/* Fixed 44px at every width: matches the design measurement (not --fs-h2). */
.ik-section-heading__title {
    margin: 0;
    font: 600 44px/1.05 var(--font-title);
    letter-spacing: var(--ls-title);
    color: var(--iskm-navy);
    text-wrap: balance;
    overflow-wrap: anywhere;
}
.ik-section-heading__lead { margin: 0; font: italic 400 22px/1.3 var(--font-title); color: var(--iskm-navy-400); }
.ik-section-heading__action { flex-shrink: 0; }
.ik-section-heading--center { flex-direction: column; align-items: center; text-align: center; }
.ik-section-heading--center .ik-section-heading__body { align-items: center; }
.ik-section-heading--inverse .ik-section-heading__title { color: var(--iskm-cream); }
.ik-section-heading--inverse .ik-section-heading__lead { color: var(--iskm-navy-200); }
@media not all and (min-width: 768px) {
    .ik-section-heading__action--desktop { display: none; }
    /* An action kept on mobile (action-mobile) stacks under the text instead of squeezing the title. */
    .ik-section-heading { flex-direction: column; align-items: flex-start; gap: 16px; }
    .ik-section-heading--center { align-items: center; }
}

/* ---------- Ornaments ---------- */
.ik-flower { display: block; flex-shrink: 0; }
.ik-monogram { display: block; width: auto; height: var(--ik-monogram-h, auto); }

.ik-band { display: block; width: 100%; background-repeat: repeat-x; background-position: center; }
.ik-band--ochre-14 { height: 14px; background-image: url(../img/ornament/band-ochre-14.png); background-size: 2600px 14px; }
.ik-band--ochre-18 { height: 18px; background-image: url(../img/ornament/band-ochre-18.png); background-size: 2600px 18px; }
.ik-band--ochre-22 { height: 22px; background-image: url(../img/ornament/band-ochre-22.png); background-size: 2600px 22px; }
.ik-band--teal-24 { height: 24px; background-image: url(../img/ornament/band-teal-24.png); background-size: 2600px 24px; }
/* Fallbacks for heights without a pre-rendered band: repeat-x border tile (1400x626). */
.ik-band--ochre-24 { height: 24px; background-image: url(../img/ornament/border-ochre.png); background-size: 54px 24px; }
.ik-band--teal-14 { height: 14px; background-image: url(../img/ornament/border-teal.png); background-size: 31px 14px; }
.ik-band--teal-18 { height: 18px; background-image: url(../img/ornament/border-teal.png); background-size: 40px 18px; }
.ik-band--teal-22 { height: 22px; background-image: url(../img/ornament/border-teal.png); background-size: 49px 22px; }

/*
 * PatternFill: vertical (`-rot90`) is the default orientation (client D2). The `-rot90` tiles are one
 * exact pattern period rotated 90deg CW from the horizontal sheet; background-size = image px / 2.
 * The pattern layer paints above the container's own background and
 * below its children. For a pattern at opacity 1 put the background on the
 * container itself (e.g. style="background:var(--iskm-cream)").
 */
.ik-pattern { position: relative; isolation: isolate; }
.ik-pattern::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background-repeat: repeat;
    background-position: 0 0;
    opacity: var(--ik-pattern-opacity, .14);
    pointer-events: none;
}
.ik-pattern--ochre-140::before { background-image: url(../img/ornament/sheet-ochre-140.png); background-size: 2000px 1232px; }
.ik-pattern--ochre-140-rot90::before { background-image: url(../img/ornament/sheet-ochre-140-rot90.png); background-size: 2000px 1260px; }
.ik-pattern--ochre-150::before { background-image: url(../img/ornament/sheet-ochre-150.png); background-size: 2000px 1320px; }
.ik-pattern--teal-150::before { background-image: url(../img/ornament/sheet-teal-150.png); background-size: 2000px 1320px; }
.ik-pattern--teal-170::before { background-image: url(../img/ornament/sheet-teal-170.png); background-size: 2000px 1309px; }
.ik-pattern--ochre-150-rot90::before { background-image: url(../img/ornament/tile-ochre-150-rot90.png); background-size: 165px 150px; }
.ik-pattern--teal-150-rot90::before { background-image: url(../img/ornament/tile-teal-150-rot90.png); background-size: 165px 150px; }
.ik-pattern--teal-170-rot90::before { background-image: url(../img/ornament/tile-teal-170-rot90.png); background-size: 187px 170px; }

.ik-flower-rule { display: flex; align-items: center; gap: 16px; }
.ik-flower-rule::before,
.ik-flower-rule::after { content: ""; flex: 1; height: 1px; background: var(--ik-rule-color, var(--line)); }

/*
 * Pill row (task 7): horizontally scrolling row of small buttons (page tabs, anchors,
 * filters, years). The 6px padding / -6px margin keeps the focus ring and the 44px hit
 * area of the buttons inside the scroll box without moving anything visually.
 */
.ik-pills {
    margin: -6px;
    padding: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.ik-pills::-webkit-scrollbar { display: none; }
.ik-pills__list { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ik-pills__item { flex: none; }
/*
 * Modifier --bleed (task 82; news filters, page tabs / anchors, album and video bars, action pills): on mobile the row
 * bleeds to the viewport edges; the first and last pills keep the gutter.
 */
@media not all and (min-width: 768px) {
    .ik-pills--bleed { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
    /* The trailing inline padding of a scroll container is dropped by some engines: add the end gutter as an item. */
    .ik-pills--bleed .ik-pills__list::after { content: ""; flex: 0 0 calc(var(--gutter) - 8px); }
}

/*
 * ActionCard (task 11): big outline link with a flower and an arrow (home «Сегодня» buttons,
 * schedule sidebar). Markup: components/action-card.blade.php.
 */
.ik-action-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    padding: 20px 24px;
    border: var(--stroke) solid var(--iskm-navy);
    border-radius: var(--radius-panel);
    background: var(--iskm-cream);
    color: var(--iskm-navy);
    font: 600 25px/1.15 var(--font-title);
    text-align: left;
    text-decoration: none;
    transition: background-color var(--dur) var(--ease);
}
.ik-action-card__label { display: flex; align-items: center; gap: 14px; min-width: 0; overflow-wrap: anywhere; }
.ik-action-card__flower,
.ik-action-card__arrow { flex-shrink: 0; }
.ik-action-card__flower { width: 22px; height: 22px; }
.ik-action-card:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.ik-action-card:active { background: var(--iskm-cream-300); }
/* Keep the resting colours on sticky :hover (touch) where the hover media rule does not apply. */
.ik-action-card:hover { color: var(--iskm-navy); }
@media (hover: hover) {
    .ik-action-card:hover { background: var(--iskm-cream-300); }
}

/* ---------- Pagination (task 18) ---------- */
.ik-pager__list { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ik-pager__item { flex: none; }
.ik-pager__page {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--iskm-navy);
    text-decoration: none;
    font: 600 20px/1 var(--font-title);
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ik-pager__page.is-current { background: var(--iskm-navy); color: var(--iskm-cream-50); }
a.ik-pager__page:hover { color: var(--iskm-navy); }
@media (hover: hover) {
    a.ik-pager__page:hover { background: var(--iskm-cream); }
}

/* ---------- DayTabs (task 25) ---------- */
.ik-day-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.ik-day-tab {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 68px;
    padding: 10px 14px 12px;
    border: var(--stroke) solid var(--line);
    border-radius: 999px;
    background: var(--iskm-paper);
    color: var(--iskm-navy);
    text-decoration: none;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ik-day-tab[aria-selected="true"] { border-color: var(--iskm-navy); background: var(--iskm-navy); color: var(--iskm-cream-50); }
.ik-day-tab__label { font: 500 12px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.ik-day-tab__date { font: 600 26px/1 var(--font-title); }
.ik-day-tab__dot { width: 6px; height: 6px; border-radius: 50%; }
.ik-day-tab__dot--feast { background: var(--iskm-ochre); }
.ik-day-tab:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
/* Keep the resting colours on sticky :hover (touch) where the hover media rule does not apply. */
.ik-day-tab:hover { color: var(--iskm-navy); }
.ik-day-tab[aria-selected="true"]:hover { color: var(--iskm-cream-50); }
@media (hover: hover) {
    .ik-day-tab:not([aria-selected="true"]):hover { border-color: var(--iskm-navy); }
}
