:root {
  --spratley-bg-true-deep: #127578;
  --spratley-bg-deep: #139595;
  --spratley-bg-light: #24c4c4;
  --spratley-bg-black: #0D1321;
  --spratley-pop-red: #EB362D;
  --spratley-pop-yellow: #E9C46A;
  --transition-speed: 0.3s;
}

@font-face {
  font-family: 'Kiwi Maru';
  src: url('/Fonts/KiwiMaru-Regular.woff2') format('woff2'),
       url('/Fonts/KiwiMaru-Regular.woff') format('woff');
  font-weight: normal; font-style: normal; font-display: swap;
}

/* Base Styles */
* { margin: 0; padding: 0; }

body, html {
  font-family: "Kiwi Maru", serif;
  font-weight: 400;
  font-style: normal;
  background-color: var(--spratley-bg-black);
}
ul { list-style-type: none; }
.container { max-width: 1400px; margin: auto; }

/* Header */
.main-header { position: relative; width: 100%; background-color: var(--spratley-bg-black); }
.header-flex { display:flex; width: 100%; align-items: center; justify-content: space-between; padding: 20px 10px 25px;}

.spratley-brand { display: flex; align-items: center; gap: 10px; color: white; text-decoration: none; }
.spratley-brand h1 { font-size: 60px; line-height: 1.5; }

.translation { font-size: 24px; position: relative; display: inline-block; width: max-content; }
.translation span:not(.sizer) { position: absolute; inset: 0; transition: opacity 0.5s; }
.translation .en, .translation:hover .jp { opacity: 0; }
.translation .jp, .translation:hover .en { opacity: 1; }
.translation .sizer { visibility: hidden; }

.spratley-logo { 
  background: repeating-radial-gradient(circle at center, var(--spratley-bg-deep), var(--spratley-bg-deep) 5%, var(--spratley-bg-light) 5%, var(--spratley-bg-light) 10%);
  border-radius: 50%; padding: 7px 10px 8px 0px; transition: transform var(--transition-speed) ease; 
}
.spratley-logo:hover { transform: scale(1.01) rotate(5deg); }
.spratley-logo img { height: 130px; width: auto; display: block; }

.header-social { color: white; display: flex; align-items: center; gap: 25px; text-align: center; }
.header-social img { height: 80px; width: auto; }
.social-icon { transition: transform var(--transition-speed) ease; }
.social-icon:hover { transform: scale(1.1) rotate(-3deg); }

@media screen and (max-width: 1076px) {
    .header-flex { flex-wrap: wrap; row-gap: 3vw; justify-content: center; box-sizing: border-box; }

    .spratley-brand h1 { font-size: 8vw; margin: 0; }
    .spratley-logo img { height: 14vw; }

    .translation { font-size: 4vw; }

    .header-social { gap: 4vw; }
    .header-social p { font-size: 2vw; }
    .header-social img { height: 10vw; }
}

/* Reusable Components */
.sine-wave { width: 100%; height: 8px; animation: scroll-horizontal 4s linear infinite; }
.sine-wave.is-dark { background: url('/Images/Sine_Dark.webp'); }
.sine-wave.is-teal { background: url('/Images/Sine_Teal.webp'); }
.sine-wave.is-red { background: url('/Images/Sine_Red.webp'); }
.sine-wave.is-yellow { background: url('/Images/Sine_Yellow.webp'); }

.section { width: 100%; position: relative; }
.section.is-teal { background: linear-gradient(to bottom, #5ee2e2, var(--spratley-bg-light)); }
.section.is-red { background: linear-gradient(to bottom, #ed544b, var(--spratley-pop-red)); color: white; text-align: center; }
.section.is-yellow { background: linear-gradient(to bottom, #f9ca24, var(--spratley-pop-yellow)); color: var(--spratley-bg-black); text-align: center; }

.section-body { max-width: 1000px; padding: 30px 20px 45px; font-size: 25px; font-weight: 500; color: black; box-sizing: border-box;}
.section-body h2 { text-align: center; margin: 0 0 15px;}

/* Stats Section */
.stats-container { display: flex; flex-direction: column; align-items: center; gap: 35px; }
.stat-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.stat-card h3 { font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.5em; opacity: 0.7; margin: 0 0 5px; font-weight: 800; }
.stats-number { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; }

.time-block { 
  display: flex; flex-direction: column; align-items: center; min-width: 90px; 
  background: rgba(0,0,0,0.2); padding: 5px 4px; border-radius: 5px; box-shadow: 0 4px 6px rgba(0,0,0,0.5); 
}
.time-block .val { font-size: 64px; font-weight: 900; color: var(--spratley-pop-red); line-height: 1; }
.time-block .lab { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.15em; margin-top: 8px; opacity: 0.8; }
.time-block:nth-child(3) { margin-right: 18px; }

/* Work Cards */
.work-title {
  margin: 0.67em 0;
}
.work-card-container { 
  display: flex; align-items: center; justify-content: center; gap: 50px; 
  max-width: 1100px; margin: auto; padding: 20px 20px 80px; 
}
.work-text-side { flex: 1; text-align: left; }
.work-text-side h1 { margin: 0 0 8px; font-size: 36px; }
.role-highlight { font-weight: 700; font-size: 20px; color: var(--spratley-pop-yellow); margin: 8px 0 12px; }

.work-visual-side { flex: 1; perspective: 1000px; }
.work-visual-side a { display: block; }

/* Optimized Tilt logic using CSS variables */
.tilt-wrapper { 
  transition: transform 0.5s ease; transform-style: preserve-3d; 
  --dir: 1; transform: rotateY(calc(var(--dir) * -15deg)) rotateX(5deg);
}
.tilt-wrapper.is-left { --dir: -1; }
.work-visual-side:hover .tilt-wrapper { transform: rotateY(calc(var(--dir) * -5deg)) rotateX(0deg) scale(1.05); }

.tilt-img { 
  max-width: 75%; height: auto; border-radius: 8px; border: 2px solid var(--spratley-bg-black); 
  filter: drop-shadow(0 0 15px rgba(0,0,0,0.2));
  box-shadow: 20px 20px 0px rgba(0,0,0,0.2), -5px 5px 20px rgba(0,0,0,0.4); 
}

/* Language Toggle */
.language-switcher-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.language-menu {
  display: flex;
  flex-direction: column;
  background-color: var(--spratley-bg-black);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  min-width: 120px;

  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition-speed) ease, 
              transform var(--transition-speed) ease, 
              visibility 0s linear var(--transition-speed);

  pointer-events: none;
}

.language-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.language-menu button {
  color: white;
  padding: 12px 20px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--transition-speed) ease;
  font-family: "Kiwi Maru", serif;
}

.language-menu button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.language-menu button.active-language {
  color: var(--spratley-pop-red);
  font-weight: bold;
  background-color: rgba(255, 255, 255, 0.05);
}

.language-menu button.active-language::before {
  content: "•";
  margin-right: 8px;
  color: var(--spratley-pop-red);
}

.language-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--spratley-bg-black);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.language-button:hover {
  transform: scale(1.1);
  background-color: var(--spratley-pop-red);
}

.language-button img {
  width: 28px;
  height: auto;
}

/* Footer */
.main-footer { background-color: var(--spratley-bg-black); color: white; text-align: center; padding-bottom: 20px; }

/* Animations */
@keyframes scroll-horizontal { from { background-position: 0 0; } to { background-position: 256px 0; } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px) rotate(-1deg); }
  50% { transform: translateX(5px) rotate(1deg); }
  75% { transform: translateX(-5px) rotate(-1deg); }
}
.shake-element { animation: shake 0.3s ease-in-out; }