/* 1. Global variables & reset (dark mode) */
:root {
    --color-bg: #0A0A0A;
    --color-text-main: #FAFAFA;
    --color-text-muted: #888888;
    --color-watermark: #121212;
    --color-hanko-red: #C8242B;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Inter', -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* 2. Background kanji animation */
.watermark-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    user-select: none;
}

.kanji-bg {
    position: absolute;
    font-size: min(60vh, 80vw);
    color: var(--color-watermark);
    font-family: var(--font-serif);
    opacity: 0;
    animation: fadeCycle 15s infinite ease-in-out;
}

@keyframes fadeCycle {
    0% {
        opacity: 0;
        transform: scale(0.98);
    }

    5% {
        opacity: 1;
        transform: scale(1);
    }

    28% {
        opacity: 1;
        transform: scale(1);
    }

    33% {
        opacity: 0;
        transform: scale(1.02);
    }

    100% {
        opacity: 0;
    }
}

/* Stagger at D/3 and 2D/3 of the 15s cycle — keep in step with it */
.kanji-bg:nth-child(1) {
    /* 正 integrity */
    animation-delay: 0s;
}

.kanji-bg:nth-child(2) {
    /* 誠 sincerity */
    animation-delay: 5s;
}

.kanji-bg:nth-child(3) {
    /* 清 purity */
    animation-delay: 10s;
}

/* 3. Main content */
.content-wrapper {
    position: relative;
    z-index: 1;
    text-align: center;
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    margin-top: auto;
    margin-bottom: auto;
}

h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.accent-line {
    width: 40px;
    height: 2px;
    background-color: var(--color-hanko-red);
    margin: 0 auto 2.5rem auto;
    opacity: 0.8;
}

.btn-primary {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 1rem 3.5rem;
    background-color: transparent;
    color: var(--color-text-main);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.btn-primary:hover {
    background-color: var(--color-text-main);
    color: var(--color-bg);
    border-color: var(--color-text-main);
}

/* 4. Philosophy launcher — absolute so the header stays viewport-centered */
.philosophy-bar {
    position: absolute;
    bottom: 3rem;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 1;
}

/* 5. Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #111;
    width: 90%;
    max-width: 450px;
    padding: 4rem 2.5rem;
    position: relative;
    border: 1px solid #222;
    /* Scrolls only when content exceeds the viewport — inert when it fits */
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    transform: translateY(30px);
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    font-weight: 200;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--color-text-main);
}

.modal-header {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    margin-bottom: 2rem;
    text-align: center;
}

.form-group {
    margin-bottom: 2rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    padding: 0.8rem 0;
    border: none;
    border-bottom: 1px solid #333;
    background: transparent;
    color: var(--color-text-main);
    outline: none;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    border-bottom-color: var(--color-hanko-red);
}

.btn-submit {
    width: 100%;
    padding: 1.2rem;
    background-color: transparent;
    border: 1px solid var(--color-text-main);
    color: var(--color-text-main);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.btn-submit:hover {
    background-color: var(--color-hanko-red);
    border-color: var(--color-hanko-red);
    color: white;
}

.form-status {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    display: none;
}

.philosophy-text {
    font-size: 0.85rem;
    line-height: 1.7;
    font-weight: 300;
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
}

.philosophy-list {
    padding-left: 1.1rem;
    font-size: 0.85rem;
    line-height: 1.7;
    font-weight: 300;
    color: var(--color-text-muted);
}

.philosophy-list li {
    margin-bottom: 0.9rem;
}

.philosophy-list li:last-child {
    margin-bottom: 0;
}

/* 500 is the heaviest Inter weight loaded — never 700, which would synthesize */
.philosophy-list strong {
    color: var(--color-text-main);
    font-weight: 500;
}

/* 6. Responsive — the stacking rules are 404-only; home stays viewport-centered */
@media (max-width: 850px) {
    body.page-404 {
        overflow-y: auto;
        height: auto;
        display: block;
    }

    .page-404 .content-wrapper {
        margin-top: 15vh;
        margin-bottom: 10vh;
    }

    .philosophy-bar {
        bottom: 2rem;
    }
}

.hidden-honeypot {
    display: none !important;
}

/* 7. 404 page */
.page-404 .content-wrapper {
    max-width: 640px;
}

.error-code {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    letter-spacing: 0.3em;
    color: var(--color-hanko-red);
    margin-bottom: 1rem;
}

.page-404 h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    margin-bottom: 0.75rem;
}

.error-message {
    font-size: 0.85rem;
    line-height: 1.7;
    font-weight: 300;
    color: var(--color-text-muted);
    max-width: 420px;
    margin: 0 auto 2.5rem auto;
}

/* .btn-primary is a <button> on the home page, an <a> here */
a.btn-primary {
    display: inline-block;
    text-decoration: none;
}
