:root {
  --brand-red: #c8102e;
  --brand-red-dark: #a20d26;
  --ink: #1d2736;
  --muted: #647184;
  --line: #e4e8ed;
  --surface: #fff;
  color-scheme: light;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  color: var(--ink);
  background: transparent;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  isolation: isolate;
  background: transparent;
}

.guestbook-header,
.guestbook-main {
  position: relative;
  z-index: 1;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; }

.guestbook-header {
  min-height: 78px;
  padding: 10px max(24px, calc((100% - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 2px solid var(--brand-red);
  box-shadow: 0 4px 18px rgba(29, 39, 54, .045);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #1c2638;
  text-decoration: none;
}

.brand img { width: 52px; height: 52px; object-fit: contain; }
.brand span { display: grid; gap: 3px; }
.brand strong { color: var(--brand-red); font-size: 12px; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: 11px; font-weight: 600; }

.back-link {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #465367;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color .16s ease, color .16s ease;
}
.back-link:hover { border-color: var(--brand-red); color: var(--brand-red); background: #fff7f8; }

.guestbook-main { width: min(100% - 16px, 1440px); margin: 52px auto 20px; }
.guestbook-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.intro { margin: 0 auto 34px; padding: 0 12px 20px; border-bottom: 2px solid rgba(255, 255, 255, .75); text-align: center; text-shadow: 0 1px 12px rgba(0, 0, 0, .28); }
.eyebrow { color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.intro h1 { margin: 10px 0 9px; color: #fff; font-size: clamp(2.3rem, 4vw, 4.25rem); line-height: 1.1; font-weight: 800; }
.intro > p { margin: 0; color: rgba(255, 255, 255, .92); font-size: 1.05rem; line-height: 1.7; }
.guestbook-form-column { position: relative; min-width: 0; isolation: isolate; }
.guestbook-form-column::before {
  position: absolute;
  z-index: -1;
  inset: 9% -8px 8%;
  content: "";
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(200, 16, 46, .72) 0%, rgba(200, 16, 46, .46) 38%, rgba(200, 16, 46, .18) 62%, transparent 78%);
  filter: blur(35px);
  pointer-events: none;
}

.form-status {
  margin-bottom: 16px;
  padding: 13px 16px;
  border: 1px solid #f1d59d;
  border-radius: 7px;
  background: #fff8e9;
  color: #74500b;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
}
.form-status.is-success { border-color: #b7e2c4; background: #effaf2; color: #1d6b38; }
.form-status.is-error { border-color: #f3c3ca; background: #fff3f5; color: #a3112a; }

.guestbook-card {
  display: flex;
  height: min(82vh, 620px);
  max-height: min(82vh, 620px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(200, 16, 46, .52);
  border-top: 3px solid var(--brand-red);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 48px rgba(200, 16, 46, .42), 0 16px 38px rgba(29, 39, 54, .14);
}
.field b, .choice-group b { color: var(--brand-red); }

.visitor-nav {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  justify-content: center;
  padding: 8px 12px;
  background: linear-gradient(90deg, var(--brand-red-dark), var(--brand-red) 30%, var(--brand-red) 70%, var(--brand-red-dark));
  box-shadow: 0 4px 12px rgba(29, 39, 54, .12);
}
/* Sorotan putih meluncur ke tab terpilih; --active-tab diisi buku-tamu.js. */
.visitor-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 180px);
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .16);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .18), 0 1px 0 rgba(255, 255, 255, .12);
}
.visitor-tabs::before {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 3);
  content: "";
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(90, 4, 20, .35);
  transform: translateX(calc(var(--active-tab, 0) * 100%));
  transition: transform .4s cubic-bezier(.34, 1.4, .64, 1);
}
.visitor-tab {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, .86);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color .25s ease, background .2s ease;
}
.visitor-tab svg { flex: none; width: 17px; height: 17px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.visitor-tab:not(.is-active):hover { background: rgba(255, 255, 255, .1); color: #fff; }
.visitor-tab:hover svg { transform: scale(1.12); }
.visitor-tab.is-active { color: var(--brand-red); }
.visitor-tab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.visitor-form { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; overflow: hidden; padding: 0; }
.visitor-form[hidden] { display: none; }
.form-content { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 24px 30px 12px; }
.form-section-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.section-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  place-items: center;
  border-radius: 6px;
  background: #fff0f2;
  color: #c8102e;
  font-size: 11px;
  font-weight: 800;
}
.form-section-heading h3 { margin: 0; font-size: 13px; }
.form-section-heading p { margin: 3px 0 0; color: #8992a1; font-size: 10px; }
.shared-heading { margin-top: 27px; padding-top: 23px; border-top: 1px solid #edf0f4; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 18px; }
.field { display: grid; align-content: start; gap: 7px; color: #465166; font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea, .count-field input {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid #dfe3ea;
  border-radius: 9px;
  outline: none;
  background: #fff;
  color: #253044;
  font-size: 12px;
  font-weight: 500;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 68px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #a4acb9; }
.field input:focus, .field select:focus, .field textarea:focus, .count-field input:focus { border-color: var(--brand-red); box-shadow: 0 0 0 3px rgba(200, 16, 46, .1); }
.field-wide { grid-column: 1 / -1; }
.visit-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.choice-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-group legend { margin-bottom: 7px; padding: 0; color: #465166; font-size: 11px; font-weight: 700; }
.choice-grid, .count-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 18px; }
.choice, .count-field { display: flex; align-items: center; gap: 9px; min-width: 0; color: #253044; font-size: 12px; font-weight: 500; }
.choice { min-height: 32px; cursor: pointer; }
.choice input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: #c8102e; }
.choice input:focus-visible { outline: 3px solid rgba(200, 16, 46, .3); outline-offset: 2px; }
.count-field input { flex: none; width: 66px; min-height: 38px; padding: 8px; text-align: center; }

.form-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 14px 30px 16px;
  border-top: 1px solid #edf0f4;
  background: #fff;
}
.form-actions p { margin: 0; color: #8992a1; font-size: 10px; line-height: 1.5; }
.submit-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: var(--brand-red);
  box-shadow: 0 5px 12px rgba(200, 16, 46, .16);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background .16s ease, transform .16s ease;
}
.submit-button:hover { transform: translateY(-1px); background: var(--brand-red-dark); }
.submit-button:focus-visible, .back-link:focus-visible { outline: 3px solid rgba(200, 16, 46, .3); outline-offset: 3px; }
.page-footer { margin: 24px 0 0; color: rgba(255, 255, 255, .82); font-size: 10px; text-align: center; text-shadow: 0 1px 8px rgba(0, 0, 0, .3); }
.page-footer span { padding: 0 5px; color: #fff; }

@media (max-width: 1100px) {
  .guestbook-form-column::before { inset-inline: 0; }
}

@media (max-width: 680px) {
  .guestbook-form-column::before { inset-inline: 0; }
  .guestbook-header { min-height: 66px; padding: 8px 16px; }
  .brand img { width: 43px; height: 43px; }
  .brand strong { font-size: 11px; }
  .brand small { max-width: 155px; font-size: 9px; }
  .back-link { padding: 8px 10px; font-size: 10px; }
  .guestbook-main { width: min(100% - 24px, 640px); margin-top: 32px; }
  .guestbook-card { height: auto; max-height: none; }
  .intro { margin-bottom: 24px; padding-right: 0; padding-left: 0; }
  .intro h1 { font-size: 25px; }
  .intro > p { font-size: 12px; }
  .visitor-tabs { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .visitor-tab { gap: 6px; height: 38px; padding: 0 6px; font-size: 12px; }
  .visitor-tab svg { width: 15px; height: 15px; }
  .guestbook-card { max-height: none; }
  .visitor-form { min-height: auto; flex: 0 0 auto; overflow: visible; }
  .form-content { min-height: auto; flex: 0 0 auto; overflow: visible; padding: 20px 17px 12px; }
  .form-grid, .visit-fields { grid-template-columns: 1fr; gap: 13px; }
  .field-wide { grid-column: auto; }
  .choice-grid, .count-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
  .count-field input { width: 56px; }
  .shared-heading { margin-top: 22px; padding-top: 19px; }
  .form-actions { align-items: stretch; flex-direction: column; padding: 14px 17px 18px; }
  .submit-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

body { display: flex; flex-direction: column; background: #f3f4f6; }
.guestbook-header, .guestbook-main { position: relative; z-index: 1; }
.guestbook-header { background: rgba(255,255,255,.96); border-bottom: 2px solid #c8102e; box-shadow: 0 4px 18px rgba(29,39,54,.045); }
.guestbook-header { min-height: 100px; }
.brand { gap: 14px; }
.brand img { width: 76px; height: 76px; }
.brand span { gap: 4px; }
.brand strong { color: #c8102e; font-size: 26px; font-weight: 800; letter-spacing: .06em; line-height: 1.1; }
.brand small { color: #5b6474; font-size: 15px; font-weight: 700; letter-spacing: .04em; }
.back-link { border-color: #e4e8ed; border-radius: 7px; color: #465367; }
.back-link:hover { border-color: #c8102e; color: #c8102e; background: #fff7f8; }
.guestbook-main { display: flex; flex: 1 0 auto; flex-direction: column; width: 100%; margin: 0; }
.intro {
  display: grid;
  min-height: clamp(340px, 52vh, 480px);
  align-content: center;
  margin: 0;
  padding: 44px 24px 40px;
  border-bottom: 0;
  background: linear-gradient(rgba(12, 20, 30, .5), rgba(12, 20, 30, .62)),
    url("../img/login-kampus-luar.png") center 68% / cover no-repeat;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.eyebrow { color: #fff; font-size: 12px; letter-spacing: .2em; }
.intro h1 {
  margin: 8px 0 6px;
  color: #fff;
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.intro > p { color: rgba(255,255,255,.92); font-size: 17px; line-height: 1.6; }
.form-status { width: 100%; max-width: 920px; margin: 24px auto 0; text-align: left; text-shadow: none; }
/* Non Anggota dan Rombongan: panel putih selebar layar yang menempel sampai bawah foto. */
.guestbook-card {
  --panel-gutter: max(30px, calc((100% - 1120px) / 2));
  display: flex;
  height: auto;
  max-height: none;
  flex-direction: column;
  margin: 28px -24px -40px;
  overflow: visible;
  border: 0;
  border-top: 3px solid #c8102e;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  text-align: left;
  text-shadow: none;
}
.visitor-form { display: flex; flex-direction: column; overflow: visible; padding: 0; }
.form-content { overflow: visible; scrollbar-gutter: auto; padding: 28px var(--panel-gutter) 12px; }
.form-actions { margin: 0; padding: 16px var(--panel-gutter) 24px; border-top: 1px solid #edf0f4; background: #fff; }
.page-footer { margin: 0; padding: 22px 16px; color: rgba(255,255,255,.88); background: #4b5260; font-size: 13px; text-align: center; text-shadow: none; }
.page-footer span { color: #fff; }

/* Anggota: NIM/nama dalam satu baris seperti kotak pencarian. */
.member-search { display: block; width: 100%; max-width: 760px; margin: 28px auto 0; }
.search-shell {
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 30px rgba(14, 25, 40, .22);
  text-shadow: none;
}
.search-shell:focus-within { box-shadow: 0 0 0 3px rgba(255, 255, 255, .45), 0 16px 30px rgba(14, 25, 40, .22); }
.search-shell input {
  min-width: 0;
  height: 50px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}
.search-shell input { flex: 1 1 auto; padding: 0 18px 0 20px; }
.search-shell input::placeholder { color: #72819a; }
.search-shell button {
  display: grid;
  flex: 0 0 50px;
  height: 50px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--brand-red);
  color: #fff;
  cursor: pointer;
  transition: background .16s ease;
}
.search-shell button:hover { background: var(--brand-red-dark); }
.search-shell button:focus-visible { outline: 3px solid rgba(200, 16, 46, .35); outline-offset: 2px; }
.search-shell button:disabled { opacity: .6; cursor: wait; }
.search-shell svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.member-hint { margin: 18px 0 0; color: rgba(255, 255, 255, .92); font-size: 14px; }
.member-hint button { padding: 0; border: 0; background: none; color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.member-hint button:focus-visible { outline: 2px solid rgba(255, 255, 255, .75); outline-offset: 3px; }
/* Strip sampul koleksi terbaru yang terus bergeser; isi dan durasi dari buku-tamu-sampul.js. */
.cover-showcase {
  --cover-gap: 20px;
  width: min(100% - 48px, 1120px);
  margin: 32px auto 40px;
  padding: 18px 0 22px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(29, 39, 54, .08);
}
.cover-showcase[hidden] { display: none; }
.cover-showcase h2 { margin: 0 24px 14px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.cover-marquee {
  overflow: hidden;
  padding: 6px 0 10px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.cover-track { display: flex; width: max-content; gap: var(--cover-gap); animation: cover-scroll var(--cover-duration, 60s) linear infinite; }
.cover-marquee:hover .cover-track { animation-play-state: paused; }
.cover-item {
  flex: none;
  width: 100px;
  height: 146px;
  overflow: hidden;
  border-radius: 6px;
  background: #e9ecf1;
  box-shadow: 0 6px 14px rgba(29, 39, 54, .16);
  transition: transform .2s ease, box-shadow .2s ease;
}
.cover-item:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(29, 39, 54, .22); }
.cover-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
@keyframes cover-scroll { to { transform: translateX(calc(-50% - var(--cover-gap) / 2)); } }
@media (prefers-reduced-motion: reduce) {
  .cover-track { animation: none; }
  .cover-marquee { overflow-x: auto; }
  .cover-item[aria-hidden="true"] { display: none; }
}

/* Panel form hanya tampil untuk Non Anggota dan Rombongan. */
.guestbook-card:not(:has(.visitor-form:not([hidden]))) { display: none; }

@media (max-width: 680px) {
  .intro { min-height: 320px; padding: 32px 12px 12px; }
  .intro h1 { font-size: 28px; }
  .intro > p { font-size: 13px; }
  .page-footer { font-size: 11px; }
  .guestbook-header { min-height: 72px; }
  .brand { gap: 10px; }
  .brand img { width: 48px; height: 48px; }
  .brand strong { font-size: 17px; }
  .brand small { max-width: 180px; font-size: 10px; }
  .member-search { margin-top: 22px; }
  .search-shell { flex-wrap: nowrap; border-radius: 12px; }
  .search-shell input { flex-basis: 0; height: 48px; padding: 0 14px; font-size: 16px; }
  .search-shell button { flex-basis: 46px; height: 46px; }
  .member-hint { font-size: 12px; }
  .cover-showcase { --cover-gap: 14px; width: min(100% - 24px, 640px); margin: 22px auto 28px; padding: 14px 0 16px; }
  .cover-showcase h2 { margin: 0 16px 10px; font-size: 11px; }
  .cover-item { width: 78px; height: 114px; }
  .guestbook-card { --panel-gutter: 17px; margin: 22px -12px -12px; }
  .form-content { min-height: auto; flex: 0 0 auto; overflow: visible; padding: 20px 17px 12px; }
  .visitor-form { min-height: auto; flex: 0 0 auto; overflow: visible; }
  .form-actions { align-items: stretch; flex-direction: column; padding: 14px 17px 18px; }
  .submit-button { width: 100%; }
}

@media (max-width: 380px) {
  .visitor-tab svg { display: none; }
}
