/* Tonkin Digital Studio — site styles
   Brand blues sampled from 99-Company/logo-vertical.png:
   #243B46 (mark + wordmark), #305666 ("DIGITAL STUDIO"). */

:root {
  --brand: #243b46;
  --brand-2: #305666;
  --brand-deep: #1a2c35;
  --brand-deeper: #14232b;
  --brand-tint: #8db6c9;
  --brand-wash: #e8eff2;

  --bg: #f7f9fa;
  --surface: #ffffff;
  --line: #dce4e8;
  --text: #15232b;
  --muted: #56676f;

  --on-dark: #e6eef2;
  --on-dark-muted: #a9bcc6;
  --line-dark: rgba(141, 182, 201, 0.18);

  --syn-key: #8db6c9;
  --syn-str: #c9dda6;
  --syn-fn: #f0c987;
  --syn-com: #7d95a2;
  --ok: #7cc4a0;
  --err: #e8988a;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 10px;
  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);

  color-scheme: light;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: var(--brand-2); text-underline-offset: 3px; }
a:hover { color: var(--brand); }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--brand);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 14px;
}
.skip:focus { left: 8px; }

.mono { font-family: var(--mono); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 249, 250, 0.88);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 80px;
}

.brand img { height: 46px; width: auto; }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 14px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav a:hover { color: var(--brand); background: var(--brand-wash); }
.nav a .slash { color: var(--brand-tint); }
.nav a[aria-current="page"]:not(.btn) { color: var(--brand); }

.nav .btn { margin-left: 10px; }

.nav-toggle {
  display: none;
  font-family: var(--mono);
  font-size: 14px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--brand);
  padding: 7px 12px;
  cursor: pointer;
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  .nav {
    display: none;
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .nav .btn { margin: 8px 0 0; text-align: center; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 13px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); color: #fff; }

.nav .btn-primary { color: #fff; padding: 10px 16px; }
.nav .btn-primary:hover { color: #fff; background: var(--brand-2); }

.btn-light { background: var(--on-dark); color: var(--brand-deep); }
.btn-light:hover { background: #fff; color: var(--brand-deep); }

.btn-ghost-dark {
  background: transparent;
  color: var(--on-dark);
  border-color: var(--line-dark);
}
.btn-ghost-dark:hover { border-color: var(--brand-tint); color: #fff; }

.btn .arrow { transition: transform 0.15s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Dark sections ---------- */

.dark {
  background-color: var(--brand-deep);
  background-image:
    linear-gradient(rgba(141, 182, 201, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(141, 182, 201, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--on-dark);
}

/* ---------- Hero ---------- */

.hero { padding: clamp(64px, 10vw, 120px) 0 clamp(64px, 9vw, 112px); }

.hero .wrap {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--brand-tint);
  margin: 0 0 20px;
  letter-spacing: 0.01em;
}

.hero h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(34px, 4.6vw, 54px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 24px;
  color: #fff;
}
.hero h1 em { font-style: normal; color: var(--brand-tint); }

.hero .lead {
  font-size: 19px;
  color: var(--on-dark-muted);
  max-width: 34em;
  margin: 0 0 36px;
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Editor window ---------- */

.editor {
  background: var(--brand-deeper);
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  min-width: 0;
}

.editor-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-dark);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--on-dark-muted);
}
.editor-bar .dot { width: 11px; height: 11px; border-radius: 50%; background: #3a525e; }
.editor-bar .file { margin-left: 10px; }

.editor pre {
  margin: 0;
  padding: 20px 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--on-dark);
  counter-reset: line;
}
.editor code { display: block; white-space: normal; }
.editor .ln {
  display: block;
  padding: 0 20px 0 0;
  white-space: pre;
}
.editor .ln::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 3.2em;
  padding-right: 1.2em;
  text-align: right;
  color: #4d6773;
  user-select: none;
}

.k { color: var(--syn-key); }
.s { color: var(--syn-str); }
.f { color: var(--syn-fn); }
.c { color: var(--syn-com); font-style: italic; }
.ok { color: var(--ok); }

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  vertical-align: -0.2em;
  background: var(--brand-tint);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

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

section { padding: clamp(72px, 9vw, 112px) 0; }

.label {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--brand-2);
  margin: 0 0 14px;
  letter-spacing: 0.02em;
}
.label b { font-weight: 700; color: var(--brand); }
.dark .label { color: var(--brand-tint); }
.dark .label b { color: #fff; }

h2 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  color: var(--brand);
}
.dark h2 { color: #fff; }

.section-intro {
  color: var(--muted);
  font-size: 18px;
  max-width: 40em;
  margin: 0 0 48px;
}
.dark .section-intro { color: var(--on-dark-muted); }

h3 {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 10px;
  color: var(--brand);
}

/* ---------- Services ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: var(--brand-tint);
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -20px rgba(36, 59, 70, 0.35);
}

.card-path {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--bg), var(--surface));
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-path span { color: var(--brand-2); }

.card-body { padding: 22px 20px 24px; display: flex; flex-direction: column; flex: 1; }
.card-body p { margin: 0 0 18px; color: var(--muted); font-size: 16px; }

.tags {
  list-style: none;
  padding: 0;
  margin: auto 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tags li {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--brand-2);
  background: var(--brand-wash);
  border-radius: 4px;
  padding: 3px 8px;
}

/* ---------- Approach ---------- */

.approach .wrap {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.principles { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 22px; }
.principles li { display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.principles .bullet { font-family: var(--mono); color: var(--brand-tint); font-size: 15px; line-height: 1.6; }
.principles strong { display: block; font-family: var(--mono); color: #fff; font-size: 16px; margin-bottom: 2px; }
.principles p { margin: 0; color: var(--on-dark-muted); font-size: 16px; }

.terminal-body { padding: 20px; font-family: var(--mono); font-size: 13.5px; line-height: 1.9; color: var(--on-dark); }
.terminal-body p { margin: 0; }
.terminal-body .gap { margin-top: 10px; }
.terminal .prompt { color: var(--ok); }
.terminal .hash { color: var(--syn-fn); }
.terminal .step { color: #fff; font-weight: 700; }
.terminal .msg { color: var(--on-dark-muted); }
.terminal .commit { display: grid; grid-template-columns: 7ch 9ch 1fr; gap: 0 14px; }

/* ---------- Engagements ---------- */

.engage .card-body h3 { font-size: 20px; }
.engage .fit {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--brand-2);
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  margin: auto 0 0;
}

/* ---------- Stack ---------- */

.stack { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stack .section-intro { margin-bottom: 36px; }
.stack-panel { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.stack-panel .card-path { border-radius: 0; }

.imports {
  margin: 0;
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 2;
  background: var(--bg);
  padding: 22px 24px;
  overflow-x: auto;
  color: var(--text);
}
.imports .k { color: var(--brand-2); font-weight: 500; }
.imports .s { color: #5d7a3a; }
.imports .c { color: var(--muted); }

/* ---------- CTA ---------- */

.cta { padding: clamp(64px, 8vw, 96px) 0; }
.cta .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 32px; }
.cta .cmd { font-family: var(--mono); font-size: 14px; color: var(--ok); margin: 0 0 12px; }
.cta h2 { margin: 0; max-width: 18em; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--brand-deeper);
  color: var(--on-dark-muted);
  font-size: 14px;
  padding: 48px 0 40px;
}
.site-footer .wrap { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: end; }
.site-footer img { height: 44px; width: auto; filter: brightness(0) invert(1); opacity: 0.9; margin-bottom: 18px; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--on-dark); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .legal { font-family: var(--mono); font-size: 12.5px; margin-top: 10px; color: #7d95a2; }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; font-family: var(--mono); font-size: 13px; }

/* ---------- Contact page ---------- */

.page-hero { padding: clamp(56px, 8vw, 88px) 0 clamp(48px, 6vw, 72px); }
.page-hero h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(32px, 4.2vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  color: #fff;
}
.page-hero h1 em { font-style: normal; color: var(--brand-tint); }
.page-hero p.lead { color: var(--on-dark-muted); font-size: 18px; max-width: 36em; margin: 0; }

.contact .wrap { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(28px, 4vw, 48px); align-items: start; }

.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.form-card .card-path { border-radius: 0; }

form { padding: 28px clamp(20px, 3vw, 32px) 32px; display: grid; gap: 20px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.field { display: grid; gap: 7px; }
.field label { font-family: var(--mono); font-size: 13px; color: var(--brand); font-weight: 500; }
.field label .opt { color: var(--muted); font-weight: 400; }

.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field textarea { min-height: 170px; resize: vertical; line-height: 1.55; }
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--brand-2) 50%), linear-gradient(135deg, var(--brand-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-2);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(48, 86, 102, 0.15);
}

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.form-foot small { color: var(--muted); font-size: 13px; }

.status {
  display: none;
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--brand-deeper);
  color: var(--on-dark);
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.7;
}
.status.show { display: block; }
.status .ok { color: var(--ok); }
.status .err { color: var(--err); }
.status a { color: var(--brand-tint); }

.btn[disabled] { opacity: 0.6; cursor: progress; transform: none; }

.aside { display: grid; gap: 20px; }
.aside .card-body h3 { font-size: 16px; }
.aside .big-link { font-family: var(--mono); font-size: 17px; font-weight: 500; word-break: break-all; }
.aside ul { margin: 0; padding-left: 0; list-style: none; color: var(--muted); font-size: 15.5px; display: grid; gap: 8px; }
.aside ul li::before { content: "- "; font-family: var(--mono); color: var(--brand-tint); }
.aside p { margin: 0; }

/* ---------- 404 ---------- */

.notfound { min-height: 60vh; display: flex; align-items: center; }
.notfound pre { font-family: var(--mono); font-size: 15px; line-height: 1.9; margin: 0 0 28px; white-space: pre-wrap; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .hero .wrap,
  .approach .wrap,
  .contact .wrap { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .hero .lead { font-size: 17px; }
  .editor pre { font-size: 12px; }
  .imports { font-size: 12.5px; padding: 18px 16px; }
  .editor .ln::before { width: 2.4em; padding-right: 0.9em; }
  .terminal .commit { grid-template-columns: 9ch 1fr; }
  .terminal .commit .hash { display: none; }
  .site-footer .wrap { grid-template-columns: 1fr; }
  .brand img { height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  .btn, .card { transition: none; }
}
