@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+Sundanese&display=swap');

:root {
  --color-primary: #263f93;
  --color-accent-hover: #335FB3;
  --color-light-bg: #E8EEF7;
  --color-border: #B6D0E2;
  --color-navy-dark: #1a2a5e;
  --color-gold: #DFCE3C;
  --color-page-bg: #f8fafc;
  --color-card-bg: #FFFFFF;
  --color-text-primary: #1a2a5e;
  --color-text-secondary: #4a5568;
  --color-warning: #dc2626;
  --color-success: #16a34a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--color-page-bg);
  color: var(--color-text-primary);
  margin: 0;
}

.font-sunda {
  font-family: 'Noto Sans Sundanese', sans-serif;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: 9999px;
}

::selection {
  background: var(--color-primary);
  color: #fff;
}

/* ---------------------------------------------------------------------
   VISUAL POLISH LAYER
   --------------------------------------------------------------------- */

/* Layered shadow system (per brand spec: subtle, navy-tinted, no black) */
.shadow-brand-sm {
  box-shadow: 0 1px 2px rgba(38, 63, 147, 0.08), 0 2px 6px rgba(38, 63, 147, 0.06);
}
.shadow-brand-md {
  box-shadow: 0 2px 8px rgba(38, 63, 147, 0.08), 0 8px 24px rgba(38, 63, 147, 0.1);
}
.shadow-brand-lg {
  box-shadow: 0 4px 16px rgba(38, 63, 147, 0.1), 0 16px 40px rgba(38, 63, 147, 0.15);
}

/* Nav link underline sweep */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--color-gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease-out;
}
.nav-link:hover::after {
  transform: scaleX(1);
}

/* Buttons: lift + deepen shadow on hover, press down on click */
.btn-lift {
  transition: transform 180ms ease-out, box-shadow 180ms ease-out, background-color 180ms ease-out;
}
.btn-lift:hover {
  transform: translateY(-2px);
}
.btn-lift:active {
  transform: translateY(0);
}

/* Hero decorative texture: soft diagonal weave, evokes woven Sundanese
   textile lines without literally illustrating one */
.hero-texture {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.045) 0px,
    rgba(255, 255, 255, 0.045) 1px,
    transparent 1px,
    transparent 34px
  );
  pointer-events: none;
}

/* Oversized watermark glyph anchoring the hero, echoes the favicon mark */
.hero-watermark {
  position: absolute;
  right: -2vw;
  bottom: -8vw;
  font-family: 'Noto Sans Sundanese', sans-serif;
  font-size: clamp(10rem, 28vw, 22rem);
  line-height: 1;
  color: rgba(255, 255, 255, 0.05);
  pointer-events: none;
  user-select: none;
}

/* Example phrase chips */
.example-chip {
  transition: transform 180ms ease-out, background-color 180ms ease-out, border-color 180ms ease-out;
}
.example-chip:hover {
  transform: translateY(-1px);
  background-color: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Feature icon badges */
.icon-badge {
  width: 3rem;
  height: 3rem;
  border-radius: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-light-bg);
}

/* Feature card lift on hover */
.feature-card {
  transition: transform 200ms ease-out, box-shadow 200ms ease-out, border-color 200ms ease-out;
}
.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-border);
}

/* Tool card top accent bar */
.tool-card {
  position: relative;
  overflow: hidden;
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-gold));
}

/* Output box: gentle inset depth so translated text reads as a distinct surface */
.output-surface {
  box-shadow: inset 0 1px 3px rgba(38, 63, 147, 0.06);
}

/* Hero doodle art: kept in the flank margins outside the centered
   max-w-3xl text column, and low-opacity, so it never competes with
   headline/subtitle contrast. Flanks are desktop-only since that side
   space disappears once the text column goes full-width on mobile. */
.hero-doodle-left,
.hero-doodle-right {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: auto;
  opacity: 0.22;
  pointer-events: none;
  filter: brightness(0) invert(1); /* normalize source grey linework to brand white */
}
.hero-doodle-left {
  left: 2vw;
  width: 190px;
}
.hero-doodle-right {
  right: 3vw;
  top: 38%;
  width: 150px;
}
.hero-skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 70px;
  opacity: 0.15;
  pointer-events: none;
}
@media (min-width: 1024px) {
  .hero-skyline {
    height: 110px;
  }
}

/* Keyboard Latin label toggle */
#keyboardContainer.hide-latin-labels .keyboard-latin-label {
  display: none;
}

/* Language toggle (SU/ID) */
.lang-toggle-btn {
  color: #9ca3af;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: all 180ms ease-out;
}
.lang-toggle-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Bidirectional mode tabs */
.mode-tab {
  transition: all 180ms ease-out;
}
.mode-tab-active {
  background-color: var(--color-primary);
  color: #fff;
}

/* Character counter states */
.counter-warn {
  color: var(--color-gold) !important;
}
.counter-danger {
  color: var(--color-warning) !important;
}

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.toast-show {
  animation: slideUp 0.3s ease-out;
}

.modal-backdrop {
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  animation: scaleIn 0.3s ease-out;
}

/* Virtual keyboard key press */
.keyboard-key {
  transition: transform 200ms ease-out, background-color 200ms ease-out;
}
.keyboard-key:active {
  transform: scale(0.95);
}

/* AdSense placeholders — reserve space to prevent layout shift (CLS) */
.adsense-slot {
  min-height: 96px;
}
.adsense-slot-sidebar {
  min-height: 384px;
}

/* Mobile menu */
#mobileMenu {
  animation: slideUp 0.2s ease-out;
}

/* Focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--color-accent-hover);
}

/* Transitions default */
a, button, input, textarea {
  transition: all 200ms ease-out;
}

/* Responsive tweaks */
@media (max-width: 375px) {
  .hero-title {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}

@media (max-width: 1024px) {
  .sidebar-slot {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
