/*
 * `student-files` — the student files demo's theme (Hashiyeh). Fetched, not compiled.
 *
 * Subject and visitor: a shop opposite the university on Enghelab Street that
 * sells typed lecture notes, solved past papers, thesis and slide templates and
 * short books; a student, usually two weeks (or one night) before an exam, or
 * three months into a thesis, who wants to know the file is right before paying.
 * Tone: a good set of notes: ruled paper, blue ballpoint, one yellow highlighter
 * and the red margin line.
 * The detail only this subject has: the edition. Every file carries its edition
 * and the month it was revised; the front page opens on this month's editions
 * (a spiral-notebook card); the errata strikes the wrong line through in red
 * and writes the right one in blue ink, with the name of who found it.
 *
 * Paper white, navy ink, ballpoint blue, highlighter yellow and margin red. A
 * red margin rule runs under the header; every section heading is marked with
 * the highlighter; every card is an index card with a red rule at its head;
 * spiral-binding rings sit over the footer. Headings in Estedad ExtraBold; 8px
 * corners, cut paper rather than plastic. Never letter-spaced in Persian.
 *
 * Plain CSS; it selects only the hooks the builder publishes (`sb-*`,
 * `ui-*`, `data-sb-*`, `data-block`, `data-part`, `data-catalog-card`).
 */

:root.theme-student-files {
  --theme-font-display: 'EstedadFD';
  --background: #fbfaf5;
  --foreground: #16213e;
  --card: #ffffff;
  --card-foreground: #16213e;
  --popover: #ffffff;
  --popover-foreground: #16213e;
  --primary: #2346a0;
  --primary-foreground: #ffffff;
  --secondary: #eef2fa;
  --secondary-foreground: #16213e;
  --muted: #f1efe6;
  --muted-foreground: #5b6478;
  --accent: #fff3b0;
  --accent-foreground: #5c4400;
  --destructive: #c0392b;
  --destructive-foreground: #ffffff;
  --border: #dde3ee;
  --input: #c9d3e6;
  --ring: #2346a0;

  --primary-50: #eff3fd;
  --primary-100: #dce5fa;
  --primary-200: #b9caf3;
  --primary-300: #8ba6e8;
  --primary-400: #5a7dd8;
  --primary-500: #3a5ec4;
  --primary-600: #2346a0;
  --primary-700: #1d3a85;
  --primary-800: #1a316b;
  --primary-900: #172a58;
  --primary-950: #0e1835;

  --brand-accent: var(--brand-primary, #2346a0);
  --brand-accent-foreground: var(--brand-primary-foreground, #ffffff);
  --chrome-ink: var(--brand-secondary, #16213e);
  --chrome-ink-foreground: #e6ebf5;

  --surface-page: #fbfaf5;
  --surface-alt: #f1efe6;
  --surface-input: #ffffff;
  --surface-panel: #f1efe6;
  --ink-secondary: #33405e;

  --radius-step-sm: 4px;
  --radius-step-md: 8px;
  --radius-step-lg: 8px;
  --radius-step-xl: 12px;

  --hs-ink: var(--brand-primary, #2346a0);
  --hs-navy: var(--brand-secondary, #16213e);
  --hs-marker: #ffe066;
  --hs-margin: #e05a47;
  --hs-rule: #d3ddef;
  --hs-paper: #ffffff;
  --hs-display: var(--app-font-display);
  /* A highlighter stroke: the lower part of a line, a little ragged at its ends. */
  --hs-mark: linear-gradient(100deg, transparent 0.4em, var(--hs-marker) 0.5em calc(100% - 0.5em), transparent calc(100% - 0.4em));
}

@media (prefers-color-scheme: dark) {
  :root:not(.light).theme-student-files {
    --background: #0f1526;
    --foreground: #e6ebf5;
    --card: #161e33;
    --card-foreground: #e6ebf5;
    --popover: #161e33;
    --popover-foreground: #e6ebf5;
    --primary: #8ba6e8;
    --primary-foreground: #0e1835;
    --secondary: #1d2741;
    --secondary-foreground: #e6ebf5;
    --muted: #1d2741;
    --muted-foreground: #a7b1c8;
    --accent: #4a3d0a;
    --accent-foreground: #ffe9a0;
    --border: #2a3553;
    --input: #36436a;
    --ring: #8ba6e8;
    --chrome-ink: #0a0f1d;
    --surface-page: #0f1526;
    --surface-alt: #161e33;
    --surface-input: #1d2741;
    --surface-panel: #161e33;
    --ink-secondary: #c9d2e6;
    --hs-ink: #8ba6e8;
    --hs-marker: #a68a1c;
    --hs-margin: #ef7d6c;
    --hs-rule: #2a3553;
    --hs-paper: #161e33;
  }
}

/* Same palette as the media query above — change both. */
:root.dark.theme-student-files {
  --background: #0f1526;
  --foreground: #e6ebf5;
  --card: #161e33;
  --card-foreground: #e6ebf5;
  --popover: #161e33;
  --popover-foreground: #e6ebf5;
  --primary: #8ba6e8;
  --primary-foreground: #0e1835;
  --secondary: #1d2741;
  --secondary-foreground: #e6ebf5;
  --muted: #1d2741;
  --muted-foreground: #a7b1c8;
  --accent: #4a3d0a;
  --accent-foreground: #ffe9a0;
  --border: #2a3553;
  --input: #36436a;
  --ring: #8ba6e8;
  --chrome-ink: #0a0f1d;
  --surface-page: #0f1526;
  --surface-alt: #161e33;
  --surface-input: #1d2741;
  --surface-panel: #161e33;
  --ink-secondary: #c9d2e6;
  --hs-ink: #8ba6e8;
  --hs-marker: #a68a1c;
  --hs-margin: #ef7d6c;
  --hs-rule: #2a3553;
  --hs-paper: #161e33;
}

/* ── Type: Estedad ExtraBold ──────────────────────────────────────────── */

.theme-student-files :is(h1, h2, h3, .sb-heading, .sb-cta-title, .sb-stat-value) {
  font-family: var(--hs-display);
  font-weight: 800;
  font-synthesis: none;
  line-height: 1.5;
}

.theme-student-files main .sb-heading:is(h1) {
  font-size: clamp(2rem, 4.6vw, 3.3rem);
  line-height: 1.35;
}

/* A section heading is marked with the highlighter across its lower half. */
.theme-student-files main .sb-heading:is(h2) {
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  display: inline;
  padding-inline: 0.15em;
  background: var(--hs-mark) left bottom 0.12em / 100% 0.5em no-repeat;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ── The header: a navy strip, then one paper row over the red margin rule ── */

.theme-student-files .sb-chrome-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 1px 0 var(--hs-rule);
}

.theme-student-files .sb-chrome-header::after {
  content: '';
  position: absolute;
  inset: 100% 0 auto;
  block-size: 6px;
  background:
    linear-gradient(var(--hs-margin), var(--hs-margin)) left top / 100% 2px no-repeat,
    linear-gradient(var(--hs-margin), var(--hs-margin)) left top 4px / 100% 1px no-repeat;
  pointer-events: none;
}

.theme-student-files .sb-chrome-header .sb-section-inner {
  align-items: center;
}

.theme-student-files .sb-chrome-header .sb-column {
  align-self: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.theme-student-files .sb-chrome-header .sb-section:first-child {
  background: var(--chrome-ink);
  color: var(--chrome-ink-foreground);
  font-size: 0.8125rem;
}

.theme-student-files .sb-chrome-header .sb-section:first-child .sb-column:last-child {
  justify-content: flex-end;
}

.theme-student-files .sb-chrome-header .sb-section:first-child :is(a, button) {
  color: var(--chrome-ink-foreground);
}

.theme-student-files .sb-chrome-header .sb-section:nth-child(2) .sb-column:last-child {
  justify-content: flex-end;
}

.theme-student-files .sb-chrome-logo > span {
  font-family: var(--hs-display);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--foreground);
}

.theme-student-files .sb-chrome-header .sb-chrome-logo img {
  block-size: 2.75rem;
  inline-size: auto;
  border-radius: 8px;
}

.theme-student-files .sb-chrome-header :is(.sb-chrome-cart, .sb-chrome-theme, .sb-chrome-account, .sb-chrome-search) {
  display: inline-grid;
  place-items: center;
  min-inline-size: 2.5rem;
  block-size: 2.5rem;
  color: var(--foreground);
  border-radius: 8px;
  transition: background-color 150ms, color 150ms;
}

.theme-student-files .sb-chrome-header :is(.sb-chrome-cart, .sb-chrome-theme, .sb-chrome-account, .sb-chrome-search, .sb-chrome-menu-toggle):hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.theme-student-files .sb-chrome-cart-count {
  background: var(--hs-margin);
  color: #ffffff;
  font-weight: 700;
}

.theme-student-files .sb-chrome-header .sb-section:nth-child(2) .sb-chrome-menu-link {
  font-weight: 700;
  font-size: 0.9375rem;
  white-space: nowrap;
  padding: 0.6rem 0.65rem;
  color: var(--ink-secondary);
  background: linear-gradient(var(--hs-marker), var(--hs-marker)) center bottom 0.55rem / 0 0.45em no-repeat;
  transition: background-size 180ms, color 150ms;
}

.theme-student-files .sb-chrome-header .sb-section:nth-child(2) .sb-chrome-menu-link:hover,
.theme-student-files .sb-chrome-header .sb-section:nth-child(2) .sb-chrome-menu-link:focus-visible,
.theme-student-files .sb-chrome-header .sb-section:nth-child(2) .sb-chrome-menu-link[aria-current='page'] {
  color: var(--foreground);
  background-size: calc(100% - 1rem) 0.45em;
}

.theme-student-files .sb-chrome-mega-panel {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-block-start: 3px solid var(--hs-margin);
  border-radius: 8px;
  box-shadow: 0 18px 40px -18px rgb(22 33 62 / 0.4);
}

.theme-student-files .sb-chrome-mega-link:hover {
  color: var(--primary-700);
}

@media (max-width: 47.99rem) {
  .theme-student-files .sb-chrome-header .sb-section:first-child {
    font-size: 0.75rem;
  }

  .theme-student-files .sb-chrome-header .sb-section:first-child .sb-column:last-child {
    display: none;
  }

  .theme-student-files .sb-chrome-logo > span {
    font-size: 1.375rem;
  }

  .theme-student-files .sb-chrome-header .sb-chrome-logo img {
    block-size: 2.25rem;
  }
}

/* ── Bands ─────────────────────────────────────────────────────────────── */

/* A muted band is a ruled page with its red margin line. */
.theme-student-files .sb-section[data-sb-background='muted'] {
  background:
    linear-gradient(var(--hs-margin), var(--hs-margin)) right 1.25rem top 0 / 2px 100% no-repeat,
    repeating-linear-gradient(transparent 0 35px, var(--hs-rule) 35px 36px),
    var(--surface-alt);
}

.theme-student-files[dir='ltr'] .sb-section[data-sb-background='muted'] {
  background:
    linear-gradient(var(--hs-margin), var(--hs-margin)) left 1.25rem top 0 / 2px 100% no-repeat,
    repeating-linear-gradient(transparent 0 35px, var(--hs-rule) 35px 36px),
    var(--surface-alt);
}

.theme-student-files .sb-button {
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
  padding-inline: 1.3rem;
}

.theme-student-files [data-block='image'] img {
  border-radius: 8px;
}

/* The edition card: this month's new editions, on a spiral-notebook page; each file, its edition in a yellow tab. */
.theme-student-files #edition-card {
  position: relative;
  padding: 2rem 1.4rem 1.1rem;
  background:
    repeating-linear-gradient(transparent 0 31px, var(--hs-rule) 31px 32px) 0 1.6rem / 100% calc(100% - 1.6rem) no-repeat,
    var(--hs-paper);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 4px 4px 8px 8px;
  box-shadow: 0 22px 40px -26px rgb(22 33 62 / 0.55);
  font-variant-numeric: tabular-nums;
}

/* The spiral: rings punched along the top edge. */
.theme-student-files #edition-card::before {
  content: '';
  position: absolute;
  inset: -0.55rem 1rem auto;
  block-size: 1.3rem;
  background: radial-gradient(circle at 50% 50%, transparent 0.3rem, var(--hs-navy) 0.32rem 0.42rem, transparent 0.44rem) left / 1.5rem 100% repeat-x;
}

.theme-student-files #edition-card p:first-child {
  margin: 0 0 0.5rem;
  font-family: var(--hs-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--hs-navy);
}

.theme-student-files #edition-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.theme-student-files #edition-card li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 1rem;
  padding-block: 0.55rem;
  border-block-end: 1px dashed var(--border);
}

.theme-student-files #edition-card li b {
  font-weight: 700;
  color: var(--foreground);
}

.theme-student-files #edition-card li strong {
  justify-self: end;
  padding: 0.05rem 0.65rem;
  border-radius: 4px;
  background: var(--hs-marker);
  color: #16213e;
  font-family: var(--hs-display);
  font-weight: 800;
  white-space: nowrap;
  transform: rotate(-2deg);
}

.theme-student-files #edition-card li span {
  grid-column: 1 / -1;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.theme-student-files #edition-card p:last-child {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--hs-ink);
}

.theme-student-files #edition-card .sb-text {
  color: var(--foreground);
}

/* Category doors: an index card with its picture. */
.theme-student-files [data-block='image-box'] {
  block-size: 100%;
}

.theme-student-files [data-block='image-box'] > * {
  background: var(--card);
  border: 1px solid var(--border);
  border-block-start: 4px solid var(--hs-margin);
  border-radius: 6px;
  overflow: hidden;
  block-size: 100%;
  transition: border-color 150ms, transform 150ms;
}

.theme-student-files [data-block='image-box'] > *:hover {
  border-color: var(--hs-ink);
  border-block-start-color: var(--hs-margin);
  transform: translateY(-2px) rotate(-0.4deg);
}

.theme-student-files .sb-image-box-img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  inline-size: 100%;
  border-radius: 0;
}

.theme-student-files .sb-image-box-body {
  align-self: stretch;
  padding: 0.75rem 0.875rem 0.875rem;
}

.theme-student-files .sb-image-box-title {
  font-family: var(--hs-display);
  font-weight: 800;
  font-size: 1.125rem;
}

.theme-student-files .sb-image-box-text {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

/* Product cards: an index card, a red rule at its head and blue lines under the text. */
.theme-student-files [data-catalog-card] {
  background:
    linear-gradient(var(--hs-margin), var(--hs-margin)) left top / 100% 3px no-repeat,
    var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 150ms, box-shadow 150ms, transform 150ms;
}

.theme-student-files [data-catalog-card]:hover {
  border-color: var(--hs-ink);
  box-shadow: 0 14px 30px -20px rgb(22 33 62 / 0.5);
  transform: rotate(-0.4deg);
}

.theme-student-files [data-catalog-card] .ui-image {
  border-radius: 4px;
}

.theme-student-files .sb-products-view-all {
  color: var(--foreground);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--hs-marker);
  text-decoration-thickness: 0.4em;
  text-underline-offset: -0.15em;
  text-decoration-skip-ink: none;
}

/* Figures: numbers in ballpoint blue over a margin rule. */
.theme-student-files .sb-stat-value {
  font-size: clamp(1.6rem, 2.8vw, 2.3rem);
  color: var(--hs-ink);
  line-height: 1.3;
}

.theme-student-files .sb-stat {
  border-inline-start: 2px solid var(--hs-margin);
  padding-inline-start: 0.9rem;
}

/* Tables (the errata, the finals plan): a navy head over ruled rows, the page number circled in pen. */
.theme-student-files .sb-text table {
  inline-size: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.theme-student-files .sb-text thead th {
  background: var(--chrome-ink);
  color: var(--chrome-ink-foreground);
  font-weight: 700;
  text-align: start;
  padding: 0.7rem 0.75rem;
}

.theme-student-files .sb-text tbody td {
  padding: 0.6rem 0.75rem;
  border-block-end: 1px solid var(--hs-rule);
}

.theme-student-files .sb-text tbody tr:last-child td {
  border-block-end: 0;
}

.theme-student-files .sb-text tbody td strong {
  display: inline-grid;
  place-items: center;
  min-inline-size: 2.2rem;
  block-size: 2.2rem;
  padding-inline: 0.2rem;
  border: 2px solid var(--hs-ink);
  border-radius: 50% 45% 50% 42%;
  color: var(--hs-ink);
  font-family: var(--hs-display);
  font-weight: 800;
  transform: rotate(-6deg);
}

/* The errata: the wrong line struck through in red, the right one in blue ink with the highlighter. */
.theme-student-files #errata-log s {
  color: var(--hs-margin);
  text-decoration-color: var(--hs-margin);
  text-decoration-thickness: 2px;
  white-space: nowrap;
}

.theme-student-files #errata-log u {
  text-decoration: none;
  color: var(--hs-ink);
  font-weight: 700;
  white-space: nowrap;
  padding-inline: 0.2em;
  background: linear-gradient(transparent 55%, var(--hs-marker) 55%);
}

.theme-student-files #errata-log .sb-text,
.theme-student-files #finals-plan .sb-text {
  overflow-x: auto;
}

.theme-student-files #finals-plan tbody td:last-child {
  font-weight: 800;
  color: var(--hs-ink);
}

@media (max-width: 47.99rem) {
  .theme-student-files #errata-log tbody td:nth-child(3),
  .theme-student-files #errata-log tbody td:nth-child(4) {
    min-inline-size: 9rem;
  }
}

.theme-student-files :is(.sb-testimonial, .sb-post, [data-block='icon-box'] > *) {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* A testimonial is a sticky note: yellow paper, a little askew. */
.theme-student-files .sb-testimonial {
  background: #fff8d6;
  border-color: #f2e3a0;
  color: #3b3417;
  transform: rotate(-0.6deg);
}

.theme-student-files .sb-testimonial:nth-child(even) {
  transform: rotate(0.6deg);
}

.theme-student-files .sb-testimonial :is(p, span, blockquote) {
  color: inherit;
}

.theme-student-files .sb-testimonial-name {
  font-weight: 700;
}

.theme-student-files .sb-brand {
  border-color: var(--border);
  border-radius: 8px;
  background: #fbfaf5;
}

.theme-student-files .sb-brand:hover {
  border-color: var(--hs-ink);
}

.theme-student-files [data-block='cta'] > * {
  border-radius: 12px;
}

/* ── The footer: navy under a row of spiral-binding rings ──────────────── */

.theme-student-files .sb-chrome-footer {
  position: relative;
  padding-block-start: 2.75rem;
  background: var(--chrome-ink);
  color: var(--chrome-ink-foreground);
}

.theme-student-files .sb-chrome-footer::before {
  content: '';
  position: absolute;
  inset: -0.9rem 0 auto;
  block-size: 1.8rem;
  background: radial-gradient(ellipse 0.42rem 0.8rem at 50% 50%, transparent 0.3rem, #94a3b8 0.34rem 0.5rem, transparent 0.54rem) center / 1.6rem 100% repeat-x;
  pointer-events: none;
}

.theme-student-files .sb-chrome-footer :is(a, .sb-chrome-logo > span) {
  color: var(--chrome-ink-foreground);
}

.theme-student-files .sb-chrome-footer a:hover {
  color: var(--hs-marker);
}

.theme-student-files .sb-chrome-footer .sb-chrome-menu > ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 1.5rem;
}

.theme-student-files .sb-chrome-footer .sb-section:last-child {
  border-block-start: 1px solid rgb(255 255 255 / 0.12);
  font-size: 0.8125rem;
  color: #a7b1c8;
}

@media (max-width: 47.99rem) {
  .theme-student-files .sb-brands {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-student-files .sb-testimonial,
  .theme-student-files .sb-testimonial:nth-child(even) {
    transform: none;
  }
}
