/* TK ABADI PERTIWI (YAYASAN ABADI PERTIWI) - Botanical Charter & Open Book Design System */
:root {
  /* Semantic Botanical Palette */
  --ap-paper: #FAF8F3;
  --ap-surface: #FFFFFF;
  --ap-surface-tint: #F5F2EA;
  --ap-sage-band: #EDF5F0;
  --ap-ochre-band: #F7F1DF;
  --ap-canopy: #157347;
  --ap-canopy-deep: #0F5A36;
  --ap-forest: #15803D;
  --ap-forest-dark: #0F6D34;
  --ap-ochre: #C99312;
  --ap-gold-bright: #FACC15;
  --ap-ink: #132219;
  --ap-muted: #4A5D52;
  --ap-rule: #DDD8CE;
  --ap-rule-soft: #EAE5DC;

  /* Backward-compatible aliases */
  --ica-green-950: #0C4328;
  --ica-green-900: #115D38;
  --ica-green-800: #0F6D34;
  --ica-green-700: #15803D;
  --ica-green-600: #16A34A;
  --ica-green-100: #DCFCE7;
  --ica-green-50: #F0FDF4;
  --ap-gold-500: #F2E100;
  --ap-gold-100: #FEF9C3;
  --ap-sage-soft: #EDF5F0;
  --ap-cream-soft: #F7F1DF;
  --ica-canvas: #FAF8F3;
  --ica-surface: #FFFFFF;
  --ica-ink: #132219;
  --ica-body: #4A5D52;
  --ica-border: #DDD8CE;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ap-ink);
  background-color: var(--ap-paper);
}

body {
  overflow-x: clip;
  max-width: 100%;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  background-color: var(--ap-paper);
  color: var(--ap-ink);
}

/* Pastikan seluruh kontrol form, tabel, dan kode mewarisi Poppins secara konsisten */
h5,
h6,
table,
th,
td,
input,
select,
textarea,
button,
option,
optgroup,
code,
kbd,
pre {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

/* Rapikan dropdown select agar teks tidak terpotong panah native OS */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.5rem !important;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234A5D52' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem 1rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

/* Smart Sticky Header */
#site-header,
#ppdb-header {
  position: sticky;
  top: 0;
  z-index: 40;
}
#site-header.header-hidden,
#ppdb-header.header-hidden {
  pointer-events: none;
}
.ica-smart-header {
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms ease;
  will-change: transform;
}
.ica-smart-header.is-hidden {
  transform: translateY(-100%);
  box-shadow: none;
}
@media (prefers-reduced-motion: reduce) {
  .ica-smart-header { transition: none; }
}

h1, h2, h3, h4 {
  font-family: 'Poppins', system-ui, sans-serif;
  text-wrap: balance;
  overflow-wrap: break-word;
}

p {
  text-wrap: pretty;
}

.tabular-nums, time {
  font-variant-numeric: tabular-nums;
}

/* Justified legal copy that stays legible on narrow phones */
.ap-justify {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  text-wrap: normal;
}

/* Skip Link (WCAG 2.2 AA) */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  background: var(--ap-canopy);
  color: #fff;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: top 150ms ease-out;
}
.skip-link:focus { top: 1rem; outline: 2px solid var(--ap-gold-bright); outline-offset: 2px; }

/* Tactile Press */
.btn-tactile {
  transition: transform 140ms ease-out, background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out;
}
.btn-tactile:active { transform: scale(0.98); }

/* Dropdown Menu Reveal */
.ica-dropdown { position: relative; }
.ica-dropdown-panel {
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 150ms ease-out, transform 150ms ease-out, visibility 150ms;
}
.ica-dropdown:hover .ica-dropdown-panel,
.ica-dropdown:focus-within .ica-dropdown-panel,
.ica-dropdown.is-open .ica-dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Loading Skeleton (warm paper tone) */
.skeleton {
  background: linear-gradient(90deg, #EFECE4 0%, #E5E0D5 50%, #EFECE4 100%);
  background-size: 200% 100%;
  animation: ica-shimmer 1.3s ease-in-out infinite;
}
@keyframes ica-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

:focus-visible {
  outline: 2px solid var(--ap-forest);
  outline-offset: 2px;
}

/* ==========================================================================
   SIGNATURE VISUAL DNA: Botanical Charter & Open Book
   ========================================================================== */

/* 1. Asymmetric Open-Book / Leaf Silhouette */
.ap-leaf-frame {
  border-radius: 4px 20px 4px 20px;
}

/* 2. Crisp Offset Architectural Backing Plate (No Blurry Shadows) */
.ap-offset-frame {
  background: var(--ap-surface);
  border: 1px solid #C8D9CE;
  box-shadow: 6px 6px 0 0 #D6E7DC;
}
.ap-offset-frame-ochre {
  background: var(--ap-surface);
  border: 1px solid #DFCFA3;
  box-shadow: 6px 6px 0 0 #EFE2B9;
}

/* 3. Editorial Masthead with Subtle Paper Micro-Dot Texture */
.ap-masthead,
.ap-page-hero {
  background-color: var(--ap-paper);
  background-image: radial-gradient(rgba(15, 61, 36, 0.065) 1px, transparent 1px);
  background-size: 20px 20px;
  border-bottom: 1px solid var(--ap-rule);
}

/* 3b. Localized Feather Hero Photo Backdrop (unobstructed vivid photo + spacious typography) */
.ap-hero-photo {
  position: relative;
  overflow: hidden;
  background-color: var(--ap-paper);
  border-bottom: 1px solid var(--ap-rule);
}
.ap-hero-photo-scrim {
  background: linear-gradient(
    180deg,
    #FAF8F3 0%,
    rgba(250, 248, 243, 0.55) 16%,
    rgba(250, 248, 243, 0) 40%,
    rgba(250, 248, 243, 0) 100%
  );
}
@media (min-width: 1024px) {
  .ap-hero-photo-scrim {
    background: linear-gradient(
      90deg,
      #FAF8F3 0%,
      rgba(250, 248, 243, 0.88) 14%,
      rgba(250, 248, 243, 0.36) 27%,
      rgba(250, 248, 243, 0) 40%,
      rgba(250, 248, 243, 0) 100%
    );
  }
}

/* 4. Open Editorial Hairline Ledger (Replaces Card-Grid Slop) */
.ap-ledger {
  border-top: 1px solid var(--ap-rule);
}
.ap-ledger-row {
  border-bottom: 1px solid var(--ap-rule);
  transition: background-color 150ms ease;
}
.ap-ledger-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ap-forest);
}

/* 5. Crisp Square-ish Operational Status Flag */
.ap-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.6rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.ap-flag-open {
  background: #E6F4EB;
  color: #0F5132;
  border: 1px solid #B7DEC4;
}
.ap-flag-ochre {
  background: #FBF4DF;
  color: #7C5308;
  border: 1px solid #E6D29B;
}
.ap-flag-closed {
  background: #F3F0EA;
  color: #4A5D52;
  border: 1px solid #D8D2C5;
}
.ap-flag-danger {
  background: #FDF2F2;
  color: #991B1B;
  border: 1px solid #F5C2C7;
}

/* 6. Architectural Underline Tab Bar */
.ap-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--ap-rule);
}
.ap-tab-btn {
  position: relative;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 150ms ease, border-color 150ms ease;
}
.ap-tab-btn:hover {
  color: var(--ap-ink);
}
.ap-tab-btn[aria-selected="true"],
.ap-tab-btn.is-active {
  color: var(--ap-ink);
  font-weight: 600;
  border-bottom-color: var(--ap-forest);
}

/* 7. Restrained Flat Surface Panels (only when container framing is warranted) */
.ap-card {
  background: var(--ap-surface);
  border: 1px solid var(--ap-rule);
}
.ap-card-interactive {
  background: var(--ap-surface);
  border: 1px solid var(--ap-rule);
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}
.ap-card-interactive:hover {
  border-color: #9BC5AA;
}

/* 8. Unified Admin Metric Strip */
.ap-metric-strip {
  background: var(--ap-surface);
  border: 1px solid var(--ap-rule);
  border-radius: 8px;
}

/* 9. Subtle Org Tree Orthogonal Connectors (Desktop) */
@media (min-width: 768px) {
  .ap-tree-branch {
    position: relative;
  }
  .ap-tree-branch::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 16.666%;
    right: 16.666%;
    height: 1px;
    background: #B9C8BE;
  }
  .ap-tree-node {
    position: relative;
  }
  .ap-tree-node::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 50%;
    width: 1px;
    height: 20px;
    background: #B9C8BE;
  }
}

/* Scroll Fade Reveal */
.ap-reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 420ms cubic-bezier(0.16, 1, 0.3, 1), transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}
.ap-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .ap-reveal { opacity: 1; transform: none; transition: none; }
  .ap-offset-frame, .ap-offset-frame-ochre { transition: none; }
}

@media print {
  .no-print, #site-header, #site-footer, #ppdb-header, #ppdb-footer, #akun-header, #akun-footer, #akun-mobile-bottom-nav, #akun-mob-drawer, #pwd-modal, #app-shell, #floating-wa, #ppdb-mobile-bottom-nav {
    display: none !important;
  }
  body { background: #fff !important; color: #000 !important; }
}
