/* ================================================
   d-studio Corporate Site - Main Stylesheet
   ================================================ */

/* --- CSS Variables --- */
:root {
    --primary: #2563EB;
    --accent: #06B6D4;
    --dark: #0F172A;
    --light: #F8FAFC;
}

/* --- Base Settings --- */
body {
    font-family: 'Space Grotesk', 'Noto Sans JP', sans-serif;
    background-color: #FFFFFF;
    color: var(--dark);
    overflow-x: hidden;
    cursor: none;
}

/* --- Noise Overlay --- */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://grainy-gradients.vercel.app/noise.svg');
    opacity: 0.04;
    pointer-events: none;
    z-index: 9990;
}

/* --- Grid Background --- */
.grid-bg {
    background-size: 60px 60px;
    background-image:
        linear-gradient(to right, rgba(15, 23, 42, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
    position: absolute;
    inset: 0;
    z-index: -2;
    height: 100vh;
}

/* --- Custom Cursor --- */
.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, background-color 0.3s;
}

.cursor-circle {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(37, 99, 235, 0.3);
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: all 0.15s ease-out;
}

body.hovering .cursor-circle {
    width: 60px;
    height: 60px;
    border-color: var(--accent);
    background-color: rgba(6, 182, 212, 0.05);
    mix-blend-mode: difference;
}

body.hovering .cursor-dot {
    width: 12px;
    height: 12px;
    background: var(--accent);
}

/* --- Page Transition --- */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2563EB, #06B6D4);
    z-index: 9999;
    transform: translateY(-100%);
    pointer-events: none;
}

/* --- Scroll Progress --- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #2563EB, #06B6D4);
    z-index: 9998;
    transition: width 0.1s ease;
}

/* --- Text Gradient --- */
.text-gradient {
    background: linear-gradient(135deg, #2563EB, #06B6D4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Reveal Text Animation --- */
.reveal-text {
    overflow: hidden;
}

.reveal-text span {
    display: block;
    transform: translateY(100%);
}

/* --- Marquee Animation --- */
.marquee-wrapper {
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-block;
    animation: marquee 20s linear infinite;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- Tech Scroll Animation --- */
.tech-track {
    display: flex;
    width: max-content;
    animation: scroll 40s linear infinite;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- Image Reveal Animation --- */
.img-reveal {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1s cubic-bezier(0.77, 0, 0.175, 1);
}

.img-reveal.active {
    clip-path: inset(0 0 0 0);
}

/* --- Hover Zoom --- */
.hover-zoom img {
    transition: transform 0.7s ease;
}

.hover-zoom:hover img {
    transform: scale(1.05);
}

/* --- Logo Animation --- */
.logo-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawLogo 2s cubic-bezier(0.87, 0, 0.13, 1) forwards 1s;
}

@keyframes drawLogo {
    to { stroke-dashoffset: 0; }
}

/* --- Glassmorphism --- */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* --- Value Card Animation --- */
.value-card .value-keyword {
    display: inline-block;
    transition: transform 0.4s ease, letter-spacing 0.4s ease;
}

.value-card:hover .value-keyword {
    transform: scale(1.05);
    letter-spacing: 0.1em;
}

.value-card .value-text {
    transition: transform 0.4s ease;
}

.value-card:hover .value-text {
    transform: translateY(-4px);
}

/* --- Magnetic Button --- */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Card Flip --- */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* --- Gradient Border Animation --- */
@keyframes borderGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.gradient-border {
    background: linear-gradient(90deg, #2563EB, #06B6D4, #2563EB);
    background-size: 200% 200%;
    animation: borderGradient 3s ease infinite;
}

/* --- Ripple Effect --- */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.3) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: transform 0.6s, opacity 0.6s;
}

.ripple:hover::after {
    transform: scale(2);
    opacity: 1;
}

/* --- Form Styles --- */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* --- Contact Card Animation --- */
.contact-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* --- Fade In Animation --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Spin Slow Animation --- */
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin-slow {
    animation: spin-slow 3s linear infinite;
}

/* --- Pulse Animation --- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --- Bounce Animation --- */
@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.animate-bounce {
    animation: bounce 1s infinite;
}

/* --- Timeline Styles (Company Page) --- */
.timeline-item {
    position: relative;
    padding-left: 40px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 24px;
    width: 2px;
    height: calc(100% - 16px);
    background: #e2e8f0;
}

.timeline-item:last-child::after {
    display: none;
}

/* --- Typing Effect --- */
.typing-effect {
    overflow: hidden;
    white-space: pre-wrap;
    animation: typing 2s steps(40, end);
}

@keyframes typing {
    from { max-height: 0; }
    to { max-height: 200px; }
}

/* ================================================
   Page-Specific Styles
   ================================================ */

/* --- Services Page --- */
.tech-logo {
    transition: transform 0.3s ease;
}

.tech-logo:hover {
    transform: translateY(-5px) scale(1.05);
}

.timeline-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.timeline-line.active {
    animation: drawLine 2s ease forwards;
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.accordion-content.active {
    max-height: 500px;
}

/* --- Works Page --- */
.filter-tab {
    position: relative;
    padding-bottom: 0.5rem;
}

.filter-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #2563EB, #06B6D4);
    transition: width 0.3s ease;
}

.filter-tab.active::after {
    width: 100%;
}

.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-3d:hover {
    transform: rotateX(2deg) rotateY(5deg) translateY(-10px);
}

.quote-mark {
    font-size: 8rem;
    line-height: 1;
    opacity: 0.1;
    font-family: Georgia, serif;
}

/* --- Company Page --- */
.team-card {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.team-card:hover {
    transform: translateY(-10px);
}

.team-card:hover .team-overlay {
    opacity: 1;
}

.team-overlay {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.value-icon {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.value-card:hover .value-icon {
    transform: rotate(360deg) scale(1.1);
}

.timeline-dot {
    transition: all 0.3s ease;
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.5);
    background: linear-gradient(135deg, #2563EB, #06B6D4);
}

/* --- Blog Page --- */
.category-pill {
    transition: all 0.3s ease;
}

.category-pill.active {
    background: linear-gradient(135deg, #2563EB, #06B6D4);
    color: white;
}

.search-input:focus {
    outline: none;
    border-color: #2563EB;
}

.blog-card {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.blog-card:hover {
    transform: translateY(-8px);
}

/* --- Contact Page --- */
.toast {
    position: fixed;
    bottom: -100px;
    right: 2rem;
    background: linear-gradient(135deg, #2563EB, #06B6D4);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transition: bottom 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.toast.show {
    bottom: 2rem;
}
