/* reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* colors */
    --bg-page: #f7f7f9;
    /* page canvas background */
    --text-primary: #1a1a1a;
    /* body text and primary headings */
    --text-secondary: #666666;
    /* secondary text, captions, and muted labels */
    --text-hero: #ffffff;
    /* high-contrast text on hero or dark backgrounds */
    --color-primary: #ff4500;
    /* brand accent, primary buttons, key highlights */
    --color-primary-rgb: 255, 69, 0;
    /* rgb channels for opacity mixing */
    --color-main: var(--color-primary);
    /* alias for primary brand accent */
    --header-link-hover-opacity: 0.08;
    /* site-header link hover background opacity */
    --header-link-hover-bg: rgba(var(--color-primary-rgb), var(--header-link-hover-opacity));
    /* site-header link hover background color */
    --card-bg: rgba(255, 255, 255, 0.7);
    /* glass card and panel background */
    --card-border: #d9d9df;
    /* subtle border for glass cards and panels */
    --header-bg: #242428;
    /* common header gray background */
    --header-border: rgba(255, 255, 255, 0.08);
    /* subtle border for dark header */
    --header-text: #ffffff;
    /* header navigation text */

    /* shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    /* low elevation, default buttons and small items */
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* medium elevation, hovered items and popovers */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
    /* soft ambient shadow for cards and containers */
    --drop-shadow-sm: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    /* subtle outline for small transparent graphics */
    --drop-shadow-md: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
    /* prominent outline for logos and transparent assets */

    /* interactions */
    --hover-darken: brightness(0.90);
    /* slight tone reduction on hover */
    --active-darken: brightness(0.82);
    /* deeper tone reduction on click or press */
    --transition-fast: 0.2s ease;
    /* quick timing for hover, active, and focus states */

    /* fonts: "Inter" for latin/numbers, "Noto Sans CJK JP" for japanese */
    --font-base: 'Inter', 'Noto Sans CJK JP', 'Noto Sans JP', sans-serif;

    /* font size (320px to 1200px) */
    --font-size-100: clamp(0.75rem, 0.73rem + 0.11vw, 0.8125rem);
    /* captions, fine print, and footer text */
    --font-size-200: clamp(0.875rem, 0.85rem + 0.11vw, 0.9375rem);
    /* buttons, navigation links, and small labels */
    --font-size-300: clamp(1rem, 0.97rem + 0.14vw, 1.075rem);
    /* default body reading text */
    --font-size-400: clamp(1.125rem, 1.08rem + 0.23vw, 1.25rem);
    /* subheadings, lead text, and hero subtitle */
    --font-size-500: clamp(1.25rem, 1.1rem + 0.73vw, 1.65rem);
    /* tertiary headings and sub-section titles */
    --font-size-600: clamp(1.4rem, 1.14rem + 1.32vw, 2.125rem);
    /* secondary headings and section titles */
    --font-size-700: clamp(1.65rem, 1.21rem + 2.18vw, 2.85rem);
    /* primary display headings and hero title */
}

html,
body {
    width: 100%;
    min-height: 100%;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-base);
    font-size: var(--font-size-300);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "palt" 1;
    hanging-punctuation: first last;
    text-spacing-trim: trim-start;
}

a {
    color: inherit;
    text-decoration: none;
}

/* layout container */
.site-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1rem 3rem;
}

@media (min-width: 768px) {
    .site-container {
        padding: 1.5rem 2rem 4rem;
    }
}

/* footer */
.site-footer {
    width: 100%;
    padding-top: 1.75rem;
    text-align: center;
}

.site-footer-text {
    color: var(--text-primary);
    opacity: 0.45;
    font-size: var(--font-size-100);
    letter-spacing: 0.03em;
}

/* buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.5rem;
    border-radius: 0.375rem;
    font-size: var(--font-size-200);
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    border: none;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: filter var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
}

.btn:hover {
    filter: var(--hover-darken);
    box-shadow: var(--shadow-md);
}

.btn:active {
    filter: var(--active-darken);
    transform: translateY(1px);
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--text-hero);
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

/* mesh gradient background */
.mesh-bg {
    background-color: #ffa200;
    background-image:
        radial-gradient(80% 80% at 50% 160%, #ffbc85 0%, rgba(255, 188, 133, 0.7) 50%, transparent 100%),
        radial-gradient(85% 85% at 95% 20%, #ba0104 0%, rgba(186, 1, 4, 0.7) 50%, transparent 100%),
        radial-gradient(65% 65% at 55% 15%, #db1102 0%, rgba(219, 17, 2, 0.7) 50%, transparent 100%),
        radial-gradient(50% 50% at 25% 25%, #f36d00 0%, rgba(243, 109, 0, 0.7) 50%, transparent 100%),
        radial-gradient(80% 80% at 85% 85%, #f86f49 0%, rgba(248, 111, 73, 0.7) 50%, transparent 100%),
        radial-gradient(90% 90% at 20% 90%, #ee9905 0%, rgba(238, 153, 5, 0.7) 50%, transparent 100%);
    position: relative;
    isolation: isolate;
}

/* noise overlay */
.mesh-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.8;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    mix-blend-mode: overlay;
    pointer-events: none;
    border-radius: inherit;
}

/* custom elements */
site-header {
    display: block;
    width: 100%;
    position: sticky;
    top: 1rem;
    z-index: 100;
}

@media (min-width: 768px) {
    site-header {
        top: 1.5rem;
    }
}

site-footer {
    display: block;
    width: 100%;
}

/* common header (for subpages) */
.site-header {
    width: 100%;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 50;
    isolation: isolate;
}

/* header blur background */
.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: rgba(247, 247, 249, 0.75);
    border: 1px solid var(--card-border);
    border-radius: inherit;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: -1;
    pointer-events: none;
}

@media (min-width: 768px) {
    .site-header {
        border-radius: 1.25rem;
        padding: 1.25rem;
        margin-bottom: 1.75rem;
    }
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.site-logo {
    display: flex;
    align-items: center;
    line-height: 0;
}

.site-logo-img {
    height: clamp(20px, 3.5vw, 28px);
    width: auto;
    object-fit: contain;
}

/* mobile menu toggle */
.site-menu-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.3125rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 50;
}

.site-menu-toggle-bar {
    width: 20px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 0.125rem;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.site-menu-toggle[aria-expanded="true"] .site-menu-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.site-menu-toggle[aria-expanded="true"] .site-menu-toggle-bar:nth-child(2) {
    opacity: 0;
}

.site-menu-toggle[aria-expanded="true"] .site-menu-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* mobile menu overlay */
.site-menu {
    position: absolute;
    top: calc(100% + 0.625rem);
    right: 0;
    width: max-content;
    list-style: none;
    background-color: rgba(247, 247, 249, 0.8);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    gap: 0.375rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    z-index: 60;
}

.site-menu.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.site-menu-link {
    font-size: var(--font-size-300);
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    text-align: right;
    white-space: nowrap;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.site-menu-link:hover {
    color: var(--color-primary);
    background-color: var(--header-link-hover-bg);
}

/* desktop navigation */
@media (min-width: 768px) {
    .site-menu-toggle {
        display: none;
    }

    .site-menu {
        position: static;
        inset: auto;
        width: auto;
        min-width: auto;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        box-shadow: none;
        border-radius: 0;
        flex-direction: row;
        align-items: center;
        padding: 0;
        gap: 0.5rem;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .site-menu-link {
        font-size: var(--font-size-200);
        font-weight: 500;
        color: var(--text-primary);
        text-align: left;
        padding: 0.375rem 0.875rem;
        border-radius: 0.375rem;
        transition: color var(--transition-fast), background-color var(--transition-fast);
    }

    .site-menu-link:hover {
        color: var(--color-primary);
        background-color: var(--header-link-hover-bg);
    }
}
