*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --paper: #f7f3e8;
  --paper-dark: #efe8d6;
  --desk: #d9d2bf;
  --ink: #1a1a1a;
  --ink-soft: #3d3d3d;
  --line: #c8c0a8;
  --line-soft: #ddd6c2;
  --red: #8b2942;
  --green: #2d6a4f;
  --muted: #7a7366;
  --white: #faf8f2;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--desk);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  padding: 0.75rem 1rem;
  background: rgba(250, 248, 242, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.nav-btn {
  font-family: "Caveat", cursive;
  font-size: 1.15rem;
  font-weight: 600;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  text-transform: lowercase;
}

.nav-btn:hover {
  color: var(--ink);
  border-color: var(--line);
}

.nav-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.page {
  display: none;
  min-height: calc(100dvh - 52px);
}

.page.active {
  display: block;
  animation: fade 0.22s ease;
}

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

/* HOME — proper page, not notebook */
.page-home {
  background: var(--white);
}

.home-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  text-align: center;
}

.home-inner.narrow {
  max-width: 520px;
  text-align: left;
}

.home-nib {
  display: block;
  margin: 0 auto 1.25rem;
  width: 140px;
  height: 140px;
  object-fit: contain;
}

.home-inner h1 {
  margin: 0;
  font-family: "Caveat", cursive;
  font-size: clamp(3rem, 10vw, 4.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.home-tag {
  margin: 0.4rem 0 2rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.home-body {
  text-align: left;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.home-body p {
  margin: 0 0 1.15rem;
}

.home-close {
  margin-top: 1.5rem !important;
  font-family: "Caveat", cursive;
  font-size: 1.45rem;
  color: var(--ink);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 2.25rem;
}

.home-link {
  font-family: "Caveat", cursive;
  font-size: 1.25rem;
  font-weight: 600;
  padding: 0.45rem 1.2rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}

.home-link.ghost {
  background: transparent;
  color: var(--ink);
}

.home-link:hover {
  opacity: 0.88;
}

.home-foot {
  margin-top: 3rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.home-foot .dot {
  margin: 0 0.35rem;
}

.nfa-title {
  font-family: "Caveat", cursive;
  font-size: 2.5rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  text-align: center;
}

.nfa-body {
  font-family: "Kalam", cursive;
  font-size: 1.25rem;
  color: var(--ink-soft);
}

.nfa-body p {
  margin: 0 0 1rem;
}

.signoff {
  margin-top: 2rem !important;
  color: var(--ink);
  font-size: 1.35rem;
}

/* NOTEBOOK — wide paper */
.page-notebook {
  background: var(--desk);
  padding: 1.25rem 1rem 2.5rem;
}

.paper {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  min-height: calc(100dvh - 100px);
  background:
    repeating-linear-gradient(
      transparent,
      transparent 31px,
      var(--line-soft) 31px,
      var(--line-soft) 32px
    ),
    var(--paper);
  background-attachment: local;
  border: 1px solid var(--line);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 12px 40px rgba(0, 0, 0, 0.08);
  padding: 2rem 2.5rem 3rem 4.5rem;
  position: relative;
}

.paper::before {
  content: "";
  position: absolute;
  left: 2.75rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(180, 80, 80, 0.35);
  pointer-events: none;
}

@media (max-width: 700px) {
  .page-notebook {
    padding: 0.5rem 0 0;
  }
  .paper {
    padding: 1.5rem 1.15rem 2.5rem 2.5rem;
    border-left: none;
    border-right: none;
    max-width: none;
  }
  .paper::before {
    left: 1.35rem;
  }
}

.nb-top {
  text-align: center;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.nb-mark {
  display: block;
  margin: 0 auto 0.5rem;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.nb-title {
  margin: 0;
  font-family: "Caveat", cursive;
  font-weight: 600;
  font-size: clamp(2.25rem, 6vw, 3.25rem);
  line-height: 1;
  text-transform: lowercase;
}

.nb-sub {
  margin: 0.3rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  font-family: "Kalam", cursive;
}

.notes {
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 900px) {
  .notes {
    columns: 2;
    column-gap: 2.5rem;
  }
  .notes li {
    break-inside: avoid;
  }
}

.notes li {
  font-family: "Caveat", cursive;
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
  line-height: 1.35;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--line);
  color: var(--ink);
}

.note-footer {
  margin: 2rem 0 0;
  text-align: right;
  color: var(--muted);
  font-size: 1.15rem;
  font-family: "Caveat", cursive;
}

.pnl-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.55rem;
  margin-bottom: 1.5rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
}

.pnl-line[hidden] {
  display: none !important;
}

.pnl-label {
  color: var(--muted);
  text-transform: lowercase;
  font-size: 0.8rem;
}

.pnl-num {
  font-weight: 500;
}

.pnl-num.up {
  color: var(--green);
}

.pnl-num.down {
  color: var(--red);
}

.pnl-sep {
  color: var(--line);
}

.trade-block {
  margin-bottom: 1.75rem;
}

.trade-block h3 {
  margin: 0 0 0.65rem;
  font-family: "Caveat", cursive;
  font-size: 1.55rem;
  font-weight: 600;
  text-transform: lowercase;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}

.empty-line {
  margin: 0;
  font-family: "Caveat", cursive;
  font-size: 1.25rem;
  color: var(--muted);
}

.trade-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dotted var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.trade-row .sym {
  font-weight: 500;
}

.trade-row .meta {
  color: var(--muted);
}

.trade-row .pnl.up {
  color: var(--green);
}

.trade-row .pnl.down {
  color: var(--red);
}

.goals ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.goals li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 1.25rem;
  font-family: "Caveat", cursive;
  padding: 0.35rem 0;
  color: var(--ink-soft);
}

.box {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  margin-top: 0.35rem;
  flex-shrink: 0;
}

button:focus-visible,
.nav-btn:focus-visible,
.home-link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .page {
    animation: none;
  }
}


.trade-row.with-img {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tok-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--paper-dark);
  border: 1px solid var(--line);
}

.tok-img.placeholder {
  display: inline-block;
}

.tok-info {
  flex: 1;
  min-width: 0;
}

.tok-info .sym {
  font-weight: 500;
}

.tok-name {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.78rem;
}

.trade-row .pnl {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  white-space: nowrap;
}


.usd-right {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  margin-left: auto;
  color: var(--ink);
}

.usd-right.up {
  color: var(--green);
}

.usd-right.down {
  color: var(--red);
}


/* video player on home */
.video-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 1.25rem auto 1.75rem;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--line);
  aspect-ratio: 1 / 1;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.nib-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #fff;
}

.play-btn {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 20, 20, 0.72);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.2s ease;
  z-index: 2;
}

.play-btn:hover {
  transform: scale(1.06);
  background: rgba(20, 20, 20, 0.88);
}

.play-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.play-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
}

.home-foot a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.home-actions a.home-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
