/* ====== Base ====== */
:root{
  --bg: #1d1621;          /* deep plum (dark but not black) */
  --panel: #261d2c;       /* slightly lighter plum */
  --panel-2: #2f2436;     /* table header / accents */
  --border: #4a3956;      /* muted purple border */
  --text: #f3eef6;        /* soft off-white */
  --muted: #cbbad6;       /* muted lavender */
  --accent: #d97bb8;      /* rose accent */
  --accent-2: #8ee3c5;    /* gentle mint highlight */
  --shadow: rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body{
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(217,123,184,0.22), transparent 60%),
              radial-gradient(900px 500px at 110% 0%, rgba(142,227,197,0.12), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: "Verdana", "Tahoma", system-ui, -apple-system, Segoe UI, sans-serif;
  line-height: 1.5;
}

/* Keep it simple + centered */
.wrap{
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

/* ====== Header ====== */
.site-header{
  padding: 28px 0 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(38,29,44,0.85), rgba(38,29,44,0.35));
  box-shadow: 0 8px 20px var(--shadow);
}

.site-header h1{
  margin: 0 0 6px;
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: 0.3px;
}

.tagline{
  margin: 0 0 14px;
  color: var(--muted);
}

/* ====== Top links (TOC) ====== */
.toc{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  background: rgba(47,36,54,0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.toc a{
  display: inline-block;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(217,123,184,0.35);
  background: rgba(217,123,184,0.12);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.toc a:hover,
.toc a:focus{
  outline: none;
  border-color: rgba(217,123,184,0.8);
  background: rgba(217,123,184,0.22);
}

/* ====== Sections ====== */
.memory-section{
  margin: 26px 0 34px;
  padding: 18px 16px 16px;
  background: rgba(38,29,44,0.55);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 22px var(--shadow);
}

.section-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 12px;
}

.section-head h2{
  margin: 0;
  font-size: 22px;
}

.back-to-top{
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed rgba(203,186,214,0.45);
}

.back-to-top:hover,
.back-to-top:focus{
  color: var(--text);
  border-bottom-color: rgba(217,123,184,0.8);
}

/* ====== Table ====== */
.memory-table{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;          /* IMPORTANT */
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(29,22,33,0.35);
}

.memory-table thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(47,36,54,0.95), rgba(47,36,54,0.75));
  color: var(--text);
  text-align: left;
  padding: 12px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.memory-table td{
  vertical-align: top;
  padding: 12px;
  border-top: 1px solid rgba(74,57,86,0.45);
  word-wrap: break-word;
}

/* Column sizing */
.memory-table td.title,
.memory-table th:nth-child(1){
  width: 18%;
  font-weight: 600;
}

.memory-table td.ref,
.memory-table th:nth-child(3){
  width: 140px;                 /* keep your fixed width */
  white-space: normal;          /* allow wrapping */
  overflow-wrap: anywhere;      /* break long strings/URLs */
  word-break: break-word;       /* extra safety */
}

.memory-table td.memory,
.memory-table th:nth-child(2){
  width: auto;                 /* takes remaining space */
}
/* ====== Footer ====== */
.site-footer{
  margin: 30px 0 50px;
  text-align: center;
  color: var(--muted);
}

.site-footer a{
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed rgba(217,123,184,0.5);
}

.site-footer a:hover,
.site-footer a:focus{
  outline: none;
  border-bottom-color: rgba(217,123,184,0.9);
}

/* ====== Mobile tweaks ======
   Tables are inherently wide; we allow horizontal scrolling on small screens.
*/
@media (max-width: 760px){
  .memory-section{ padding: 14px 12px; }
  .memory-table{ display: block; overflow-x: auto; }
  .memory-table thead th{ position: static; }
  .toc a{ font-size: 13px; }
}