/* ==========================================================
   jonathanshanks.com - shared stylesheet

   Placeholder styling until the branding lands.
   Change colours, fonts and spacing in the variables below;
   everything else on the site reads from them.
   ========================================================== */

:root {
  /* Colours */
  --colour-background: #ffffff;
  --colour-text: #000000;
  --colour-muted: #6b6b6b;          /* secondary text */
  --colour-line: #e5e5e5;           /* borders and dividers */
  --colour-panel: #f5f5f5;          /* light grey panels */
  --colour-accent: #ff1a1a;         /* bright red: swap this one line to change it */

  /* Fonts */
  --font-main: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* Type sizes */
  --size-tiny: 0.75rem;             /* copyright line */
  --size-small: 0.875rem;
  --size-body: 1.125rem;
  --size-large: 1.5rem;
  --size-hero: clamp(2.75rem, 7vw, 5.5rem);   /* scales with screen width */

  /* Spacing */
  --space-xs: 0.5rem;
  --space-s: 1rem;
  --space-m: 2rem;
  --space-l: 4rem;
  --space-xl: 8rem;

  /* Layout */
  --page-width: 1200px;
  --page-gutter: 1.5rem;            /* space at the left and right edges */
}


/* ---------- Basics ---------- */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--colour-background);
  color: var(--colour-text);
  font-family: var(--font-main);
  font-size: var(--size-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

/* Keeps content centred and at a readable width */
.container {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--page-gutter);
}

/* Vertical space between homepage sections */
.section {
  padding: var(--space-xl) 0;
}


/* ---------- Header and navigation ---------- */

.site-header {
  border-bottom: 1px solid var(--colour-line);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  padding-top: var(--space-s);
  padding-bottom: var(--space-s);
}

.site-name {
  font-weight: 600;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-m);
  font-size: var(--size-small);
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--colour-accent);
}

/* Services dropdown: hidden until Services is hovered (or tabbed to) */
.nav-dropdown {
  position: relative;
}

/* "Services" is a label, not a link: it only opens the dropdown */
.nav-label {
  cursor: default;
}

.nav-dropdown:hover .nav-label,
.nav-label:focus {
  color: var(--colour-accent);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: calc(-1 * var(--space-s));
  z-index: 10;
  min-width: 12rem;
  margin: 0;
  padding: var(--space-xs) 0;
  list-style: none;
  background: var(--colour-background);
  border: 1px solid var(--colour-line);
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: var(--space-xs) var(--space-s);
}


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

.hero .container {
  display: grid;
  grid-template-columns: 3fr 2fr;   /* text on the left, photo on the right */
  gap: var(--space-l);
  align-items: center;
}

.hero h1 {
  font-size: var(--size-hero);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 600;
  margin: 0;
}

/* Second line of the hero in the accent colour */
.hero h1 span {
  display: block;
  color: var(--colour-accent);
}


/* ---------- Intro panel and body copy ---------- */

.intro-panel {
  font-size: var(--size-large);
  line-height: 1.4;
  max-width: 40ch;
  margin: 0 0 var(--space-l);
}

.body-copy {
  max-width: 60ch;
}


/* ---------- "Find out more" links ---------- */

.more-link {
  display: inline-block;
  margin-top: var(--space-s);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid var(--colour-accent);
}

.more-link:hover {
  color: var(--colour-accent);
}

/* Calendly pop-up: kept narrower so Calendly uses its single-column
   layout (its wide layout pushes "Privacy Policy" against the edge) */
body .calendly-overlay .calendly-popup {   /* "body" so this beats Calendly's own CSS */
  min-width: 0;
  max-width: 680px;
}

/* Call-to-action block: one large link centred in a full-width panel */
.cta-block {
  text-align: center;
}

.cta-block .more-link {
  margin-top: 0;
  font-size: var(--size-large);
}

/* Two "Find out more" style links side by side */
.link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-m);
  margin-top: var(--space-s);
}

.link-row .more-link,
p .more-link {
  margin-top: 0;      /* no extra space when the link sits in a row or a sentence */
}


/* ---------- My Guiding Principles (open and close) ---------- */

/* Two columns, filled in pairs left to right; one column on phones */
.principles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--space-l);
  align-items: start;         /* opening one doesn't stretch its neighbour */
}

.principle {
  border-bottom: 1px solid var(--colour-line);
}

/* Line above the top pair */
.principle:nth-child(-n+2) {
  border-top: 1px solid var(--colour-line);
}

/* Variant: fill the first column top to bottom, then the second
   (used on Business Consultancy: Feasibility, Build | Coherence, AI) */
.principles-down {
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
}

.principles-down .principle:nth-child(2) {
  border-top: 0;
}

.principles-down .principle:nth-child(3) {
  border-top: 1px solid var(--colour-line);
}

/* Same, with three per column (home page: six principles) */
.principles-down.rows-3 {
  grid-template-rows: repeat(3, auto);
}

.principles-down.rows-3 .principle:nth-child(3) {
  border-top: 0;
}

.principles-down.rows-3 .principle:nth-child(4) {
  border-top: 1px solid var(--colour-line);
}

/* The clickable title row, with the cross on the right */
.principle summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-s);
  padding: var(--space-s) 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;           /* hides the browser's own arrow */
}

.principle summary::-webkit-details-marker {
  display: none;              /* hides the arrow in Safari */
}

.principle summary::after {
  content: "+";
  flex-shrink: 0;
  font-size: var(--size-large);
  font-weight: 400;
  line-height: 1;
  color: var(--colour-accent);
  transition: transform 0.2s ease;
}

/* When open, the + turns into a × */
.principle[open] summary::after {
  transform: rotate(45deg);
}

.principle summary:hover {
  color: var(--colour-accent);
}

.principle p {
  margin: 0 0 var(--space-s);
}


/* ---------- Squares (e.g. What I do) ---------- */

/* Three in a row by default; add "squares-2" for two per row */
.squares {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-m);
}

.squares-2 {
  grid-template-columns: 1fr 1fr;
}

/* Two-per-row boxes are oblongs rather than squares */
.squares-2 .square {
  aspect-ratio: 3 / 2;
}

/* A bar across the full width, under all the boxes (e.g. AI Integration).
   Black so it reads as a layer beneath them, not another option */
.squares .square-span {
  grid-column: 1 / -1;
  aspect-ratio: auto;
  background: var(--colour-text);
  color: var(--colour-background);
}

.square {
  aspect-ratio: 1 / 1;
  padding: var(--space-l) var(--space-m);
  background: var(--colour-panel);
}

/* Title at the top of each square */
.square h3 {
  margin: 0 0 var(--space-s);
  font-size: var(--size-large);
}

.square p {
  margin: 0 0 var(--space-s);
}


/* ---------- Professional engagements (ruled rows, like a table) ---------- */

.engagements {
  border-top: 2px solid var(--colour-text);
}

/* One row: company and role on the left, details on the right */
.engagement {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-m);
  padding: var(--space-m) 0;
  border-bottom: 1px solid var(--colour-line);
}

.engagement-who h3 {
  margin: 0 0 var(--space-xs);
  font-size: var(--size-large);
  line-height: 1.3;
}

/* Company names link to their sites: no underline, red on hover */
.engagement-who h3 a {
  text-decoration: none;
}

.engagement-who h3 a:hover {
  color: var(--colour-accent);
}

.engagement-who p {
  margin: 0;
  color: var(--colour-muted);
}

.engagement-what ul {
  margin: 0 0 var(--space-s);
  padding-left: 1.2em;
}

.engagement-what li {
  margin-bottom: var(--space-xs);
}

/* "What was different" line, set off with a red rule */
.engagement-diff {
  margin: 0;
  padding-left: var(--space-s);
  border-left: 3px solid var(--colour-accent);
}


/* ---------- Consulting panel (full width) ---------- */

.consulting {
  background: var(--colour-text);
  color: var(--colour-background);
}

.consulting p {
  max-width: 60ch;
}

/* Copy split into two columns; stacks on phones */
.consulting-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-l);
}

.consulting-columns p:first-child {
  margin-top: 0;
}


/* Long copy that flows down one column and into the next.
   The browser balances the two columns, so edits re-flow on their own. */
.copy-columns {
  column-count: 2;
  column-gap: var(--space-l);
}

.copy-columns p {
  break-inside: avoid;   /* keep each paragraph in one column */
}

.copy-columns p:first-child {
  margin-top: 0;
}


/* ---------- Inner Cohesion and Totem Practice (half panels) ---------- */

.half-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
}

/* Black section background, white text. Add "section-dark" to any section */
.section-dark {
  background: var(--colour-text);
  color: var(--colour-background);
}

/* Flex column so "Find out more" sits at the bottom left of every panel */
.half-panel {
  display: flex;
  flex-direction: column;
  padding: var(--space-l) var(--space-m);
  background: var(--colour-panel);
  color: var(--colour-text);   /* stays dark even inside a black section */
}

.half-panel .more-link {
  margin-top: auto;
  align-self: flex-start;
}

.half-panel p {
  margin-bottom: var(--space-m);
}

.half-panel h2 {
  font-size: var(--size-large);
  margin: 0 0 var(--space-s);
}

/* Panel titles link to their pages: no underline, red on hover */
.half-panel h2 a {
  text-decoration: none;
}

.half-panel h2 a:hover {
  color: var(--colour-accent);
}


/* ---------- Testimonials ---------- */

.section-heading {
  font-size: var(--size-large);
  margin: 0 0 var(--space-m);
}

.testimonials {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-m);
}

/* "See more testimonials" link under the home page cards */
.testimonials + .more-link {
  margin-top: var(--space-m);
}

/* Testimonials page: full versions in two columns; one column on phones */
.testimonials-full {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
}

/* One testimonial: quote, then name and role underneath.
   Flex column so the name always sits at the bottom of the card. */
.testimonial {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: var(--space-m);
  background: var(--colour-panel);
}

.testimonial blockquote {
  margin: 0 0 var(--space-m);
  font-style: italic;
}

.testimonial figcaption {
  margin-top: auto;   /* pushes name and role to the bottom */
  font-size: var(--size-small);
  color: var(--colour-muted);
}

/* Home page cards share rows, so every name lines up
   even when a job title runs onto two lines */
.testimonials .testimonial {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 2;
}

.testimonials .testimonial figcaption {
  margin-top: 0;      /* the shared rows do the aligning here */
}

.testimonial figcaption strong {
  display: block;
  color: var(--colour-text);
}


/* ---------- Let's connect ---------- */

.connect {
  border-top: 1px solid var(--colour-line);
}


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

.site-footer {
  background: var(--colour-background);
  color: var(--colour-text);
  padding: var(--space-l) 0;
  font-size: var(--size-small);
}

.site-footer .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  text-decoration: none;
}

/* Pages listed under the "Services" heading in the footer */
.footer-sub {
  list-style: none;
  margin: 0;
  padding-left: var(--space-s);
}

.footer-links a:hover {
  color: var(--colour-accent);
}


/* ---------- Placeholders (delete once the real thing is in) ---------- */

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  padding: var(--space-m);
  border: 1px dashed var(--colour-muted);
  color: var(--colour-muted);
  font-size: var(--size-small);
  text-align: center;
}

.placeholder.photo {
  aspect-ratio: 4 / 5;
}

.site-footer .placeholder {
  min-height: 6rem;
}

/* Copyright line: spans the full footer width */
.copyright {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--size-tiny);
  color: var(--colour-muted);
}

/* Back to top: sits on the right, just above the banner or footer */
.back-to-top-row {
  text-align: right;
  padding-bottom: var(--space-m);
}

.back-to-top {
  font-size: var(--size-small);
  color: var(--colour-text);
  text-decoration: none;
}

.back-to-top:hover {
  color: var(--colour-accent);
}

/* Smooth scrolling for "Back to top" and other on-page links.
   Turned off for people who have asked their device for less motion. */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


/* ---------- Phone width ---------- */

@media (max-width: 760px) {
  .copy-columns {
    column-count: 1;
  }

  :root {
    --space-xl: 4rem;
    --page-gutter: 1rem;
  }

  /* Stack everything into one column */
  .hero .container,
  .half-panels,
  .testimonials,
  .principles,
  .consulting-columns,
  .testimonials-full,
  .site-footer .container {
    grid-template-columns: 1fr;
  }

  /* On phones the squares stack and grow to fit their text */
  .squares,
  .squares-2 {
    grid-template-columns: 1fr;
    gap: var(--space-s);
  }

  .square,
  .squares-2 .square {
    aspect-ratio: auto;
    padding: var(--space-m);
  }

  .principles-down {
    grid-template-rows: none;
    grid-auto-flow: row;
  }

  .principles-down .principle:nth-child(3) {
    border-top: 0;
  }

  .principles-down.rows-3 .principle:nth-child(4) {
    border-top: 0;
  }

  .engagement {
    grid-template-columns: 1fr;
    gap: var(--space-s);
  }

  /* In one column only the first principle needs a top line */
  .principle:nth-child(2) {
    border-top: 0;
  }

  .site-nav {
    gap: var(--space-xs) var(--space-s);
  }
}
