/* Ma'had Daring Al Madinah — gaya situs */

:root {
  --lime: #90E200;
  --lime-soft: #E6F8C7;
  --ink: #12301B;
  --forest: #1D5A2C;
  --paper: #F4F8EF;
  --mist: #E4ECDA;
  --line: #C6D5B9;
  --muted: #4A5F4E;
  --white: #FFFFFF;
  --danger: #A8251B;

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --arabic: "Amiri", "Traditional Arabic", serif;

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius-lg: 22px;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--forest); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; }

:focus-visible { outline: 3px solid var(--forest); outline-offset: 3px; border-radius: 6px; }
.section-ink :focus-visible, .site-footer :focus-visible { outline-color: var(--lime); }
.form-card :focus-visible { outline-color: var(--forest); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 50;
  background: var(--ink); color: var(--white); padding: .6rem 1rem; border-radius: 8px;
}
.skip:focus { top: 1rem; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }

/* Logo diwarnai lewat mask agar terlihat di atas latar hijau muda */
.mark-ink {
  background: var(--ink);
  -webkit-mask: url("/assets/logo.png") center / contain no-repeat;
          mask: url("/assets/logo.png") center / contain no-repeat;
}

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .75rem 1.5rem;
  font: 700 1rem/1.2 var(--font);
  border-radius: 999px; border: 2px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 2.5rem; padding: .5rem 1.15rem; font-size: .9375rem; }
.btn-ink { background: var(--ink); color: var(--white); }
.btn-ink:hover { background: var(--forest); }
.btn-line { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-line:hover { background: rgba(18, 48, 27, .08); }
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-lime:hover { background: #A2EE1F; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--lime);
  border-bottom: 1px solid rgba(18, 48, 27, .12);
}
.header-row { display: flex; align-items: center; gap: 1.5rem; min-height: 4.25rem; }
.brand {
  display: flex; align-items: center; gap: .65rem;
  color: var(--ink); text-decoration: none;
  font-weight: 800; font-size: .875rem; line-height: 1.15; letter-spacing: -0.01em;
}
.brand-mark { flex: none; width: 22px; height: 38px; }
.nav { display: flex; gap: 1.5rem; margin-left: auto; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9375rem; }
.nav a:hover { text-decoration: underline; }
.header-row > .btn { margin-left: auto; }
.nav + .btn { margin-left: 0; }
.nav-toggle {
  display: none; flex: none; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0;
  color: var(--ink); background: transparent; border: 0; border-radius: 10px; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero { background: var(--lime); overflow: hidden; padding: clamp(2.5rem, 6vw, 5rem) 0 2.5rem; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  align-items: center; gap: 2rem;
}
.hero-org { font-weight: 600; font-size: 1rem; margin-bottom: 1.25rem; }
.hero h1 {
  font-size: clamp(2.9rem, 8.5vw, 6.25rem);
  font-weight: 800; line-height: .95; letter-spacing: -0.045em;
  max-width: 10ch;
}
.hero-lead { margin-top: 1.5rem; font-size: clamp(1.0625rem, 1.6vw, 1.25rem); line-height: 1.55; max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.hero-note { margin-top: 1.25rem; font-size: .9375rem; font-weight: 600; }
.hero-note:empty { display: none; }

.hero-mark { position: relative; justify-self: end; height: clamp(320px, 46vw, 600px); aspect-ratio: 903 / 1575; }
.hero-mark img { display: none; }
.hero-mark::before {
  content: ""; position: absolute; inset: 0;
  background: var(--ink);
  -webkit-mask: url("/assets/logo.png") center / contain no-repeat;
          mask: url("/assets/logo.png") center / contain no-repeat;
}

.hero-facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: clamp(2rem, 5vw, 3.5rem) 0 0; border-top: 2px solid var(--ink);
}
.hero-facts > div { padding: 1rem 1rem 0 0; }
.hero-facts dt { font-size: .875rem; font-weight: 500; }
.hero-facts dd { margin: .2rem 0 0; font-size: clamp(1.0625rem, 1.8vw, 1.375rem); font-weight: 800; letter-spacing: -0.015em; }

@media (prefers-reduced-motion: no-preference) {
  .hero-mark::before { animation: mark-in .9s cubic-bezier(.2, .7, .2, 1) both .1s; }
  .hero-copy > * { animation: copy-in .7s cubic-bezier(.2, .7, .2, 1) both; }
  .hero-copy > :nth-child(2) { animation-delay: .05s; }
  .hero-copy > :nth-child(3) { animation-delay: .12s; }
  .hero-copy > :nth-child(4) { animation-delay: .18s; }
  .hero-copy > :nth-child(5) { animation-delay: .22s; }
}
@keyframes mark-in { from { opacity: 0; transform: translateY(40px) rotate(4deg); } to { opacity: 1; transform: none; } }
@keyframes copy-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Bagian umum ---------- */
.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section-mist { background: var(--mist); }
.section-ink { background: var(--ink); color: var(--white); }
.section-head { max-width: 38rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head h2 { font-size: clamp(1.9rem, 4.2vw, 2.875rem); font-weight: 800; letter-spacing: -0.035em; }
.section-head p { margin-top: .9rem; font-size: 1.125rem; color: var(--muted); }
.section-head p.muted { font-size: .9375rem; }
.section-ink .section-head p { color: rgba(255, 255, 255, .78); }

/* ---------- Sepekan ---------- */
.week {
  list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
}
.day {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 8.5rem; padding: .9rem .85rem; border-radius: 14px;
}
.day-name { font-weight: 800; font-size: 1.125rem; }
.day-what { font-size: .875rem; font-weight: 600; line-height: 1.3; }
.day-study { background: var(--lime); }
.day-review { background: var(--forest); color: var(--white); }
.day-rest { background: transparent; border: 2px dashed var(--line); color: var(--muted); }

.week-legend { display: none; list-style: none; flex-wrap: wrap; gap: .4rem 1.1rem; margin-top: .9rem; font-size: .875rem; font-weight: 600; }
.week-legend li { display: flex; align-items: center; gap: .45rem; }
.swatch { flex: none; width: .9rem; height: .9rem; border-radius: 4px; }
.swatch-study { background: var(--lime); }
.swatch-review { background: var(--forest); }
.swatch-rest { border: 2px dashed var(--line); }

.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem); margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.how-item { border-top: 4px solid var(--ink); padding-top: 1.1rem; }
.how-item h3 { font-size: 1.25rem; font-weight: 800; }
.how-item p { margin-top: .5rem; color: var(--muted); }

/* ---------- Kurikulum: rantai silsilah ---------- */
.kur-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.sticky-head { position: sticky; top: 6.5rem; }

.chain { list-style: none; position: relative; }
.chain > li { position: relative; padding-bottom: .5rem; }
.chain > li::before {
  content: ""; position: absolute; left: 21px; top: 3.25rem; bottom: -.5rem;
  width: 3px; background: var(--ink); opacity: .85; border-radius: 2px;
}
.chain > li:last-child::before { display: none; }

.chain summary, .chain-exam {
  display: flex; align-items: center; gap: 1rem;
  padding: .45rem 0; cursor: pointer; list-style: none;
}
.chain summary::-webkit-details-marker { display: none; }
.chain-exam { cursor: default; }

.link-no {
  flex: none; display: grid; place-items: center;
  width: 45px; height: 45px; border-radius: 50%;
  border: 3px solid var(--ink); background: var(--paper);
  font-weight: 800; font-size: 1rem;
  transition: background-color .15s ease;
}
.link-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.link-text b { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
.link-text small { font-size: .875rem; color: var(--muted); }
.chain summary::after {
  content: ""; flex: none; width: 10px; height: 10px; margin-right: .5rem;
  border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: rotate(45deg) translateY(-3px); transition: transform .2s ease;
}
.chain details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.chain details[open] .link-no, .chain summary:hover .link-no { background: var(--lime); }
.chain details p {
  margin: .25rem 0 .75rem 61px; padding: .9rem 1.1rem;
  background: var(--white); border-radius: var(--radius); color: var(--ink); font-size: 1rem;
}
.chain-end .link-no { background: var(--ink); color: var(--lime); }

/* ---------- Alur ---------- */
.steps { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.25rem; position: relative; }
.steps::before {
  content: ""; position: absolute; top: 22px; left: 22px; right: calc((100% - 5rem) / 5 - 22px);
  height: 3px; background: var(--ink); border-radius: 2px;
}
.steps li { position: relative; }
.step-no {
  position: relative; display: grid; place-items: center;
  width: 45px; height: 45px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--ink);
  font-weight: 800;
}
.steps li:last-child .step-no { background: var(--lime); }
.steps h3 { margin-top: 1rem; font-size: 1.125rem; font-weight: 800; }
.steps p { margin-top: .35rem; font-size: .9375rem; color: var(--muted); }

/* ---------- Hadits ---------- */
.hadith { padding: clamp(3rem, 7vw, 5rem) 0; border-top: 1px solid var(--line); }
.hadith-inner { text-align: center; max-width: 46rem; }
.arabic { font-family: var(--arabic); font-size: clamp(1.75rem, 4.2vw, 2.6rem); line-height: 1.9; color: var(--ink); }
.hadith-id { margin-top: 1rem; font-size: 1.125rem; color: var(--ink); }
.hadith-src { margin-top: .5rem; font-size: .9375rem; color: var(--muted); }

/* ---------- Pendaftaran ---------- */
.daftar-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.daftar-copy h2 { font-size: clamp(1.9rem, 4.2vw, 2.875rem); font-weight: 800; letter-spacing: -0.035em; }
.daftar-copy > p { margin-top: .9rem; font-size: 1.125rem; color: rgba(255, 255, 255, .8); }
.ticks { list-style: none; margin-top: 1.75rem; display: grid; gap: .75rem; }
.ticks li { position: relative; padding-left: 2rem; font-weight: 600; }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: .2rem;
  width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--lime);
}
.ticks li::after {
  content: ""; position: absolute; left: .42rem; top: .45rem;
  width: .38rem; height: .62rem; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: rotate(45deg);
}
.daftar-angkatan { margin-top: 2rem; display: inline-block; padding: .4rem .9rem; border: 1.5px solid var(--lime); border-radius: 999px; color: var(--lime); font-weight: 700; font-size: .9375rem; }
.daftar-angkatan:empty { display: none; }

.form-card {
  background: var(--white); color: var(--ink);
  border-radius: var(--radius-lg); padding: clamp(1.25rem, 3.5vw, 2.25rem);
}
.progress { height: 6px; border-radius: 3px; background: var(--mist); overflow: hidden; }
.progress span { display: block; height: 100%; width: 33.33%; background: var(--ink); border-radius: 3px; transition: width .3s ease; }
.step-label { margin: .9rem 0 1.5rem; font-size: .9375rem; font-weight: 700; color: var(--muted); }
.step-label:focus { outline: none; }

.fstep { border: 0; margin: 0; padding: 0; min-width: 0; }
.field { margin-bottom: 1.25rem; flex: 1; min-width: 0; }
.field-row { display: flex; gap: 1rem; }
.field-narrow { flex: 0 0 7.5rem; }
.field label, .field .label { display: block; margin-bottom: .45rem; font-weight: 700; font-size: .9375rem; }
.opt { font-weight: 500; color: var(--muted); }

.field input[type="text"], .field input[type="number"], .field input[type="tel"], .field input[type="email"], .field input[type="password"], .field select {
  width: 100%; min-height: 3.1rem; padding: .75rem 1rem;
  font: 500 1rem/1.3 var(--font); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s ease, background-color .15s ease;
  -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.5rem;
}
.field input::placeholder { color: #627365; }
.field input:hover, .field select:hover { border-color: #9FB394; }
.field input:focus, .field select:focus { outline: none; border-color: var(--ink); background: var(--white); box-shadow: 0 0 0 3px rgba(144, 226, 0, .45); }
.field.invalid input, .field.invalid select { border-color: var(--danger); background: #FFF6F5; }
.hint { margin-top: .4rem; font-size: .875rem; color: var(--muted); }
.err { margin-top: .4rem; font-size: .875rem; font-weight: 600; color: var(--danger); }
.err:empty { display: none; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.tile, .pill, .check { position: relative; cursor: pointer; }
.tile input, .pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile-box {
  display: flex; flex-direction: column; gap: .1rem; height: 100%;
  padding: 1rem 1.1rem; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--paper);
  transition: border-color .15s ease, background-color .15s ease;
}
.tile-box b { font-size: 1.125rem; }
.tile-box small { font-size: .875rem; color: var(--muted); }
.tile:hover .tile-box { border-color: #9FB394; }
.tile input:checked + .tile-box { border: 2px solid var(--ink); background: var(--lime-soft); padding: calc(1rem - .5px) calc(1.1rem - .5px); }
.tile input:focus-visible + .tile-box, .pill input:focus-visible + span { outline: 3px solid var(--forest); outline-offset: 2px; }

.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill span {
  display: inline-block; padding: .6rem 1rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--paper); font-weight: 600; font-size: .9375rem;
}
.pill:hover span { border-color: #9FB394; }
.pill input:checked + span { background: var(--ink); color: var(--white); border-color: var(--ink); }

.summary { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1.25rem; margin: 0 0 1.5rem; padding: 1.1rem 1.25rem; background: var(--paper); border-radius: var(--radius); font-size: .9375rem; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.check { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: 1rem; font-size: .9375rem; }
.check input { flex: none; width: 1.3rem; height: 1.3rem; margin: .1rem 0 0; accent-color: var(--ink); }

.form-error { margin: .5rem 0 1rem; padding: .8rem 1rem; border-radius: var(--radius); background: #FFF0EE; color: var(--danger); font-weight: 600; font-size: .9375rem; }
.form-nav { display: flex; gap: .75rem; justify-content: flex-end; margin-top: .5rem; }
.form-nav #btn-back { margin-right: auto; }
.form-nav .btn { white-space: nowrap; padding-left: 1.25rem; padding-right: 1.25rem; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-closed h3, .form-done h3 { font-size: 1.5rem; font-weight: 800; }
.form-closed p, .form-done p { margin-top: .75rem; color: var(--muted); }
.form-done { text-align: left; }
.form-done:focus { outline: none; }
.done-mark { color: var(--forest); margin-bottom: 1rem; }
.done-kode {
  display: inline-block; margin: .9rem 0 .25rem !important;
  padding: .6rem 1.1rem; border-radius: var(--radius); background: var(--lime);
  font-size: 1.75rem; font-weight: 800; letter-spacing: .02em; color: var(--ink) !important;
}
.form-done > .btn { margin-top: 1.5rem; }
.done-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.done-row .btn { margin-top: .65rem; }

@media (prefers-reduced-motion: no-preference) {
  .fstep.enter { animation: step-in .28s ease both; }
  .form-done.enter .done-mark svg path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s ease .15s forwards; }
}
@keyframes step-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Tanya jawab ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.faq details { border-bottom: 1.5px solid var(--line); }
.faq details:first-child { border-top: 1.5px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.1rem 0; font-weight: 700; font-size: 1.0625rem; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; flex: none; width: 1.75rem; height: 1.75rem; display: grid; place-items: center;
  border-radius: 50%; background: var(--mist); font-weight: 600; font-size: 1.2rem; line-height: 1;
  transition: transform .2s ease, background-color .2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); background: var(--lime); }
.faq details p { padding: 0 2.5rem 1.25rem 0; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: rgba(255, 255, 255, .8); padding: 2.5rem 0; font-size: .9375rem; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem 2.5rem; }
.footer-brand { display: flex; align-items: center; gap: .9rem; }
.footer-brand b { display: block; color: var(--white); }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a { color: var(--lime); font-weight: 600; }
.footer-copy { margin-left: auto; }

/* ---------- Responsif ---------- */
@media (max-width: 960px) {
  .nav-toggle { display: grid; }
  .header-row { gap: .75rem; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    flex-direction: column; gap: 0; padding: .25rem var(--gutter) .75rem;
    background: var(--lime); border-bottom: 1px solid rgba(18, 48, 27, .12);
  }
  .nav.open { display: flex; }
  .nav a { padding: .8rem 0; font-size: 1.0625rem; }
  .nav a + a { border-top: 1px solid rgba(18, 48, 27, .15); }
  .nav + .btn { margin-left: auto; }
  .kur-grid, .daftar-grid, .faq-grid { grid-template-columns: 1fr; }
  .sticky-head { position: static; }
  .steps { grid-template-columns: 1fr; gap: 0; }
  .steps::before { top: 22px; bottom: 40px; left: 21px; right: auto; width: 3px; height: auto; }
  .steps li { display: grid; grid-template-columns: 45px 1fr; column-gap: 1rem; padding-bottom: 1.5rem; }
  .steps .step-no { grid-row: span 2; }
  .steps h3 { margin-top: .55rem; }
}

@media (max-width: 720px) {
  .hero-grid { grid-template-columns: 1fr; position: relative; }
  .hero-copy { position: relative; z-index: 1; }
  .hero-mark { position: absolute; right: -18vw; top: -1rem; height: 380px; opacity: .13; }
  .hero-facts { grid-template-columns: 1fr 1fr; }
  .hero-facts > div { padding-bottom: .75rem; }
  .how { grid-template-columns: 1fr; }
  .day { min-height: 3.5rem; padding: .6rem .2rem; align-items: center; justify-content: center; }
  .day-name { font-size: .9375rem; }
  .day-what {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .week-legend { display: flex; }
  .footer-copy { margin-left: 0; }
}

@media (max-width: 420px) {
  .field-row { flex-direction: column; gap: 0; }
  .field-narrow { flex-basis: auto; }
}

@media (max-width: 340px) {
  .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
