/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-card: rgba(26, 31, 58, 0.8);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent-cyan: #00f0ff;
    --accent-magenta: #ff00ff;
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --glow-cyan: rgba(0, 240, 255, 0.5);
    --glow-magenta: rgba(255, 0, 255, 0.5);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #00f0ff 0%, #ff00ff 100%);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-primary: #1a1f3a;
    --text-secondary: #4a5568;
    --accent-cyan: #0891b2;
    --accent-magenta: #c026d3;
    --accent-purple: #7c3aed;
    --accent-blue: #2563eb;
    --glow-cyan: rgba(8, 145, 178, 0.3);
    --glow-magenta: rgba(192, 38, 211, 0.3);
}

/* Light theme header adjustments */
[data-theme="light"] header.main {
    background: linear-gradient(135deg, #d3ecfc 0%, #eeecf7 50%, #d8cbd2 100%);
}

[data-theme="light"] header.main::before {
    background: radial-gradient(circle, rgba(8, 145, 178, 0.15) 0%, transparent 50%),
        radial-gradient(circle, rgba(192, 38, 211, 0.15) 0%, transparent 50%);
}

[data-theme="light"] header.main::after {
    background-image:
        linear-gradient(rgba(8, 145, 178, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(8, 145, 178, 0.1) 1px, transparent 1px);
}

[data-theme="light"] .menu {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--accent-cyan);
}

[data-theme="light"] .menu a {
    color: var(--text-primary);
}

[data-theme="light"] .menu a:hover {
    color: var(--accent-cyan);
}

[data-theme="light"] .code-bg {
    opacity: 0.25;
}

[data-theme="light"] .shader-canvas {
    opacity: 0.5;
}

/* ===== Base Styles ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 10px;
}

body {
    font-family: 'M PLUS Rounded 1c', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: 0.05em;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-text-size-adjust: 100%;
}

.jp {
    font-family: 'Kosugi Maru', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
    position: fixed;
    top: 0.8rem;
    right: 2rem;
    z-index: 1000;
    background: var(--bg-card);
    border: 2px solid var(--accent-cyan);
    border-radius: 50%;
    width: 5rem;
    height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px var(--glow-cyan);
    color: var(--accent-cyan);
    opacity: 0.35;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(360deg);
    box-shadow: 0 0 30px var(--glow-cyan);
    opacity: 1;
}

.theme-toggle svg {
    width: 3rem;
    height: 3rem;
}

[data-theme="dark"] .theme-toggle .moon {
    display: none;
}

[data-theme="light"] .theme-toggle .sun {
    display: none;
}

/* ===== Header Styles ===== */
header.main {
    position: relative;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0a0e27 100%);
    height: 100vh;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Grid pattern overlay */
header.main::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(0, 240, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.05) 1px, transparent 1px);
    background-size: 4px 4px;
    z-index: 1;
}

@keyframes gradientMove {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -50px) rotate(120deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

.menu {
    position: fixed;
    top: -2px;
    left: -2px;
    z-index: 100;
    background: rgba(10, 14, 39, 0.5);
    backdrop-filter: blur(10px);
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 40px color-mix(in srgb, var(--accent-cyan), transparent 70%);
    border-radius: 0 0 3rem 0;
    opacity: 0.35;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.menu:hover {
    opacity: 1;
}

.menu nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    place-items: center;
    gap: 0rem;
    padding: 0.5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.6rem;
    font-weight: 600;
    padding: 1rem 2rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    position: relative;
    transition: all 0.3s ease;
}

.menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gradient-accent);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.menu a:hover {
    color: var(--accent-cyan);
    text-shadow: 0 0 10px var(--glow-cyan);
}

.menu a:hover::after {
    width: 100%;
}

/* WebGL Shader Canvas */
.shader-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.8;
}

/* Code background */
.code-bg {
    position: absolute;
    top: 20%;
    left: 5%;
    right: 5%;
    z-index: 1;
    opacity: 0.15;
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    pointer-events: none;
}

.code-line {
    color: var(--accent-cyan);
    margin: 1.5rem 0;
    animation: codeGlow 3.5s ease-in-out infinite;
}

.code-line:nth-child(2) {
    animation-delay: 0.5s;
}

.code-line:nth-child(3) {
    animation-delay: 1s;
}

.code-line:nth-child(4) {
    animation-delay: 1.5s;
}

.code-line:nth-child(5) {
    animation-delay: 2s;
}

.code-line:nth-child(6) {
    animation-delay: 2.5s;
}

.code-keyword {
    color: var(--accent-magenta);
}

.code-string {
    color: var(--accent-purple);
}

.code-line.indent-1 {
    margin-left: 2rem;
}

@keyframes codeGlow {

    0%,
    100% {
        opacity: 0.3;
        text-shadow: 0 0 5px var(--glow-cyan);
    }

    50% {
        opacity: 0.6;
        text-shadow: 0 0 15px var(--glow-cyan);
    }
}

header.main .inner {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

h1 {
    font-size: clamp(4rem, 8vw, 8rem);
    text-align: center;
    letter-spacing: 0.3em;
    font-weight: 900;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    animation: glow 2s ease-in-out infinite alternate;
}

h1 span {
    display: block;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 400;
    margin: 1em 0 0;
    letter-spacing: 0.5em;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes glow {
    from {
        filter: drop-shadow(0 0 20px var(--glow-cyan));
    }

    to {
        filter: drop-shadow(0 0 40px var(--glow-magenta));
    }
}

/* ===== Section Styles ===== */
section {
    padding: 10rem 4rem;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--accent-cyan), transparent);
    opacity: 0.3;
}

section>div {
    width: 100%;
    max-width: 1600px;
    position: relative;
    z-index: 2;
}

section h2 {
    font-size: clamp(3rem, 5vw, 4.8rem);
    font-weight: 900;
    letter-spacing: 0.2em;
    margin: 0 auto 6rem;
    text-align: center;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

section h2::before {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-accent);
    box-shadow: 0 0 20px var(--glow-cyan);
}

section h2::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    width: 30%;
    height: 3px;
    background: var(--accent-magenta);
    transform: translateX(-50%);
    box-shadow: 0 0 30px var(--glow-magenta);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        width: 30%;
        opacity: 1;
    }

    50% {
        width: 60%;
        opacity: 0.8;
    }
}

/* ===== Section Description ===== */
.section-description {
    font-size: 1.8rem;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.8;
}

/* ===== Services Section ===== */
section#services {
    background: var(--bg-primary);
    min-height: auto;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3rem;
    margin-top: 4rem;
}

.service-card {
    background: var(--bg-card);
    padding: 4rem 3rem;
    border-radius: 20px;
    border: 2px solid transparent;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-accent);
    opacity: 0;
    transition: all 0.5s ease;
    z-index: 0;
}

.service-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-cyan);
    box-shadow: 0 15px 50px var(--glow-cyan);
}

.service-card:hover::before {
    left: 0;
    opacity: 0.15;
}

.service-icon {
    width: 6rem;
    height: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-accent);
    border-radius: 15px;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.service-icon svg {
    width: 3.5rem;
    height: 3.5rem;
    stroke: white;
    stroke-width: 2;
}

.service-card h3 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.service-card p {
    font-size: 1.5rem;
    line-height: 1.8;
    color: var(--text-secondary);
    flex: 1;
    position: relative;
    z-index: 1;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
    position: relative;
    z-index: 1;
}

.tech-tags span {
    padding: 0.5rem 1.5rem;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--accent-cyan);
    border-radius: 20px;
    font-size: 1.2rem;
    color: var(--accent-cyan);
    font-weight: 600;
    transition: all 0.3s ease;
}

.service-card:hover .tech-tags span {
    background: rgba(255, 0, 255, 0.2);
    border-color: var(--accent-magenta);
    color: var(--accent-magenta);
}

/* ===== Stats Section ===== */
.stats-section {
    background: var(--bg-secondary);
    min-height: auto;
    padding: 8rem 4rem;
}

.stats-section::before {
    display: none;
}

.stat-item {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-card);
    border-radius: 20px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.stat-item:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 10px 40px var(--glow-cyan);
    transform: translateY(-5px);
}

.stat-item:hover::before {
    opacity: 0.1;
}

.stat-number {
    font-size: 5rem;
    font-weight: 900;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 1.4rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* ===== About Section ===== */
section#about {
    background: var(--bg-primary);
    min-height: auto;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 6rem;
    margin-top: 4rem;
}

.about-philosophy h3,
.company-details h3 {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3rem;
    text-align: center;
    position: relative;
    padding-bottom: 1.5rem;
}

.about-philosophy h3::after,
.company-details h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--gradient-accent);
}

.philosophy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
}

.philosophy-item {
    background: var(--bg-card);
    padding: 3rem 2.5rem;
    border-radius: 20px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.philosophy-item:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 10px 40px var(--glow-cyan);
    transform: translateY(-5px);
}

.philosophy-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.philosophy-item h4 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
}

.philosophy-item p {
    font-size: 1.4rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.company-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
}

.info-item {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 15px;
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.info-item:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 5px 25px var(--glow-cyan);
    transform: translateX(5px);
}

.info-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.info-content {
    flex: 1;
}

.info-content dt {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.8rem;
}

.info-content dd {
    font-size: 1.6rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.6;
}

/* ===== Contact Section ===== */
section#contact {
    background: var(--bg-primary);
}

section#contact>div>p {
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 4rem;
    color: var(--text-secondary);
    line-height: 2;
}

form {
    max-width: 700px;
    margin: 0 auto;
}

form ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-group {
    width: 100%;
}

.form-control {
    width: 100%;
    padding: 1.5rem;
    font-size: 1.6rem;
    border-radius: 10px;
    border: 2px solid var(--accent-cyan);
    background: var(--bg-card);
    color: var(--text-primary);
    resize: vertical;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-magenta);
    box-shadow: 0 0 20px var(--glow-magenta);
}

.form-group.error .form-control {
    border-color: #ff4444;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.3);
}

.help-inline {
    display: block;
    font-size: 1.4rem;
    margin-top: 0.5rem;
    color: #ff4444;
}

.alert {
    font-size: 1.6rem;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 10px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid #ff4444;
    color: #ff4444;
    display: none;
    text-align: center;
}

.alert h4 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

form ul li:last-child {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

/* ===== Button Styles ===== */
.btn {
    padding: 1.5rem 4rem;
    font-size: 1.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 50px;
    border: 2px solid var(--accent-cyan);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--gradient-accent);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    z-index: -1;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    color: white;
    border-color: var(--accent-magenta);
    box-shadow: 0 5px 30px var(--glow-cyan);
    transform: translateY(-3px);
}

.btn.btn-primary {
    background: var(--gradient-accent);
    border: none;
    color: white;
    box-shadow: 0 5px 20px var(--glow-cyan);
}

.btn.btn-primary:hover {
    box-shadow: 0 8px 40px var(--glow-magenta);
    transform: translateY(-5px);
}

/* ===== Modal Styles ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

.modal .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 39, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal .inner {
    background: var(--bg-card);
    border: 2px solid var(--accent-cyan);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 240, 255, 0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal .header {
    padding: 2.5rem;
    border-bottom: 1px solid var(--accent-cyan);
}

.modal .header h3 {
    font-size: 2.4rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.modal .content {
    padding: 3rem 2.5rem;
    color: var(--text-primary);
}

.modal .content p {
    font-size: 1.6rem;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.modal .content dl {
    margin-bottom: 2rem;
}

.modal .content dt {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.modal .content dd {
    font-size: 1.6rem;
    color: var(--text-primary);
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.modal .footer {
    padding: 2.5rem;
    border-top: 1px solid var(--accent-cyan);
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
}

/* ===== Footer Styles ===== */
footer {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 1.5rem;
    padding: 6rem 2rem;
    text-align: center;
    border-top: 1px solid var(--accent-cyan);
}

/* ===== Responsive Design ===== */
@media screen and (max-width: 1400px) {
    .services-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .philosophy-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media screen and (max-width: 768px) {
    html {
        font-size: 8px;
    }

    .menu nav {
        gap: 1rem;
        padding: 1.5rem;
    }

    .menu a {
        padding: 0.8rem 1.5rem;
        font-size: 1.4rem;
    }

    .theme-toggle {
        top: 7rem;
        right: 1rem;
        width: 4.5rem;
        height: 4.5rem;
    }

    section {
        padding: 8rem 2rem;
        min-height: auto;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .company-info {
        grid-template-columns: 1fr;
    }

    .about-content {
        gap: 4rem;
    }

    form ul li:last-child {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    /* Hide code background on mobile for better readability */
    .code-bg {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    html {
        font-size: 7px;
    }

    h1 {
        letter-spacing: 0.2em;
    }

    section h2 {
        letter-spacing: 0.1em;
    }

    .service-card {
        padding: 3rem 2rem;
    }

    .info-item {
        flex-direction: column;
        text-align: center;
    }
}

/* ===== Scrollbar Styles ===== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-accent);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-magenta);
}
