/* IPB-BetaSeg — style.css
   Warna utama ada di :root. Mode gelap mengikuti sistem, atau tombol di header. */

:root {
  --bg: #F7F9FB;
  --surface: #FFFFFF;
  --tint: #EDF2F6;
  --ink: #14202E;
  --muted: #4E5D6E;
  --line: #D3DCE5;
  --navy: #0E2A47;
  --teal: #0F8B8D;        /* garis, ikon, isian */
  --teal-text: #0B6F71;   /* teks dan tautan (kontras cukup di latar terang) */
  --teal-soft: #D9F0EE;
  --on-navy: #F2F6FA;
  --tissue: #EEF1F7;
  --c-beta: #9A6532;
  --c-other: #C6D0E4;
  --c-nuc: #8FA3CC;
  --pt: #0E2A47;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1626; --surface: #10233A; --tint: #0D1D31; --ink: #E6EDF5; --muted: #A6B5C6;
    --line: #25405E; --navy: #17395E; --teal: #4FC3C1; --teal-text: #6AD3D0; --teal-soft: #123C45;
    --on-navy: #F2F6FA; --tissue: #14283F; --c-beta: #B98250; --c-other: #3A4F70; --c-nuc: #5E76A6; --pt: #F2F6FA;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1626; --surface: #10233A; --tint: #0D1D31; --ink: #E6EDF5; --muted: #A6B5C6;
  --line: #25405E; --navy: #17395E; --teal: #4FC3C1; --teal-text: #6AD3D0; --teal-soft: #123C45;
  --on-navy: #F2F6FA; --tissue: #14283F; --c-beta: #B98250; --c-other: #3A4F70; --c-nuc: #5E76A6; --pt: #F2F6FA;
  color-scheme: dark;
}

/* ---------- Bahasa: sembunyikan bahasa yang tidak aktif ---------- */
html[data-lang="id"] body [lang="en"],
html[data-lang="en"] body [lang="id"] { display: none !important; }

/* ---------- Dasar ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem; line-height: 1.6;
  color: var(--ink); background: var(--bg);
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, pre { margin: 0; }
h1, h2 { font-family: "Newsreader", Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: clamp(2.1rem, 6.2vw, 3.5rem); line-height: 1.08; }
h2 { font-size: clamp(1.7rem, 4.2vw, 2.4rem); line-height: 1.15; margin-bottom: 1.25rem; }
h3 { font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
h4 { font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
p { max-width: 68ch; }
a { color: var(--teal-text); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap { width: min(1100px, 100% - 2.5rem); margin-inline: auto; }
.small { font-size: .92rem; color: var(--muted); }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--navy); color: var(--on-navy); padding: .6rem 1rem; border-radius: 6px; z-index: 100; }
.skip:focus { left: .5rem; }
.sr-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 3.75rem; position: relative; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.tools { display: flex; align-items: center; gap: .4rem; }

.menu {
  display: none; position: absolute; left: -1.25rem; right: -1.25rem; top: 100%;
  background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem 1.25rem 1rem;
  flex-direction: column;
}
.menu.open { display: flex; }
.menu a { color: var(--ink); text-decoration: none; font-weight: 500; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.menu a:last-child { border-bottom: 0; }
.menu a:hover { color: var(--teal-text); }

.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang button { font: inherit; font-size: .9rem; font-weight: 600; padding: .4rem .65rem; min-height: 2.5rem; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); }
.icon-btn { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover, .lang button:hover { background: var(--tint); }
.lang button[aria-pressed="true"]:hover { background: var(--navy); }

/* ikon tema: tampilkan bulan di mode terang, matahari di mode gelap */
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.9rem;
  padding: .65rem 1.25rem; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--teal); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.btn.primary:hover { background: #163A60; border-color: #163A60; }
.btn.small-btn { min-height: 2.4rem; padding: .4rem .9rem; font-size: .92rem; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .6; cursor: not-allowed; }
a.placeholder-link { text-decoration-style: dashed; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- Bagian ---------- */
main > section { padding: 3.5rem 0; }
main > section + section { border-top: 1px solid var(--line); }
.tint { background: var(--tint); }
.section-intro { color: var(--muted); font-size: 1.1rem; margin-bottom: 1.75rem; }
.prose p + p { margin-top: 1rem; }
section h3 { margin: 2rem 0 .9rem; }

/* ---------- Beranda ---------- */
.hero { padding-top: 2.5rem; }
.hero-grid { display: grid; gap: 2.5rem; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 1.25rem 0 1.75rem; max-width: 56ch; }
.notice { margin-top: 1.75rem; padding: .8rem 1rem; border-left: 4px solid var(--teal); background: var(--teal-soft); border-radius: 0 6px 6px 0; font-size: .97rem; }

.islet-fig svg { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--line); background: var(--tissue); }
.islet-fig figcaption { font-size: .88rem; color: var(--muted); margin-top: .7rem; }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-bottom: .4rem; color: var(--ink); }
.legend li { display: inline-flex; align-items: center; gap: .45rem; }
.k { display: inline-block; width: .9rem; height: .9rem; flex: none; }
.k-beta { border-radius: 50%; background: var(--c-beta); }
.k-pt { border-radius: 50%; background: var(--pt); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--pt); width: .7rem; height: .7rem; }
.k-poly { border: 2px solid var(--teal); border-radius: 2px; }

.cell-beta { fill: var(--c-beta); }
.cell-other { fill: var(--c-other); }
.cell-nuc { fill: var(--c-nuc); }
.islet-outline { fill: none; stroke: var(--teal); stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw 1.8s ease-out both; }
.islet-vertex { fill: var(--surface); stroke: var(--teal); stroke-width: 2; animation: appear .5s ease-out 1.6s both; }
.islet-pt { fill: var(--pt); stroke: var(--surface); stroke-width: 1.2; animation: appear .6s ease-out 1.9s both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Diagram alur ---------- */
.flow { list-style: none; padding: 0; display: grid; gap: 2.25rem; counter-reset: langkah; }
.flow li { position: relative; counter-increment: langkah; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; }
.flow li::before { content: counter(langkah); position: absolute; top: 1rem; right: 1.1rem; font-weight: 600; color: var(--muted); }
/* panah penghubung antar-langkah */
.flow li:not(:last-child)::after {
  content: ""; position: absolute; left: 50%; bottom: -1.55rem; width: .8rem; height: .8rem;
  border-right: 2.5px solid var(--teal); border-bottom: 2.5px solid var(--teal); transform: translateX(-50%) rotate(45deg);
}
.flow svg { width: 44px; height: 44px; fill: none; stroke: var(--teal); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; margin-bottom: .6rem; }
.flow svg .fill { fill: var(--teal); stroke: none; }
.flow h4 { margin-bottom: .4rem; }
.flow p { font-size: .97rem; color: var(--muted); }
.flow + .small { margin-top: 1.5rem; }

/* ---------- Output ---------- */
.outputs { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.outputs article { background: var(--surface); padding: 1.4rem 1.25rem; }
.outputs h3 { margin: 0 0 .5rem; }
.formula { font-family: "Newsreader", Georgia, serif; font-size: 1.45rem; color: var(--teal-text); margin-bottom: .5rem; }
.formula var { font-style: italic; }
.formula .unit { font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: .95rem; color: var(--muted); }
.outputs article > p:not(.formula) { font-size: .97rem; color: var(--muted); }

/* ---------- Demo ---------- */
.demo-frame { margin-top: 1.5rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.demo-frame iframe { display: block; width: 100%; height: min(80vh, 760px); border: 0; }
#demo-note { margin-top: 1rem; }
.notes { margin-top: 1.75rem; display: grid; gap: .75rem; }
.notes p { padding: .8rem 1rem; border-left: 4px solid var(--teal); background: var(--teal-soft); border-radius: 0 6px 6px 0; font-size: .97rem; max-width: 72ch; }

/* ---------- Dataset & validasi ---------- */
.two-col { display: grid; gap: 2.5rem; }
.two-col h3 { margin-top: 0; }
.facts div { display: grid; gap: .1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .95rem; }
.facts dd { font-weight: 500; overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--navy); color: var(--on-navy); font-weight: 600; }
tbody th { font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }

/* ---------- Tim ---------- */
.team { list-style: none; padding: 0; display: grid; gap: 1.5rem; }
.team li { display: flex; gap: 1rem; align-items: flex-start; }
.team h3 { margin: 0 0 .15rem; }
.avatar { flex: none; display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%; background: var(--navy); color: var(--on-navy); font-weight: 600; }
.role { color: var(--teal-text); font-weight: 600; }
.team p { font-size: .97rem; }
.funding { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.funding h3 { margin-top: 0; }

/* ---------- Publikasi ---------- */
.links { list-style: none; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.links li { background: var(--surface); padding: 1.25rem; overflow-wrap: anywhere; }
.links h3 { margin: 0 0 .4rem; }
.cite { margin-top: 1rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 0 10px 10px 0; padding: 1.1rem 1.25rem; }
.cite p { margin-bottom: .9rem; overflow-wrap: anywhere; }
.bibtex { margin-top: 1rem; }
.bibtex summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }
pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.5; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; overflow-x: auto; margin-bottom: .75rem; }

/* ---------- Kontak ---------- */
.mail { font-family: "Newsreader", Georgia, serif; font-size: clamp(1.4rem, 5vw, 2rem); margin-bottom: 1rem; overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: var(--on-navy); padding: 2.5rem 0; font-size: .95rem; }
.site-footer p { margin-bottom: .7rem; max-width: 80ch; }
.site-footer a { color: #8FE0DC; }
.site-footer :focus-visible { outline-color: #8FE0DC; }
.site-footer .disclaimer { font-size: 1rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(242, 246, 250, .25); margin-bottom: 1rem; }
.site-footer .meta { margin: 1.25rem 0 0; opacity: .85; }
.site-footer .sep { margin: 0 .5rem; }

/* ---------- Layar lebih lebar ---------- */
@media (min-width: 700px) {
  main > section { padding: 4.5rem 0; }
  .outputs, .links { grid-template-columns: repeat(2, 1fr); }
  .links { grid-template-columns: repeat(3, 1fr); }
  .team { grid-template-columns: repeat(2, 1fr); }
  .facts div { grid-template-columns: 14rem 1fr; gap: 1rem; }
}
@media (min-width: 980px) {
  .menu-btn { display: none; }
  .menu { display: flex; position: static; flex-direction: row; gap: 1.25rem; padding: 0; border: 0; background: transparent; }
  .menu a { padding: .4rem 0; border: 0; font-size: .97rem; }
  .hero { padding-top: 4rem; }
  .hero-grid { grid-template-columns: 1.05fr 1fr; align-items: center; gap: 3.5rem; }
  .flow { grid-template-columns: repeat(4, 1fr); gap: 2rem; }
  .flow li:not(:last-child)::after { left: auto; right: -1.35rem; bottom: auto; top: 50%; transform: translateY(-50%) rotate(-45deg); }
  .outputs { grid-template-columns: repeat(4, 1fr); }
  .two-col { grid-template-columns: 1fr 1fr; gap: 3.5rem; }
  .team { grid-template-columns: repeat(3, 1fr); }
  .facts div { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .islet-outline, .islet-vertex, .islet-pt { animation: none; }
}

@media print {
  .site-header, .actions, .demo-frame, .skip { display: none; }
  body { background: #fff; color: #000; }
}
