/* browser compatibility and reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

/* ------------------------- Scaling System by Osmo [https://osmo.supply/] -------------------------  */

/* Desktop */
:root {
    --size-unit: 16;
    /* body font-size in design - no px */
    --size-container-ideal: 1440;
    /* screen-size in design - no px */
    --size-container-min: 992px;
    --size-container-max: 1920px;
    --size-container: clamp(var(--size-container-min), 100vw, var(--size-container-max));
    --size-font: calc(var(--size-container) / (var(--size-container-ideal) / var(--size-unit)));
    /* Grid scaling - unified between photos and music sections */
    --grid-scale: 0.575;
    /* 50% + 15% = 57.5% */
}

/* Tablet */
@media screen and (max-width: 991px) {
    :root {
        --size-container-ideal: 834;
        /* screen-size in design - no px */
        --size-container-min: 768px;
        --size-container-max: 991px;
    }
}

/* Mobile Landscape */
@media screen and (max-width: 767px) {
    :root {
        --size-container-ideal: 550;
        /* screen-size in design - no px */
        --size-container-min: 480px;
        --size-container-max: 767px;
    }
}

/* Mobile Portrait */
@media screen and (max-width: 479px) {
    :root {
        --size-container-ideal: 390;
        /* screen-size in design - no px */
        --size-container-min: 320px;
        --size-container-max: 479px;
    }
}

/* normalize cross-browser defaults */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ensure consistent baseline across browsers */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: "kern";
    -moz-font-feature-settings: "kern";
    font-feature-settings: "kern";
}

/* cross-browser flex support */
.container {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
}

/* ensure consistent rendering */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
    display: block;
}

/* custom font faces */
@font-face {
    font-family: 'Nexa Light';
    src: url('AnonymousPro-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0020-007F;
}

@font-face {
    font-family: 'Asobi Memogaki';
    src: url('asobi2/AsobiMemogaki-Regular-1-01.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
    unicode-range: U+3040-309F, U+30A0-30FF, U+4E00-9FAF;
}

/* body and html setup */
html,
body {
    font-family: 'Nexa Light', monospace, courier;
    font-size: calc(var(--size-font) * 1px);
    line-height: 1.1;
    background-color: #ffffff;
    color: #333;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    zoom: 1;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* prevent text selection for all elements */
* {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* main container - consistent layout */
.container {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -moz-box-orient: horizontal;
    -moz-box-direction: normal;
    -ms-flex-direction: row;
    -webkit-flex-direction: row;
    flex-direction: row;
    justify-content: center;
    gap: 0px;
    -webkit-gap: 0px;
    -moz-gap: 0px;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 80px;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

/* main content - centered */
.content {
    -webkit-box-flex: 1;
    -moz-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
    min-width: 450px;
    max-width: 900px;
    position: relative;
    padding-left: 120px;
    padding-right: 120px;
    margin: 0 auto;
}

/* Center content on home page only when active */
#section0.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    max-height: 100vh;
    text-align: center;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 900px;
    padding: 0 40px;
    box-sizing: border-box;
    overflow: hidden;
    z-index: 100;
    font-size: 1.1em;
    /* Increased by 10% from base font size */
}

#section0.active h2,
#section0.active p {
    text-align: center;
    width: 100%;
    max-width: 600px;
    margin: 0.5em auto;
    line-height: 1.6;
}

#section0.active .connect-links {
    justify-content: center;
    max-width: 600px;
    width: 100%;
}

/* Directory Navigation - Centered at bottom */
.directory-nav {
    position: fixed !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    padding: 0 !important;
    font-size: 16.8px !important;
    /* Increased by 20% from 14px */
    color: #333 !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    top: auto !important;
    margin: 0 !important;
    z-index: 9999 !important;
    line-height: normal !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
}

.directory-path {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Nexa Light', monospace, courier;
    text-align: center;
}

.path-segment {
    cursor: default;
    transition: all 0.2s ease;
}

.path-segment.clickable {
    cursor: pointer;
    color: #666;
}

.path-segment.clickable:hover {
    color: #333;
}

.path-segment.current {
    color: #333;
    font-weight: normal;
}

.path-separator {
    margin: 0 4px;
    color: #666;
}


/* Parent Directory Contents - Horizontal Layout at Top (same as contents navigator) */
.parent-directory-contents {
    position: fixed !important;
    left: 50% !important;
    top: 10px !important;
    transform: translateX(-50%) !important;
    margin: 0;
    padding: 0;
    transition: opacity 0.6s ease;
    z-index: 10000 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* Keep parent directory centered when collapsed or expanded */
.parent-directory-contents.collapsed {
    transform: translateX(-50%) !important;
}

.parent-directory-contents.expanded {
    transform: translateX(-50%) !important;
}

.parent-title {
    font-size: 16px;
    color: #666;
    margin: 0;
    padding: 8px 0;
    font-weight: normal;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    z-index: 1001;
    will-change: opacity;
    transform: translate3d(0, 0, 0);
    text-align: center;
}

.parent-title.fade-in {
    opacity: 1;
}

.parent-title.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.parent-title.clickable:hover {
    color: #333;
}


/* Contents Directory Navigator for Contents Page - Horizontal Layout */
.contents-directory-navigator {
    margin: 0;
    padding: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Bottom directory navigation stays centered */
.content-section.active .directory-nav,
#section1.active .directory-nav {
    position: fixed !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 9999 !important;
}

/* Contents directory navigator - always fixed at top center regardless of section state */
.contents-directory-navigator {
    position: fixed !important;
    left: 50% !important;
    top: 10px !important;
    transform: translateX(-50%) !important;
    z-index: 10000 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* Keep horizontal navigator centered when collapsed or expanded */
.contents-directory-navigator.collapsed {
    transform: translateX(-50%) !important;
}

.contents-directory-navigator.expanded {
    transform: translateX(-50%) !important;
}

.contents-directory-navigator.fade-in {
    opacity: 1;
}

.contents-nav-title {
    font-size: 16px;
    color: #333;
    margin: 0;
    padding: 8px 0;
    font-weight: normal;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    position: relative;
    z-index: 1001;
    will-change: opacity;
    transform: translate3d(0, 0, 0);
    text-align: center;
}

.contents-nav-title.fade-in {
    opacity: 1;
}

.contents-nav-title.clickable:hover {
    color: #333;
}

.contents-nav-dropdown {
    display: flex;
    flex-direction: row;
    gap: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: max-width 0.4s ease, opacity 0.4s ease;
    max-width: 0;
    opacity: 0;
    white-space: nowrap;
}

.contents-nav-dropdown.expanded {
    max-width: 1200px;
    opacity: 1;
    padding: 8px 0;
}

.contents-nav-dropdown.collapsed {
    max-width: 0;
    opacity: 0;
}

.contents-nav-item {
    font-size: 10.5px;
    padding: 0 12px;
    display: inline-block;
    white-space: nowrap;
}

.contents-nav-item:not(:last-child)::after {
    content: '';
    margin-left: 12px;
    color: #999;
    white-space: nowrap;
}

.contents-nav-link {
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.contents-nav-link:hover {
    color: #333;
}



/* Unified Directory Listing - Horizontal Layout */
.unified-directory-listing {
    display: flex;
    flex-direction: row;
    gap: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: max-width 0.4s ease, opacity 0.4s ease;
    max-width: 0;
    opacity: 0;
    white-space: nowrap;
}

.unified-directory-listing.fade-in {
    opacity: 1;
    max-width: 1200px;
    padding: 8px 0;
}

.unified-directory-listing.expanded {
    max-width: 1200px;
    opacity: 1;
    padding: 8px 0;
}

.unified-directory-listing.collapsed {
    max-width: 0;
    opacity: 0;
}

.unified-directory-entry {
    font-size: 10.5px;
    padding: 0 12px;
    display: inline-block;
    white-space: nowrap;
}

.unified-directory-entry:not(:last-child)::after {
    content: '';
    margin-left: 12px;
    color: #999;
    white-space: nowrap;
}

.unified-directory-link {
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline;
}

.unified-directory-link:hover {
    color: #333;
}

.unified-directory-link.current {
    color: #333 !important;
    font-weight: bold !important;
    cursor: pointer;
    transition: all 0.4s ease;
}

.unified-directory-link.current:hover {
    color: #333 !important;
}

/* Sticky image removed - layout now centered */

/* header styling */
header {
    margin-bottom: 20px;
    margin-left: -40px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-right: 5px;
}

header h1 {
    font-size: 2.900390625rem;
    font-weight: normal;
    margin: 10px 0 0 0;
    color: #000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

header h1.fade-in {
    opacity: 1;
}

/* keep header name always in english font */
.static-english {
    font-family: 'Nexa Light', monospace, courier !important;
}

/* button font styles */
.btn-hiragana {
    font-family: 'Asobi Memogaki', 'Noto Sans CJK JP', sans-serif;
}

.btn-english {
    font-family: 'Nexa Light', monospace, courier;
}

.language-toggle {
    background: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    padding: 20.4px 9.6px !important;
    /* Increased by 20% from 32px 8px */
    font-size: 1.35rem !important;
    /* Increased by 20% from 1.375rem */
    color: #333 !important;
    transition: all 0.3s ease;
    font-family: inherit;
    text-decoration: none;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: fixed !important;
    bottom: 40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 10001 !important;
    opacity: 0;
    height: auto !important;
    line-height: normal !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.btn-hiragana,
.btn-english {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.language-toggle.fade-in {
    opacity: 1;
}

.language-toggle:hover {
    opacity: 0.7;
}

/* language-specific font styles */
body.lang-en {
    font-family: 'Nexa Light', monospace, courier;
}

body.lang-ja {
    font-family: 'Asobi Memogaki', 'Noto Sans CJK JP', sans-serif;
}

/* ensure connect buttons use language-appropriate fonts */
body.lang-ja .connect-button {
    font-family: 'Asobi Memogaki', 'Noto Sans CJK JP', sans-serif;
}

body.lang-en .connect-button {
    font-family: 'Nexa Light', monospace, courier;
}

/* section visibility */
.content-section {
    display: none;
    overflow: hidden;
}

.content-section.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 34px);
    max-height: calc(100vh - 34px);
    text-align: center;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    padding-bottom: 34px;
}

/* Contents section - positioned below horizontal navigator */
#section1.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 0;
    min-height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
    overflow-y: auto;
    padding-bottom: 60px;
}

/* Force directory nav and language toggle to maintain exact positioning in contents section */
#section1.active~.directory-nav,
#section1 .directory-nav,
body[data-current-section="1"] .directory-nav {
    position: absolute !important;
    bottom: 0px !important;
    left: 0 !important;
    padding: 20px 0 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    z-index: 9999 !important;
}

/* Language toggle stays fixed at top left for all sections */

/* Text sections - vertically centered */
#section2.active,
/* now section */
#section3.active,
/* food section */
#section9.active,
/* things section */
#section10.active,
/* goals section */
#section11.active

/* inspirations section */
    {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 0;
    min-height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
    overflow-y: auto;
    padding-bottom: 60px;
}

/* Section content wrapper for centering */
.section-content {
    max-width: 540px;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* Ensure section content elements are properly centered */
.content-section p,
.content-section h2,
.content-section .toc-container,
.content-section .section-content,
.content-section .image-grid,
.content-section .photos-grid,
.content-section .music-grid {
    margin: 0 auto 1em auto;
    text-align: center;
    max-width: 100%;
}

/* table of contents styling */
.toc-container {
    margin-top: 25px;
}

.toc-entry {
    display: block;
    margin-bottom: 30px;
    font-family: monospace, courier;
    font-size: 1.125rem;
}

.chapter-number {
    display: none;
    /* hide numbers for this style */
}

.chapter-title {
    color: #333;
    text-decoration: none;
    transition: text-decoration 0.2s ease;
}

.chapter-title:hover {
    color: #333;
}

.toc-entry::before {
    content: "[>] ";
    color: #333;
    font-weight: normal;
}

/* fixed navigation */
.fixed-nav {
    position: fixed;
    bottom: 39px;
    left: 15px;
    display: flex;
    gap: -20px;
    z-index: 1000;

}

.fixed-nav-item {
    font-family: monospace, courier;
    font-size: 1.71875rem;
    color: #333;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border: none;
    transition: all 0.3s ease;
    opacity: 0;
}

.fixed-nav-item.fade-in {
    opacity: 1;
}

.fixed-nav-item:hover {
    opacity: 0.7;
}


/* table of contents shortcut button */
.toc-shortcut {
    position: absolute;
    bottom: 20px;
    right: 5px;
    font-family: monospace, courier;
    font-size: 1.71875rem;
    color: #333;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    line-height: 1;
    opacity: 0;
}

.toc-shortcut.fade-in {
    opacity: 1;
}

.toc-shortcut:hover {
    opacity: 0.7;
}

/* connection links styling */
.connect-links {
    margin-top: 15px;
    margin-right: 5;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: opacity;
    transform: translate3d(0, 0, 0);
}

.connect-links.fade-in {
    opacity: 1;
}

/* connect links fade-in when navigating to section0 */
#section0.loaded .connect-links,
#section0 .connect-links.fade-in {
    opacity: 1;
}

.connect-button {
    font-family: monospace, courier;
    font-size: 1rem;
    color: #333;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.connect-button:hover {
    opacity: 0.7;
}

.directory-button {
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    margin: 0;
    color: inherit;
}


/* simple fade-in for first page (section0) initial load only */
#section0.initial-load h2,
#section0.initial-load p {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#section0.initial-load.fade-in h2,
#section0.initial-load.fade-in p {
    opacity: 1;
}

/* smooth fade transition for all sections */
.content-section h2,
.content-section p,
.toc-container,
.content-section .image-grid,
.content-section .image-grid-anime,
.content-section .image-grid-single-row {
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    opacity: 0;
    /* start invisible */
    will-change: opacity, transform;
    transform: translate3d(0, 0, 0);
}

/* music grid - smooth fade (no transform here to allow .music-grid scale to apply) */
.content-section .music-grid {
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    opacity: 0;
    will-change: opacity, transform;
    /* transform removed so .music-grid's scale(0.575) is not overridden */
}

/* override for initial load section0 */
#section0.initial-load h2,
#section0.initial-load p {
    transition: opacity 0.3s ease;
    transform: none;
}

.content-section.loaded h2,
.content-section.loaded p,
.content-section.loaded .toc-container,
.content-section.loaded .image-grid,
.content-section.loaded .image-grid-anime,
.content-section.loaded .image-grid-single-row {
    opacity: 1;
    /* fade in */
}

/* music grid loaded - only fade in, no transform */
.content-section.loaded .music-grid {
    opacity: 1;
}

.content-section.fade-out h2,
.content-section.fade-out p,
.content-section.fade-out .toc-container,
.content-section.fade-out .image-grid,
.content-section.fade-out .image-grid-anime,
.content-section.fade-out .image-grid-single-row {
    opacity: 0;
    transform: translate3d(0, 15px, 0);
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    /* move down while fading out */
}

/* music grid fade out - only fade, no transform */
.content-section.fade-out .music-grid {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* connect links fade out during language switch */
.content-section.fade-out .connect-links {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}


/* image grid styling */
.image-grid {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 1fr 18px 1fr 18px 1fr;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    -webkit-gap: 18px;
    -moz-gap: 18px;
    margin-top: 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 540px;
}

/* Anime grid - 2x4 layout (2 rows, 4 columns) */
.image-grid-anime {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 1fr 9px 1fr 9px 1fr 9px 1fr;
    -ms-grid-rows: 1fr 9px 1fr;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    -webkit-gap: 10px;
    -moz-gap: 10px;
    margin-top: 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 400px;
    /* Proper sizing for 2x4 grid */
}

/* Manga and Books grid - 1x4 layout (1 row, 4 columns) */
.image-grid-single-row {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 1fr 9px 1fr 9px 1fr 9px 1fr;
    -ms-grid-rows: 1fr;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr;
    gap: 10px;
    -webkit-gap: 10px;
    -moz-gap: 10px;
    margin-top: 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 400px;
    /* Proper sizing for 1x4 grid */
}

/* Hide mobile carousels on desktop */
.mobile-media-carousel {
    display: none;
}

/* Smaller image items for anime, manga, and books - properly sized for grid layouts */
.image-item-small {
    width: 100%;
    height: 80px;
    /* Reduced height for proper proportions in grid */
    background: #f0f0f0;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    overflow: hidden;
}

.image-item-small:hover {
    opacity: 0.8;
}

.image-item-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Reduce text size by 50% then increase by 15% (= 57.5%) for all sections except home page (section0) */
.content-section:not(#section0) p {
    font-size: 0.575em;
    /* 50% × 1.15 = 57.5% of base font size */
}

.content-section:not(#section0) h1,
.content-section:not(#section0) h2,
.content-section:not(#section0) h3,
.content-section:not(#section0) h4,
.content-section:not(#section0) h5,
.content-section:not(#section0) h6 {
    font-size: 0.575em;
    /* 50% × 1.15 = 57.5% of base font size */
}

.content-section:not(#section0) .date {
    font-size: 0.575em;
    /* 50% × 1.15 = 57.5% of base font size */
}

.content-section:not(#section0) .section-content {
    font-size: 0.575em;
    /* 50% × 1.15 = 57.5% of base font size */
}

/* Also reduce size for directory navigation elements in non-home sections */
.content-section:not(#section0) .contents-nav-title,
.content-section:not(#section0) .parent-title,
.content-section:not(#section0) .child-title {
    font-size: 0.5em;
    /* 50% of base font size */
}

.content-section:not(#section0) .contents-nav-link,
.content-section:not(#section0) .unified-directory-link {
    font-size: 0.5em;
    /* 50% of base font size */
}

.content-section:not(#section0) .unified-directory-entry {
    font-size: 0.5em;
    /* 50% of base font size */
}

/* Restore original font size for contents vertical directory bar */
.content-section .contents-nav-title,
.content-section .parent-title,
.content-section .child-title {
    font-size: 19.2px !important;
    /* Increased by 20% from 16px */
    /* Use absolute pixel value to ensure consistency */
}

.content-section .contents-nav-link,
.content-section .unified-directory-link,
.content-section .unified-directory-entry {
    font-size: 16.8px !important;
    /* Increased by 20% from 14px */
    /* Use absolute pixel value to ensure consistency */
}

/* Japanese mode: Apply Asobi font to contents directory bar */
[data-lang="ja"] .contents-nav-title,
[data-lang="ja"] .parent-title,
[data-lang="ja"] .child-title,
[data-lang="ja"] .contents-nav-link,
[data-lang="ja"] .unified-directory-link,
[data-lang="ja"] .unified-directory-entry {
    font-family: 'Asobi', 'Nexa Light', monospace, courier !important;
}

/* Smooth transitions for directory navigation text changes */
.contents-nav-title,
.parent-title,
.child-title,
.contents-nav-link,
.unified-directory-link,
.unified-directory-entry {
    transition: opacity 0.3s ease, font-family 0.3s ease;
}

/* Language transition states - completely hide ALL text elements */
.language-transition .contents-nav-title,
.language-transition .parent-title,
.language-transition .child-title,
.language-transition .contents-nav-link,
.language-transition .unified-directory-link,
.language-transition .unified-directory-entry,
.language-transition [data-en][data-ja] {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Language updating state - keep ALL text hidden during text updates */
.language-updating .contents-nav-title,
.language-updating .parent-title,
.language-updating .child-title,
.language-updating .contents-nav-link,
.language-updating .unified-directory-link,
.language-updating .unified-directory-entry,
.language-updating [data-en][data-ja] {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Reduce date font size by 30% for food and now sections */
#section2 .date,
#section3 .date {
    font-size: 0.4025em !important;
    /* 57.5% reduced by 30% = 40.25% */
}

/* Increase font size by 25% for now and food sections content (excluding directory navigation) */
#section2 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section2 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section2 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section2 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section2 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section2 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section2 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section2 .section-content,
#section3 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section3 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section3 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section3 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section3 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section3 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section3 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section3 .section-content {
    font-size: 0.950546875em !important;
    /* Previous 76.04375% increased by 25% = 95.0546875% */
}

/* Increase font size by additional 25% for things, goals, and inspirations sections content (excluding directory navigation) */
#section9 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section9 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section9 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section9 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section9 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section9 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section9 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section9 .section-content,
#section10 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section10 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section10 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section10 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section10 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section10 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section10 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section10 .section-content,
#section11 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section11 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section11 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section11 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section11 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section11 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section11 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
#section11 .section-content {
    font-size: 0.8984375em !important;
    /* Previous 71.875% increased by 25% = 89.84375% */
}

/* Increase image sizes by 25% + additional 15% for anime, manga, and books sections */
#section4 .image-grid-anime {
    max-width: 575px !important;
    /* Additional 15% increase: 500px × 1.15 = 575px */
}

#section5 .image-grid-single-row,
#section6 .image-grid-single-row {
    max-width: 575px !important;
    /* Additional 15% increase: 500px × 1.15 = 575px */
}

#section4 .image-item-small,
#section5 .image-item-small,
#section6 .image-item-small {
    height: 115px !important;
    /* Additional 15% increase: 100px × 1.15 = 115px */
}

/* Image sections - vertically centered */
#section4.active,
/* anime section */
#section5.active,
/* manga section */
#section6.active

/* books section */
    {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 0;
    min-height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
    position: relative;
    overflow-y: auto;
    padding-bottom: 60px;
}

/* Photos section - vertically centered */
#section7.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 0;
    min-height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
    position: relative;
    overflow-y: auto;
    padding-bottom: 60px;
}

/* Music section - vertically centered */
#section8.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 0;
    min-height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
    position: relative;
    overflow-y: auto;
    padding-bottom: 60px;
}

/* photos grid styling - 4x4 layout */
.photos-grid {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 1fr 15px 1fr 15px 1fr 15px 1fr;
    -ms-grid-rows: 1fr 15px 1fr 15px 1fr 15px 1fr;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 15px;
    -webkit-gap: 15px;
    -moz-gap: 15px;
    margin-top: 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 600px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    transform: scale(var(--grid-scale));
    transform-origin: center center;
    transition: opacity 0.3s ease;
}

/* Loading states for photos grid */
.photos-grid.photos-loading {
    opacity: 0.7;
}

.photos-grid.photos-loaded {
    opacity: 1;
}

/* music grid styling - exactly same as photos grid */
.music-grid {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 1fr 15px 1fr 15px 1fr 15px 1fr;
    -ms-grid-rows: 1fr 15px 1fr 15px 1fr 15px 1fr;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 15px;
    -webkit-gap: 15px;
    -moz-gap: 15px;
    margin-top: 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 600px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    transform: scale(var(--grid-scale));
    transform-origin: center center;
    transition: opacity 0.3s ease;
}

/* Loading states for music grid */
.music-grid.music-loading {
    opacity: 0.7;
}

.music-grid.music-loaded {
    opacity: 1;
}

.image-item {
    width: 100%;
    height: 198px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    overflow: hidden;
}

.image-item:hover {
    opacity: 0.8;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder {
    color: #999;
    font-size: 0.8rem;
    text-align: center;
}

/* photo item styling - smaller squares */
.photo-item {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    background: #f0f0f0;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
    will-change: transform, opacity;
    transform: translate3d(0, 15px, 0);
    opacity: 0;
}

.photo-item img {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: opacity;
    transform: translate3d(0, 0, 0);
}

.photo-item.photo-loaded {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.photo-item.photo-loaded img {
    opacity: 1;
}

/* Staggered animation delays for smooth cascading effect */
.photo-item:nth-child(1) {
    transition-delay: 0ms;
}

.photo-item:nth-child(2) {
    transition-delay: 80ms;
}

.photo-item:nth-child(3) {
    transition-delay: 160ms;
}

.photo-item:nth-child(4) {
    transition-delay: 240ms;
}

.photo-item:nth-child(5) {
    transition-delay: 320ms;
}

.photo-item:nth-child(6) {
    transition-delay: 400ms;
}

.photo-item:nth-child(7) {
    transition-delay: 480ms;
}

.photo-item:nth-child(8) {
    transition-delay: 560ms;
}

.photo-item:nth-child(9) {
    transition-delay: 640ms;
}

.photo-item:nth-child(10) {
    transition-delay: 720ms;
}

.photo-item:nth-child(11) {
    transition-delay: 800ms;
}

.photo-item:nth-child(12) {
    transition-delay: 880ms;
}

.photo-item:nth-child(13) {
    transition-delay: 960ms;
}

.photo-item:nth-child(14) {
    transition-delay: 1040ms;
}

.photo-item:nth-child(15) {
    transition-delay: 1120ms;
}

.photo-item:nth-child(16) {
    transition-delay: 1200ms;
}

.photo-item:hover {
    opacity: 0.8;
}

.photo-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    display: block;
}

.photo-item .placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    color: #999;
    text-align: center;
}

/* Loading shimmer animation for better UX */
.photo-item .loading-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.photo-item.photo-error {
    background: #fafafa;
    border-color: #eee;
}

.photo-item .placeholder-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: #ccc;
    text-align: center;
}

/* music item styling - exactly same as photo items */
.music-item {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    background: #f0f0f0;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
    will-change: transform, opacity;
    transform: translate3d(0, 15px, 0);
    opacity: 0;
}

.music-item img {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: opacity;
    transform: translate3d(0, 0, 0);
}

.music-item.music-loaded {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.music-item.music-loaded img {
    opacity: 1;
}

/* Staggered animation delays for smooth cascading effect */
.music-item:nth-child(1) {
    transition-delay: 0ms;
}

.music-item:nth-child(2) {
    transition-delay: 80ms;
}

.music-item:nth-child(3) {
    transition-delay: 160ms;
}

.music-item:nth-child(4) {
    transition-delay: 240ms;
}

.music-item:nth-child(5) {
    transition-delay: 320ms;
}

.music-item:nth-child(6) {
    transition-delay: 400ms;
}

.music-item:nth-child(7) {
    transition-delay: 480ms;
}

.music-item:nth-child(8) {
    transition-delay: 560ms;
}

.music-item:nth-child(9) {
    transition-delay: 640ms;
}

.music-item:nth-child(10) {
    transition-delay: 720ms;
}

.music-item:nth-child(11) {
    transition-delay: 800ms;
}

.music-item:nth-child(12) {
    transition-delay: 880ms;
}

.music-item:nth-child(13) {
    transition-delay: 960ms;
}

.music-item:nth-child(14) {
    transition-delay: 1040ms;
}

.music-item:nth-child(15) {
    transition-delay: 1120ms;
}

.music-item:nth-child(16) {
    transition-delay: 1200ms;
}

.music-item:hover {
    opacity: 0.8;
}

.music-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    display: block;
}

.music-item .placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    color: #999;
    text-align: center;
}

/* Loading shimmer animation for better UX */
.music-item .loading-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.music-item.music-error {
    background: #fafafa;
    border-color: #eee;
}

.music-item .placeholder-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: #ccc;
    text-align: center;
}

/* photo enlargement on hover - position already set in main .photo-item rule */

/* Global enlarged photo - completely independent */
.enlarged-photo-global {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 300px;
    transform: translate3d(-50%, -50%, 0) scale(0);
    z-index: 9999;
    border: 3px solid #333;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    background: white;
    will-change: transform, opacity;
}

.enlarged-photo-global img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1px;
}

/* ensure photos and music sections can contain absolutely positioned buttons */
#section7,
/* photos section */
#section8

/* music section */
    {
    position: relative;
}

/* Music container to position refresh button relative to grid */
.music-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.music-container .music-grid {
    position: relative;
}

/* Photos container to position refresh button relative to grid */
.photos-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.photos-container .photos-grid {
    position: relative;
}

/* refresh button styling for photos - positioned to the right of grid */
.refresh-button-photos {
    position: absolute;
    top: 50%;
    left: calc(100% + 20px);
    transform: translateY(-50%);
    font-family: monospace, courier;
    font-size: 1.203125rem;
    color: #333;
    background: transparent;
    border: none;
    transition: opacity 0.2s ease;
    padding: 0;
    margin: 0;
    z-index: 100;
}

/* refresh button styling for music - positioned to the right of grid */
.refresh-button-music {
    position: absolute;
    top: 50%;
    left: calc(100% + 20px);
    transform: translateY(-50%);
    font-family: monospace, courier;
    font-size: 1.203125rem;
    color: #333;
    background: transparent;
    border: none;
    transition: opacity 0.2s ease;
    padding: 0;
    margin: 0;
    z-index: 100;
}

.refresh-button-photos:hover,
.refresh-button-music:hover {
    opacity: 0.7;
}

/* navigation menu - horizontal */
nav ul {
    list-style: none;
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    gap: 20px;
    -webkit-gap: 20px;
    -moz-gap: 20px;
}

nav a {
    text-decoration: none;
    color: #555;
    padding: 5px 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

nav a:hover {
    color: #000;
    border: 1px solid #ddd;
}

/* main sections */
section {
    margin-bottom: 60px;
}

section h2 {
    font-size: 2.08828125rem;
    font-weight: normal;
    margin-bottom: 10px;
    margin-left: -40px;
    color: #000;
}

section h3 {
    font-size: 2.0109375rem;
    font-weight: normal;
    margin-bottom: 15px;
    color: #333;
}

/* paragraph styling */
p {
    margin-bottom: 5px;
    margin-left: -40px;
    max-width: 70ch;
    /* limit line length for readability */
}

/* date styling */
.date {
    font-size: 0.6875rem;
    color: #777;
    margin-top: 20px;
    font-style: normal;
}

/* project styling */
.project {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border: 1px solid #eee;
    border-radius: 4px;
}

.project-link {
    display: inline-block;
    color: #0066cc;
    text-decoration: none;
    margin-top: 10px;
    padding: 5px 10px;
    border: 1px solid #0066cc;
    transition: all 0.2s ease;
}

.project-link:hover {
    background: #0066cc;
    color: white;
}

/* contact list */
.contact-list {
    list-style: none;
}

.contact-list li {
    margin-bottom: 10px;
}

.contact-list a {
    color: #0066cc;
    text-decoration: none;
}

.contact-list a:hover {
    color: #333;
}

/* footer */
footer {
    margin-top: 100px;
    padding-top: 40px;
    border-top: 1px solid #eee;
    color: #666;
    font-size: 1.71875rem;
}

/* Hide fixed navigators on mobile to avoid interference */
@media screen and (max-width: 768px) {

    .contents-directory-navigator,
    .parent-directory-contents {
        display: none !important;
    }

    /* Reset section positioning for mobile - return to standard centering */
    #section0.active {
        position: relative !important;
        left: auto !important;
        width: 100% !important;
        top: auto !important;
        padding: 20px !important;
        min-height: auto !important;
        max-height: none !important;
        z-index: auto !important;
    }


    #section1.active,
    #section2.active,
    #section3.active,
    #section4.active,
    #section5.active,
    #section6.active,
    #section7.active,
    #section8.active,
    #section9.active,
    #section10.active,
    #section11.active {
        padding-top: 20px !important;
        min-height: auto !important;
        justify-content: center !important;
        align-items: center !important;
    }
}

/* ============================= MOBILE NAVIGATION & CAROUSEL ============================= */

/* Mobile Image Carousel - replaces fixed sidebar on mobile */
.mobile-image-carousel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: #ffffff;
    z-index: 50;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    width: 500%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.carousel-slide {
    flex: 0 0 20%;
    height: 100%;
    position: relative;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.carousel-indicator.active {
    background: rgba(255, 255, 255, 0.9);
}

.carousel-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    pointer-events: none;
}

.carousel-btn {
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.carousel-btn:active {
    transform: scale(0.95);
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
}

.mobile-bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    background: none;
    border: none;
    color: #666;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 60px;
    gap: 4px;
}

.mobile-bottom-nav .nav-item.active {
    color: #333;
    background: rgba(51, 51, 51, 0.05);
    border-radius: 12px;
}

.mobile-bottom-nav .nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
    transition: transform 0.3s ease;
}

.mobile-bottom-nav .nav-item.active svg {
    transform: scale(1.1);
}

.mobile-bottom-nav .nav-item span {
    font-weight: 500;
    letter-spacing: -0.02em;
}

/* Mobile Hamburger Menu */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: #ffffff;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
}

.mobile-menu-overlay.active .mobile-menu {
    transform: translateX(0);
}

.mobile-menu-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.mobile-menu-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
    font-weight: normal;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.mobile-menu-content {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section h4 {
    padding: 0 20px 10px 20px;
    margin: 0 0 15px 0;
    font-size: 0.9rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
}

.menu-item {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(51, 51, 51, 0.05);
    border-left-color: #333;
    padding-left: 25px;
}

.menu-item.active {
    background: rgba(51, 51, 51, 0.1);
    border-left-color: #333;
    font-weight: 500;
}

/* Pull-to-Refresh Indicator */
.pull-to-refresh {
    display: none;
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #333;
}

.pull-to-refresh.active {
    top: 20px;
    display: flex;
}

.refresh-spinner {
    animation: spin 1s linear infinite;
}

.refresh-spinner svg {
    width: 20px;
    height: 20px;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* mobile responsive design - enhanced for better user experience */
@media screen and (max-width: 768px) {

    /* Show mobile-specific elements */
    .mobile-image-carousel {
        display: block;
    }

    .mobile-media-carousel {
        display: block !important;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .mobile-menu-overlay {
        display: block;
    }

    html,
    body {
        /* Font size handled by Osmo scaling system */
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        text-size-adjust: 100%;
        /* Enable momentum scrolling on iOS */
        -webkit-overflow-scrolling: touch;
        /* Add safe area for mobile devices */
        padding-bottom: env(safe-area-inset-bottom);
    }

    .container {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -moz-box-orient: vertical;
        -moz-box-direction: normal;
        -ms-flex-direction: column;
        -webkit-flex-direction: column;
        flex-direction: column;
        padding: 220px 15px 100px 15px;
        /* Top padding for carousel, bottom for nav */
        max-width: 100%;
        min-height: 100vh;
        /* Better mobile viewport handling */
        min-height: -webkit-fill-available;
        /* Add safe area for notched devices */
        padding-top: calc(200px + env(safe-area-inset-top));
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }


    .content {
        max-width: 100%;
        min-width: auto;
        padding: 0 20px;
        margin-left: 0;
    }

    .container {
        padding: 20px;
    }

    /* Larger, more readable header on mobile */
    header {
        margin-bottom: 25px;
        margin-left: 0;
        /* Remove negative margin on mobile */
    }

    header h1 {
        font-size: 2.8rem;
        /* Increased from 2.5rem */
        line-height: 1.1;
        margin: 0;
    }

    .header-top {
        padding-right: 0;
        margin-bottom: 15px;
    }

    /* Larger touch targets for mobile */
    .language-toggle {
        padding: 14.4px 24px;
        /* Increased by 20% from 12px 20px */
        font-size: 1.8rem;
        /* Increased by 20% from 1.5rem */
        min-width: 72px;
        /* Increased by 20% from 60px */
        min-height: 57.6px;
        /* Increased by 20% from 48px */
        /* Minimum touch target size */
    }

    /* Better mobile navigation */
    .fixed-nav {
        bottom: 20px;
        left: 15px;
        right: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(255, 255, 255, 0.95);
        padding: 15px 20px;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        max-width: none;
        width: auto;
    }

    .fixed-nav-item {
        font-size: 1.4rem;
        padding: 12px 16px;
        /* Larger touch targets */
        min-width: 48px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: rgba(51, 51, 51, 0.1);
        text-decoration: none;
    }

    .fixed-nav-item:hover {
        background: rgba(51, 51, 51, 0.2);
        opacity: 1;
    }

    /* Table of contents shortcut - mobile optimized */
    .toc-shortcut {
        position: fixed;
        bottom: 100px;
        right: 20px;
        padding: 12px 16px;
        min-width: 48px;
        min-height: 48px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        font-size: 1.3rem;
    }

    /* Mobile-optimized image grids */
    .image-grid {
        -ms-grid-columns: 1fr 15px 1fr;
        grid-template-columns: repeat(2, 1fr);
        /* Two columns on mobile for wider items */
        gap: 15px;
        margin-top: 30px;
        margin-left: 0;
        /* Remove left margin on mobile */
        max-width: 100%;
    }

    /* ============================= MOBILE MEDIA CAROUSELS ============================= */

    /* Hide default grids on mobile and show carousels instead */
    .image-grid-anime,
    .image-grid-single-row {
        display: none !important;
    }

    /* Mobile Media Carousel Container */
    .mobile-media-carousel {
        display: block;
        width: 100%;
        margin: 20px 0;
        position: relative;
        overflow: hidden;
    }

    .media-carousel-container {
        position: relative;
        width: 100%;
        padding: 0 50px;
        /* Space for navigation arrows */
    }

    .media-carousel-track {
        display: flex;
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        gap: 15px;
        padding: 10px 0;
    }

    .media-carousel-item {
        flex: 0 0 calc(50% - 7.5px);
        /* Two items visible, accounting for gap */
        min-width: 0;
        position: relative;
        border-radius: 12px;
        overflow: hidden;
        background: #f5f5f5;
        transition: all 0.3s ease;
        cursor: pointer;
    }

    .media-carousel-item:active {
        transform: scale(0.95);
    }

    .media-carousel-item img {
        width: 100%;
        height: auto;
        aspect-ratio: 3/4;
        /* Standard poster ratio */
        object-fit: cover;
        display: block;
        border-radius: 12px;
    }

    .media-carousel-item .item-label {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
        color: white;
        padding: 20px 12px 12px 12px;
        font-size: 0.8rem;
        font-weight: 500;
        text-align: center;
        opacity: 0;
        transition: opacity 0.3s ease;
        border-radius: 0 0 12px 12px;
    }

    .media-carousel-item:hover .item-label {
        opacity: 1;
    }

    /* Mobile Media Carousel Navigation */
    .media-carousel-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0, 0, 0, 0.6);
        border: none;
        color: white;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 10;
    }

    .media-carousel-nav:active {
        transform: translateY(-50%) scale(0.9);
        background: rgba(0, 0, 0, 0.8);
    }

    .media-carousel-nav.prev {
        left: 10px;
    }

    .media-carousel-nav.next {
        right: 10px;
    }

    .media-carousel-nav svg {
        width: 18px;
        height: 18px;
    }

    /* Mobile Section Headers */
    .mobile-section-header {
        display: block;
        text-align: center;
        margin: 30px 0 20px 0;
        padding: 0 20px;
    }

    .mobile-section-header h3 {
        font-size: 1.5rem;
        color: #333;
        margin: 0;
        font-weight: normal;
        letter-spacing: -0.02em;
    }

    .mobile-section-subheader {
        font-size: 0.9rem;
        color: #666;
        margin-top: 5px;
        font-style: italic;
    }


    /* Hide desktop section headers on mobile */
    #section4 h2,
    #section5 h2,
    #section6 h2 {
        display: none;
    }

    /* Mobile grid fallback - improved 2x grid layout */
    .mobile-grid-fallback {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 20px;
        margin: 20px 0;
    }

    .mobile-grid-fallback .image-item-small {
        height: auto;
        aspect-ratio: 3/4;
        border-radius: 12px;
        overflow: hidden;
        position: relative;
        cursor: pointer;
        transition: transform 0.3s ease;
    }

    .mobile-grid-fallback .image-item-small:active {
        transform: scale(0.95);
    }

    .mobile-grid-fallback .image-item-small img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 12px;
    }

    /* Show fallback for sections that don't have carousel implemented yet */
    #section4 .image-grid-anime {
        display: none !important;
    }

    #section5 .image-grid-single-row {
        display: none !important;
    }

    #section6 .image-grid-single-row {
        display: none !important;
    }

    .image-item {
        height: 200px;
        /* Increased from 160px */
        border-radius: 8px;
        overflow: hidden;
    }

    .image-item-small {
        height: 115px;
        /* 50% of mobile image-item height (100px) + 15% = 115px */
        border-radius: 8px;
        overflow: hidden;
    }

    /* Increase mobile image sizes by 25% + additional 15% for anime, manga, books sections */
    #section4 .image-item-small,
    #section5 .image-item-small,
    #section6 .image-item-small {
        height: 166px !important;
        /* Additional 15% increase: 144px × 1.15 = 166px */
    }

    /* Make mobile carousel items larger for anime, manga, books sections */
    #section4 .media-carousel-item,
    #section5 .media-carousel-item,
    #section6 .media-carousel-item {
        flex: 0 0 calc(71.875% - 10.8px) !important;
        /* Additional 15% increase: 62.5% × 1.15 = 71.875% */
    }

    /* 50% text size reduction + 15% increase = 57.5% on mobile for non-home sections */
    .content-section:not(#section0) p,
    .content-section:not(#section0) h1,
    .content-section:not(#section0) h2,
    .content-section:not(#section0) h3,
    .content-section:not(#section0) h4,
    .content-section:not(#section0) h5,
    .content-section:not(#section0) h6,
    .content-section:not(#section0) .date,
    .content-section:not(#section0) .section-content {
        font-size: 0.575em;
        /* 50% × 1.15 = 57.5% of mobile base font size */
    }

    /* Restore original font size for contents vertical directory bar on mobile */
    .content-section .contents-nav-title,
    .content-section .parent-title,
    .content-section .child-title {
        font-size: 19.2px !important;
        /* Increased by 20% from 16px */
        /* Use absolute pixel value to ensure consistency on mobile */
    }

    .content-section .contents-nav-link,
    .content-section .unified-directory-link,
    .content-section .unified-directory-entry {
        font-size: 16.8px !important;
        /* Increased by 20% from 14px */
        /* Use absolute pixel value to ensure consistency on mobile */
    }

    /* Japanese mode: Apply Asobi font to contents directory bar on mobile */
    [data-lang="ja"] .contents-nav-title,
    [data-lang="ja"] .parent-title,
    [data-lang="ja"] .child-title,
    [data-lang="ja"] .contents-nav-link,
    [data-lang="ja"] .unified-directory-link,
    [data-lang="ja"] .unified-directory-entry {
        font-family: 'Asobi', 'Nexa Light', monospace, courier !important;
    }

    /* Smooth transitions for directory navigation on mobile */
    .contents-nav-title,
    .parent-title,
    .child-title,
    .contents-nav-link,
    .unified-directory-link,
    .unified-directory-entry {
        transition: opacity 0.3s ease, font-family 0.3s ease;
    }

    /* Language transition states on mobile - completely hide ALL text elements */
    .language-transition .contents-nav-title,
    .language-transition .parent-title,
    .language-transition .child-title,
    .language-transition .contents-nav-link,
    .language-transition .unified-directory-link,
    .language-transition .unified-directory-entry,
    .language-transition [data-en][data-ja] {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Language updating state on mobile - keep ALL text hidden during text updates */
    .language-updating .contents-nav-title,
    .language-updating .parent-title,
    .language-updating .child-title,
    .language-updating .contents-nav-link,
    .language-updating .unified-directory-link,
    .language-updating .unified-directory-entry,
    .language-updating [data-en][data-ja] {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Reduce date font size by 30% for food and now sections on mobile */
    #section2 .date,
    #section3 .date {
        font-size: 0.4025em !important;
        /* 57.5% reduced by 30% = 40.25% on mobile */
    }

    /* Increase font size by 25% for now and food sections content on mobile (excluding directory navigation) */
    #section2 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section2 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section2 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section2 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section2 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section2 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section2 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section2 .section-content,
    #section3 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section3 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section3 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section3 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section3 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section3 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section3 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section3 .section-content {
        font-size: 0.950546875em !important;
        /* Previous 76.04375% increased by 25% = 95.0546875% on mobile */
    }

    /* Increase font size by additional 25% for things, goals, and inspirations sections content on mobile (excluding directory navigation) */
    #section9 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section9 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section9 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section9 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section9 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section9 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section9 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section9 .section-content,
    #section10 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section10 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section10 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section10 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section10 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section10 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section10 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section10 .section-content,
    #section11 p:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section11 h1:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section11 h2:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section11 h3:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section11 h4:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section11 h5:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section11 h6:not(.contents-nav-title):not(.parent-title):not(.child-title),
    #section11 .section-content {
        font-size: 0.8984375em !important;
        /* Previous mobile 71.875% increased by 25% = 89.84375% on mobile */
    }

    /* Mobile photos grid - 2x2 instead of 4x4 */
    .photos-grid {
        -ms-grid-columns: 1fr 15px 1fr;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-top: 30px;
        margin-left: 0;
        max-width: 100%;
        transform: none;
        /* Remove scaling for better mobile visibility */
    }

    /* Mobile music grid - 2x2 same as photos grid */
    .music-grid {
        -ms-grid-columns: 1fr 15px 1fr;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-top: 30px;
        margin-left: 0;
        max-width: 100%;
        transform: none;
        /* Remove scaling for better mobile visibility */
    }

    .photo-item {
        height: 150px;
        /* Larger photo items on mobile */
        border-radius: 8px;
        overflow: hidden;
    }

    .music-item {
        height: 150px;
        /* Larger music items on mobile */
        border-radius: 8px;
        overflow: hidden;
    }

    /* Adjust enlarged photo size for mobile */
    .enlarged-photo-global {
        width: 250px;
        height: 250px;
        border-radius: 12px;
    }

    /* Mobile-optimized refresh buttons */
    .refresh-button-photos,
    .refresh-button-music {
        position: absolute;
        top: -40px;
        right: 0;
        font-size: 1.5rem;
        padding: 8px;
        min-width: 40px;
        min-height: 40px;
        transform: none;
    }

    /* Better mobile typography */
    section h2 {
        font-size: 2rem;
        /* Reduced from 2.3203125rem */
        margin-left: 0;
        /* Remove negative margin */
        margin-bottom: 15px;
        line-height: 1.2;
    }

    p {
        margin-left: 0;
        /* Remove negative margin */
        margin-bottom: 8px;
        line-height: 1.4;
        /* Better mobile line spacing */
        max-width: 100%;
    }

    /* Mobile-friendly connect links */
    .connect-links {
        margin-left: 0;
        gap: 10px;
        flex-direction: column;
        align-items: flex-start;
    }

    .connect-button {
        padding: 12px 16px;
        min-width: 48px;
        min-height: 48px;
        font-size: 1.3rem;
        border-radius: 8px;
        width: 100%;
        max-width: 200px;
    }


    /* Disable hover effects on mobile */
    .image-item:hover,
    .photo-item:hover,
    .connect-button:hover,
    .language-toggle:hover,
    .toc-shortcut:hover {
        opacity: 1;
    }

    /* Better mobile table of contents */
    .toc-entry {
        font-size: 1.4rem;
        margin-bottom: 20px;
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }

}

/* small mobile devices - phones in portrait */
@media screen and (max-width: 480px) {

    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2.4rem;
    }

    .photos-grid {
        grid-template-columns: 1fr;
        /* Single column on very small screens */
        gap: 10px;
    }

    .music-grid {
        grid-template-columns: 1fr;
        /* Single column on very small screens */
        gap: 10px;
    }

    .photo-item {
        height: 180px;
    }

    .music-item {
        height: 180px;
    }

    .fixed-nav {
        padding: 12px 15px;
        left: 10px;
        right: 10px;
    }

    .fixed-nav-item {
        font-size: 1.2rem;
        padding: 10px 12px;
        min-width: 44px;
        min-height: 44px;
    }
}

/* Adjust navigator positioning for tablets */
@media (min-width: 769px) and (max-width: 1024px) {

    .contents-directory-navigator,
    .parent-directory-contents {
        left: 50% !important;
        top: 10px !important;
        transform: translateX(-50%) !important;
        min-width: 140px;
        max-width: 180px;
    }

}

/* tablet responsive design */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 20px 360px 20px 140px;
    }

    .content {
        padding-left: 160px;
        padding-right: 15px;
        margin-left: -100px;
        max-width: 750px;
    }


    /* Better tablet photo grid - maintain 3 columns with expanded width */
    .photos-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        margin-left: 20px;
        max-width: 450px;
    }

    .photo-item {
        height: 140px;
    }

    /* Better tablet music grid - same as photos grid */
    .music-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        margin-left: 20px;
        max-width: 450px;
    }

    .music-item {
        height: 140px;
    }

    /* Tablet navigation improvements */
    .fixed-nav {
        bottom: 25px;
        left: 20px;
    }

    .toc-shortcut {
        bottom: 80px;
        right: 25px;
    }
}

/* desktop consistent sizing */
@media screen and (min-width: 1025px) {
    .container {
        max-width: 1400px;
    }

    /* Ensure navigators position correctly with centered layout */
    .contents-directory-navigator,
    .parent-directory-contents {
        left: 50% !important;
        top: 10px !important;
        transform: translateX(-50%) !important;
    }

}


/* Brave browser specific fixes */
@supports (-webkit-appearance: none) {
    .content {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Firefox specific fixes */
@-moz-document url-prefix() {
    .container {
        min-height: 100vh;
        min-height: -moz-available;
    }
}

/* Safari specific fixes */
@supports (-webkit-appearance: -apple-pay-button) {
    .container {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* IE/Edge specific fixes */
@supports (-ms-ime-align: auto) {

    .image-grid,
    .photos-grid {
        display: -ms-grid;
    }

    .content {
        -ms-flex: 1 1 auto;
        flex: 1 1 auto;
    }
}

/* Velocity-based custom cursor */
.cursor {
    z-index: 99999;
    pointer-events: none;
    position: fixed;
    inset: 0% auto auto 0%;
    transform: translate3d(-50%, -50%, 0);
    will-change: transform;
}

.cursor-inner {
    width: 1.6em;
}

/* Hide browser default cursor */
html {
    cursor: none !important;
}

/* Ensure no browser cursor appears on any interactive elements */
*,
*:hover,
*:focus,
*:active,
a,
a:hover,
a:focus,
a:active,
button,
button:hover,
button:focus,
button:active,
[data-cursor],
[data-cursor]:hover,
[data-cursor]:focus,
[data-cursor]:active,
.connect-button,
.connect-button:hover,
.connect-button:focus,
.connect-button:active,
.language-toggle,
.language-toggle:hover,
.language-toggle:focus,
.language-toggle:active,
.toc-entry,
.toc-entry:hover,
.toc-entry:focus,
.toc-entry:active,
.fixed-nav-item,
.fixed-nav-item:hover,
.fixed-nav-item:focus,
.fixed-nav-item:active,
.toc-shortcut,
.toc-shortcut:hover,
.toc-shortcut:focus,
.toc-shortcut:active,
.refresh-button-photos,
.refresh-button-photos:hover,
.refresh-button-photos:focus,
.refresh-button-photos:active,
.refresh-button-music,
.refresh-button-music:hover,
.refresh-button-music:focus,
.refresh-button-music:active,
svg,
svg:hover,
svg:focus,
svg:active,
path,
path:hover,
path:focus,
path:active,
#site-title-clickable,
#site-title-clickable:hover,
#site-title-clickable:focus,
#site-title-clickable:active,
h1,
h1:hover,
h1:focus,
h1:active {
    cursor: none !important;
}

/* Hide custom cursor initially */
.cursor {
    display: none;
}

/* Show custom cursor only when user is on the site */
html:hover .cursor {
    display: block;
}

/* Hide custom cursor on touch screens */
@media (hover: none) and (pointer: coarse) {
    .cursor {
        display: none !important;
    }
}

/* Opening Screen - Interactive Dots Grid */
.section-dots {
    background-color: #ffffff;
    color: #333;
    justify-content: center;
    align-items: stretch;
    min-height: 100vh;
    padding: 4em;
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    overflow: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.section-dots.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.section-dots__wrap {
    width: 100%;
    min-height: 30em;
    position: relative;
}

.dots-container {
    gap: 2em;
    pointer-events: none;
    flex-flow: wrap;
    justify-content: center;
    align-items: center;
    display: flex;
    position: absolute;
    inset: 0;
}

.dot {
    will-change: transform, background-color;
    transform-origin: center;
    background-color: #e0e0e0;
    border-radius: 50%;
    width: 1em;
    height: 1em;
    position: relative;
    transform: translate3d(0, 0, 0);
}

.osmo-icon__link {
    color: currentColor;
    text-decoration: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: none;
}

.osmo-icon-svg {
    width: 10em;
    transition: transform 0.3s ease;
}

.osmo-icon-svg.rotating {
    animation: rotateClockwise 2s linear infinite;
}

.osmo-icon-svg.rotating-counter {
    animation: rotateCounterClockwise 2s linear infinite;
}

/* ============================= MAGNETIC CURSOR ============================= */

/* Magnetic Link Styles */
.magnetic-link {
    color: inherit;
    padding: .5em .875em;
    text-decoration: none;
    position: relative;
    display: inline-block;
}

.magnetic-link__inner {
    z-index: 1;
    grid-column-gap: .35em;
    grid-row-gap: .35em;
    justify-content: center;
    align-items: center;
    display: flex;
    position: relative;
}

.magnetic-link__icon {
    justify-content: center;
    align-items: center;
    width: .4em;
    margin-bottom: -.125em;
    display: flex;
}

.magnetic-link__bg {
    z-index: 0;
    border-radius: .25em;
    position: absolute;
    inset: 0%;
    background-color: rgba(51, 51, 51, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Enhanced cursor background for magnetic effect */
.cursor-bg {
    border-radius: inherit;
    background-color: rgba(51, 51, 51, 0.15);
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* When cursor is over magnetic elements */
.magnetic-link .cursor-bg {
    opacity: 0.8;
}

/* Magnetic cursor target styles - replace existing underline hovers */
[data-magnetic-cursor-target] {
    position: relative;
    transition: all 0.3s ease;
}

[data-magnetic-cursor-target]:hover {
    text-decoration: none !important;
}

/* Background element for magnetic targets */
[data-magnetic-cursor-bg] {
    position: absolute;
    inset: 0;
    background-color: rgba(51, 51, 51, 0.1);
    border-radius: 0.25em;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

/* ============================= MAGNETIC HIGHLIGHT ============================= */

/* Cursor highlight element - smooth background highlight */
.cursor-highlight {
    position: absolute;
    inset: -4px;
    background: linear-gradient(135deg,
            rgba(51, 51, 51, 0.08),
            rgba(51, 51, 51, 0.12));
    border-radius: 0.35em;
    opacity: 0;
    transform: scale(0.95);
    transform-origin: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 0;
    pointer-events: none;
    backdrop-filter: blur(2px);
}

/* Magnetic highlight target container */
[data-magnetic-highlight-target] {
    position: relative;
}

/* Individual highlight elements for each target - DISABLED */
.magnetic-highlight {
    display: none !important;
}

/* Active highlight state */
.magnetic-highlight.active {
    opacity: 1;
    transform: scale(1);
}

/* Position highlight relative to the parent element - covers full clickable area */
[data-magnetic-highlight-target] {
    position: relative;
}

/* Position highlight relative to the inner text element */
.magnetic-link__inner {
    position: relative;
    z-index: 1;
}

/* Contents navigation specific highlight styling - DISABLED */
.contents-nav-link .magnetic-highlight {
    display: none !important;
}

.unified-directory-link .magnetic-highlight {
    display: none !important;
}

.contents-nav-title .magnetic-highlight {
    inset: -1px -6px;
    border-radius: 0.25em;
}

.parent-title .magnetic-highlight {
    inset: -1px -6px;
    border-radius: 0.25em;
}

/* Language toggle highlight */
.language-toggle .magnetic-highlight {
    inset: 0px -4px;
    border-radius: 0.25em;
}

/* Directory button highlight */
.directory-button .magnetic-highlight {
    inset: 0px -8px;
    border-radius: 0.3em;
}

@keyframes rotateClockwise {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateCounterClockwise {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(-360deg);
    }
}

/* Media tooltip for hover effects */
.media-tooltip {
    position: fixed;
    min-width: 24px;
    padding: 6px 8px;
    background: black;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
    display: none;
    border-radius: 2px;
    transform: translate(10px, 10px);
}

/* Hide media tooltip on touch screens */
@media (hover: none) and (pointer: coarse) {
    .media-tooltip {
        display: none !important;
    }
}