/* Cube Law Corporation — Legal Pages Stylesheet
 * Ink + Sage palette. Mobile-first. Optimized for long-form legal reading.
 */

:root {
  --sage:    #4A7B6F;
  --sage-d:  #3a6358;
  --ink:     #1C2B2A;
  --linen:   #F3F5F2;
  --white:   #FFFFFF;
  --body:    #586E6C;
  --border:  #d4ddd9;
  --amber:   #b07a2e;
  --amber-bg:#fdf6ea;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: var(--body);
  background: var(--linen);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ────────────────────────── HEADER ────────────────────────── */
.masthead {
  background: var(--ink);
  color: var(--white);
  padding: 18px 20px;
}
.masthead-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.masthead-brand {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--white);
  letter-spacing: 0.2px;
  line-height: 1.2;
}
.masthead-brand span {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--sage);
  margin-top: 2px;
}
.masthead-nav {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.masthead-link {
  color: var(--white);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.masthead-link:hover, .masthead-link.active { border-bottom-color: var(--sage); }

@media (min-width: 700px) {
  .masthead { padding: 24px 32px; }
  .masthead-brand { font-size: 22px; }
  .masthead-nav { gap: 24px; }
  .masthead-link { font-size: 13px; }
}

/* ────────────────────────── HERO ────────────────────────── */
.hero {
  background: var(--linen);
  padding: 36px 20px 32px;
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero-eyebrow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--sage);
  margin-bottom: 14px;
}
.hero h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 400;
  font-size: 30px;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}
.hero-lead {
  font-size: 15px;
  line-height: 1.55;
  color: var(--body);
  margin-bottom: 22px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.hero-meta-item { font-size: 12px; }
.hero-meta-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sage);
  font-size: 9px;
  margin-bottom: 2px;
}
.hero-meta-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px;
  color: var(--ink);
  font-weight: 500;
}

@media (min-width: 700px) {
  .hero { padding: 80px 32px 60px; }
  .hero-eyebrow { font-size: 11px; margin-bottom: 20px; }
  .hero h1 { font-size: clamp(36px, 5vw, 52px); margin-bottom: 24px; letter-spacing: -0.5px; }
  .hero-lead { font-size: 18px; line-height: 1.6; max-width: 620px; margin-bottom: 32px; }
  .hero-meta { gap: 32px; padding-top: 24px; }
  .hero-meta-item { font-size: 13px; }
  .hero-meta-label { font-size: 10px; margin-bottom: 4px; }
  .hero-meta-value { font-size: 17px; }
}

/* ────────────────────────── LAYOUT ────────────────────────── */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 0 40px;
}

@media (min-width: 900px) {
  .layout {
    padding: 64px 32px 80px;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 64px;
    align-items: start;
  }
}

/* ────────────── MOBILE TOC (collapsible) ────────────── */
.toc-mobile {
  margin: 0 16px 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.toc-mobile summary {
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--sage);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after {
  content: '▾';
  color: var(--sage);
  font-size: 14px;
  transition: transform 0.2s;
}
.toc-mobile[open] summary::after { transform: rotate(180deg); }
.toc-mobile ol {
  list-style: none;
  counter-reset: tocm;
  padding: 0 18px 14px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.toc-mobile li {
  counter-increment: tocm;
  position: relative;
  padding-left: 28px;
}
.toc-mobile li::before {
  content: counter(tocm, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 12px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 11px;
  color: var(--sage);
  font-weight: 500;
}
.toc-mobile a {
  display: block;
  padding: 11px 0;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
}
.toc-mobile li:last-child a { border-bottom: 0; }

@media (min-width: 900px) { .toc-mobile { display: none; } }

/* ────────────── DESKTOP TOC (sidebar) ────────────── */
.toc-desktop { display: none; }

@media (min-width: 900px) {
  .toc-desktop {
    display: block;
    position: sticky;
    top: 32px;
    font-size: 13px;
  }
  .toc-desktop .toc-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--sage);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .toc-desktop ol { list-style: none; counter-reset: toc; }
  .toc-desktop li {
    counter-increment: toc;
    margin-bottom: 10px;
    position: relative;
    padding-left: 28px;
    line-height: 1.4;
  }
  .toc-desktop li::before {
    content: counter(toc, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 1px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 11px;
    color: var(--sage);
    font-weight: 500;
  }
  .toc-desktop a {
    color: var(--body);
    text-decoration: none;
    transition: color 0.2s;
  }
  .toc-desktop a:hover { color: var(--sage); }
  .toc-desktop a.active { color: var(--ink); font-weight: 500; }
}

/* ────────────── DOCUMENT BODY ────────────── */
.doc {
  background: var(--white);
  padding: 28px 20px 32px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 700px) {
  .doc { padding: 40px 28px 36px; border: 1px solid var(--border); margin: 0 16px; }
}
@media (min-width: 900px) {
  .doc { padding: 64px 64px 56px; max-width: 760px; margin: 0; }
}

.doc-preface {
  font-size: 14px;
  line-height: 1.7;
  color: var(--body);
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.doc-preface p { margin-bottom: 12px; }
.doc-preface strong { color: var(--ink); font-weight: 600; }
.doc-preface a {
  color: var(--sage);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

section { margin-bottom: 36px; scroll-margin-top: 20px; }
section:last-of-type { margin-bottom: 0; }
.section-num {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--sage);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
section h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 18px;
  letter-spacing: -0.2px;
}
.section-intro {
  font-size: 13.5px;
  color: var(--body);
  margin-bottom: 16px;
  font-style: italic;
}

@media (min-width: 700px) {
  section { margin-bottom: 48px; }
  section h2 { font-size: 26px; margin-bottom: 24px; }
  .section-num { font-size: 13px; margin-bottom: 8px; }
}

.clause {
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.7;
}
.clause:last-child { margin-bottom: 0; }
.clause strong { color: var(--ink); font-weight: 600; }
.clause a { color: var(--sage); border-bottom: 1px solid var(--border); text-decoration: none; }

@media (min-width: 700px) {
  .clause { font-size: 14.5px; line-height: 1.75; margin-bottom: 18px; }
}

/* Lists inside clauses */
.clause ol, .clause ul {
  margin: 10px 0 12px 0;
  padding-left: 0;
  list-style: none;
}
.clause ol { counter-reset: cl; }
.clause ol li {
  counter-increment: cl;
  position: relative;
  padding-left: 28px;
  margin-bottom: 7px;
}
.clause ol li::before {
  content: counter(cl) ".";
  position: absolute;
  left: 4px;
  top: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 13px;
  color: var(--sage);
  font-weight: 500;
}
.clause ul li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 7px;
}
.clause ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 8px;
  height: 1px;
  background: var(--sage);
}

/* Callouts */
.callout {
  background: var(--linen);
  border-left: 3px solid var(--sage);
  padding: 14px 16px;
  margin: 14px 0 16px;
  font-size: 13.5px;
  line-height: 1.6;
  border-radius: 0 4px 4px 0;
}
.callout-amber {
  background: var(--amber-bg);
  border-left-color: var(--amber);
}
.callout strong { color: var(--ink); }
@media (min-width: 700px) {
  .callout { padding: 18px 22px; font-size: 14px; line-height: 1.65; }
}

/* Tables */
table.platforms, table.retention {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0;
  background: var(--white);
  display: block;
  overflow-x: auto;
}
table.platforms thead, table.retention thead { display: table-header-group; }
table.platforms tbody, table.retention tbody { display: table-row-group; }
table.platforms tr, table.retention tr { display: table-row; }
table.platforms th, table.retention th,
table.platforms td, table.retention td { display: table-cell; }
table.platforms th, table.retention th {
  background: var(--linen);
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sage);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.platforms td, table.retention td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}
table.platforms td:first-child, table.retention td:first-child {
  font-weight: 500;
  color: var(--ink);
}

@media (min-width: 700px) {
  table.platforms, table.retention {
    display: table;
    font-size: 13.5px;
  }
  table.platforms th, table.retention th { font-size: 11px; padding: 12px 16px; }
  table.platforms td, table.retention td { padding: 12px 16px; }
  table.platforms td:first-child, table.retention td:first-child { white-space: nowrap; }
}

/* ────────────── DOC FOOTER / RELATED / VERSION ────────────── */
.doc-footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 8px 0 24px;
}
.doc-footer-col h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}
.doc-footer-col p {
  color: var(--body);
  font-size: 13px;
  line-height: 1.7;
}
.doc-footer-col a { color: var(--sage); text-decoration: none; }

@media (min-width: 600px) {
  .doc-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}

.related {
  background: var(--linen);
  padding: 16px 18px;
  border-radius: 4px;
  margin-top: 28px;
  font-size: 13px;
  line-height: 1.6;
}
.related-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--sage);
  margin-bottom: 8px;
}
.related a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s;
  display: inline-block;
  padding: 4px 0;
  min-height: 32px;
}
.related a:hover { border-bottom-color: var(--sage); }

.version-stamp {
  background: var(--linen);
  padding: 14px 16px;
  font-family: 'DM Sans', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--body);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--border);
  margin-top: 20px;
  border-radius: 4px;
}
.version-stamp strong { color: var(--ink); font-weight: 600; }
@media (min-width: 700px) {
  .version-stamp { padding: 16px 20px; font-size: 11px; letter-spacing: 1.5px; }
}

/* Archive notice when viewing a dated URL */
.archive-banner {
  background: var(--amber-bg);
  border-bottom: 2px solid var(--amber);
  padding: 12px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink);
}
.archive-banner strong { font-weight: 600; }
.archive-banner a {
  color: var(--sage);
  font-weight: 600;
  border-bottom: 1px solid var(--sage);
  text-decoration: none;
  margin-left: 4px;
}

/* ────────────── SITE FOOTER ────────────── */
.site-footer {
  background: var(--ink);
  color: var(--white);
  padding: 32px 20px;
  text-align: center;
}
.site-footer-inner { max-width: 760px; margin: 0 auto; }
.site-footer p {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 6px;
  line-height: 1.6;
}
.site-footer a { color: var(--sage); text-decoration: none; }
.site-footer a:hover { color: var(--white); }
.site-footer-rule {
  width: 40px;
  height: 1px;
  background: var(--sage);
  margin: 16px auto;
}

@media (min-width: 700px) {
  .site-footer { padding: 48px 32px; }
  .site-footer p { font-size: 13px; }
}

/* ────────────── PRINT ────────────── */
@media print {
  .masthead, .toc-mobile, .toc-desktop, .site-footer, .archive-banner { display: none; }
  body { background: white; }
  .layout { padding: 0; }
  .doc { border: none; padding: 0; max-width: 100%; margin: 0; }
  .hero { padding: 20px 0; }
  section { page-break-inside: avoid; }
}
