/* Authentic CEEFAX Teletext Style */

@font-face {
    font-family: 'Teletext';
    src: local('Courier New'), local('Consolas'), local('monospace');
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --black: #000000;
    --white: #FFFFFF;
    --red: #FF0000;
    --green: #00FF00;
    --yellow: #FFFF00;
    --blue: #0000FF;
    --magenta: #FF00FF;
    --cyan: #00FFFF;
}

body {
    background: var(--black);
    margin: 0;
    padding: 0;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 16px;
}

/* CRT wrapper - minimal */
.crt {
    position: relative;
}


/* Screen */
.screen {
    width: 780px;
    min-width: 780px;
    margin: 0 auto;
    background: var(--black);
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 16px;
    line-height: 1.3;
    position: relative;
    overflow: visible;
    padding-bottom: 40px;
}

/* BBC DANFEST Banner */
.bbc-banner {
    background: var(--blue);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.bbc-blocks {
    display: flex;
    gap: 2px;
}

.bbc-block {
    background: var(--white);
    padding: 2px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bbc-letter {
    font-size: 8px;
    line-height: 1;
    color: var(--black);
    font-weight: bold;
    margin: 0;
}

.danfest-logo {
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0;
    color: var(--cyan);
    font-weight: bold;
}

/* Page counter - shows in header when navigating */
.page-counter {
    display: none;
    background: var(--red);
    color: var(--yellow);
    padding: 2px 6px;
    font-weight: bold;
    font-family: inherit;
}

.page-counter::before {
    content: 'P';
    color: var(--white);
}

.page-counter.active {
    display: inline;
}

.header-date {
    color: var(--white);
}

/* Globe graphic */
.globe-container {
    position: absolute;
    right: 10px;
    top: 50px;
    opacity: 0.7;
}

.globe-art {
    font-size: 9px;
    line-height: 1;
    color: var(--cyan);
    margin: 0;
}

.content-with-globe {
    position: relative;
}


/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    background: var(--black);
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.page-num {
    background: var(--red);
    color: var(--white);
    padding: 2px 6px;
}

.ceefax-title {
    color: var(--yellow);
    letter-spacing: 4px;
    font-size: 1.2em;
}

.subpage {
    color: var(--white);
}

.time {
    color: var(--cyan);
}

/* Page input box - type a page number */
.page-input-box {
    display: flex;
    align-items: center;
    background: var(--red);
    padding: 2px 4px;
}

.page-p {
    color: var(--white);
    font-weight: bold;
}

.page-input {
    width: 38px;
    background: var(--red);
    border: none;
    color: var(--white);
    font-family: inherit;
    font-size: 1em;
    text-align: center;
    padding: 0;
    font-weight: bold;
}

.page-input:focus {
    outline: none;
    color: var(--yellow);
}

.page-input.invalid {
    color: var(--black);
    animation: shake 0.3s;
}

.page-hint {
    color: var(--white);
    opacity: 0.3;
    font-size: 0.7em;
    margin-left: 2px;
}

.page-input:focus + .page-hint {
    opacity: 0.6;
    color: var(--yellow);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Content */
.content {
    padding: 8px;
    min-height: 580px;
}

/* Block art / graphics */
.graphic {
    text-align: center;
    margin: 5px 0;
}

.block-art {
    font-size: 18px;
    line-height: 1.1;
    letter-spacing: 2px;
}

/* Double height text - the classic CEEFAX look */
.dbl-height-block {
    text-align: center;
    padding: 4px 0;
    margin: 4px 0;
}

.dbl-height {
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 4px;
    text-transform: uppercase;
    display: inline-block;
    transform: scaleY(1.4);
    transform-origin: center;
}

/* Text colors */
.white { color: var(--white); }
.red { color: var(--red); }
.green { color: var(--green); }
.yellow { color: var(--yellow); }
.blue { color: var(--blue); }
.magenta { color: var(--magenta); }
.cyan { color: var(--cyan); }
.black-text { color: var(--black); }

/* Background colors */
.red-bg { background-color: var(--red); color: var(--white); }
.green-bg { background-color: var(--green); color: var(--black); }
.yellow-bg { background-color: var(--yellow); color: var(--black); }
.blue-bg { background-color: var(--blue); color: var(--white); }
.magenta-bg { background-color: var(--magenta); color: var(--white); }
.cyan-bg { background-color: var(--cyan); color: var(--black); }

/* Info row */
.info-row {
    text-align: center;
    font-size: 1.1em;
    letter-spacing: 2px;
}

/* Text blocks */
.text-block {
    margin: 8px 4px;
}

.text-block p {
    margin: 3px 0;
}

.text-block.center {
    text-align: center;
}

/* Spacer */
.spacer {
    height: 10px;
}

/* Divider */
.divider {
    color: var(--white);
    opacity: 0.5;
    text-align: center;
    margin: 8px 0;
    overflow: hidden;
}

/* Sections for stay page */
.section {
    margin: 8px 0;
}

.section-header {
    display: inline-block;
    padding: 2px 12px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.listing {
    margin: 6px 0 10px 8px;
}

.listing p {
    margin: 2px 0;
}

/* Blinking text - authentic teletext flash */
.blink {
    animation: teletext-flash 1s step-end infinite;
}

.blink-slow {
    animation: teletext-flash 1.5s step-end infinite;
}

@keyframes teletext-flash {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Fastext buttons - the colored buttons at bottom */
.fastext {
    display: flex;
    gap: 0;
    border-top: 2px solid var(--white);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 780px;
    margin: 0 auto;
}

.fastext-btn {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    font-weight: bold;
    text-decoration: none;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: block;
}

.fastext-btn:hover {
    filter: brightness(1.3);
}


/* Airbnb listings */

.airbnb-listing {
    margin: 8px 0;
}

.listing-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.block-pic {
    flex-shrink: 0;
}

.tiny-art {
    font-size: 11px;
    line-height: 1.0;
    margin: 0;
    letter-spacing: 0;
}

.listing-info {
    flex: 1;
}

.listing-info p {
    margin: 1px 0;
}

.listing-title {
    font-weight: bold;
    font-size: 1em !important;
}

.listing-link {
    font-size: 0.85em;
    margin-left: 10px;
    margin-top: 2px;
}

.center {
    text-align: center;
}

.small-text {
    font-size: 0.85em;
}

/* Email link styling */
.email-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.email-link {
    text-decoration: none;
    font-size: 1.1em;
}

.email-link:hover {
    text-decoration: underline;
}

.copy-btn {
    background: var(--cyan);
    color: var(--black);
    border: none;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 1em;
    cursor: pointer;
    font-weight: bold;
}

.copy-btn:hover {
    background: var(--yellow);
}

.copy-btn.copied {
    background: var(--green);
}

/* Links */
a.magenta {
    text-decoration: none;
}

a.magenta:hover {
    text-decoration: underline;
}

a.link {
    text-decoration: none;
}

a.link:hover {
    text-decoration: underline;
}

a.cyan.link {
    color: var(--cyan);
}

a.cyan.link:hover {
    color: var(--yellow);
}

/* Page index - clickable page numbers */
.page-index {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px dashed rgba(255,255,255,0.3);
}

.idx {
    background: var(--black);
    border: 1px solid var(--cyan);
    color: var(--cyan);
    padding: 2px 6px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: bold;
}

.idx:hover {
    background: var(--cyan);
    color: var(--black);
}

.idx.active {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--black);
}

/* Fastext page numbers */
.fnum {
    font-size: 0.8em;
    opacity: 0.8;
    margin-right: 2px;
}

/* Calendar row */
.calendar-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.cal-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 4px;
}

.cal-btn:hover {
    filter: brightness(1.3);
}

.cal-icon {
    font-size: 10px;
    line-height: 1;
    margin: 0;
}

.cal-label {
    font-size: 10px;
    color: var(--white);
    margin-top: 2px;
}

/* Tagline */
.tagline {
    text-align: center;
    padding: 10px 0 5px 0;
    font-size: 0.85em;
    font-style: italic;
}

/* Responsive */
@media (max-width: 820px) {
    .screen {
        width: 100%;
        min-width: 0;
    }

    .bbc-banner {
        flex-direction: column;
        gap: 5px;
        padding: 5px 8px;
    }

    .bbc-logo, .danfest-logo {
        font-size: 7px;
    }

    .globe-container {
        display: none;
    }
}

@media (max-width: 700px) {
    .crt {
        padding: 15px;
        border-radius: 10px;
    }

    .screen {
        font-size: 14px;
    }

    .dbl-height {
        font-size: 22px;
        letter-spacing: 2px;
    }

    .block-art {
        font-size: 12px;
        letter-spacing: 0;
    }

    .scanlines {
        top: 15px;
        left: 15px;
        right: 15px;
        bottom: 15px;
    }

    .header {
        flex-wrap: wrap;
        gap: 4px;
    }

    .ceefax-title {
        font-size: 1em;
        letter-spacing: 2px;
    }

    .listing-row {
        flex-direction: column;
        gap: 5px;
    }

    .block-pic {
        display: none;
    }

    .tiny-art {
        font-size: 9px;
    }

    .content {
        min-height: auto;
    }

    .bbc-logo, .danfest-logo {
        font-size: 6px;
    }

    .calendar-row {
        gap: 8px;
    }

    .cal-icon {
        font-size: 9px;
    }

    .page-index {
        gap: 4px;
        flex-wrap: wrap;
    }

    .idx {
        font-size: 0.8em;
        padding: 2px 4px;
    }

    .fnum {
        display: none;
    }

    .page-input {
        width: 40px;
        font-size: 0.9em;
    }
}

@media (max-width: 400px) {
    body {
        padding: 5px;
    }

    .crt {
        padding: 8px;
        border-radius: 8px;
    }

    .screen {
        font-size: 12px;
    }

    .dbl-height {
        font-size: 18px;
        letter-spacing: 1px;
        transform: scaleY(1.2);
    }

    .block-art {
        font-size: 10px;
    }

    .fastext-btn {
        font-size: 10px;
        padding: 6px 2px;
        letter-spacing: 0;
    }

    .header {
        padding: 4px 2px;
    }

    .page-num, .subpage, .time {
        font-size: 0.9em;
    }

    .email-link {
        font-size: 0.95em;
    }

    .copy-btn {
        padding: 3px 6px;
        font-size: 0.9em;
    }

    .listing p, .listing-info p {
        font-size: 0.85em;
    }

    .calendar-row {
        gap: 6px;
    }

    .cal-btn {
        padding: 2px;
    }

    .tagline {
        font-size: 0.75em;
    }

    .page-index {
        padding: 4px 0;
    }
}

/* TV Listings (600+ pages) */
.tv-listings {
    margin: 4px 0;
}

.tv-listing {
    display: flex;
    gap: 10px;
    margin: 6px 0;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.tv-time {
    flex-shrink: 0;
    width: 50px;
    font-weight: bold;
    padding-top: 1px;
}

.tv-detail {
    flex: 1;
}

.tv-title {
    font-weight: bold;
    margin: 0 0 2px 0;
}

.tv-desc {
    margin: 1px 0;
}

.tv-meta {
    margin: 2px 0 0 0;
    font-size: 0.9em;
}

/* TV Guide Index (page 600) */
.tv-index {
    margin: 8px 0;
}

.tv-index-row {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 6px 8px;
    margin: 3px 0;
    text-decoration: none;
    border: none;
    background: rgba(255,255,255,0.03);
}

.tv-index-row:hover {
    background: rgba(0,255,255,0.1);
}

.tv-idx-num {
    flex-shrink: 0;
    width: 30px;
    font-weight: bold;
}

.tv-idx-desc {
    flex: 1;
    font-size: 0.9em;
    opacity: 0.7;
}

/* Chart list (page 607) */
.chart-list {
    margin: 4px 0;
}

.chart-entry {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.chart-pos {
    flex-shrink: 0;
    width: 24px;
    font-weight: bold;
    text-align: right;
}

.chart-move {
    flex-shrink: 0;
    width: 28px;
    font-size: 0.85em;
    text-align: center;
}

.chart-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.chart-title {
    font-weight: bold;
}

.chart-artist {
    font-size: 0.9em;
}

/* ORACLE banner (page 608) */
.oracle-banner {
    background: var(--red);
    padding: 8px 12px;
    text-align: center;
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.oracle-logo {
    font-size: 9px;
    line-height: 1;
    margin: 0 auto;
}

.oracle-subtitle {
    font-size: 0.85em;
    letter-spacing: 3px;
    margin-top: 4px;
}

/* ORACLE deliberately worse styling */
.oracle-listings .tv-time {
    color: var(--yellow);
}

/* Responsive for TV listings */
@media (max-width: 700px) {
    .tv-thumb {
        width: 100px;
        padding: 3px;
        border-radius: 6px;
    }

    .tv-teaser-strip .tv-thumb {
        width: 90px;
    }

    .tv-teaser-strip .tv-teaser-label {
        font-size: 0.7em;
        max-width: 90px;
    }

    .tv-listing {
        gap: 6px;
    }

    .tv-time {
        width: 42px;
        font-size: 0.9em;
    }

    .tv-index-row {
        padding: 5px 4px;
        gap: 6px;
    }

    .tv-idx-desc {
        display: none;
    }

    .chart-entry {
        gap: 4px;
    }

    .oracle-logo {
        font-size: 7px;
    }
}

@media (max-width: 400px) {
    .tv-listing .tv-thumb {
        display: none;
    }

    .tv-teaser-strip .tv-thumb {
        width: 70px;
    }

    .tv-teaser-strip .tv-teaser-label {
        font-size: 0.6em;
        max-width: 70px;
    }

    .tv-time {
        width: 36px;
        font-size: 0.85em;
    }

    .tv-desc {
        font-size: 0.85em;
    }

    .chart-title, .chart-artist {
        font-size: 0.85em;
    }

    .oracle-logo {
        font-size: 5px;
    }
}

/* Test Card F */
.testcard-frame {
    background: #222;
    border: 3px solid #444;
    border-radius: 12px;
    padding: 8px;
    max-width: 620px;
    margin: 0 auto;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
}

.testcard-screen {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    line-height: 0;
}

.testcard-img {
    width: 100%;
    display: block;
    filter: contrast(1.15) saturate(1.2) brightness(0.95);
    image-rendering: auto;
}

.testcard-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
}

/* TV Thumbnail - retro TV frame for featured listings */
.tv-listing.featured {
    padding: 8px 0;
}

.tv-thumb {
    flex-shrink: 0;
    width: 140px;
    background: #222;
    border: 2px solid #444;
    border-radius: 8px;
    padding: 4px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
    align-self: flex-start;
}

.tv-thumb-screen {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    line-height: 0;
    background: #111;
}

.tv-thumb-screen img {
    width: 100%;
    display: block;
    filter: contrast(1.15) saturate(1.2) brightness(0.95);
    image-rendering: auto;
}

.tv-thumb-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
}

/* TV Teaser Strip - horizontal row of featured thumbnails */
.tv-teaser-strip {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.tv-teaser-strip a {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tv-teaser-strip a:hover .tv-thumb {
    border-color: var(--cyan);
}

.tv-teaser-strip .tv-thumb {
    width: 120px;
    transition: border-color 0.2s;
}

.tv-teaser-strip .tv-teaser-label {
    font-size: 0.75em;
    text-align: center;
    max-width: 120px;
}

/* CEEFAX cross-reference link */
.see-also {
    text-align: center;
    margin: 6px 0;
    font-size: 0.9em;
}

/* Extra small phones */
@media (max-width: 320px) {
    .screen {
        font-size: 11px;
    }

    .dbl-height {
        font-size: 14px;
    }

    .fastext-btn {
        font-size: 9px;
    }
}
