/* Variables */
:root {
    --bg-color: #0a0a0a;
    --text-color: #ffffff;
    --text-muted: #aaaaaa;
    --primary-color: #00CADC; 
    --accent-hover: #00aebc;
    --font-en: 'Montserrat', 'Inter', sans-serif;
    --font-jp: 'Noto Sans JP', sans-serif;
    
    /* 背景透過設定 */
    --bg-glass: rgba(10, 10, 10, 0.5); 
    --bg-glass-darker: rgba(5, 5, 5, 0.7);
    --bg-card: rgba(30, 30, 30, 0.6);
}

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

html {
    scroll-behavior: smooth;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-color);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-jp);
    line-height: 1.8;
    letter-spacing: 0.05em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased; /* Safari font rendering */
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

/* --- Cyber Grid Background (Compatibility Fix) --- */
.bg-cyber-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Mobile Safari fix */
    z-index: -1; 
    background-size: 50px 50px;
    background-image:
        linear-gradient(rgba(0, 202, 220, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 202, 220, 0.3) 1px, transparent 1px);
    transform-origin: top center;
    transform: perspective(500px) rotateX(10deg) scale(1.5);
    animation: gridScroll 15s linear infinite;
    /* Cross-browser mask */
    mask-image: radial-gradient(circle at center, black 60%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle at center, black 60%, transparent 100%);
}

@keyframes gridScroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 50px; }
}

main, header, footer {
    position: relative;
    z-index: 10;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-en);
    font-weight: 700;
}

.section-subtitle {
    display: block;
    color: var(--primary-color);
    font-family: var(--font-en);
    font-size: 0.9rem;
    margin-bottom: 10px;
    letter-spacing: 0.2em;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 40px;
    line-height: 1.2;
}

/* Helper Classes */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

.bg-darker {
    background-color: var(--bg-glass-darker);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px); /* Safari support */
}

.highlight {
    color: var(--primary-color);
    font-weight: bold;
}

.center {
    text-align: center;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    background-color: var(--primary-color);
    color: #000;
    padding: 15px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    z-index: 1;
    border: none;
    cursor: pointer;
    text-shadow: none !important;
    /* Mobile tap highlight fix */
    -webkit-tap-highlight-color: transparent;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 0%; height: 100%;
    background-color: #fff;
    transition: width 0.3s ease;
    z-index: -1;
}

.btn-primary:hover::before {
    width: 100%;
}

.btn-large {
    width: 100%;
    max-width: 300px;
}

/* Loading */
#loading {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    height: 100dvh; /* Mobile Safari fix */
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-logo {
    font-family: var(--font-en);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #fff;
}

.loader-bar {
    width: 0;
    height: 2px;
    background: var(--primary-color);
    animation: loadBar 1.5s ease-in-out forwards;
}

@keyframes loadBar {
    0% { width: 0; }
    100% { width: 100px; }
}

/* Header */
#header {
    position: fixed;
    top: 0; left: 0; width: 100%;
    padding: 15px 40px;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo Styling */
.logo a {
    display: inline-block;
    background: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    line-height: 1;
}

.logo-img {
    height: 30px;
    width: auto;
    vertical-align: bottom;
}

.nav-list {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-list a {
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-en);
}

.nav-list a:hover {
    color: var(--primary-color);
}

.btn-nav {
    border: 1px solid #fff;
    padding: 8px 20px;
    border-radius: 30px;
}

.btn-nav:hover {
    background: #fff;
    color: #000 !important;
}

/* First View */
.fv {
    height: 100vh;
    height: 100dvh; /* Mobile fix */
    width: 100%;
    display: flex;
    align-items: center;
    position: relative;
    padding: 0 10%;
    overflow: hidden;
    background: url('kv.png') no-repeat center center;
    background-size: cover;
}

#fv-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; 
    opacity: 0;
    transition: opacity 1s ease;
}

.fv-content {
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
    z-index: 10;
}

.fv-sub {
    color: var(--primary-color);
    font-family: var(--font-en);
    margin-bottom: 20px;
    font-weight: 700;
}

.fv-title {
    font-size: 4.5rem;
    line-height: 1.1;
    margin-bottom: 30px;
}

.fv-jp {
    font-size: 1.1rem;
    margin-bottom: 50px;
    color: var(--primary-color);
    font-weight: 500;
}

/* Mission */
.section {
    padding: 100px 0;
    position: relative;
    background-color: var(--bg-glass);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.mission-body {
    max-width: 800px;
    margin-bottom: 60px;
}

.text-lead {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 30px;
}

.strengths.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.strength-card {
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-card);
    border-radius: 8px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.strength-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
}

.strength-card .icon {
    font-size: 3rem;
    font-family: var(--font-en);
    color: var(--primary-color);
    opacity: 0.3;
    margin-bottom: 10px;
}

.strength-card h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

/* Service */
.service-list {
    display: grid;
    gap: 30px;
}

.service-item {
    background: var(--bg-card);
    padding: 40px;
    border-left: 4px solid var(--primary-color);
    transition: background 0.3s ease;
}

.service-item:hover {
    background: rgba(40, 40, 40, 0.7);
}

.service-content-wrapper {
    width: 100%;
}

.service-head {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.service-head h3 {
    font-family: var(--font-en);
    font-size: 1.8rem;
    margin-bottom: 5px;
    color: #fff;
}

.service-cat {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 700;
}

.service-body {
    color: #ddd;
}

.service-desc {
    margin-bottom: 20px;
    line-height: 1.8;
}

.service-detail-list {
    list-style: none;
    margin-top: 15px;
}

.service-detail-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.service-detail-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.service-detail-list strong {
    color: #eee;
    margin-right: 5px;
}

/* Tech Stack Marquee */
.tech-stack {
    margin-top: 80px;
    overflow: hidden;
}

.tech-label {
    text-align: center;
    font-family: var(--font-en);
    margin-bottom: 20px;
    color: #555;
    font-size: 0.9rem;
}

.marquee-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

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

.marquee-content span {
    display: inline-block;
    margin: 0 30px;
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 1.2rem;
    color: #444;
}

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

/* Works */
.works-carousel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.work-card {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.work-img {
    height: 200px;
    background-color: #333;
    position: relative;
}

.placeholder-img::after {
    content: 'Project Image';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #555;
    font-family: var(--font-en);
}

.work-content {
    padding: 25px;
}

.work-cat {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-family: var(--font-en);
}

.work-stats {
    margin: 15px 0;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 0;
}

.work-stats li {
    margin-bottom: 5px;
}

.work-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Company */
.company-list {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.company-list .row {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
}

.company-list dt {
    width: 200px;
    font-weight: 700;
    color: #888;
}

.company-list dd {
    flex: 1;
}

/* Contact */
.contact-container {
    max-width: 800px;
}

.contact-lead {
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
}

.required {
    color: var(--primary-color);
    font-size: 0.8rem;
    margin-left: 5px;
}

input, textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    padding: 15px;
    color: #fff;
    border-radius: 5px;
    font-family: inherit;
    /* iOS input style reset */
    appearance: none;
    -webkit-appearance: none;
    border-radius: 5px; /* Re-apply radius */
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-submit {
    text-align: center;
    margin-top: 40px;
}

#form-response {
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
    display: none;
}
.success-msg { color: var(--primary-color); }
.error-msg { color: #ff4444; }

/* Footer */
#footer {
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid #222;
    background-color: var(--bg-glass-darker);
}

.footer-logo {
    margin-bottom: 20px;
}

.footer-logo .logo-img {
    height: 40px;
    background: #fff;
    padding: 5px 10px;
    border-radius: 4px;
}

.copyright {
    color: #666;
    font-size: 0.8rem;
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInAnim 0.8s forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

@keyframes fadeInAnim {
    to { opacity: 1; transform: translateY(0); }
}

.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.scroll-reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .fv-title { font-size: 2.5rem; }
    .nav { display: none; }
    .company-list .row { flex-direction: column; }
    .company-list dt { width: 100%; margin-bottom: 5px; }
    
    .hamburger { display: block; position: relative; width: 30px; height: 20px; cursor: pointer; }
    .hamburger span { position: absolute; width: 100%; height: 2px; background: #fff; transition: 0.3s; }
    .hamburger span:nth-child(1) { top: 0; }
    .hamburger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
    .hamburger span:nth-child(3) { bottom: 0; }
    
    .hamburger.active span:nth-child(1) { transform: rotate(45deg); top: 9px; }
    .hamburger.active span:nth-child(2) { opacity: 0; }
    .hamburger.active span:nth-child(3) { transform: rotate(-45deg); bottom: 9px; }
}