/* Craig Barr | Platform Engineering — site styles */

:root {
  --bg: #070b12;
  --bg-soft: #0c1220;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e8edf5;
  --muted: #97a3b6;
  --accent: #2dd4bf;
  --accent-2: #818cf8;
  --accent-3: #f472b6;
  --radius: 16px;
  --maxw: 1080px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}
.brand { font-size: 18px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--muted); font-size: 15px; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* Hero */
.hero {
  position: relative;
  padding: 96px 0 72px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 130%;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(45, 212, 191, 0.16), transparent 65%),
    radial-gradient(700px 500px at 80% 0%, rgba(129, 140, 248, 0.18), transparent 65%),
    radial-gradient(500px 400px at 55% 30%, rgba(244, 114, 182, 0.08), transparent 60%);
  pointer-events: none;
}
.hero .wrap { position: relative; }
.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 700;
  max-width: 17ch;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lede {
  margin-top: 24px;
  max-width: 58ch;
  font-size: 19px;
  color: var(--muted);
}
.cta-row { margin-top: 36px; display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-block;
  border-radius: 12px;
  padding: 13px 26px;
  font-weight: 600;
  font-size: 16px;
  border: 0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #06090f;
  box-shadow: 0 8px 30px rgba(45, 212, 191, 0.25);
}
.btn-ghost {
  color: var(--text);
  border: 1px solid var(--panel-border);
  background: var(--panel);
}

/* Stat strip */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 64px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.stat b {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 30px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat span { color: var(--muted); font-size: 14px; }

/* Interactive stats: hover affordance + click opens a story panel */
.stat[data-metric] {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.stat[data-metric]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(45, 212, 191, 0.08) 50%, transparent 70%);
  transform: translateX(-100%);
  pointer-events: none;
}
.stat[data-metric]:hover, .stat[data-metric]:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 12px 34px rgba(45, 212, 191, 0.12);
  outline: none;
}
@media (prefers-reduced-motion: no-preference) {
  .stat[data-metric]:hover::after, .stat[data-metric]:focus-visible::after { transform: translateX(100%); transition: transform 0.7s ease; }
}
.stat-hint {
  display: block;
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 10px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.stat[data-metric]:hover .stat-hint, .stat[data-metric]:focus-visible .stat-hint { opacity: 1; transform: none; }

/* Metric story modal */
body.modal-open { overflow: hidden; }
.metric-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 8, 14, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.metric-modal.open { opacity: 1; }
.metric-panel {
  width: min(880px, 100%);
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.25s ease;
}
.metric-modal.open .metric-panel { transform: none; }
.metric-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 28px 18px;
  border-bottom: 1px solid var(--panel-border);
}
.metric-panel-head h3 { font-size: 24px; }
.metric-panel-sub { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.metric-close {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  width: 38px;
  height: 38px;
  cursor: pointer;
  flex-shrink: 0;
}
.metric-close:hover { border-color: rgba(45, 212, 191, 0.5); color: var(--accent); }
.metric-panel-body { padding: 24px 28px 28px; overflow-y: auto; }
.metric-footnote { color: var(--muted); font-size: 13.5px; margin-top: 20px; }
.metric-empty { color: var(--muted); }

/* Shared enter animation for panel items */
.anim-in { opacity: 0; transform: translateY(12px); transition: opacity 0.4s ease, transform 0.4s ease; }
.anim-in.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .anim-in { opacity: 1; transform: none; transition: none; }
}

/* Timeline (6 years) */
.timeline { position: relative; padding: 30px 0 8px; }
.timeline-axis { position: absolute; inset: 0; }
.timeline-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px dashed rgba(255, 255, 255, 0.09);
}
.timeline-year {
  position: absolute;
  top: -2px;
  left: 6px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.timeline-row { position: relative; height: 34px; margin: 8px 0; }
.timeline-bar {
  position: absolute;
  top: 4px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.timeline-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #06090f;
  padding: 0 10px;
  white-space: nowrap;
}
.timeline-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Industries */
.industry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { .industry-grid { grid-template-columns: 1fr; } }
.industry-tile {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 20px 22px;
}
.industry-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.industry-icon { font-size: 24px; }
.industry-count {
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.industry-tile h4 { font-size: 17px; margin-bottom: 6px; }
.industry-tile p { color: var(--muted); font-size: 14px; }

/* Working software checklist */
.handover-list { list-style: none; display: grid; gap: 12px; }
.handover-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px 16px;
  opacity: 0.35;
  transition: opacity 0.4s ease, border-color 0.4s ease;
}
.handover-item.done { opacity: 1; border-color: rgba(45, 212, 191, 0.35); }
.handover-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #06090f;
  background: rgba(151, 163, 182, 0.4);
  transform: scale(0.6);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.35s ease;
}
.handover-item.done .handover-check { background: linear-gradient(135deg, var(--accent), var(--accent-2)); transform: scale(1); }
.handover-text { display: grid; gap: 3px; }
.handover-name { font-weight: 600; font-size: 15.5px; }
.handover-kind {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(129, 140, 248, 0.12);
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 10px;
  vertical-align: 2px;
}
.handover-outcome { color: var(--muted); font-size: 14px; }

/* Portfolio grid */
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.portfolio-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, opacity 0.4s ease;
}
.portfolio-card:hover { text-decoration: none; transform: translateY(-3px); border-color: rgba(45, 212, 191, 0.45); }
.portfolio-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.portfolio-name { font-weight: 600; font-size: 14.5px; font-family: "SF Mono", ui-monospace, Menlo, monospace; color: var(--accent); }
.portfolio-year { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.portfolio-blurb { color: var(--muted); font-size: 13.5px; }
.portfolio-card .pills { margin-top: auto; padding-top: 4px; }
.portfolio-card .pill { font-size: 11.5px; padding: 3px 10px; }

/* Sections */
section { padding: 72px 0; }
.section-head { max-width: 62ch; margin-bottom: 44px; }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); }
.section-head p { margin-top: 14px; color: var(--muted); }

/* Cards */
.cards { display: grid; gap: 20px; }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cards.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) {
  .cards.two { grid-template-columns: 1fr; }
}
.card {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-4px); border-color: rgba(45, 212, 191, 0.4); }
.card .chip {
  align-self: flex-start;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(129, 140, 248, 0.12);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 16px;
}
.card h3 { font-size: 22px; margin-bottom: 10px; }
.card p, .card li { color: var(--muted); font-size: 15.5px; }
.card ul { margin: 12px 0 0 18px; display: grid; gap: 8px; }
.card .more { margin-top: auto; padding-top: 18px; font-weight: 600; font-size: 15px; }
.card .price {
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}

/* Case study cards */
.case-card .tag {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Tech pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 4px 12px;
}

/* Blog list */
.post-list { display: grid; gap: 14px; max-width: 760px; }
.post-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  transition: border-color 0.18s ease;
}
.post-item:hover { border-color: rgba(45, 212, 191, 0.4); text-decoration: none; }
.post-item .post-title { color: var(--text); font-weight: 600; font-size: 16.5px; }
.post-item .post-date {
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.post-more { margin-top: 24px; font-weight: 600; }

/* Article pages (blog posts, case studies, offers) */
.article { padding: 64px 0 48px; }
.article .tag {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.article h1 { font-size: clamp(30px, 4.5vw, 46px); margin-top: 12px; max-width: 24ch; }
.article .meta { color: var(--muted); font-size: 14.5px; margin-top: 14px; }
.article h2 { font-size: 26px; margin: 48px 0 16px; }
.article h3 { font-size: 20px; margin: 32px 0 12px; }
.article h4, .article h5, .article h6 { margin: 24px 0 10px; }
.article p { color: var(--muted); max-width: 70ch; margin-top: 12px; }
.article ul, .article ol { margin: 16px 0 0 20px; display: grid; gap: 10px; max-width: 70ch; }
.article li { color: var(--muted); }
.article li b, .article p b, .article li strong, .article p strong { color: var(--text); }
.article img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  margin-top: 16px;
}
.article pre {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  margin-top: 16px;
  max-width: 70ch;
}
.article code {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 14px;
  color: #a5f3eb;
}
.article p code, .article li code {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 1px 6px;
}
.article blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
  margin-top: 16px;
  max-width: 70ch;
}
.article table {
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 15px;
}
.article th, .article td {
  border: 1px solid var(--panel-border);
  padding: 8px 14px;
  color: var(--muted);
  text-align: left;
}
.article th { color: var(--text); }
.pending {
  margin-top: 20px;
  background: rgba(146, 64, 14, 0.15);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: #fcd34d;
  font-size: 15px;
}

/* Contact */
.contact {
  text-align: center;
  background:
    radial-gradient(500px 300px at 50% 0%, rgba(129, 140, 248, 0.12), transparent 70%);
  border-top: 1px solid var(--panel-border);
}
.contact h2 { font-size: clamp(28px, 4vw, 40px); }
.contact p { color: var(--muted); margin: 16px auto 32px; max-width: 52ch; }
.contact-form {
  max-width: 520px;
  margin: 0 auto 28px;
  display: grid;
  gap: 12px;
  text-align: left;
}
.contact-form input, .contact-form textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 13px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 15.5px;
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: none;
  border-color: rgba(45, 212, 191, 0.5);
}
.contact-form textarea { min-height: 130px; resize: vertical; }
.contact-form button[disabled] { opacity: 0.7; cursor: wait; }
.form-error { color: #fca5a5; font-size: 14px; }

/* Contact form success state (form is replaced on successful submit) */
.form-success {
  max-width: 520px;
  margin: 0 auto 28px;
  background: var(--bg-soft);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: var(--radius);
  padding: 36px 32px;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.form-success.in { opacity: 1; transform: none; }
.form-success svg { width: 52px; height: 52px; margin-bottom: 14px; }
.form-success svg circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  opacity: 0.5;
}
.form-success svg path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw-check 0.5s ease 0.3s forwards;
}
@keyframes draw-check { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .form-success { opacity: 1; transform: none; transition: none; }
  .form-success svg path { stroke-dashoffset: 0; animation: none; }
}
.form-success h3 { font-size: 22px; margin-bottom: 8px; }
.form-success p { margin: 0 auto; }
.socials { display: flex; justify-content: center; gap: 24px; margin-top: 8px; }
.socials a { color: var(--muted); font-size: 15px; }
.socials a:hover { color: var(--accent); }

/* Footer */
footer {
  border-top: 1px solid var(--panel-border);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
}
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; width: 100%; }

/* Reveal animation */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise 0.7s ease both; }
  .reveal:nth-child(2) { animation-delay: 0.08s; }
  .reveal:nth-child(3) { animation-delay: 0.16s; }
  .reveal:nth-child(4) { animation-delay: 0.24s; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
  }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  section { padding: 56px 0; }
}
