/* Global Typography & Variables */
:root {
  --column-width: 320px;
  --column-gap: 2rem;
  --font-typewriter: "Special Elite", monospace;
  --font-handwriting: "Fuzzy Bubbles", "ZCOOL KuaiLe", sans-serif;
  --font-code: "Anonymous Pro", monospace;
}

html {
  font-size: 11pt; /* Baseline font size */
  overflow-x: hidden;
}

body {
  background-color: #f4f4f5;
  font-family: var(--font-typewriter);
  margin: 0;
  padding: 0 2rem;
  color: #27272a;
  background-image: url("/img/corkboard-tile.jpg");
  background-size: 192px 192px;
  background-repeat: repeat;
  position: relative;
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  box-shadow: inset 0 0 150px rgba(60, 30, 0, 0.4);
  pointer-events: none;
  z-index: 100;
}

code,
pre {
  font-family: var(--font-code);
  font-size: 1rem;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

code {
  padding: 0.2rem 0.4rem;
}

pre {
  line-height: 1rem;
  padding: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

pre::-webkit-scrollbar {
  display: none;
}

pre code {
  background-color: transparent;
  padding: 0;
}

.site-header {
  text-align: center;
  margin-bottom: 2rem;
  width: 100%;
  flex-shrink: 0;
}

h1 {
  margin: 2rem 0 1rem 0;
  font-family: var(--font-handwriting);
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); /* contrast against corkboard */
  color: #fff;
}

h1 a,
h1 a:visited {
  color: inherit;
  text-decoration: none;
}

.subtitle {
  font-family: var(--font-handwriting);
  font-size: 2rem;
  color: #e4e4e7;
  margin: 0 0 1rem 0;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.back-btn {
  display: inline-block;
  margin-bottom: 2rem;
  text-decoration: none;
  color: #52525b;
  font-weight: 600;
}

.subtitle .back-btn {
  color: #e4e4e7;
  text-decoration: underline;
}

.back-btn:hover {
  color: #000;
}

.content {
  line-height: 1.8;
  font-size: 1rem;
}

/* Board Layout */
.board {
  columns: auto var(--column-width);
  column-gap: var(--column-gap);
  width: 100%;
  margin: 0 auto;
}

.note-wrapper {
  break-inside: avoid;
  margin-bottom: calc(
    -1rem - 30px
  ); /* Creates vertical overlap, compensates for padding-top */
  padding-top: 30px; /* Prevents absolute tape/pins from being clipped at column boundaries */
  position: relative;
  transform: translate(var(--shift-x, 0), var(--shift-y, 0))
    rotate(var(--rot, 0deg));
  transition:
    z-index 0s,
    transform 0.2s;
  z-index: 1;
  filter: drop-shadow(2px 4px 4px rgba(0, 0, 0, 0.25));
}

.note-wrapper::after {
  content: "";
  position: absolute;
  bottom: var(--curl-sh-bottom, 8px);
  right: var(--curl-sh-right, 15px);
  left: var(--curl-sh-left, auto);
  width: var(--curl-sh-width, 50%);
  height: var(--curl-sh-height, 15px);
  background: transparent;
  border-radius: 50%;
  box-shadow: var(--curl-sh-box, 15px 15px 15px rgba(0, 0, 0, 0.4));
  transform: rotate(var(--curl-sh-rot, 6deg));
  z-index: -1;
  pointer-events: none;
}

.curl-highlight {
  position: absolute;
  bottom: 0;
  right: var(--curl-hl-right, 0);
  left: var(--curl-hl-left, auto);
  width: var(--curl-hl-width, 60px);
  height: var(--curl-hl-height, 60px);
  background: var(
    --curl-hl-bg,
    linear-gradient(
      135deg,
      transparent 20%,
      rgba(0, 0, 0, 0.1) 40%,
      rgba(255, 255, 255, 0.7) 70%,
      rgba(255, 255, 255, 0.1) 100%
    )
  );
  border-bottom-right-radius: var(--curl-hl-br, inherit);
  border-bottom-left-radius: var(--curl-hl-bl, 0);
  z-index: 3;
  pointer-events: none;
}

.curl-size-1 {
  --c-sh-b: 3px;
  --c-sh-w: 30%;
  --c-sh-r: 2;
  --c-sh-bx: 5;
  --c-sh-a: 0.2;
  --c-hl-s: 30px;
}

.curl-size-2 {
  --c-sh-b: 5px;
  --c-sh-w: 40%;
  --c-sh-r: 4;
  --c-sh-bx: 10;
  --c-sh-a: 0.3;
  --c-hl-s: 40px;
}

.curl-size-3 {
  --c-sh-b: 8px;
  --c-sh-w: 50%;
  --c-sh-r: 6;
  --c-sh-bx: 15;
  --c-sh-a: 0.4;
  --c-hl-s: 60px;
}

.curl-size-4 {
  --c-sh-b: 10px;
  --c-sh-w: 55%;
  --c-sh-r: 7;
  --c-sh-bx: 18;
  --c-sh-a: 0.42;
  --c-hl-s: 70px;
}

.curl-size-5 {
  --c-sh-b: 12px;
  --c-sh-w: 60%;
  --c-sh-r: 8;
  --c-sh-bx: 20;
  --c-sh-a: 0.45;
  --c-hl-s: 80px;
}

.curl-right {
  --curl-sh-right: 15px;
  --curl-sh-left: auto;
  --curl-sh-rot: calc(var(--c-sh-r) * 1deg);
  --curl-sh-box: calc(var(--c-sh-bx) * 1px) calc(var(--c-sh-bx) * 1px)
    calc(var(--c-sh-bx) * 1px) rgba(0, 0, 0, var(--c-sh-a));
  --curl-hl-right: 0;
  --curl-hl-left: auto;
  --curl-hl-br: inherit;
  --curl-hl-bl: 0;
  --curl-hl-width: var(--c-hl-s);
  --curl-hl-height: var(--c-hl-s);
  --curl-hl-bg: linear-gradient(
    135deg,
    transparent 20%,
    rgba(0, 0, 0, 0.1) 40%,
    rgba(255, 255, 255, 0.7) 70%,
    rgba(255, 255, 255, 0.1) 100%
  );
}

.curl-left {
  --curl-sh-right: auto;
  --curl-sh-left: 15px;
  --curl-sh-rot: calc(var(--c-sh-r) * -1deg);
  --curl-sh-box: calc(var(--c-sh-bx) * -1px) calc(var(--c-sh-bx) * 1px)
    calc(var(--c-sh-bx) * 1px) rgba(0, 0, 0, var(--c-sh-a));
  --curl-hl-right: auto;
  --curl-hl-left: 0;
  --curl-hl-br: 0;
  --curl-hl-bl: inherit;
  --curl-hl-width: var(--c-hl-s);
  --curl-hl-height: var(--c-hl-s);
  --curl-hl-bg: linear-gradient(
    225deg,
    transparent 20%,
    rgba(0, 0, 0, 0.1) 40%,
    rgba(255, 255, 255, 0.7) 70%,
    rgba(255, 255, 255, 0.1) 100%
  );
}

.note-wrapper:hover {
  z-index: 50;
}

.note {
  font-size: var(--base-font, 1.4rem);
  padding: 1.5rem;
  border-radius: var(--radius, 2px 15px 3px 10px / 15px 2px 10px 5px);
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
  /* Add subtle SVG noise for that gritty vintage paper feel */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
}

.note.style-sticky h2,
.note.style-notepad h2,
.note.style-newspaper h2 {
  margin-bottom: 0 !important;
  line-height: 2rem;
}

.note-wrapper.pin-tape::before {
  content: "";
  position: absolute;
  top: 17px;
  left: var(--tape-left, 50%);
  transform: translateX(-50%) rotate(calc(var(--rot) * -0.5));
  width: 70px;
  height: 25px;
  background-image: url("/img/masking-tape.jpg");
  background-size: cover;
  background-position: center;
  mix-blend-mode: multiply;
  opacity: 0.9;
  z-index: 100;
  pointer-events: none;
}

.note-wrapper.pin-pushpin::before {
  content: "";
  position: absolute;
  top: 35px;
  left: var(--tape-left, 50%);
  transform: translateX(-50%) rotate(calc(var(--rot) * -1));
  width: 75px;
  height: 75px;
  background-image: url("/img/pushpin.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.95;
  filter: drop-shadow(1px 3px 3px rgba(0, 0, 0, 0.5)) brightness(0.6);
  z-index: 100;
  pointer-events: none;
}

.note.is-expandable {
  cursor: pointer;
}

/* Debug Mode Styles */
.debug-info {
  display: none;
  font-family: monospace;
  font-size: 0.8rem;
  color: #d946ef;
  background: rgba(255, 255, 255, 0.85);
  margin-bottom: 0;
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: 20;
}

body.debug-mode .debug-info {
  display: block;
}

.note:hover {
  transform: translateY(-5px) scale(1.02) rotate(0deg);
  box-shadow: 5px 12px 20px rgba(0, 0, 0, 0.25);
}

.note h2,
.dialog-header h2 {
  font-size: var(--h2-font, 1.25em);
  font-weight: 700;
  text-align: left;
}

.note-content {
  font-size: 1em;
  max-height: 300px;
  min-height: 150px;
  overflow: hidden;
  position: relative;
  scrollbar-width: none;
}

.note-content::-webkit-scrollbar {
  display: none;
}

.note.is-expandable .note-content {
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

/* Tags */
.tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 0;
  flex-wrap: wrap;
}

.modal-view .tags {
  flex-shrink: 0;
  margin-top: 3rem;
  border-top: none;
  padding-top: 1.5rem;
}

.tag {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

.term-list {
  text-align: left;
  padding-left: 1.2rem;
  margin: 0;
}

.term-link,
.term-link:visited {
  color: inherit;
  text-decoration: none;
}

.modal-view {
  font-family: var(--font-typewriter);
  font-size: var(--base-font, 1rem);
  padding: 3rem;
  border: none;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  background-color: var(--notepad-color, #fff);
  color: #27272a;
  box-sizing: border-box;
  max-width: 90vw;
  max-height: 90vh;
  word-wrap: break-word;
  overflow-wrap: break-word;

  /* Force fixed positioning since .note class overrides it to relative */
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
}

dialog.modal-view[open],
div.modal-view {
  display: flex;
  flex-direction: column;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog-header {
  flex-shrink: 0;
  padding: 2rem 0 1rem 0;
  border-radius: 8px;
}

.dialog-header h2 {
  margin: 0;
  text-align: left;
}

.dialog-content {
  flex: 1;
  min-height: 0;
  font-size: 1em;
  position: relative;
  line-height: 1.2;
  overflow-y: auto;
  scrollbar-width: none;
}

.dialog-content img,
.dialog-content pre {
  max-width: 100%;
  height: auto;
  break-inside: avoid;
  margin: 1rem 0;
}

.dialog-content p:first-child {
  margin-top: 0;
}

.dialog-content p:last-child {
  margin-bottom: 0;
}

.dialog-content::-webkit-scrollbar {
  display: none;
}

.dialog-meta {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.copy-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.copy-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  padding: 1rem 1.5rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.2rem;
  transition: background 0.2s;
  z-index: 100;
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.2);
}

.layout-wrapper {
  display: flex;
  flex-direction: row;
  flex: 1;
  gap: var(--column-gap);
  align-items: flex-start;
}

.chaotic-sidebar {
  width: var(--column-width);
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
  height: max-content;
  scrollbar-width: none;
}

.chaotic-sidebar::-webkit-scrollbar {
  display: none;
}

.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}

.main-content::-webkit-scrollbar {
  display: none;
}

/* Dymo Labels (Category Headers) */
.dymo-label {
  background-color: #7b0d0d;
  color: #fff;
  font-family: var(--font-code);
  font-size: 1.2rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  box-shadow:
    2px 3px 5px rgba(0, 0, 0, 0.4),
    inset 1px 1px 1px rgba(255, 255, 255, 0.2);
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.6),
    1px 1px 0 rgba(255, 255, 255, 0.2);
  transform: rotate(-2deg);
  margin-bottom: 1.5rem;
}

a.dymo-label,
a.dymo-label:visited {
  color: #fff;
  text-decoration: none;
}

.mt-3 {
  margin-top: 3rem !important;
}

/* Mobile Tabs Container */
.mobile-sidebar-tabs {
  display: none;
}

/* Torn Masking Tape Tags */
.torn-tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.torn-tags li {
  position: relative;
}

.torn-paper {
  font-family: var(--font-handwriting);
  font-size: 1.1rem;
  background-color: #fdfdfd;
  color: #111;
  text-decoration: none;
  padding: 0.3rem 0.8rem;
  display: inline-block;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.2);
  border-radius: 2px 5px 3px 6px;
  transform: rotate(3deg);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  position: relative;
}

/* Alternate rotation for chaos */
.torn-tags li:nth-child(even) .torn-paper {
  transform: rotate(-3deg);
  background-color: #faf9f5;
}

.torn-tags li:nth-child(3n) .torn-paper {
  transform: rotate(1deg);
}

/* The masking tape piece holding it up */
.torn-paper::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(-5deg);
  width: 40px;
  height: 14px;
  background-image: url("/img/masking-tape.jpg");
  background-size: cover;
  background-position: center;
  mix-blend-mode: multiply; /* drops out the white background, leaving only tape wrinkles! */
  opacity: 0.9;
  z-index: 5;
}

.torn-tags li:nth-child(even) .torn-paper::before {
  transform: translateX(-40%) rotate(8deg);
}

.torn-paper:hover {
  transform: translateY(-2px) scale(1.05) !important;
  box-shadow: 3px 5px 10px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

/* Manila Folder Tabs for Years */
.folder-tabs {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.folder-tab {
  font-family: var(--font-handwriting);
  font-size: 1.2rem;
  color: #000;
  text-decoration: none;
  background: #f4e8c1;
  padding: 0.2rem 1.5rem 0.2rem 1rem;
  border-radius: 8px 15px 2px 2px;
  box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.25);
  transform: rotate(1deg);
  transition: transform 0.2s;
}

.folder-tabs a:nth-child(even) {
  transform: rotate(-1.5deg);
}

.folder-tab:hover {
  transform: translateX(8px) scale(1.05) !important;
}

/* removed */
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 15px;
  align-items: flex-start;
  margin-left: 5px;
}

.ticket-wrapper {
  text-decoration: none;
  filter: drop-shadow(2px 4px 4px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s;
  transform: rotate(-2deg);
}

.ticket-wrapper:hover {
  transform: rotate(1deg) scale(1.05);
}

.ticket-wrapper:nth-child(even) {
  transform: rotate(3deg);
}

.ticket-wrapper:nth-child(even):hover {
  transform: rotate(-1deg) scale(1.05);
}

.ticket-stub {
  display: flex;
  align-items: center;
  background-color: var(--ticket-bg, #f4e8d1);
  color: #333;
  font-family: var(--font-typewriter);
  padding: 10px 15px 10px 10px;
  border: 2px solid #333;
  /* Cut out semi-circles on left and right edges */
  -webkit-mask-image:
    radial-gradient(circle at 0 50%, transparent 6px, black 7px),
    radial-gradient(circle at 100% 50%, transparent 6px, black 7px);
  -webkit-mask-size: 51% 100%;
  -webkit-mask-position: left, right;
  -webkit-mask-repeat: no-repeat;
  mask-image:
    radial-gradient(circle at 0 50%, transparent 6px, black 7px),
    radial-gradient(circle at 100% 50%, transparent 6px, black 7px);
  mask-size: 51% 100%;
  mask-position: left, right;
  mask-repeat: no-repeat;
}

.ticket-stub::before {
  content: "ADMIT\A ONE";
  white-space: pre;
  font-size: 0.55rem;
  line-height: 1.1;
  text-align: center;
  border-right: 1px dashed #333;
  padding-right: 6px;
  margin-right: 10px;
  opacity: 0.8;
  letter-spacing: 1px;
}

.ticket-icon {
  margin-right: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.ticket-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ticket-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.ticket-description {
  font-size: 0.8rem;
  margin-top: 2px;
  opacity: 0.8;
  letter-spacing: 0.5px;
}

/* --- Polaroid Styles --- */
.wrapper-style-polaroid {
  width: 80%;
  margin: 0 auto;
}

.note.style-polaroid.is-expandable .note-content {
  -webkit-mask-image: none;
  mask-image: none;
}

.modal-view:not(.style-polaroid) .tags {
  margin-top: 1rem;
  padding-top: 0;
}

.style-polaroid {
  background: #fff;
  padding: 10px 10px 30px 10px;
  box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  background-image: none;
  color: #111;
  font-family: var(--font-handwriting);
  text-align: center;
}

.style-polaroid h2 {
  display: none !important;
}

/* Hide the curled paper shadow and glossy highlight entirely */
.wrapper-style-polaroid::after,
.style-polaroid .curl-highlight {
  display: none;
}

.style-polaroid .note-content img {
  width: 100%;
  display: block;
  background: #eee;
  margin-bottom: 15px;
}

/* Pinboard Thumbnail */
.board .style-polaroid .note-content img {
  height: 150px;
  object-fit: cover;
}

/* If there are multiple photos, stack them to look like a messy pile */
.board .style-polaroid .note-content {
  display: grid;
  max-height: none !important;
  overflow: visible !important;
}

.board .style-polaroid .note-content p:has(img) {
  grid-area: 1 / 1 / 2 / 2;
}

/* Explicitly place the caption below the image stack */
.board .style-polaroid .note-content p:not(:has(img)) {
  grid-row: 2;
  margin-top: 1rem;
  font-size: 1.2rem;
  z-index: 10;
}

.board .style-polaroid .note-content img {
  border: 3px solid #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.board .style-polaroid .note-content p:has(img):nth-of-type(1) {
  z-index: 3;
}

.board .style-polaroid .note-content p:has(img):nth-of-type(2) {
  z-index: 2;
  transform: rotate(6deg) translate(3px, 4px);
}

.board .style-polaroid .note-content p:has(img):nth-of-type(3) {
  z-index: 1;
  transform: rotate(-5deg) translate(-4px, 2px);
}

/* Hide any more than 3 to avoid making it too thick */
.board .style-polaroid .note-content p:has(img):nth-of-type(n + 4) {
  display: none !important;
}

/* Dialog Popup Full Photo */
.modal-view.style-polaroid {
  padding: 20px 20px 50px 20px !important;
  width: 90vw;
  max-width: min(1000px, 75vh);
}

.modal-view.style-polaroid .dialog-content img {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 25px;
  display: block;
}

.modal-view.style-polaroid .dialog-content p:not(:has(img)) {
  font-size: 2rem;
  margin: 0;
  width: 100%;
}

/* --- Sticky Note Styles --- */
.wrapper-style-sticky {
  width: 75%;
  margin: 0 auto;
}

.style-sticky {
  --base-font: 1.2rem;
  --h2-font: 1.25em;
  font-family: var(--font-handwriting);
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.modal-view.style-sticky {
  --base-font: 1.8rem;
  font-family: var(--font-handwriting);
  width: 50vh;
  max-width: min(90vw, 600px);
  padding: 1.5rem;
}

/* --- Notepad Styles --- */
.wrapper-style-notepad {
  width: 90%;
  margin: 0 auto;
}

.style-notepad {
  background-color: var(--notepad-color, #fff) !important;
  color: #2b2013;
  border-radius: 4px !important;
  background-image:
    linear-gradient(
      90deg,
      transparent 40px,
      #ff9999 40px,
      #ff9999 42px,
      transparent 42px
    ),
    linear-gradient(#e5e5f7 1px, transparent 1px);
  background-size:
    100% 100%,
    100% 1.8rem;
  background-position:
    0 0,
    0 1.8rem;
  --base-font: 1.2rem;
  --h2-font: 1.5em;
  font-family: var(--font-handwriting);
  line-height: 1.4rem;
  padding-left: 50px !important;
}

.style-notepad::before,
.single-note-view.style-notepad::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 12px;
  width: 16px;
  background-image: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0.3) 4px,
    transparent 5px
  );
  background-size: 100% 1.8rem;
  background-position: 0 1.8rem;
  z-index: 10;
  pointer-events: none;
}

.modal-view.style-notepad {
  --base-font: 1.4rem;
  font-family: var(--font-handwriting);
  height: 86vh;
  max-height: 1200px;
  width: 90vw;
  max-width: min(90vw, 600px);
  aspect-ratio: 1 / 1.414;
  font-size: var(--base-font);
  background-position:
    0 0,
    0 4.1rem;
}

.modal-view.style-notepad h2 {
  line-height: 2.4rem;
}

.modal-view.style-notepad::before {
  background-position: 0 4.1rem;
}

.modal-view.style-notepad .dialog-content {
  line-height: 1.6rem;
}

/* --- Newspaper Styles --- */
.wrapper-style-newspaper {
  width: 100%;
  margin: 0 auto;
}

.style-newspaper {
  --base-font: 1.1rem;
  --h2-font: 1.4em;
  font-family: var(--font-typewriter);
  background-color: var(--newspaper-color, #d1c4b5) !important;
  color: #1a1a1a;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.15'/%3E%3C/svg%3E");

  /* Random jagged edges via tear-* classes */
  border-radius: 0 !important;
}

.style-newspaper h2 {
  text-transform: uppercase;
}

.style-newspaper.tear-1 {
  clip-path: polygon(
    /* top */ 0% 0%,
    12.5% 0.5%,
    16.7% 0.4%,
    20.8% 0.6%,
    25% 0.7%,
    29.2% 0.4%,
    33.3% 0.3%,
    45.8% 0.5%,
    50% 0.7%,
    54.2% 0.8%,
    75% 1%,
    79.2% 0.7%,
    83.3% 0.7%,
    87.5% 0.7%,

    /* right */ 100% 0%,
    99.5% 8.3%,
    99% 16.7%,
    99.8% 20.8%,
    98.7% 25%,
    100% 37.5%,
    99.2% 41.7%,
    99.4% 45.8%,
    99.9% 58.3%,
    99.9% 62.5%,
    100% 70.8%,
    100% 75%,
    100% 79.2%,
    99.9% 83.3%,
    99.9% 87.5%,
    99.8% 91.7%,
    99.8% 95.8%,

    /* bottom */ 100% 100%,
    50% 99.8%,
    25% 99.9%,
    12.5% 99.8%,
    4.2% 99.9%,

    /* left */ 0% 100%,
    0.5% 95%,
    0.2% 75%,
    0.7% 70.8%,
    0.8% 66.7%,
    0.5% 50.7%,
    0.7% 25.7%,
    0.6% 12.5%,
    0% 4.2%,
    0% 0%
  );
}

.style-newspaper.tear-2 {
  clip-path: polygon(
    /* top */ 0% 0%,
    4.2% 0.5%,
    8.3% 0.8%,
    29.2% 0.4%,
    45.8% 0.1%,
    41.7% 0.2%,
    50% 0.5%,
    83.3% 0.4%,
    87.5% 0%,
    95.8% 0.1%,

    /* right */ 100% 0%,
    99.8% 20.8%,
    99.9% 25%,
    99.7% 33.3%,
    99.6% 37.5%,
    99.8% 50%,
    99.3% 54.2%,
    99.4% 58.3%,
    99.4% 62.5%,
    99.5% 66.7%,
    99.6% 70.8%,
    99.7% 75%,
    98.5% 80%,
    100% 95.8%,

    /* bottom */ 100% 100%,
    50% 99.8%,
    25% 99.9%,
    12.5% 99.8%,
    4.2% 99.9%,

    /* left */ 0% 100%,
    0% 100%,
    0.9% 85.8%,
    0.5% 75.8%,
    0.3% 50%,
    0.1% 25.5%,
    0% 0%
  );
}

.style-newspaper.tear-3 {
  clip-path: polygon(
    /* top*/ 0% 0%,
    20.8% 0.2%,
    25% 0.1%,
    29.2% 0.1%,
    50% 0%,
    54.2% 0.1%,
    58.3% 0.1%,
    62.5% 0.2%,
    66.7% 0.2%,
    83.3% 0.1%,
    87.5% 0.3%,
    95.8% 0.1%,

    /* right */ 100% 0%,
    99.8% 4.2%,
    99.6% 12.5%,
    99.8% 16.7%,
    100% 20.8%,
    99.3% 25%,
    99.1% 41.7%,
    98.9% 45.8%,
    98.8% 50%,
    98.9% 54.2%,
    99.1% 58.3%,
    99.5% 62.5%,
    99.6% 66.7%,
    99.3% 70.8%,
    99.8% 91.7%,
    99.6% 95.8%,

    /* bottom */ 100% 100%,
    50% 99.8%,
    25% 99.9%,
    12.5% 99.8%,
    4.2% 99.9%,

    /* left */ 0% 100%,
    0.5% 75%,
    0.8% 70.8%,
    0.6% 66.7%,
    0.5% 62.5%,
    0% 54.2%,
    0.1% 50%,
    0.2% 45.8%,
    0.1% 41.7%,
    0.2% 37.5%,
    0% 33.3%,
    0.4% 29.2%,
    0.2% 25%,
    0.4% 4.2%,
    0% 0%
  );
}

/* Crease / Kink down the middle */
.style-newspaper::after {
  content: "";
  position: absolute;
  top: 0;
  left: var(--crease-pos, 35%);
  bottom: 0;
  width: 30px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(0, 0, 0, 0.06) 40%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent
  );
  transform: rotate(1.5deg);
  pointer-events: none;
  z-index: 2;
}

.modal-view.style-newspaper {
  --base-font: 1.2rem;
  width: 90vw;
  max-width: 1600px;
  height: 90vh;
  max-height: 90vh;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.05),
    0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-view.style-newspaper .dialog-header {
  padding: 1rem 0;
  margin-bottom: 2rem;
  border-bottom: 2px solid #222;
  border-top: 2px solid #222;
  border-radius: 0;
}

.modal-view.style-newspaper .dialog-header h2 {
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.modal-view.style-newspaper .inner-content {
  columns: 2;
  column-gap: 2rem;
  column-rule: 1px solid #ccc;
}

.modal-view.style-newspaper .dialog-content {
  line-height: 1.2;
}

/* --- Mobile Breakpoint (iPad Mini: 768px) ---
   NOTE: Vanilla CSS does not support variables inside @media conditions
   WARN: Keep maxMobileWidth in layouts/partials/sidebar.html in sync!
 */
@media (max-width: 767px) {
  :root {
    --column-width: 240px;
  }
  body {
    background-size: 128px 128px;
  }
  .layout-wrapper {
    flex-direction: column;
  }
  .desktop-only {
    display: none !important;
  }
  .mobile-sidebar-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: center;
    width: 100%;
    margin-bottom: 1.5rem;
  }
  .mobile-tab {
    cursor: pointer;
    margin-bottom: 0 !important;
  }
  .chaotic-sidebar {
    width: 100%;
    position: static;
  }
  .sidebar-section {
    display: none;
    width: 100%;
    margin-top: 0 !important;
  }
  .sidebar-section.mobile-active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
  }
  .site-header {
    margin-bottom: 1rem;
  }
  h1 {
    font-size: 2.5rem;
    margin: 1rem 0 0.5rem 0;
  }
  .subtitle {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }
  .folder-tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .modal-view {
    padding: 1.5rem !important;
  }
  .modal-view.style-notepad {
    padding-left: 50px !important;
  }
  .modal-view.style-newspaper .inner-content {
    columns: 1;
  }
}

/* Cursor Blink Animation */
.blink {
  animation: blinker 1s step-start infinite;
}

@keyframes blinker {
  50% {
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
