/* ============================================================
   Martin Clydeford — engineer's monograph
   Ink navy · copper · parchment. Fraunces / Newsreader / Plex Mono
   ============================================================ */

:root {
  --ink: #0d1422;
  --ink-2: #111a2c;
  --ink-3: #16213a;
  --line: rgba(192, 138, 78, 0.18);
  --line-soft: rgba(214, 205, 189, 0.08);
  --parchment: #e9e2d4;
  --parchment-dim: #b3ac9c;
  --copper: #c08a4e;
  --copper-bright: #e0aa6a;
  --copper-deep: #8a5f33;
  --serif: "Fraunces", Georgia, serif;
  --body: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--parchment);
  font-family: var(--body);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--copper); color: var(--ink); }

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

/* ---- grain overlay ---- */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 9s steps(10) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-2%,3%); }
  40% { transform: translate(3%,-2%); }
  60% { transform: translate(-3%,-3%); }
  80% { transform: translate(2%,2%); }
}

/* ---- header ---- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 2.5rem;
  background: linear-gradient(to bottom, rgba(13,20,34,0.92), rgba(13,20,34,0.75) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  color: var(--parchment);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.wordmark span { color: var(--copper); }
.site-nav { display: flex; gap: 2rem; }
.site-nav a {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--parchment-dim);
  text-decoration: none;
  transition: color 0.25s;
}
.site-nav a:hover { color: var(--copper-bright); }
.header-cta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--copper);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 0.55rem 1.2rem;
  border-radius: 2px;
  transition: all 0.25s;
}
.header-cta:hover { background: var(--copper); color: var(--ink); }

/* ---- hero ---- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8rem 2.5rem 0;
}
#topology {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0.55;
}
.hero-inner {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: var(--copper);
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 2.2rem;
}
.hero-eyebrow .rule { width: 3.5rem; height: 1px; background: var(--copper); display: inline-block; }
.hero-name {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.4rem, 11vw, 8.5rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--parchment);
}
.hero-name .line { display: block; overflow: hidden; }
.hero-name .line:last-child { margin-left: clamp(2rem, 8vw, 7rem); }
.hero-name em, .hero-name .reveal-up { font-style: normal; }
.hero-role {
  margin-top: 2.2rem;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 400;
  font-style: italic;
  color: var(--copper-bright);
}
.hero-lede {
  margin-top: 1.2rem;
  max-width: 34rem;
  color: var(--parchment-dim);
  font-size: 1.1rem;
}
.hero-actions { margin-top: 2.6rem; display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.9rem 1.7rem;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
  border: 1px solid transparent;
}
.btn-solid {
  background: var(--copper);
  color: var(--ink);
  border-color: var(--copper);
}
.btn-solid:hover { background: var(--copper-bright); border-color: var(--copper-bright); transform: translateY(-2px); }
.btn-ghost {
  background: transparent;
  color: var(--parchment);
  border-color: rgba(233, 226, 212, 0.25);
}
.btn-ghost:hover { border-color: var(--copper); color: var(--copper-bright); }

.hero-foot {
  position: relative;
  max-width: 1100px;
  margin: 4.5rem auto 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: 1.6rem 0 2.2rem;
  gap: 0 3.5rem;
}
.stat { display: flex; flex-direction: column; padding: 0.4rem 0; }
.stat strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2rem;
  color: var(--parchment);
}
.stat strong em { font-style: normal; font-size: 1.1rem; color: var(--copper); }
.stat span {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--parchment-dim);
}

/* ---- sections ---- */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 7rem 2.5rem 2rem;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.2rem;
  margin-bottom: 3rem;
}
.section-no {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--copper);
  letter-spacing: 0.1em;
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  letter-spacing: -0.01em;
}
.section-lede {
  font-style: italic;
  color: var(--parchment-dim);
  margin: -1.4rem 0 2.6rem;
  max-width: 38rem;
}

/* ---- profile ---- */
.profile-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 4rem;
}
.profile-text p { margin-bottom: 1.4rem; max-width: 36rem; }
.profile-text em { color: var(--copper-bright); }
.dropcap::first-letter {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 4.4rem;
  float: left;
  line-height: 0.8;
  padding: 0.35rem 0.7rem 0 0;
  color: var(--copper);
}
.profile-aside { display: flex; flex-direction: column; gap: 2rem; }
.aside-block {
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--ink-2), var(--ink));
  padding: 1.8rem;
  border-radius: 2px;
}
.aside-block h3 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 1.1rem;
}
.aside-block p { color: var(--parchment-dim); font-size: 0.98rem; }
.mono-list { list-style: none; }
.mono-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.92rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--line-soft);
}
.mono-list li:last-child { border-bottom: none; }
.mono-list li span {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--parchment-dim);
  padding-top: 0.25rem;
  white-space: nowrap;
}

/* ---- timeline ---- */
.timeline { list-style: none; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0; top: 0.5rem; bottom: 0.5rem;
  width: 1px;
  background: linear-gradient(to bottom, var(--copper), var(--line) 60%, transparent);
}
.job {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  padding: 0 0 3.5rem 2.5rem;
  position: relative;
}
.job::before {
  content: "";
  position: absolute;
  left: -4px; top: 0.55rem;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--ink);
  border: 1.5px solid var(--copper);
}
.job-when .mono {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--copper);
}
.job-body h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.55rem;
  margin-bottom: 0.2rem;
}
.job-org {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--parchment-dim);
  margin-bottom: 0.9rem;
}
.job-body > p { color: var(--parchment-dim); max-width: 36rem; }
.job-body ul {
  margin-top: 0.9rem;
  list-style: none;
}
.job-body ul li {
  position: relative;
  padding: 0.3rem 0 0.3rem 1.4rem;
  max-width: 36rem;
}
.job-body ul li::before {
  content: "—";
  position: absolute; left: 0;
  color: var(--copper);
}
.job-body strong { font-weight: 500; color: var(--copper-bright); }

/* ---- credentials ---- */
.cred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
}
.cred {
  border: 1px solid var(--line);
  background: linear-gradient(165deg, var(--ink-3), var(--ink-2) 60%);
  padding: 1.8rem 1.8rem 1.5rem;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s, border-color 0.35s;
}
.cred::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--copper), transparent 70%);
  opacity: 0.6;
}
.cred:hover { transform: translateY(-4px); border-color: rgba(192,138,78,0.45); }
.cred-major {
  background: linear-gradient(165deg, #1a2440, var(--ink-2) 70%);
}
.cred-issuer {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--parchment-dim);
}
.cred h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.25rem;
  margin: 0.6rem 0 0.9rem;
  min-height: 2.6em;
}
.cred-no {
  font-size: 1.3rem;
  color: var(--copper-bright);
  letter-spacing: 0.04em;
}
.cred-meta {
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--parchment-dim);
}

/* ---- expertise ---- */
.expertise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2.6rem 3rem;
}
.exp-col h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--copper-bright);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line-soft);
}
.tag-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-list li {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--parchment);
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.02);
  padding: 0.4rem 0.75rem;
  border-radius: 2px;
  transition: border-color 0.25s, color 0.25s;
}
.tag-list li:hover { border-color: var(--copper); color: var(--copper-bright); }

/* ---- community ---- */
.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1.2rem;
}
.talk {
  border-left: 2px solid var(--copper);
  background: linear-gradient(to right, rgba(192,138,78,0.06), transparent 60%);
  padding: 1.4rem 1.6rem;
}
.talk-venue {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper);
}
.talk h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.15rem;
  margin-top: 0.5rem;
  line-height: 1.4;
}
.community-foot {
  margin-top: 2.4rem;
  font-style: italic;
  color: var(--parchment-dim);
}
.community-foot strong { color: var(--copper-bright); font-weight: 500; }

/* ---- contact ---- */
.contact { padding-bottom: 7rem; text-align: center; }
.contact-inner {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 5rem 2rem;
  background:
    radial-gradient(ellipse 60% 80% at 50% 110%, rgba(192,138,78,0.12), transparent),
    linear-gradient(180deg, var(--ink-2), var(--ink));
}
.contact-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--copper);
  margin-bottom: 2rem;
}
.contact h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  line-height: 1.2;
}
.contact h2 em { color: var(--copper-bright); }
.contact-lede {
  margin-top: 1.4rem;
  font-style: italic;
  color: var(--parchment-dim);
}
.contact-lines {
  margin: 2.4rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--parchment-dim);
}
.contact-lines a { color: var(--copper-bright); text-decoration: none; }
.contact-lines a:hover { text-decoration: underline; }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 2rem 2.5rem 6rem;
  text-align: center;
}
.site-footer p {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--parchment-dim);
}

/* ---- chat ---- */
.chat-fab {
  position: fixed;
  right: 1.6rem; bottom: 1.6rem;
  z-index: 200;
  display: flex; align-items: center; gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--copper);
  color: var(--ink);
  border: none;
  border-radius: 2px;
  padding: 0.9rem 1.3rem;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0,0,0,0.45);
  transition: transform 0.3s, background 0.3s;
}
.chat-fab:hover { transform: translateY(-3px); background: var(--copper-bright); }

/* author display:flex below would otherwise defeat the UA [hidden] rule */
.chat-panel[hidden] { display: none; }

.chat-panel {
  position: fixed;
  right: 1.6rem; bottom: 1.6rem;
  z-index: 210;
  width: min(400px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 4rem));
  display: flex;
  flex-direction: column;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.6);
  overflow: hidden;
  animation: chat-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes chat-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to right, rgba(192,138,78,0.1), transparent);
}
.chat-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 400;
}
.chat-sub {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--copper);
  margin-top: 0.15rem;
}
.chat-close {
  background: none;
  border: none;
  color: var(--parchment-dim);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}
.chat-close:hover { color: var(--parchment); }
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  scrollbar-width: thin;
  scrollbar-color: var(--copper-deep) transparent;
}
.msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 3px;
  font-size: 0.95rem;
  line-height: 1.55;
  animation: msg-in 0.3s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.msg-user {
  align-self: flex-end;
  background: var(--copper);
  color: var(--ink);
}
.msg-bot {
  align-self: flex-start;
  background: var(--ink-3);
  border: 1px solid var(--line-soft);
}
.msg-typing { display: flex; gap: 5px; padding: 1rem 1.1rem; }
.msg-typing i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--copper);
  animation: blink 1.2s infinite;
}
.msg-typing i:nth-child(2) { animation-delay: 0.2s; }
.msg-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100% { opacity: 0.25; } 40% { opacity: 1; } }
.chat-form {
  display: flex;
  border-top: 1px solid var(--line);
}
.chat-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--parchment);
  font-family: var(--body);
  font-size: 0.95rem;
  padding: 1rem 1.2rem;
}
.chat-form input::placeholder { color: var(--parchment-dim); opacity: 0.7; }
.chat-form button {
  background: none;
  border: none;
  border-left: 1px solid var(--line);
  color: var(--copper);
  font-size: 1.2rem;
  width: 3.2rem;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
}
.chat-form button:hover { background: var(--copper); color: var(--ink); }

/* ---- reveal animations ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.3, 1), transform 0.9s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.reveal.in { opacity: 1; transform: none; }
.d1 { transition-delay: 0.12s; }
.d2 { transition-delay: 0.24s; }
.d3 { transition-delay: 0.36s; }
.d4 { transition-delay: 0.48s; }
.d5 { transition-delay: 0.6s; }
.reveal-up {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-up.in { transform: none; }
.reveal-up.d1 { transition-delay: 0.15s; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-up { opacity: 1; transform: none; transition: none; }
  .grain { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---- responsive ---- */
@media (max-width: 860px) {
  .site-nav { display: none; }
  .profile-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .job { grid-template-columns: 1fr; gap: 0.4rem; padding-left: 1.8rem; }
  .community-grid { grid-template-columns: 1fr; }
  .hero-foot { gap: 1.2rem 2.2rem; }
  .section { padding: 5rem 1.4rem 1.5rem; }
  .hero { padding: 7rem 1.4rem 0; }
  .site-header { padding: 1rem 1.4rem; }
  .chat-fab span { display: none; }
  .chat-fab { padding: 1rem; border-radius: 50%; }
}
