
/* =========================
   BODY + BACKGROUND
========================= */

body {
  margin: 0;
  min-height: 100vh;
  background: #f3efea;
  position: relative;
  --noise-opacity: 0.32;
}

body::before {
  content: "";
  position:absolute;
  inset: 0;
  pointer-events: none;

  opacity: var(--noise-opacity);

  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='450' height='450'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.18' numOctaves='6' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='450' height='450' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");

  background-repeat: repeat;
  background-size: 500px 500px;
  z-index: -1;
}

.kulitan-mode-btn {
    padding: 10px 18px;
    border-radius: 6px;
    background: #2b2b2b;
    color: white;
    border: none;
    cursor: pointer;
    transition: 0.3s;
}

.kulitan-mode-btn.active {
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(2px);
    color: black;
}

.kulitan-mode-btn.night {
    background: #121212;
    color: #e0e0e0;
}

.kulitan-layer-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1rem;
}

.kulitan-layer-btn {
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(0,0,0,0.08);
  font-size: 0.85rem;
}

.kulitan-svg-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.kulitan-download {
  margin-top: 0.8rem;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(0,0,0,0.12);
}

.kulitan-layer-btn.active {
  background: rgba(0,0,0,0.25);
  font-weight: bold;
}

.kulitan-stack {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.kulitan-layer {
  position: absolute;
  max-width: 100%;
  height: auto;
  transition: opacity 0.2s ease;
}

.kulitan-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kulitan-controls {
  display: flex;
  justify-content: flex-start;
}

.kulitan-stage {
  display: flex;
  justify-content: center;
  align-items: center;
}

.kulitan-base {
  width: 1080px;
}


/* =========================
   HEADER
========================= */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: #2b2b2b;
    color: white;
    position: relative;
}

header nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2rem;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1;
}

.home-logo {
  height: 42px;
  width: auto;
  display: block;
}

.home-title {
    font-weight: 700;
    z-index: 1;
}

.home-sub {
    font-size: 0.9rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

/* =========================
   HERO SECTION
========================= */
.hero {
    text-align: center;
    color: white;
    background:
        linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)),
        url('../SVG/508280499_9383712238395196_8095674442001729245_n.jpg') center/cover no-repeat;
}

.hero h1 {
    font-size: 2.8rem;
}

.hero p {
    font-size: 1.2rem;
    margin-top: 1rem;
}

/* =========================
   SECTIONS
========================= */

section {
    padding: 4rem 2rem;
    text-align: center;
}

.about, .mission-fade-in, .story-fade-in, .importance-fade-in{
    padding-left: 25%;
    padding-right: 25%;
    padding-bottom: 0%;
}

/* =========================
   CARDS + STEPS
========================= */

.letter-filter {
    display: none;
    padding: 0%;
}

/* =========================
   LANGUAGE TOGGLE
========================= */
.enkp {
    z-index: 1;
}

.enkp button {
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 1.8rem;
    cursor: pointer;
    font-size: 1rem;
    background: #f2f2f2;
    color: #333;
    display: flex;
    gap: 0.4rem;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.enkp button span.active {
    color: #000;
}

.enkp button span.inactive {
    color: #e64403;
}


.letter-btn {
    display: none;
    border: none;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    gap: 0.4rem;
    font-weight: 600;
    background: none;
    padding: 0;
}


/* =========================
   SECTIONS AND CARDS
========================= */


.steps {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-bottom: 1rem;
}

.cards {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-bottom: 5rem;

}

.step {
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(2px);
    padding: 1.5rem;
    border-radius: 1rem;
    width: 280px;    
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.card {
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(2px);
    padding: 1.5rem;
    border-radius: 1rem;
    width: 350px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.step-kulitan {
    padding: 1.5rem;
    border-radius: 1rem;
    height: 280px;
}



body.night .card,
body.night .step {
    background: #2b2b2b;
    color: #e0e0e0;
}

/* =========================
   LINKS AND CARD BEHAVIOR
========================= */
.card,
.card * {
    color: inherit;
    text-decoration: none;
}

.card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.card {
    display: block;
    transition: transform 0.2s, box-shadow 0.2s;

}

/* =========================
   COLLAPSIBLE AS "MORE INFO"
========================= */

.collapsible {
  margin-top: 56px;
  border-top: 1px solid rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(0,0,0,0.35);
}

.collapsible-toggle {
  margin-left: 1%;
  padding: 18px 0;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.collapsible-toggle:hover {
  opacity: 0.85;
}

.collapsible-toggle::after {
  content: "›";
  font-size: 1.4rem;
  transition: transform 0.25s ease;
}

.collapsible.active .collapsible-content {
  display: flex;
  flex-wrap: wrap;
}

.collapsible.open .collapsible-toggle::after {
  transform: rotate(90deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}

.collapsible.open .collapsible-content {
  max-height: none;
  opacity: 1;
}
/* Night mode */
body.night .collapsible-toggle {
  border-top: 1px solid rgba(0,0,0,0.08);
}


.meaning-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meaning-item {
  padding: 12px;
  border-left: 3px solid #ccc;
}

.meaning-definition {
  font-weight: 600;
  margin-bottom: 8px;
}

.meaning-examples {
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.example-en {
  font-size: 0.95rem;
}

.example-kp {
  font-size: 0.85rem;
  opacity: 0.7;
}


.view-base .kulitan-stack,
.view-base .kulitan-layer-controls,
.view-base .kulitan-download {
  display: none;
}

.view-segmentation .kulitan-stack,
.view-segmentation .kulitan-layer-controls {
  display: block;
}

.view-full .kulitan-stack,
.view-full .kulitan-layer-controls,
.view-full .kulitan-download {
  display: block;
}


.reference-list {
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.8;
}

.reference-list li {
  margin-bottom: 1rem;
}

.reference-list a {
  margin-left: 0.5rem;
}

/* =========================
    WORD PAGE LAYOUT
 ========================= */
.word-page {
  max-width: 1100px;
  margin: 0 auto;
}

body.night .word-page {
  background: transparent;
}

body.night .kulitan-label {
  color: rgba(255,255,255,0.5);
}

body.night .collapsible {
  border-color: rgba(255,255,255,0.2);
}

body.night .meta-label {
  opacity: 0.45;
}

.word-speech {
  margin-top: 18px;
  font-size: 1.8rem;
  font-style: italic;
  font-weight: 700;
  text-align: left;
}

/* =========================
   PRONUNCIATION
========================= */

#textPronunciation {
  margin-top: 12px;
  font-size: 1rem;
  opacity: 0.7;
}

.information {
  max-width: 100%;
  margin: 0 auto;
}



/* =========================
   KULITAN HERO
========================= */

.kulitan-hero {
  padding-top: 0%;
  padding-bottom: 0%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 420px;
}

.word-kulitan {
  justify-content: center;
  align-items: center;
  padding-top: 0%;
}

.word-kulitan img,
.word-kulitan svg {
  width: 100%;
  display: block;
  filter: drop-shadow(2px 6px 6px rgba(0,0,0,0.15));
}


/* =========================
   KULITAN LABELS
========================= */

.kulitan-label {
  position: absolute;
  font-size: 2.8rem;
  font-weight: 600;
  color: #6b6b6b;
  opacity: 0.7;
  pointer-events: none;
}

.word-meaning {
  margin: 1.2rem 0 1.6rem;
  font-size: 2.3rem;
  font-weight: 700;
  line-height: 1.15;
  max-width: 760px;
  text-align: left;
}

/* =========================
    META AND EXAMPLES
========================= */
.word-meta,
.examples {
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 1rem;
  margin-top: 2rem;
  width: 100%;
  }

.meta-value {
  text-align: left;
}


.word-page .word-kulitan {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;

}

.word-kulitan svg {
  height: auto;
  margin-left: -10%;
  filter: drop-shadow(2px 6px 6px rgba(0,0,0,0.25));
}

.example-index {
  font-size: 0.7rem;
  opacity: 0.5;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}

.examples {
  margin-top: 3rem;
  padding-top: 1.6rem;
  border-top: 1px solid rgba(0,0,0,0.08);
  text-align: left;
  margin: 0 auto;
}

.dialect-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.dialect-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 5px 12px;

  border-radius: 999px;

  background: rgba(0, 0, 0, 0.08);

  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.dialect-region-tag {
    font-style: italic;
}

body.dark-mode .dialect-tag {
    background: rgba(255,255,255,0.08);
}


/* kulitan*/

.kulitan-svg-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.kulitan-structure-toggle {
  columns: -1;
  border: none;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;

  background: rgba(0,0,0,0.08);

  font-size: 0.9rem;
  font-weight: 600;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}


/* kulitan*/


.example-item {
  margin-bottom: 1.6rem;
}

.word-meta + .examples {
  margin-top: 2.5rem;
  text-align: left;
}

.example-item [class^="example-kp"] {
  font-size: 1.15rem;
  font-weight: 600;
}

.example-item [class^="example-en"] {
  margin-left: 1%;
  font-size: 0.9rem;
  font-style: italic;
  opacity: 0.8;
}

.word-meta {
  padding: 26px 0 10px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.meta-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.5;
}

.meta-value {
  font-size: 1rem;
  line-height: 1.6;
  opacity: 0.9;
}

body.night .word-meta {
  border-top: 1px solid rgba(0,0,0,0.08);
}

body.night .example-en {
  opacity: 0.85;
}

/* =========================
   WORD PAGE MOBILE
========================= */
@media (max-width: 900px) {

  .word-page {
    padding: 50px 24px 80px;
  }

  .kulitan-hero {
    min-height: 260px;
    margin-bottom: 70px;
  }

  .word-header h1 {
    font-size: 4rem;
  }

  .word-meaning {
    font-size: 1.6rem;
  }

  .kulitan-label {
    font-size: 2rem;
  }
}

@media (max-width: 600px) {

  .word-header {
    align-items: flex-start;
  }

  .word-header h1 {
    font-size: 3.2rem;
  }

  .word-meaning {
    font-size: 1.3rem;
  }

  .word-kulitan img,
  .word-kulitan svg {
    max-width: 260px;
  }

  .kulitan-label {
    display: none;
  }
}

/* =========================
   KULITAN VECTOR
========================= */
.kulitan-vector {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    filter: drop-shadow(3px 5px 4px rgba(0,0,0,0.25));
}

.dictionaryfeatured {
    display: none;
}

/* =========================
   SEARCH INPUT
========================= */
#searchInput {
    width: 80%;
    max-width: 400px;
    padding: 0.5rem 1rem;
    margin: 2rem auto 1rem;
    display: block;
    border-radius: 1rem;
    border: 1px solid #ccc;
}
  
.wordsearch {
  margin: 0;
}

/* =========================
   DICTIONARY CARD HORIZONTAL LAYOUT
========================= */
.card.dict-item .card-content {
    display: flex;
    align-items: flex-start;
    justify-content: center;    /* center the content horizontally inside card */
    gap: 1rem;
    flex-wrap:inherit;
    padding: .75rem;
}

/* Left side text */
.card.dict-item .word-text {
  width: 160px;
  max-width: 160px;
  overflow: hidden;
  text-align: left;

}

.card.dict-item .word-kulitan{
  width: inherit;
}

.word-title-wrap {
  width: 160px;
  max-width: 160px;
  overflow: visible;
}

.word-card {
  line-height: 1.1;
  white-space: nowrap;
  display: inline-block;
  transform-origin: left center;
}

/* only compress when container forces it */
.word-text {
  width: 160px;
  max-width: 160px;
  overflow: visible;
}

@media (min-width: 801px) {
  .word-card {
    transform: scaleX(1);
  }
}

/* medium screens */
@media (max-width: 800px) {
  .word-card {
    transform: scaleX(0.9);
  }
}

/* small screens */
@media (max-width: 500px) {
  .word-card {
    transform: scaleX(0.8);
  }
}


/* Right side Kulitan */
.card.dict-item .word-kulitan {
    flex-shrink: 0;             /* prevent shrinking */
    text-align: right;
}

/* Kulitan size inside cards */
.card.dict-item .word-kulitan img,
.card.dict-item .word-kulitan svg {
    width: 150px;
    height: auto;
    display: block;
}

.word-header {
  display: flex;
  align-items: center;
  gap: 18px;
}

.word-header h1 {
  font-size: 6rem;
  line-height: 0.95;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.04em;
}

.meta-items {
  display: grid;
  gap: 1rem;
  text-align: left;
}

.word-page .romanized {
    font-size: 150%;
}

#playAudio {
  border: none;
  background: transparent;
  font-size: 1.8rem;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

#playAudio:hover {
  opacity: 1;
}

.kulitan-loading,
.kulitan-missing {
  font-style: italic;
  opacity: 0.6;
  text-align: center;
  justify-content: center;
  margin-top: 2rem;
}

.kulitan-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 260px;
}

.kulitan-placeholder {
  width: 280px;
  height: 180px;
  border-radius: 18px;

  background:
    linear-gradient(
      90deg,
      rgba(0,0,0,0.04) 25%,
      rgba(0,0,0,0.09) 50%,
      rgba(0,0,0,0.04) 75%
    );

  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  margin-top: 1rem;
  text-decoration: none;
  color: inherit;
  opacity: 0.6;
  font-weight: bold;
}

.back-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ================================================
   Remove all underline and colored when using href
=================================================== */
a,
a:visited,
a:hover,
a:active {
  text-decoration: none;
  color: inherit;
}

/* =========================
   FEATURED WORDS
========================= */
.featured .cards {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}

.featured .card.dict-item {
    width: 350px;
    align-items: center;
    justify-content: center;

}

.featured .word-meaning, .word-citation {
    display: none;
}

/* =========================
   FOOTER
========================= */
footer {
  background: #2b2b2b;
  color: white;
  text-align: center;
  padding: 1rem 1rem;
  position: relative;
  z-index: 2;
}


/* =========================
   NIGHT MODE
========================= */
.controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.night-btn {
    padding: 10px 18px;
    border-radius: 6px;
    background: #333;
    color: white;
    border: none;
    cursor: pointer;
    transition: 0.3s;
}

.night-btn.active {
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(2px);
    color: black;
}

body.night {
    background: #121212;
    color: #e0e0e0;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(0,0,0,0.4);
  outline-offset: 3px;
}

body.night button:focus-visible,
body.night a:focus-visible {
  outline-color: rgba(255,255,255,0.5);
}

/* =========================
   MOBILE RESPONSIVE
========================= */
@media (max-width: 600px) {
    header nav {
        position: static;
        transform: none;
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        margin-top: 0.5rem;
    }

    .home-title {
        margin-bottom: 0.5rem;
    }

    .card.dict-item .card-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .card.dict-item .word-text {
        text-align: center;
    }

    .card.dict-item .word-kulitan {
        margin-top: 0.5rem;
        text-align: center;
    }
}

/* =========================
   PRINT STYLES
========================= */
@media print {

  body {
    background: #fff;
    color: #000;
    text-align: center;
    font-family: "Noto Sans", Arial, sans-serif;
  }

  header,
  footer,
  nav,
  .controls,
  #playAudio,
  .enkp,
  .examples,
  .meta-items,
  .collapsible-toggle,
  .back-link {
    display: none;
  }

  main {
    margin: 0;
    padding: 0;
  }

  /* =========================
     WORD PAGE LAYOUT
  ========================= */
  .word-page {
    max-width: 480px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }

  /* =========================
     FORCE SCRIPT ON TOP
  ========================= */
  .kulitan-hero {
    order: -1;
    padding: 0;
    margin: 0;
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .word-kulitan {
    padding: 0;
    margin: 0 auto;
    max-width: 100%;
    line-height: normal;
    display: block;
  }

  .word-kulitan svg,
  .word-kulitan img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
    filter: none;
    visibility: visible;
  }

  /* =========================
     LEFT CONTENT
  ========================= */
  .information {
    text-align: center;
  }

  .word-meaning {
    max-width: 100%;
    margin: 1.2rem 0 1.6rem;
  }

  /* =========================
     META AND EXAMPLES
  ========================= */
  .word-meta,
  .examples {
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 1rem;
    margin-top: 2rem;
    width: 100%;
  }

  .meta-value {
    text-align: center;
  }

}

@media print {

  .word-citation {
    margin-top: 0.8rem;
    font-size: 0.75rem;
    line-height: 1.4;
    opacity: 0.85;
  }

  .cite-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.2rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .cite-text {
    margin: 0;
  }
}