:root {
    --bg-color: #ffffff;
    --text-color: #37352f;
    --heading-color: #37352f;
    --gray-text: #787774;
    --divider-color: #e9e9e8;
    --selection-bg: #2383e2;
    --selection-text: #ffffff;
    --quote-border: #37352f;
    --link-color: #787774;
    --link-hover: #37352f;
    --code-bg: #f7f6f3;
    --callout-bg: #f1f1ef;
    --nav-height: 60px;
    --active-nav-bg: #e1e1e1;
}

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

::selection {
    background: var(--selection-bg);
    color: var(--selection-text);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Bai Jamjuree', 'Mitr', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 22px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 48px;
    padding-bottom: 30vh;
    padding-top: var(--nav-height);
}

@media (max-width: 768px) {
    .container {
        padding: 0 24px;
        padding-top: var(--nav-height);
    }
}

.cover-image {
    height: 30vh;
    width: 100%;
    margin-bottom: -40px;
    display: none;
}

.page-icon {
    font-size: 78px;
    margin-top: 60px;
    margin-bottom: 24px;
}

h1.page-title {
    font-family: 'Mitr', sans-serif;
    font-size: 56px;
    font-weight: 700;
    margin-bottom: 48px;
    line-height: 1.2;
    color: var(--heading-color);
}

h2.section-heading {
    font-family: 'Mitr', sans-serif;
    font-size: 36px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 24px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--divider-color);
    color: var(--heading-color);
    scroll-margin-top: 80px;
}

.block-section {
    margin-bottom: 120px;
}

p {
    margin-bottom: 16px;
    font-size: 22px;
    line-height: 1.75;
    min-height: 1.75em;
}

ul.bullet-list, ol.numbered-list {
    margin-top: 8px;
    margin-bottom: 24px;
    padding-left: 32px;
}

ul.bullet-list li, ol.numbered-list li {
    margin-bottom: 8px;
    line-height: 1.6;
}

ul.nested-list {
    margin-top: 8px;
    margin-bottom: 0;
    padding-left: 32px;
}

a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(55, 53, 47, 0.4);
    transition: color 0.2s, text-decoration-color 0.2s;
}

a:hover {
    color: var(--link-hover);
    text-decoration-color: var(--link-hover);
}

hr.divider {
    border: none;
    margin: 60px 0;
    height: 24px;
    position: relative;
    text-align: center;
    overflow: visible;
}

hr.divider::after {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    background: var(--heading-color);
    border-radius: 50%;
    margin: 8px auto 0;
    box-shadow: -24px 0 0 0 var(--heading-color), 24px 0 0 0 var(--heading-color);
    opacity: 0.4;
}

.media-block {
    margin: 48px 0;
}

.placeholder-media {
    background-color: var(--code-bg);
    border-radius: 4px;
    height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-text);
    border: 1px solid var(--divider-color);
}

.placeholder-media.video-placeholder {
    height: 500px;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.placeholder-text {
    font-size: 18px;
    font-family: monospace;
}

.caption {
    margin-top: 12px;
    font-size: 18px;
    color: var(--gray-text);
}

.callout-block {
    background-color: var(--callout-bg);
    padding: 24px 24px 24px 20px;
    border-radius: 4px;
    margin: 24px 0;
    font-size: 20px;
    border-left: 4px solid transparent;
}

.callout-block strong {
    display: block;
    margin-bottom: 12px;
}

.bottom-spacer {
    height: 150px;
}

/* Sticky Navigation Styles */
.sticky-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--divider-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.nav-scroll-container {
    display: flex;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
    -ms-overflow-style: none;
    scrollbar-width: none;
    height: 100%;
    flex-grow: 1;
    margin-right: 24px;
}

.nav-scroll-container::-webkit-scrollbar {
    display: none;
}

.timer-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.nav-button {
    background-color: var(--heading-color);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'Mitr', sans-serif;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.nav-button:hover {
    opacity: 0.9;
}

.presentation-timer {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--heading-color);
    padding: 0 8px;
}

.presentation-timer.over-time {
    color: #d32f2f;
}

.nav-item {
    padding: 8px 16px;
    margin-right: 8px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--gray-text);
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    background-color: var(--code-bg);
    color: var(--text-color);
    text-decoration: none;
}

.nav-item.active {
    background-color: var(--heading-color);
    color: var(--bg-color);
}

/* Carousel / Slider Styles */
.carousel-container {
    position: relative;
    width: 100%;
    max-width: 100%; 
    margin: 48px auto;
}

.carousel-track-container {
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--divider-color);
    background: #fff;
    padding: 24px 0;
}

.carousel-track {
    display: flex;
    gap: 24px;
    overflow-x: auto; /* Enable horizontal scroll */
    scroll-behavior: smooth;
    padding: 0 24px 24px 24px; /* Add bottom padding for scrollbar */
    
    /* Equal height alignment */
    align-items: stretch; 
    
    /* Show Scrollbar */
    -ms-overflow-style: auto;
    scrollbar-width: auto; 
    scrollbar-color: var(--gray-text) var(--code-bg);
}

/* Custom Scrollbar for Webkit */
.carousel-track::-webkit-scrollbar {
    display: block;
    height: 8px;
}

.carousel-track::-webkit-scrollbar-track {
    background: var(--code-bg);
    border-radius: 4px;
}

.carousel-track::-webkit-scrollbar-thumb {
    background-color: var(--gray-text);
    border-radius: 4px;
    border: 2px solid var(--code-bg);
}

.carousel-item {
    min-width: 350px;
    width: 350px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    /* Stretch items to fill height, but inner content (Twitter embed) might not stretch */
    align-items: flex-start; 
}

/* Responsive Video Container */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 48px 0;
    border-radius: 4px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-container-short {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 9 / 16;
    margin: 48px auto;
    border-radius: 4px;
    background-color: #000;
}

.video-container-short iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.code-block {
    background-color: var(--code-bg);
    border-radius: 4px;
    padding: 32px;
    margin: 24px 0;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
    border: 1px solid var(--divider-color);
}

.code-block pre {
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-block code {
    font-family: inherit;
    color: #EB5757;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}

@media (max-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

.comparison-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.comparison-item img {
    width: 100%;
    border-radius: 4px;
    border: 1px solid var(--divider-color);
}

.comparison-label {
    margin-top: 8px;
    font-size: 16px;
    color: var(--gray-text);
}

/* Receipt Styling */
.receipt-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 48px 0;
    gap: 24px;
}

.receipt {
    background-color: #fdfdfd;
    width: 100%;
    max-width: 480px;
    padding: 32px 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    font-family: 'Courier New', Courier, monospace;
    position: relative;
    /* Jagged bottom edge using conic-gradient */
    background-image: conic-gradient(from 45deg at bottom, transparent 135deg, #fdfdfd 135deg);
    background-size: 100% calc(100% - 10px); /* 10px is the height of the zigzag */
    background-repeat: no-repeat;
    padding-bottom: 40px; /* Space for the edge */
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

/* Zigzag edge implementation via pseudo-element for better browser support */
.receipt::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 10px;
    background: linear-gradient(45deg, transparent 33.333%, #fdfdfd 33.333%, #fdfdfd 66.667%, transparent 66.667%), 
                linear-gradient(-45deg, transparent 33.333%, #fdfdfd 33.333%, #fdfdfd 66.667%, transparent 66.667%);
    background-size: 20px 40px;
    background-position: 0 -20px;
}

.receipt-header {
    text-align: center;
    margin-bottom: 24px;
}

.receipt-header h3 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 8px;
    color: #000;
}

.receipt-meta {
    font-size: 14px;
    color: #555;
    margin: 2px 0;
    text-transform: uppercase;
}

.receipt-divider {
    text-align: center;
    font-weight: bold;
    letter-spacing: 4px;
    color: #ccc;
    margin: 12px 0;
    user-select: none;
    overflow: hidden;
    white-space: nowrap;
    font-family: monospace;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 18px;
    line-height: 1.4;
}

.receipt-item.huge-row {
    flex-direction: column;
    align-items: center;
    margin: 16px 0;
}

.receipt-item.huge-row .item-name {
    font-size: 16px;
    margin-right: 0;
    margin-bottom: 4px;
    color: #444;
    text-transform: uppercase;
}

.receipt-item.huge-row .item-price {
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1;
}

.receipt-item.highlight-row {
    font-weight: bold;
    margin-top: 8px;
}

.item-name {
    text-align: left;
    margin-right: 16px;
}

.item-price {
    text-align: right;
    white-space: nowrap;
}

.receipt-footer {
    text-align: center;
    margin-top: 24px;
}

.receipt-footer p {
    font-size: 12px;
    margin-bottom: 12px;
    font-family: monospace;
    min-height: auto;
}

.barcode {
    font-family: 'Libre Barcode 39', cursive; /* Fallback if not loaded, simulates bars */
    font-size: 32px;
    letter-spacing: -2px;
    transform: scaleY(0.7);
    color: #000;
    font-weight: 100;
    opacity: 0.8;
}

/* Usage Memo Styling */
.usage-memo {
    background-color: #fff9c4;
    width: 100%;
    max-width: 480px;
    padding: 24px;
    margin-top: 32px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    font-family: 'Bai Jamjuree', sans-serif;
    position: relative;
    transform: rotate(-1deg);
    border-radius: 2px;
    color: #444;
}

.usage-memo::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    border-width: 0 0 20px 20px;
    border-style: solid;
    border-color: transparent transparent rgba(0,0,0,0.1) rgba(0,0,0,0.05);
}

.memo-header {
    font-family: 'Mitr', sans-serif;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    border-bottom: 2px dashed rgba(0,0,0,0.1);
    padding-bottom: 12px;
    margin-bottom: 20px;
    color: #333;
}

.memo-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    font-size: 16px;
}

.memo-label {
    text-align: left;
}

.memo-value {
    text-align: right;
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
}

.memo-sub {
    font-size: 13px;
    color: #666;
    text-align: right;
    margin-top: -8px;
    margin-bottom: 16px;
    font-style: italic;
}

.memo-calc-box {
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.1);
    padding: 12px;
    border-radius: 4px;
    margin: 16px 0;
    text-align: center;
}

.memo-calc-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #555;
}

.memo-equation {
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px;
    font-weight: 700;
    color: #222;
}

.memo-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid rgba(0,0,0,0.1);
    font-weight: 700;
    font-size: 18px;
    color: #d32f2f;
}

.receipt-note {
    max-width: 600px;
    margin-top: 48px;
    text-align: center;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--divider-color);
    border-radius: 4px;
    position: relative;
}

.receipt-note::before {
    content: "NOTE";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 0 12px;
    font-size: 14px;
    color: var(--gray-text);
    font-weight: bold;
}

.receipt-note p {
    font-size: 18px;
    margin-bottom: 8px;
    min-height: auto;
}

.note-sub {
    font-size: 16px;
    color: var(--gray-text);
    margin-bottom: 0;
}
