/* * grid.css
 * Classic dense layout configuration
 * Canonical source: templates/css/grid.css — edit here, not in site/css/ (build overwrites it there).
 */

/* Prevent forced dark mode; @media block below backs off Samsung Internet Smart Dark Mode */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) {
    .author-block   { color: #333 !important; }
    .list-date      { color: #333 !important; }
    .txt-name-title { color: #FF0000 !important; }
    .separator      { border-top-color: #000 !important; }
    .search-btn     { background: #f0f0f0 !important; color: #000 !important; }
    .txt_body, .review-entry, .letter-box { color: #000021 !important; }
}

body {
    margin: 0;
    padding: 10px;
}
a.skip-link:link, a.skip-link:visited {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1000;
    padding: 8px 12px;
    color: #fff;
    background: #111;
    transform: translateY(-200%);
}
a.skip-link:focus { transform: none; outline: 2px solid #fff; outline-offset: 2px; }
#main-content:focus { outline: none; }

/* Main layout grid structure
   Row 1: breadcrumbs (full width)
   Row 2: [empty col1] [title+date col2] [logo col3]
   Row 3: TOC + top navigation
   Row 4: connections + main content
   Row 5: search/copyright + bottom navigation
*/
.layout-grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 110px;
    grid-template-rows: auto auto auto auto auto;
    gap: 10px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Breadcrumb - full width, row 1 */
.grid-breadcrumbs {
    grid-column: 1 / 4;
    grid-row: 1;
    font-size: 12px;
    font-style: italic;
    font-weight: bold;
    padding: 5px 0;
}
.he-breadcrumbs {
    width: 300px;
    box-sizing: border-box;
    padding-right: 20px;
    text-align: right;
}

/* Logo is now inside .grid-content-header (no separate .grid-logo cell) */

/* Left sidebar (lyric pages) - row 3 col 1 */
.grid-sidebar-left {
    grid-column: 1 / 2;
    grid-row: 3;
    padding-right: 20px;
}

/* Sidebar regions share content-row heights to continue the right-side dividers */
.grid-sidebar-toc        { grid-column: 1/2; grid-row: 3; padding-right: 20px; padding-top: 14px; }
.grid-sidebar-review     { grid-column: 1/2; grid-row: 4; padding-right: 20px;
                           font-family: "Times New Roman", serif; font-size: 16px;
                           font-style: italic; font-weight: bold; }
.grid-sidebar-copyright  { grid-column: 1/2; grid-row: 5; padding-right: 20px; padding-left: 10px; align-self: end; }
/* accord/draft: nav stays in row 4, so copyright moves to row 4 to align with nav bottom */
.grid-sidebar-copyright--row4 { grid-row: 4; }
/* draft: sidebar as flex column — copyright pinned to bottom, aligned with nav */
.grid-sidebar-col {
    grid-column: 1/2; grid-row: 3 / 6;
    display: flex; flex-direction: column;
    padding-right: 20px;
}
.grid-sidebar-col > .grid-sidebar-toc,
.grid-sidebar-col > .grid-sidebar-review,
.grid-sidebar-col > .grid-sidebar-copyright { padding-right: 0; }
.grid-sidebar-col > .grid-sidebar-copyright { margin-top: auto; align-self: stretch; }

/* Title + date + logo header area — row 2, spans content+logo columns */
.grid-content-header {
    grid-column: 2 / 4;
    grid-row: 2;
    padding: 13px 0 0;
    width: 650px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.header-logo {
    text-align: right;
    flex-shrink: 0;
}
.header-logo a,
.header-logo img {
    display: block;
}
.draft-stamp {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    flex: 0 0 154px;
    width: 154px;
    min-height: 44px;
    margin: 0;
    padding: 8px 5px 5px;
    border: 4px solid rgba(179, 0, 0, 0.62);
    color: rgba(179, 0, 0, 0.68);
    font-family: "Danger Neue Free", "Arial Narrow", Impact, sans-serif;
    font-size: 19px;
    line-height: 1;
    font-weight: 900;
    text-align: center;
    transform: rotate(-3deg);
    opacity: 0.82;
    filter: saturate(0.72) blur(0.2px);
}
.draft-stamp > span {
    position: relative;
    z-index: 2;
    display: inline-block;
    white-space: nowrap;
    transform: scaleX(1.04);
}
.draft-stamp::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1px solid currentColor;
    z-index: 1;
    pointer-events: none;
}
.draft-stamp::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.42;
    z-index: 3;
    background-image: repeating-radial-gradient(ellipse at 20% 25%, rgba(255,255,255,0.8) 0 1px, transparent 1px 4px);
    mix-blend-mode: screen;
}
.draft-author-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}
.draft-author-spacer {
    flex: 1 1 auto;
    min-width: 0;
}
.draft-author-row .author-block {
    flex: 0 1 auto;
    margin-top: 0;
    text-align: left;
}
/* Text-based "basad1.jpg" replacement — same width as logo.gif, fused with it (no gap/border) */
.basad-text,
a:link .basad-text,
a:visited .basad-text,
a:hover .basad-text,
a:active .basad-text {
    display: block;
    box-sizing: border-box;
    width: 41px;
    overflow: hidden;
    white-space: nowrap;
    background: #fff;
    color: #000;
    font-family: FrankRuehl, David, Tahoma, Verdana, sans-serif;
    font-size: 19px;
    line-height: 16px;
    padding-right: 7px;
    text-align: right;
}
/* Same "בס"ד" replacement, but inline within cv/cv_en body prose — not a fixed logo-column block */
.basad-text-inline {
    font-family: FrankRuehl, David, Tahoma, Verdana, sans-serif;
    font-size: 22px;
    font-style: normal;
    color: #000;
}

/* Body content — used by lyric pages (single block) */
.grid-content-body {
    grid-column: 2 / 3;
    grid-row: 3;
    padding: 0 10px;
}

/* Cycle page body — split into 3 rows */
.grid-content-nav    { grid-column: 2/3; grid-row: 3; padding: 14px 0 0; width: 650px; box-sizing: border-box; }
.grid-content-main   { grid-column: 2/3; grid-row: 4; padding: 0; width: 650px; box-sizing: border-box; }
.grid-content-footer { grid-column: 2/3; grid-row: 5; padding: 0; width: 650px; box-sizing: border-box; }
.slides-page .grid-content-main { grid-column: 1 / 4; width: 100%; }
.slides-page .txt_intro table {
    width: calc(100% - 100px);
    max-width: 900px;
    margin: 0 auto;
    transform: translateX(95px);
    border-collapse: collapse;
}
.slides-page .txt_intro td { padding: 4px; }
.slides-page .txt_intro img {
    display: block;
    width: 100%;
    max-width: 440px;
    height: auto;
    margin: 0 auto;
}
.slides-page .txt_intro td:first-child img { margin-left: auto; margin-right: 0; }
.slides-page .txt_intro td:last-child img { margin-left: 0; margin-right: auto; }

@media (min-width: 769px) and (max-width: 1100px) {
    .slides-page .txt_intro table {
        width: calc(100% - 108px);
        max-width: 892px;
        transform: translateX(79px);
    }
}

.lyric-intro {
    display: flex;
    margin-top: -10px;
}
.lyric-intro > span:first-child { flex: 0 0 40%; }
.lyric-intro > span:last-child { flex: 0 0 60%; }

/* Remove browser default bottom margin from last element before the separator */
.txt_intro > *:last-child,
.txt_body > *:last-child {
    margin-bottom: 0;
}

/* List container — CSS table so date column aligns across all rows */
.content-list {
    display: table;
    width: 100%;
    margin-top: 1.5em;
}

/* _all pages: title/date sit inside .txt_body (inherits italic) — un-italicize to match lyric pages */
.content-list .txt_name,
.content-list .date {
    font-style: normal;
}

/* Individual list rows */
.list-row {
    display: table-row;
}

.list-row > span:first-child {
    display: table-cell;
    padding: 2px 0;
}

/* List link - bold to match old site */
.list-link {
    font-weight: bold;
    text-decoration: none;
}

.sitemap-list {
    margin-top: 1.5em;
}
.sitemap-row {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1em;
    padding: 2px 0;
    font-style: normal;
}
.sitemap-name,
.sitemap-filename {
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
}
.sitemap-name {
    font-weight: normal;
}

/* Decorative bullet dots — replaces gif/button.gif and gif/button0.gif raster icons.
   Both source GIFs are animated (verified: button.gif = 4 frames @ 250ms, button0.gif =
   6 frames @ 170ms, each cycling through the color wheel) — reproduced here with a
   looping hue-rotate filter, stepped (not smoothed) to match the original's hard frame flips. */
.bullet-dot,
.bullet-dot0 {
    display: inline-block;
    border-radius: 50%;
    vertical-align: baseline;
}
.bullet-dot {
    width: 10px;
    height: 10px;
    box-sizing: border-box;
    border: 1px solid #000;
    background:
        radial-gradient(circle at 28% 22%, #fff 0px, #fff 1.1px, rgba(255, 255, 255, 0) 2.4px),
        radial-gradient(circle at 35% 30%, #fff 0%, #ff3333 30%, #990000 70%, #0f0011 100%);
    animation: bullet-hue-cycle 1s steps(4) infinite;
}
.bullet-dot0 {
    width: 10px;
    height: 10px;
    box-sizing: border-box;
    border: 1px solid navy;
    position: relative;
}
.bullet-dot0::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 24%, #fff 0px, #fff 1.1px, rgba(255, 255, 255, 0) 2.4px),
        radial-gradient(circle at 40% 30%, #d78fff 0%, #b300ff 35%, #8700bf 65%, #43005b 100%);
    animation: bullet-hue-cycle 1.02s steps(6) infinite;
}
@keyframes bullet-hue-cycle {
    to { filter: hue-rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .bullet-dot,
    .bullet-dot0::before {
        animation: none;
    }
}

/* Decorative divider line — replaces gif/separator.gif raster (rainbow gradient) */
.separator-line {
    display: inline-block;
    vertical-align: middle;
    width: 50%;
    height: 3px;
    background: linear-gradient(to right,
        #000020 0%, #000a7a 5%, #0026cb 10%, #0058fc 15%, #0094ff 20%,
        #00d3ce 25%, #01fb85 30%, #00ff35 35%, #00f406 40%, #00cf00 45%,
        #009b00 50%, #116100 55%, #572500 60%, #b10000 65%, #fb0000 70%,
        #ff0000 75%, #ff2100 80%, #ff9600 85%, #ffed00 90%, #ffff39 95%, #fffffe 100%);
}

/* Wider variant — page/gbook.html only, sized close to the guestbook form's width */
.separator-line-wide {
    display: inline-block;
    vertical-align: middle;
    width: 350px;
    max-width: 90%;
    height: 3px;
    background: linear-gradient(to right,
        #000020 0%, #000a7a 5%, #0026cb 10%, #0058fc 15%, #0094ff 20%,
        #00d3ce 25%, #01fb85 30%, #00ff35 35%, #00f406 40%, #00cf00 45%,
        #009b00 50%, #116100 55%, #572500 60%, #b10000 65%, #fb0000 70%,
        #ff0000 75%, #ff2100 80%, #ff9600 85%, #ffed00 90%, #ffff39 95%, #fffffe 100%);
}

/* HTML Comment Box guestbook widget (page/gbook.html) — neutralize the
   ambient page font-color/italic it otherwise inherits, hide the RSS icon,
   the moderator-only login icon, the widget's own heading (duplicates the
   page's own H1 title), and its post-submit "thank you" confirmation text
   (own .approval-msg class — can't be removed at the source, only hidden).
   "Not using..." attribution left visible (free-tier). */
#HCB_comment_box {
    color: #333;
    font-style: normal;
}
#HCB_comment_box > a[href*="rss_clean"],
#HCB_comment_box .admin-link,
#HCB_comment_box > h3,
#HCB_comment_box #comments_list > p,
#HCB_comment_box .approval-msg {
    display: none;
}

/* Posted comments: force a white card + black text — the widget's own
   color:#333 (above) reads fine on a plain white page but is nearly
   invisible against gbook's dark starfield background. !important needed:
   the widget injects its own <style> tag after this stylesheet loads, so
   equal-specificity rules would otherwise lose on source order alone. */
#HCB_comment_box .comment {
    background: #fff !important;
    color: #000 !important;
    padding: 10px 14px !important;
    border-radius: 4px !important;
}

/* .gbook-form: centers the form in the main block, sizes/aligns fields per mockup */
.guestbook-privacy {
    max-width: 465px;
    margin: 0 calc(50% - 185px) 12px auto;
    font: normal 13px/1.5 Tahoma, Verdana, sans-serif;
    color: #999;
}
.guestbook-privacy a { color: #aeeaff; text-decoration: none; }
.guestbook-privacy .comment-provider-link { color: #6ca2fd; }
.privacy-notice { line-height: 1.65; overflow-wrap: anywhere; }
.privacy-notice section { text-align: left; }
.privacy-notice section[dir="rtl"] { text-align: right; }
.privacy-notice h2 { font-size: 18px; }

/* grown 95px (half of name field's 190px width) to the left of the old centered
   370px box; right margin recreates that box's old right-edge position exactly */
.gbook-form #hcb_form {
    max-width: 465px;
    margin: 0 calc(50% - 185px) 0 auto;
}
.gbook-form input#hcb_form_name {
    width: 197px !important;
}
.gbook-form textarea#hcb_form_content {
    width: 100% !important;
    height: 200px !important;
    box-sizing: border-box;
}
.gbook-form #hcb_submit {
    display: block !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    float: none !important;
}
.gbook-form #hcb_form > .home-desc {
    width: calc(100% + 171px);
    max-width: none;
    margin-left: -38px;
    box-sizing: border-box;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    color: #999;
}
.gbook-form #hcb_form > .home-desc .hcb-attribution-text {
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}
.gbook-form #hcb_form > .home-desc .hcb-attribution-text > .home-desc {
    display: inline;
    width: auto;
    max-width: none;
}

/* gbook: align + size the nav/footer separator with the comment field beneath it
   (field is 465px wide, starting 45px right of the content column's left edge) */
.gbook-page .separator-color {
    text-align: left;
}
.gbook-page .separator-line-wide {
    width: 445px; /* comment field's 465px, minus 10px on each side */
    max-width: 445px;
    margin-left: 55px; /* comment field's left edge (45px) + 10px */
}

/* gbook: page-scoped title color, per explicit request (not a site-wide
   .cycle_name change — other bg_stars pages keep the default blue title) */
.gbook-page .cycle_name {
    color: #F80400;
}

/* Date tag styling */
.list-date {
    display: table-cell;
    font-size: 15px;
    font-weight: bold;
    color: #333;
    padding-left: 15px;
    white-space: nowrap;
}

/* "All texts" link row — below the list table */
.list-all-link {
    margin-top: 0.8em;
}

/* Navigation bars - matches .navigate from style_base.css */
.navigation-top, .navigation-bottom {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 12px;
    font-style: italic;
    font-weight: bold;
}

/* Horizontal separators */
.separator {
    border: 0;
    border-top: 1px solid #000;
    margin: 20px 0;
}
/* Tight margins for separator inside nav (between nav-top and intro) */
.grid-content-nav .separator    { margin-top: 4px; margin-bottom: 8px; }
/* Tight margins for separator inside footer (between author and nav-bottom) */
.grid-content-footer .separator { margin-top: 10px; margin-bottom: 20px; }

/* Colorful separator-line variant of .separator (gbook.html/banners.html only) */
.separator-color {
    text-align: center;
    margin: 20px 0;
}
.grid-content-nav .separator-color    { margin-top: 4px; margin-bottom: 8px; }
.grid-content-footer .separator-color { margin-top: 10px; margin-bottom: 20px; }

/* Author credit - matches .txt_author from style_base.css */
.author-block {
    text-align: right;
    font-size: 16px;
    font-style: normal;
    margin-top: 10px;
    color: #333;
}

/* Mail / correspondence page body box */
.letter-box {
    padding: 1em 1.4em;
}

/* Mail/correspondence pages: gray "letter paper" background (replaces
   jpg/bg_letter.jpg) — same animated brushstroke technique as style_base.css's
   default content-page background, just a neutral gray base + gray shadow
   blotches instead of cream/tan. Fully self-contained (own position/inset/
   z-index/background-size, not inherited from style_base.css) and scoped to
   the .mail-bg class only — style_base.css/style_he.css's own body background
   rules are explicitly scoped to body:not(.mail-bg), so the two can never
   bleed into each other regardless of future edits to either side. */
.mail-bg::before,
.mail-bg::after
{
    content: "";
    position: fixed;
    inset: -20%;
    z-index: -1;
    pointer-events: none;
    background-size: 400px 400px;
    background-repeat: repeat;
}
.mail-bg {
    background-color: #C2C2C2;
    background-image:
        radial-gradient(ellipse 50% 40% at 15% 25%, rgba(110,110,110,0.30), transparent 70%),
        radial-gradient(ellipse 45% 50% at 80% 70%, rgba(90,90,90,0.25), transparent 70%),
        radial-gradient(ellipse 55% 35% at 55% 10%, rgba(70,70,70,0.20), transparent 70%);
    background-attachment: fixed;
}
.mail-bg::before
{
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' width='200' height='200'><filter id='ml1' x='0%25' y='0%25' width='100%25' height='100%25'><feTurbulence type='fractalNoise' baseFrequency='0.08' numOctaves='3' seed='11' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0.81  0 0 0 0 0.81  0 0 0 0 0.81  0 0 0 1.6 -0.35'/></filter><rect width='200' height='200' filter='url(%23ml1)'/></svg>");
    animation: bg-noise-a 22s ease-in-out infinite alternate;
}
.mail-bg::after
{
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' width='200' height='200'><filter id='ml2' x='0%25' y='0%25' width='100%25' height='100%25'><feTurbulence type='fractalNoise' baseFrequency='0.08' numOctaves='3' seed='29' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0.81  0 0 0 0 0.81  0 0 0 0 0.81  0 0 0 1.6 -0.35'/></filter><rect width='200' height='200' filter='url(%23ml2)'/></svg>");
    animation: bg-noise-b 17s ease-in-out infinite alternate;
    animation-delay: -6s;
}
@media (prefers-reduced-motion: reduce)
{
    .mail-bg::before, .mail-bg::after { animation: none; opacity: 0.5; }
}

/* ── Sidebar elements ─────────────────────────────── */
/* Font is set on .grid-sidebar-review container; these rules handle spacing only */

/* Suppress trailing <br> blank line at the bottom of each sidebar block */
.grid-sidebar-review .review br:last-child,
.grid-sidebar-review .links br:last-child { display: none; }
.links {
    margin-top: 12px;
    margin-bottom: 12px;
}

.review {
    margin-top: 12px;
    margin-bottom: 12px;
}

.copyright {
    margin-top: 10px;
}
.rights-link {
    font-size: 11px;
    color: inherit;
    opacity: 0.7;
}

/* ── Navigation elements - match .navigate from style_base.css ── */
.nav-edge {
    flex: 1;
    font-size: 12px;
    font-style: italic;
    font-weight: bold;
}

.nav-edge:last-child {
    text-align: right;
}

.txt-name-title {
    flex: 2;
    margin: 0; /* now an <h1>; zero the UA default heading margin to match the old div */
    text-align: center;
    color: #FF0000;
    font-family: Comic Sans MS;
    font-size: 22px;
    font-style: normal;
    font-weight: normal;
}

/* ── Content layout helpers ──────────────────────── */
/* cycle_name, date, txt_intro, txt_body typography handled by style_base.css */
.cycle_name {
    margin: 0 0 4px 0; /* now an <h1>/<h2>; zero the UA default heading margin to match the old div */
    font-weight: normal; /* UA heading default is bold */
}

/* txt_intro: italic/size override; font-family comes from style_*.css (Times NR for cycles) */
.txt_intro {
    font-style: italic;
    font-size: 18px;
    font-weight: normal;
    color: inherit;
}
.txt_intro table {
    width: 100%;
}
.txt_intro td {
    padding: 4px 5px;
}
/* Purple intro blocks (cv, rangor) were Tahoma via a legacy inline face; kept here so the DB text carries no font face */
.txt_intro font[color="800080"] {
    font-family: Tahoma, Verdana;
}

/* Poem body: prevent casual drag-copy */
.txt_body, .review-entry, .letter-box {
    user-select: none;
}

/* Poem <pre> blocks: Tahoma text; line-height and tab width match the previous monospace-strut rendering (21px RU/EN, 20px HE; tab = 8 monospace columns) */
.txt_body pre {
    font-family: Tahoma, Verdana;
    line-height: 21px;
    tab-size: 4.8em;
}
.txt_body pre[lang="HE"] {
    line-height: 20px;
}

/* content.html: no italic, inherit body font (also covers HE Comic Sans override) */
.content-page .txt_intro {
    font-style: normal;
    font-family: inherit;
}

.content-page .toc-typewriter {
    display: inline-block;
    position: relative;
    width: 85px;
    height: 40px;
    vertical-align: baseline;
}
.content-page .toc-typewriter-carriage {
    position: absolute;
    left: 12px;
    top: 15px;
    width: 58px;
    height: 6px;
    border: 1px solid #161616;
    border-radius: 3px;
    background: #727b78;
    animation: toc-typewriter-carriage 3.6s steps(6, end) infinite;
}
.content-page .toc-typewriter-carriage::before,
.content-page .toc-typewriter-carriage::after {
    content: "";
    position: absolute;
    top: -2px;
    width: 5px;
    height: 8px;
    border-radius: 2px;
    background: #202725;
}
.content-page .toc-typewriter-carriage::before { left: -5px; }
.content-page .toc-typewriter-carriage::after { right: -5px; }
.content-page .toc-typewriter-paper {
    position: absolute;
    bottom: 4px;
    left: 12px;
    width: 32px;
    height: 17px;
    border: 1px solid #a0aaa6;
    border-radius: 2px 2px 0 0;
    background: #fff;
}
.content-page .toc-typewriter-paper::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 5px;
    width: 20px;
    height: 7px;
    background: repeating-linear-gradient(to bottom, #64716b 0 1px, transparent 1px 3px);
    clip-path: inset(0 100% 0 0);
    animation: toc-typewriter-ink 3.6s steps(6, end) infinite;
}
.content-page .toc-typewriter-body {
    position: absolute;
    left: 14px;
    top: 21px;
    width: 55px;
    height: 15px;
    border: 1px solid #111b17;
    border-radius: 4px 4px 3px 3px;
    background: linear-gradient(#627d6e 0 4px, #294c3b 4px 12px, #152e22 12px);
    box-shadow: 0 2px 0 #111b17;
    transform: perspective(60px) rotateX(12deg);
}
.content-page .toc-typewriter-keys {
    position: absolute;
    left: 23px;
    top: 26px;
    width: 39px;
    height: 8px;
    background: radial-gradient(circle, #f0f3ef 0 2px, #16231c 2px 3px, transparent 3px) 0 0 / 8px 8px repeat;
}
.content-page .toc-typewriter-keys::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 1px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #16231c;
    animation: toc-typewriter-key 0.6s steps(1, end) infinite;
}
@keyframes toc-typewriter-carriage {
    0%, 8% { transform: translateX(5px); }
    88% { transform: translateX(-5px); }
    100% { transform: translateX(5px); }
}
@keyframes toc-typewriter-ink {
    0%, 8% { clip-path: inset(0 100% 0 0); }
    88%, 99% { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 100% 0 0); }
}
@keyframes toc-typewriter-key {
    0%, 100% { transform: translate(0, 1px); }
    25% { transform: translate(16px, 0); }
    50% { transform: translate(8px, 1px); }
    75% { transform: translate(24px, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .content-page .toc-typewriter-carriage,
    .content-page .toc-typewriter-paper::after,
    .content-page .toc-typewriter-keys::after {
        animation: none;
    }
    .content-page .toc-typewriter-paper::after { clip-path: none; }
}

.content-width {
    width: 100%;
}

/* ── Review page ──────────────────────────────────── */
.review-entry {
    margin-bottom: 20px;
    width: 100%;
}

/* -- Scroll to top button ----------------------------------- */
#topBtn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    background: #555;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    display: none;
    z-index: 999;
    opacity: 0.7;
}
#topBtn:hover { opacity: 1; }

/* -- Sidebar search form ------------------------------------ */
.search-form { margin-bottom: 8px; display: flex; align-items: center; gap: 0; }
.search-input-wrap { position: relative; display: block; flex: 0 0 150px; width: 150px; height: 21px; }
.search-input {
    width: 150px; height: 21px; box-sizing: border-box;
    font-size: 14px; padding: 1px 2px; border: 1px solid #999;
}
.google-mark { position: absolute; top: 0; left: 2px; z-index: 1; display: flex; align-items: center; height: 21px; font: 700 14px Georgia, "Times New Roman", serif; line-height: 1; white-space: nowrap; pointer-events: none; }
.google-mark .google-blue { color: #4285f4; }
.google-mark .google-red { color: #ea4335; }
.google-mark .google-yellow { color: #fbbc05; }
.google-mark .google-green { color: #34a853; }
.search-input:focus + .google-mark,
.search-form.has-query .google-mark { display: none; }
.search-btn { height: 21px; box-sizing: border-box; font-size: 13px; padding: 1px 5px; cursor: pointer; border: 1px solid #999; border-left: none; background: #f0f0f0; }

/* -- Keyboard focus: visible outline on interactive elements -- */
.search-input:focus-visible,
.search-btn:focus-visible { outline: 2px solid #666; outline-offset: 1px; }
.layout-grid a:focus-visible { outline: 2px solid #666; outline-offset: 1px; }
.chord-key-scroll:focus-visible { outline: 2px solid #666; outline-offset: -2px; }

/* ── Mobile layout (≤768px) ──────────────────────── */
@media (max-width: 768px) {
    body {
        padding: 6px;
    }

    .layout-grid {
        grid-template-columns: 1fr;
        gap: 6px;
        max-width: 100%;
    }

    /* All grid cells: single column, auto rows */
    /* min-width:0 overrides CSS Grid's default min-width:auto so items respect the 1fr column */
    .grid-breadcrumbs,
    .grid-content-header,
    .grid-content-nav,
    .grid-content-body,
    .grid-content-main,
    .grid-content-footer,
    .grid-sidebar-toc,
    .grid-sidebar-review,
    .grid-sidebar-copyright,
    .grid-sidebar-left,
    .grid-sidebar-col {
        grid-column: 1;
        grid-row: auto;
        width: auto;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        padding-top: 0;
        overflow-wrap: break-word;
    }
    .he-breadcrumbs { width: auto; padding-right: 0; }
    .grid-sidebar-col { display: block; padding-right: 0; }
    .letter-box { box-sizing: border-box; }
    .chord-key-scroll {
        max-width: 100%;
        overflow-x: auto;
    }
    .gbook-page .separator-line-wide {
        width: calc(100% - 20px);
        max-width: none;
        margin-left: 10px;
    }
    .banners-page .txt_intro > table:last-child {
        display: block;
        max-width: 100%;
    }
    .banners-page .txt_intro > table:last-child tbody { display: block; }
    .banners-page .txt_intro > table:last-child tr {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    .banners-page .txt_intro > table:last-child td { display: block; }
    .banners-page .txt_intro > table:last-child td[width="5"] { display: none; }
    .wrapping-cycle-list .list-row > span:first-child {
        white-space: nowrap;
        vertical-align: top;
    }
    .wrapping-cycle-list .list-link {
        display: block;
        width: max-content;
        /* Leave room for a date even when a title would fill the screen. */
        max-width: calc(100vw - 12px - 3em);
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .wrapping-cycle-list .list-date {
        white-space: normal;
        overflow-wrap: anywhere;
        vertical-align: top;
        padding-top: 2px;
    }

    /* Visual order: content first, sidebars after bottom nav */
    .grid-breadcrumbs                          { order: 1; }
    .grid-content-header                       { order: 2; }
    .grid-content-nav, .grid-content-body      { order: 3; }
    .grid-content-main                         { order: 4; }
    .grid-content-footer                       { order: 5; }
    .grid-sidebar-toc,
    .grid-sidebar-review,
    .grid-sidebar-copyright,
    .grid-sidebar-left                         { order: 10; }

    .slides-page .grid-content-main { grid-column: 1; width: auto; }
    .slides-page .txt_intro table {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        transform: none;
    }
    .slides-page .txt_intro td:first-child img,
    .slides-page .txt_intro td:last-child img { margin: 0 auto; }
    .slides-page .txt_intro tr:first-child { display: none; }
    .slides-page .txt_intro tr:not(:first-child) {
        display: flex;
        flex-direction: column;
    }
    .slides-page .txt_intro td {
        width: 100%;
        box-sizing: border-box;
    }
    .slides-page .txt_intro td::before {
        display: block;
        margin-bottom: 4px;
        font-style: normal;
        font-weight: normal;
        text-align: center;
    }
    .slides-page .txt_intro td:first-child::before { content: 'Фото'; }
    .slides-page .txt_intro td:last-child::before { content: 'AI'; }

    /* Header: let logo wrap below title on very narrow screens */
    .grid-content-header {
        flex-wrap: wrap;
        gap: 6px;
    }

    .draft-stamp {
        flex-basis: 154px;
        width: 154px;
        font-size: 19px;
    }

    .draft-author-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .draft-author-spacer {
        display: none;
    }

    /* Navigation: allow title to wrap if needed on narrow screens */
    .navigation-top, .navigation-bottom {
        flex-wrap: wrap;
        gap: 4px;
    }

    /* background-attachment:fixed is broken on most mobile browsers */
    body { background-attachment: scroll; }

    /* Reduce font sizes that are too large at full mobile width */
    .lyric-intro { margin-top: -6px; }
    .txt_intro           { font-size: 14px; }
    .grid-sidebar-review { font-size: 13px; }  /* covers .links children too */
    .review              { font-size: 13px; }

    /* gbook: keep the form and attribution row inside the narrow column */
    .gbook-form #hcb_form { max-width: 100%; margin: 0 auto; }
    .guestbook-privacy { max-width: 100%; margin: 0 0 12px; }
    .gbook-form #hcb_form > .home-desc {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
    }
    .gbook-form #hcb_form > .home-desc .hcb-attribution-text { margin-left: auto; }

    /* Poem text: wrap long lines instead of scrolling horizontally */
    pre {
        white-space: pre-wrap;
        word-break: break-word;
    }
}

/* ── Print ───────────────────────────────────────── */
@media print {
    body { background: white !important; color: black !important; padding: 0; }
    .skip-link,
    .grid-breadcrumbs,
    .grid-sidebar-toc,
    .grid-sidebar-review,
    .search-form,
    #topBtn,
    .navigation-top,
    .navigation-bottom { display: none !important; }
    .layout-grid { display: block; max-width: 100%; box-shadow: none; }
    .grid-content-header,
    .grid-content-main,
    .grid-content-footer,
    .grid-sidebar-copyright { display: block; width: auto; }
    /* restore text selection so readers can copy into a document */
    .txt_body, .review-entry, .letter-box { user-select: text !important; }
}
