:root {
  color-scheme: light;
  --gold: #b0893f;
  --gold-soft: #d4bc7a;
  --ink: #1c140c;
  --cream: #fffdf8;
  --page: #f3ecdf;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Fraunces, Georgia, "Times New Roman", serif;
  line-height: 1.35;
}

.sheet-toolbar {
  width: min(8.5in, calc(100% - 1rem));
  margin: 0.8rem auto 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  font-family: Outfit, "Segoe UI", sans-serif;
}

.sheet-tools { display: flex; align-items: center; gap: 0.45rem; }

.sheet-login { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }

.sheet-toolbar a,
.sheet-toolbar button {
  appearance: none;
  border: 1px solid var(--gold);
  background: var(--cream);
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-weight: 650;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.sheet-toolbar button { background: var(--gold); color: #fffdf8; }

.sheet {
  position: relative;
  width: min(8.5in, calc(100% - 1rem));
  min-height: 11in;
  margin: 0 auto 1.2rem;
  padding: 2.3rem 1.5rem 1.3rem;
  background: var(--cream);
  color: var(--ink);
  border: 2px solid var(--gold);
  box-shadow: 0 12px 40px rgba(60, 40, 10, 0.12);
}

.sheet::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid var(--gold-soft);
  pointer-events: none;
}

.flourish {
  position: absolute;
  width: 88px;
  height: 88px;
  color: var(--gold);
  pointer-events: none;
}

.flourish.tl { top: 12px; left: 12px; }
.flourish.tr { top: 12px; right: 12px; transform: scaleX(-1); }
.flourish.bl { bottom: 12px; left: 12px; transform: scaleY(-1); }
.flourish.br { bottom: 12px; right: 12px; transform: scale(-1); }

.sheet-head, .sheet-times, .sheet-close, .sheet-address { text-align: center; }

.sheet-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  display: block;
  margin: 0 auto 0.35rem;
}

.sheet h1 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 650;
  letter-spacing: 0.01em;
}

.sheet-name-he, .sheet-kicker, .sheet-parsha {
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  margin: 0.15rem 0 0;
}

.sheet-name-he { font-size: 1.25rem; }
.sheet-kicker { font-size: 1.35rem; margin-top: 0.45rem; }
.sheet-parsha { font-size: clamp(1.8rem, 5vw, 2.35rem); font-weight: 700; margin-top: 0.15rem; line-height: 1.2; }

.sheet-date {
  margin: 0.45rem 0 0;
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  font-size: 1.25rem;
}

.sheet-subtitle {
  margin: 0.35rem 0 0;
  font-size: 1.02rem;
}

.print-tip {
  width: min(8.5in, calc(100% - 1rem));
  margin: 0 auto 0.55rem;
  text-align: center;
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: #6d5b3a;
}

.sheet-times { width: min(36rem, 100%); margin-inline: auto; }

.sheet-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.3rem 0.55rem;
  align-items: baseline;
  margin: 0.32rem 0;
}

.sheet-side {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.sheet-label { font-weight: 650; font-size: 1.02rem; }
.sheet-side.is-he .sheet-label {
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.leader {
  flex: 1 1 auto;
  border-bottom: 1.5px dotted var(--gold);
  min-width: 0.75rem;
  transform: translateY(-0.28em);
}

.sheet-time {
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}

.sheet-section {
  margin: 0.15rem 0 0.35rem;
  text-align: center;
  color: var(--gold);
  font-family: Fraunces, Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.sheet-section span { font-family: "Frank Ruhl Libre", "Times New Roman", serif; margin-inline-start: 0.35rem; }

.sheet-inline-note {
  width: min(34rem, 100%);
  margin: 0.15rem auto 0.45rem;
  text-align: center;
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 0.95rem;
}

.sheet-gap {
  border: 0;
  height: 1px;
  width: min(16rem, 68%);
  margin: 0.75rem auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.sheet-notes {
  width: min(32rem, 100%);
  margin: 0.2rem auto 0.4rem;
  padding: 0 0.4rem 0 1.2rem;
  text-align: left;
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 0.98rem;
}

.sheet-notes li { margin: 0.28rem 0; }

.sheet-close {
  margin: 0.7rem 0 0.35rem;
  color: var(--gold);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sheet-address {
  margin: 0.2rem 0 0.4rem;
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 0.98rem;
}

@page { size: letter; margin: 0; }

@media print {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 8.5in;
    height: 11in;
    background: white;
    overflow: hidden;
  }
  .sheet-toolbar, .print-tip { display: none !important; }
  .sheet {
    display: flex;
    flex-direction: column;
    width: 8.5in;
    height: 11in;
    min-height: 11in;
    max-height: 11in;
    margin: 0;
    padding: 0.55in 0.6in 0.42in;
    box-shadow: none;
    border-color: var(--gold);
    page-break-after: avoid;
    page-break-inside: avoid;
    break-after: avoid;
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .sheet-fill {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .sheet-foot { margin-top: auto; }
  .sheet.is-long {
    height: auto;
    min-height: 11in;
    max-height: none;
    break-inside: auto;
    page-break-inside: auto;
  }
  html:has(.sheet.is-long),
  body:has(.sheet.is-long) {
    height: auto;
    overflow: visible;
  }
}

@media screen and (max-width: 640px) {
  .sheet { padding: 2.5rem 0.85rem 1.1rem; min-height: 0; }
  .flourish { width: 64px; height: 64px; }
  .sheet-label { font-size: 0.86rem; }
  .sheet-side.is-he .sheet-label { font-size: 1rem; }
  .sheet-time { font-size: 0.86rem; }
  .sheet-row { gap: 0.2rem 0.3rem; }
}
