/* ============================================================
   ProfitCode — design tokens
   Ground:    deep counting-house green, used as a full-bleed
              field for the hero and footer.
   Accent:    brass, spent almost entirely on a single hairline
              rule that recurs through the page.
   ============================================================ */

:root {
  --field:        #0A3328;
  --field-deep:   #072620;
  --field-line:   #1D4A3C;

  --paper:        #FFFFFF;
  --paper-warm:   #F7F6F2;

  --ink:          #101E19;
  --mist:         #667B73;
  --rule:         #E3E1DA;

  --on-field:     #EDF1EE;
  --on-field-dim: #9BB2A7;

  --brass:        #C8A44B;

  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --body:    "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --gutter: clamp(20px, 5vw, 64px);
  --measure: 34rem;

  --step-sm: clamp(0.82rem, 0.8rem + 0.1vw, 0.88rem);
  --step-0:  clamp(1rem, 0.97rem + 0.16vw, 1.125rem);
  --step-1:  clamp(1.18rem, 1.1rem + 0.4vw, 1.4rem);
  --step-2:  clamp(1.6rem, 1.35rem + 1.2vw, 2.4rem);
  --step-3:  clamp(2.1rem, 1.5rem + 2.9vw, 4.1rem);
}

/* ---------- reset ---------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- layout ---------- */

.shell {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Asymmetric column: content sits left, air on the right.
   The left gutter carries section eyebrows on wide screens. */
.split {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0 3.5rem;
}
@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

.section { padding-block: clamp(4.5rem, 9vw, 8.5rem); }
.section + .section { border-top: 1px solid var(--rule); }

/* ---------- type ---------- */

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }

.eyebrow {
  font-family: var(--body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mist);
}
.split > .eyebrow { padding-top: 0.7rem; }
@media (max-width: 860px) {
  .split > .eyebrow { padding-top: 0; margin-bottom: 1.5rem; }
}

.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink);
  max-width: var(--measure);
}

.prose { max-width: var(--measure); color: var(--mist); }
.prose + .prose { margin-top: 1.1rem; }

/* The recurring signature: one brass hairline. */
.rule {
  width: 100%;
  max-width: 5.5rem;
  height: 1px;
  background: var(--brass);
  border: 0;
  margin-block: 2.2rem;
  transform-origin: left center;
}

/* ---------- logo ---------- */

/* Mark: three ascending strokes — a growth curve read as code
   indentation, the tallest capped with a cursor block. */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.16rem;
  letter-spacing: -0.005em;
  line-height: 1;
  white-space: nowrap;
}
.logo .mark { flex: none; width: 20px; height: 20px; }
.logo .mark line { stroke: var(--brass); stroke-width: 2; }
.logo .mark rect { fill: var(--brass); }
.logo .pc-thin { font-weight: 200; }

.on-field .logo { color: var(--on-field); }

/* ---------- masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--field);
  border-bottom: 1px solid var(--field-line);
}
.masthead .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.05rem;
}
.masthead nav {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 3vw, 2.1rem);
  font-size: var(--step-sm);
  letter-spacing: 0.01em;
}
.masthead nav a {
  color: var(--on-field-dim);
  text-decoration: none;
  padding-block: 0.2rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.masthead nav a:hover { color: var(--on-field); border-bottom-color: var(--brass); }
.masthead nav a.is-current { color: var(--on-field); border-bottom-color: var(--brass); }

@media (max-width: 560px) {
  .masthead .shell { flex-direction: column; align-items: flex-start; gap: 0.85rem; }
}

/* ---------- hero ---------- */

.hero {
  background: var(--field);
  color: var(--on-field);
  padding-top: clamp(4.5rem, 10vw, 8.5rem);
  padding-bottom: clamp(4rem, 7vw, 6.5rem);
  position: relative;
}
.hero .eyebrow { color: var(--on-field-dim); }
.hero h1 { max-width: 17ch; margin-top: 1.6rem; }
.hero h1 em {
  font-style: italic;
  color: var(--brass);
}
.hero .lede { color: var(--on-field-dim); margin-top: 2rem; }
.hero .lede strong { color: var(--on-field); font-weight: 400; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2.6rem;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--body);
  font-size: var(--step-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.82rem 1.5rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-solid { background: var(--brass); color: var(--field-deep); }
.btn-solid:hover { background: #DBB85E; }
.btn-line { border-color: var(--field-line); color: var(--on-field); }
.btn-line:hover { border-color: var(--on-field-dim); }

.on-paper .btn-solid { background: var(--field); color: var(--on-field); }
.on-paper .btn-solid:hover { background: var(--field-deep); }
.on-paper .btn-line { border-color: var(--rule); color: var(--ink); }
.on-paper .btn-line:hover { border-color: var(--ink); }

/* ---------- values ---------- */

.values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 3rem;
  border-top: 1px solid var(--rule);
}
.value {
  padding: 2rem 2.2rem 2.2rem 0;
  border-bottom: 1px solid var(--rule);
}
.value + .value { border-left: 1px solid var(--rule); padding-left: 2.2rem; }
.values .value:nth-child(3) { border-left: 0; padding-left: 0; }
.values .value:nth-child(4) { border-left: 1px solid var(--rule); padding-left: 2.2rem; }
.value h3 {
  font-family: var(--body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  line-height: 1.4;
}
.value p {
  margin-top: 0.85rem;
  color: var(--mist);
  font-size: 0.97rem;
}
@media (max-width: 700px) {
  .values { grid-template-columns: minmax(0, 1fr); }
  .value, .values .value:nth-child(4) { border-left: 0 !important; padding-left: 0 !important; padding-right: 0; }
}

/* ---------- how we work ---------- */

/* Numbering earns its place here: the stages are a real sequence
   and the order is the argument. */
.stages { margin-top: 3.2rem; position: relative; }
.stages::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.9rem;
  bottom: 0.9rem;
  width: 1px;
  background: var(--rule);
}
/* The brass rule fills as the reader descends the sequence. */
.stages::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0.9rem;
  width: 1px;
  height: var(--fill, 0px);
  background: var(--brass);
  transition: height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.stage {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  gap: 0 1.6rem;
  padding-block: 2.1rem;
}
.stage + .stage { border-top: 1px solid var(--rule); }
.stage .num {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 200;
  color: var(--rule);
  line-height: 1.1;
  padding-left: 1.5rem;
  transition: color 0.4s ease;
  font-variant-numeric: tabular-nums;
}
.stage.is-live .num { color: var(--brass); }
.stage h3 {
  font-size: var(--step-1);
  font-weight: 300;
  letter-spacing: -0.012em;
}
.stage .name {
  display: block;
  font-family: var(--body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 0.7rem;
}
.stage p {
  margin-top: 0.9rem;
  color: var(--mist);
  max-width: 40rem;
}
@media (max-width: 700px) {
  .stage { grid-template-columns: 2.9rem minmax(0, 1fr); gap: 0 1rem; }
  .stage .num { padding-left: 1rem; font-size: 1.2rem; }
}

/* ---------- contact ---------- */

.contact { background: var(--paper-warm); }
.contact h2 { max-width: 16ch; }
.contact .prose { margin-top: 1.4rem; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.4rem; }

/* ---------- blog ---------- */

.page-head {
  background: var(--field);
  color: var(--on-field);
  padding-block: clamp(3.2rem, 7vw, 5.5rem);
}
.page-head .eyebrow { color: var(--on-field-dim); }
.page-head h1 { font-size: var(--step-2); margin-top: 1.1rem; max-width: 20ch; }
.page-head .prose { color: var(--on-field-dim); margin-top: 1.2rem; }

.post-list { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.post-list li { border-bottom: 1px solid var(--rule); }
.post-list a {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0 3.5rem;
  padding-block: 2.1rem;
  text-decoration: none;
  transition: background 0.2s ease;
}
.post-list a:hover { background: var(--paper-warm); }
.post-list a:hover h2 { color: var(--field); }
.post-list time {
  font-size: var(--step-sm);
  letter-spacing: 0.06em;
  color: var(--mist);
  font-variant-numeric: tabular-nums;
  padding-top: 0.45rem;
}
.post-list h2 { font-size: var(--step-1); transition: color 0.2s ease; }
.post-list p { margin-top: 0.6rem; color: var(--mist); max-width: 44rem; font-size: 0.97rem; }
@media (max-width: 860px) {
  .post-list a { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .post-list time { padding-top: 0; }
}

.empty {
  padding-block: 3rem;
  color: var(--mist);
  border-top: 1px solid var(--rule);
}

/* ---------- article ---------- */

.article { padding-block: clamp(3.2rem, 7vw, 5.5rem); }
.article-body { max-width: 38rem; }
.article-body > * + * { margin-top: 1.3rem; }
.article-body h2 { font-size: var(--step-1); margin-top: 2.8rem; }
.article-body h3 {
  font-family: var(--body);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brass);
  margin-top: 2.4rem;
}
.article-body a { color: var(--field); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--brass); }
.article-body ul, .article-body ol { padding-left: 1.2rem; }
.article-body li + li { margin-top: 0.5rem; }
.article-body blockquote {
  border-left: 1px solid var(--brass);
  padding-left: 1.4rem;
  font-family: var(--display);
  font-size: var(--step-1);
  font-weight: 300;
  font-style: italic;
  color: var(--ink);
}
.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--paper-warm);
  padding: 0.12em 0.36em;
}
.article-body pre {
  background: var(--field-deep);
  color: var(--on-field);
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  font-size: 0.86rem;
}
.article-body pre code { background: none; padding: 0; }
.article-body img { margin-block: 2rem; }
.article-body hr { border: 0; border-top: 1px solid var(--rule); margin-block: 2.6rem; }

.back-link {
  display: inline-block;
  margin-top: 3.5rem;
  font-size: var(--step-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--mist);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.back-link:hover { color: var(--ink); border-bottom-color: var(--brass); }

/* ---------- footer ---------- */

.site-footer {
  background: var(--field-deep);
  color: var(--on-field-dim);
  padding-block: 3rem;
  font-size: var(--step-sm);
}
.site-footer .shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
}
.site-footer nav { display: flex; gap: 1.5rem; }
.site-footer a { text-decoration: none; transition: color 0.2s ease; }
.site-footer a:hover { color: var(--on-field); }

/* ---------- motion ---------- */

.lift { opacity: 0; transform: translateY(14px); }
.lift.is-in { opacity: 1; transform: none; transition: opacity 0.75s ease, transform 0.75s cubic-bezier(0.22, 1, 0.36, 1); }

/* The hero draws its own rule on load — the one orchestrated moment. */
.hero .rule { transform: scaleX(0); animation: draw 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards; }
@keyframes draw { to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  .lift { opacity: 1; transform: none; }
  .hero .rule { transform: none; }
}
