/* Mankappian Research - marketing site design system.
   Values are copied from design_handoff_mankappian_site/README.md ("Style Guide").
   Paper, not interface: white ground, ruled sections, serif text. One accent (plum).
   Rules over containers - no cards, fills, borders-around-content, shadows or radius. */

:root {
  --plum: #4C0C40;
  --plum-tint: #C9AEC2;
  --plum-wash: #E8DCE6;
  --ink: #201C1C;
  --ink-soft: #332E2E;
  --grey-text: #56504E;
  --grey-muted: #706864;
  --grey-light: #A79EA4;
  --rule: #E4DFE2;
  --rule-light: #EDE9EB;
  --paper: #FCFCFC;

  --serif: 'EB Garamond', Georgia, serif;
  --sans: 'Jost', Arial, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

a { color: var(--plum); text-decoration: none; }
a:hover { color: var(--ink); }

::selection { background: var(--plum-wash); }

img { display: block; max-width: 100%; }

/* Browsers apply a default `margin: 1em 40px` to <figure> - without this
   reset every photo sits ~40px inset from the column edges on each side. */
figure { margin: 0; }

h1, h2, h3, p { margin: 0; text-wrap: pretty; }

/* ---- Type scale ---- */

.wordmark {
  /* Mobile-safe default, matched proportionally to .tagline (same ratio
     in min/slope/max - the two were tuned to render the same width). */
  font: 500 clamp(15.5px, 2.8vw, 22px) var(--serif);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--plum);
  white-space: nowrap;
}

.tagline {
  font: 300 clamp(8.9px, 1.608vw, 12.64px) var(--sans);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--grey-muted);
  margin-top: 4px;
  white-space: nowrap;
}

/* From tablet width up (the point where .h1's own clamp(23px,3.1vw,32px)
   leaves its 23px floor) there's room to size the wordmark 2px above it -
   same 3.1vw slope, offset +2px. The tagline is scaled by the exact same
   ratio it has to the mobile wordmark size above (~1.741x), so the two
   lines stay the same rendered width as each other at this larger scale
   too, just as they do below the breakpoint. */
@media (min-width: 742px) {
  .wordmark { font-size: clamp(25px, calc(3.1vw + 2px), 34px); }
  .tagline { font-size: clamp(14.36px, calc(1.7806vw + 1.1487px), 19.53px); }
}

.note-title {
  font: 400 clamp(26px, 3.6vw, 38px) var(--serif);
  line-height: 1.2;
  letter-spacing: -0.012em;
  color: var(--plum);
  max-width: 34ch;
}

.h1 {
  font: 400 clamp(23px, 3.1vw, 32px) var(--serif);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--plum);
}

.h2 {
  font: 400 clamp(21px, 2.8vw, 26px) var(--serif);
  line-height: 1.28;
  color: var(--ink);
}

.h3 {
  font: 500 19px var(--serif);
  line-height: 1.35;
  color: var(--ink);
}

.lead {
  font: 400 clamp(17px, 2.2vw, 20px) var(--serif);
  line-height: 1.62;
  color: var(--grey-text);
  max-width: 58ch;
}

.body-text {
  font: 400 clamp(17px, 2.2vw, 19px) var(--serif);
  line-height: 1.68;
  color: var(--ink-soft);
  max-width: 62ch;
}

.body-text + .body-text { margin-top: 20px; }

.body-small {
  font: 400 16.5px var(--serif);
  line-height: 1.6;
  color: var(--grey-text);
}

.section-label {
  font: 400 11px var(--sans);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--grey-muted);
}

.nav-link {
  font: 400 12px var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey-muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 4px;
}
.nav-link:hover { color: var(--plum); }
.nav-link.active { color: var(--plum); border-bottom-color: var(--plum); }

.cta-link {
  display: inline-block;
  font: 400 13px var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--plum);
  border-bottom: 1px solid var(--plum-tint);
  padding-bottom: 5px;
}
.cta-link:hover { color: var(--ink); }

.meta {
  font: 300 12px var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-muted);
}
.meta .sep { color: var(--plum-tint); }

/* ---- Layout ---- */

body.page {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
}

/* The edge bar and the content column move together as one unit, centred
   as a whole in the viewport - not the bar pinned to the left edge with
   the content centred (or left-anchored) independently of it. */
.page-shell {
  position: relative;
  min-height: 100vh;
  max-width: calc(1060px + clamp(26px, 3.6vw, 44px));
  margin: 0 auto;
  padding-left: clamp(26px, 3.6vw, 44px);
}

.edge-bar {
  position: absolute;
  left: clamp(14px, 1.9vw, 24px);
  top: 0;
  bottom: 0;
  width: 10px;
  background: var(--plum);
}

.wrap {
  max-width: 1060px;
  margin: 0;
  padding-left: clamp(20px, 5vw, 64px);
  padding-right: clamp(20px, 5vw, 64px);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  padding-top: clamp(24px, 4vw, 48px);
  padding-bottom: clamp(16px, 2.2vw, 26px);
}

.site-header a { display: block; }

.site-nav {
  display: flex;
  gap: 22px;
}

.header-rule,
.rule {
  height: 1px;
  background: var(--rule);
  border: none;
  margin: 0;
}

/* The footer rule is a plain element (.rule, an <hr>) inside .wrap's
   content area - not a border on a .wrap-scoped box - so it's inset by
   the same gutter padding as the header rule and computes to the same
   width. A `border-top` here would instead span .wrap's own full box
   (which already includes that padding) and come out wider. */
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 28px;
  padding-top: clamp(32px, 5vw, 52px);
  padding-bottom: clamp(32px, 5vw, 52px);
}

.footer-wordmark {
  font: 400 12.5px var(--serif);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey-muted);
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  align-items: baseline;
}

.footer-meta a { color: var(--grey-muted); }
.footer-meta a:hover { color: var(--plum); }

main.home .site-footer { margin-top: clamp(32px, 6vw, 72px); }

/* ---- Sections ---- */

.section {
  padding-top: clamp(32px, 5vw, 56px);
  padding-bottom: clamp(36px, 6vw, 72px);
}

.hero {
  padding-top: clamp(16px, 2.2vw, 24px);
  padding-bottom: clamp(32px, 4.5vw, 56px);
}

.hero .lead { margin-top: clamp(28px, 4vw, 40px); }

.figure { padding-bottom: clamp(32px, 5vw, 56px); }
.figure img {
  width: 100%;
  object-fit: cover;
}
.figure figcaption {
  font: 300 12px var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-muted);
  margin-top: 14px;
}
.figure figcaption .sep { color: var(--plum-tint); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(24px, 3.5vw, 48px);
}

.list-row {
  padding: 13px 0;
  border-bottom: 1px solid var(--rule-light);
  font-size: 17px;
  color: #403A3A;
}

/* ---- Publication list (Research page) ---- */

.publication {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 40px;
  padding: clamp(24px, 3.5vw, 34px) 0;
  border-top: 1px solid var(--rule);
}

.publication .meta-col {
  flex: 0 0 150px;
  padding-top: 6px;
}
.publication .meta-col .topic { color: var(--plum); margin-top: 8px; }
.publication .meta-col .pages { margin-top: 8px; }

.publication .body-col { flex: 1 1 340px; }
.publication .body-col .h2 { letter-spacing: -0.005em; }
.publication .body-col .abstract { margin-bottom: 14px; }
.publication .body-col .read-more {
  display: inline-block;
  margin-top: 16px;
  font-size: 11px;
  letter-spacing: 0.16em;
}

/* ---- Note (long-form) ---- */

.note-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font: 400 11px var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6E6664;
  margin-bottom: clamp(12px, 1.6vw, 18px);
}

.note-dek {
  margin-top: clamp(24px, 3.5vw, 34px);
  max-width: 52ch;
  font-size: clamp(19px, 2.5vw, 23px);
  line-height: 1.5;
  color: var(--grey-text);
  font-style: italic;
}

.note-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  margin-top: clamp(26px, 4vw, 38px);
  padding-bottom: clamp(30px, 4vw, 44px);
  font: 400 12px var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6E6664;
  border-bottom: 1px solid var(--rule);
}

.note-grid {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(32px, 5vw, 64px);
  padding-top: clamp(36px, 5vw, 56px);
}

.note-main { flex: 1 1 480px; min-width: 0; max-width: 70ch; }

.note-sidebar {
  flex: 0 1 220px;
  min-width: 0;
  align-self: flex-start;
  position: sticky;
  top: 24px;
}

.sidebar-label {
  font: 400 10.5px var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #6E6664;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.contents-row {
  padding: 11px 0;
  border-bottom: 1px solid var(--rule-light);
  font-size: 16px;
  line-height: 1.4;
  color: #403A3A;
}

.keyfig-row { padding: 14px 0; border-bottom: 1px solid var(--rule-light); }
.keyfig-value { font-size: clamp(22px, 3vw, 27px); line-height: 1.1; color: var(--plum); }
.keyfig-label { margin-top: 6px; font-size: 15.5px; line-height: 1.4; color: #4A4444; }

.exec-summary {
  padding-bottom: clamp(28px, 4vw, 40px);
  border-bottom: 1px solid var(--rule);
}
.exec-summary .section-label { color: var(--plum); margin-bottom: 16px; }
.exec-summary p { font-size: clamp(18px, 2.3vw, 20px); line-height: 1.66; color: #2A2626; }

.note-main h2 {
  margin: clamp(40px, 5vw, 60px) 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--plum-tint);
  font: 400 clamp(23px, 3vw, 30px) var(--serif);
  line-height: 1.28;
  color: var(--ink);
}

.note-main > p,
.note-main .body-copy {
  margin: 20px 0 0;
  font-size: clamp(17px, 2.1vw, 19px);
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: none;
}

.pull-quote {
  margin: clamp(30px, 4vw, 40px) 0;
  font-size: clamp(20px, 2.6vw, 25px);
  line-height: 1.45;
  color: var(--plum);
  font-style: italic;
  max-width: 44ch;
}

.fig-block { margin-top: clamp(28px, 4vw, 40px); }
.fig-head {
  border-top: 1px solid var(--plum);
  border-bottom: 1px solid var(--rule);
  padding: 14px 0 18px;
}
.fig-label {
  font: 400 11px var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--plum);
}
.fig-title { margin-top: 8px; font-size: clamp(16px, 2vw, 18px); line-height: 1.45; color: var(--ink); }
.fig-placeholder {
  position: relative;
  margin-top: 18px;
  height: clamp(200px, 26vw, 320px);
  background-color: #F6F3F4;
  background-image: repeating-linear-gradient(135deg, #EDE7EA 0 8px, #F6F3F4 8px 16px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.fig-placeholder span {
  font: 400 11px var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6E6664;
  background: var(--paper);
  padding: 9px 14px;
}
.fig-caption {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  font: 300 11px var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6E6664;
}
.fig-note { margin-top: 16px; font-size: 16px; line-height: 1.55; color: #4A4444; max-width: 52ch; }

.theses-block { margin-top: clamp(28px, 4vw, 40px); }
.theses-table-label {
  border-top: 1px solid var(--plum);
  padding: 14px 0 4px;
  font: 400 11px var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--plum);
}
.thesis-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 36px;
  padding: clamp(22px, 3vw, 30px) 0;
  border-top: 1px solid var(--rule);
}
.thesis-name {
  flex: 0 0 160px;
  font-size: clamp(19px, 2.4vw, 22px);
  line-height: 1.3;
  color: var(--plum);
}
.thesis-body { flex: 1 1 320px; min-width: 0; }
.thesis-label {
  font: 400 10.5px var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6E6664;
}
.thesis-body p { margin: 10px 0 0; font-size: 17px; line-height: 1.62; color: var(--ink-soft); }
.thesis-question { color: var(--ink); font-style: italic; }
.thesis-considerations { margin-top: 22px; }

.methodology p { margin: 1.2em 0 0; font-size: 16.5px; line-height: 1.66; color: #403A3A; }
.methodology p:first-of-type { margin-top: 0; }
.methodology ul { margin: 14px 0 0; padding-left: 20px; font-size: 16.5px; line-height: 1.66; color: #403A3A; }
.methodology li { margin-bottom: 6px; }

.buyout-table { max-width: 420px; margin-top: clamp(26px, 3.5vw, 34px); }
.buyout-head {
  border-top: 1px solid var(--plum);
  padding: 12px 0;
  font: 400 10.5px var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--plum);
  display: flex;
  justify-content: space-between;
  gap: 24px;
}
.buyout-labels {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 11px 0;
  border-top: 1px solid var(--rule);
  font: 300 11px var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6E6664;
}
.buyout-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 11px 0;
  border-top: 1px solid var(--rule-light);
  font-size: 17px;
  color: var(--ink-soft);
}

.sources-block p { margin: 0; font-size: 15.5px; line-height: 1.6; color: #4A4444; }
.sources-block p + p { margin-top: 8px; }

.about-research {
  margin-top: clamp(40px, 6vw, 64px);
  padding: clamp(28px, 4vw, 36px) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.about-research .section-label { color: var(--plum); margin-bottom: 16px; }
.about-research p { font-size: 17px; line-height: 1.66; color: var(--ink-soft); max-width: 64ch; }
.about-research .signoff { margin-top: 20px; font-size: 18px; line-height: 1.6; }

/* ---- Data overview (tool grid) ---- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  background: var(--rule);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  padding: clamp(24px, 3vw, 32px) clamp(22px, 2.6vw, 30px);
  color: inherit;
  min-height: 280px;
}
.tool-card.disabled { pointer-events: none; }

.tool-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.tool-card-name { font: 400 clamp(21px, 2.6vw, 26px) var(--serif); color: var(--plum); }
.tool-badge {
  font: 400 10.5px var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--plum);
}
.tool-badge.pending { color: var(--grey-light); }

.tool-card p { margin: 16px 0 0; font-size: 16.5px; line-height: 1.6; color: var(--grey-text); flex: 1; }

.tool-tags { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 22px; }
.tool-tag {
  font: 300 11px var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-muted);
  border: 1px solid var(--rule);
  padding: 4px 9px;
}

.tool-cta {
  font: 400 12.5px var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 24px;
  padding-bottom: 5px;
  align-self: flex-start;
  color: var(--plum);
  border-bottom: 1px solid var(--plum-tint);
}
.tool-cta.pending { color: var(--grey-light); border-bottom: none; }

/* ---- Account pages (django-allauth) ---- */
/* allauth renders its form fields via Django's plain form.as_p(), so these
   are scoped, generic element selectors rather than custom classes. */

.site-messages {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}
.site-messages li {
  font: 400 16.5px var(--serif);
  color: var(--ink-soft);
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

main.account {
  max-width: 500px;
  padding-top: clamp(32px, 5vw, 56px);
  padding-bottom: clamp(36px, 6vw, 72px);
}
main.account form { margin-top: clamp(24px, 3.5vw, 34px); }
main.account form p { margin: 20px 0 0; }
main.account form p:first-child { margin-top: 0; }

main.account label {
  display: block;
  font: 400 11px var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--grey-muted);
}

main.account input[type="text"],
main.account input[type="email"],
main.account input[type="password"],
main.account input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  font: 400 17px var(--serif);
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 8px 0;
  outline: none;
}
main.account input[type="text"]:focus,
main.account input[type="email"]:focus,
main.account input[type="password"]:focus,
main.account input[type="number"]:focus {
  border-bottom-color: var(--plum);
}

main.account input[type="checkbox"],
main.account input[type="radio"] {
  width: auto;
  margin-right: 8px;
}

main.account ul.errorlist {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  color: #B03A2E;
  font: 400 13px var(--sans);
  letter-spacing: 0.02em;
}

main.account .helptext {
  display: block;
  margin-top: 6px;
  font-size: 14.5px;
  color: var(--grey-muted);
}

main.account button.cta-link {
  background: none;
  border: none;
  border-bottom: 1px solid var(--plum-tint);
  padding: 0 0 5px;
  cursor: pointer;
  font: inherit;
}
main.account a.cta-link { margin-top: 16px; }
