/* ==========================================================================
   jamespickett.info
   Palette: Bukharan turquoise used sparingly against sand and olive earth.
   ========================================================================== */

:root {
  /* earth */
  --paper:      #f4efe4;
  --paper-deep: #ebe3d2;
  --rule:       #d7cbb2;
  --rule-soft:  #e4dac5;

  /* ink */
  --ink:        #2c2a22;
  --ink-mid:    #6b6455;
  --ink-soft:   #8d8574;

  /* accents */
  --turquoise:      #157f86;
  --turquoise-deep: #0e5f64;
  --turquoise-wash: #d8ebe9;
  --olive:          #6c7a4e;
  --sand:           #c8a86f;

  --display: "Spectral", Georgia, "Times New Roman", serif;
  --utility: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  --gutter:  2rem;
}

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

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.68;
  /* very faint laid-paper tooth */
  background-image: repeating-linear-gradient(90deg,
    rgba(140,120,88,.028) 0 1px, transparent 1px 5px);
}

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

/* ------------------------------------------------------------- masthead */
.masthead { padding-top: 1.4rem; }

/* One bar. Primary links on the left, icon links pushed to the right.
   nowrap on the row keeps them on the same line; the <ul> is allowed to
   shrink and wrap internally before the icons ever drop. */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1.25rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.bar-links {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex: 0 0 auto;          /* never shrink the icons */
  margin-left: auto;
}

.ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  color: var(--ink-mid);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 2px;
  transition: color .16s, background-color .16s;
}
.ic svg { width: 18px; height: 18px; display: block; }
.ic img { display: block; opacity: .82; transition: opacity .16s; }
.ic:hover, .ic:focus-visible {
  color: var(--turquoise-deep);
  background: rgba(21,127,134,.09);
}
.ic:hover img, .ic:focus-visible img { opacity: 1; }
.ic:focus-visible { outline: 2px solid var(--turquoise); outline-offset: 1px; }
.ic-sep {
  width: 1px; height: 17px;
  background: var(--rule);
  margin: 0 .28rem;
  flex: 0 0 auto;
}

.nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  padding: .72rem 0;
  margin: 0;
  min-width: 0;      /* allow the row to shrink instead of overflowing */
  flex: 1 1 auto;
}
.nav a {
  font-family: var(--utility);
  font-size: .76rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: color .16s, border-color .16s;
}
.nav a:hover, .nav a:focus-visible { color: var(--turquoise-deep); }
.nav a[aria-current="page"] {
  color: var(--turquoise-deep);
  border-bottom-color: var(--turquoise);
}
.nav .home { font-weight: 500; letter-spacing: .13em; }

/* ------------------------------------------------------------- typography */
h1, h2, h3 { font-weight: 400; letter-spacing: -.008em; line-height: 1.22; }

.page-title {
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  margin: 2.6rem 0 .35rem;
}
.page-standfirst {
  font-family: var(--utility);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--turquoise-deep);
  margin-bottom: 1.9rem;
}

h2 {
  font-size: 1.42rem;
  margin: 2.7rem 0 .75rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--rule-soft);
}
h3 { font-size: 1.1rem; margin: 1.7rem 0 .5rem; }

p { margin-bottom: 1.05rem; }
main ul, main ol { margin: 0 0 1.15rem 1.15rem; }
main li { margin-bottom: .38rem; }
/* keep a hard ceiling only where a line would otherwise run absurdly long */
main { --hardmax: 100%; }

a {
  color: var(--turquoise-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--turquoise-wash);
  transition: border-color .16s, background-color .16s;
}
a:hover, a:focus-visible {
  border-bottom-color: var(--turquoise);
  background: rgba(21,127,134,.07);
}

em { font-style: italic; }
strong { font-weight: 600; }

hr {
  border: 0;
  border-top: 1px solid var(--rule-soft);
  margin: 2.4rem 0;
}

.note {
  font-size: .93rem;
  color: var(--ink-mid);
  font-style: italic;
}

/* ------------------------------------------------------------- book plates */
.plates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.4rem;
  margin: 2.2rem 0 1rem;
}

.plate { display: block; text-decoration: none; color: inherit; border: 0; }
.plate:hover, .plate:focus-visible { background: none; }

.plate .frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: var(--paper-deep);
  /* a printed plate: hairline rule, inset paper margin, no rounding */
  border: 1px solid var(--rule);
  outline: 6px solid var(--paper);
  outline-offset: -10px;
  box-shadow: 0 1px 0 rgba(0,0,0,.05);
  transition: border-color .22s, box-shadow .28s;
}
.plate:hover .frame, .plate:focus-visible .frame {
  border-color: var(--turquoise);
  box-shadow: 0 6px 22px rgba(44,42,34,.16);
}

.plate img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(.94);
  transition: transform .65s cubic-bezier(.2,.6,.2,1), filter .35s;
}
.plate:hover img, .plate:focus-visible img {
  transform: scale(1.035);
  filter: saturate(1.04);
}

.plate .frame::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top,
    rgba(20,32,33,.88) 0%, rgba(20,32,33,.48) 40%, rgba(20,32,33,0) 76%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.plate:hover .frame::after, .plate:focus-visible .frame::after { opacity: 1; }

.plate .reveal {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.5rem 1.55rem 1.4rem;
  z-index: 2; pointer-events: none;
  opacity: 0; transform: translateY(10px);
  transition: opacity .28s, transform .28s cubic-bezier(.2,.6,.2,1);
}
.plate:hover .reveal, .plate:focus-visible .reveal {
  opacity: 1; transform: none;
}
.plate .reveal .title {
  font-size: 1.28rem; line-height: 1.24; color: #f6f1e6;
  font-style: italic; text-wrap: balance;
}
.plate .reveal .sub {
  font-size: .95rem; color: #cfe3e1; margin-top: .32rem; line-height: 1.34;
}
.plate .reveal .imprint {
  font-family: var(--utility); font-size: .64rem; letter-spacing: .14em;
  text-transform: uppercase; color: #93b7b6; margin-top: .7rem;
}

.plate .caption {
  display: flex; align-items: baseline; gap: .75rem; margin-top: .85rem;
}
.plate .ord {
  font-family: var(--utility); font-size: .65rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--turquoise-deep); white-space: nowrap;
}
.plate .cap-text { font-size: .9rem; color: var(--ink-mid); font-style: italic; }

/* ------------------------------------------------------------- figures */
/* Right-floated illustration with text wrapping around it. Aspect ratio is
   never forced: height:auto keeps the source proportions. */
.fig-right {
  float: right;
  width: min(44%, 28rem);
  margin: .35rem 0 1.3rem 2.1rem;
  border: 1px solid var(--rule);
  outline: 5px solid var(--paper);
  outline-offset: -9px;
  background: var(--paper-deep);
}
.fig-right img { width: 100%; height: auto; display: block; }

/* a figure that is itself a link */
a.fig-right { border-bottom: 0; padding: 0; }
a.fig-right:hover, a.fig-right:focus-visible {
  background: none;
  border-color: var(--turquoise);
}
a.fig-right img { transition: filter .25s; }
a.fig-right:hover img, a.fig-right:focus-visible img { filter: saturate(1.06) brightness(1.03); }
a.fig-right:focus-visible { outline: 2px solid var(--turquoise); outline-offset: 2px; }

/* the Teaching photograph is tall; cap it so it doesn't run the page */
.fig-link { width: min(40%, 26rem); }
.fig-link img { max-height: 34rem; object-fit: cover; object-position: center top; }
/* a larger variant for the About portrait */
.fig-lg { width: min(50%, 34rem); }
/* Headings sit beside a float rather than being pushed below it: overflow
   creates a new block formatting context, so the rule stops at the image
   edge and text wraps around the figure down the whole page. */
h2 { overflow: hidden; }

/* ------------------------------------------------------------- book covers */
.covers {
  display: flex;
  gap: 1.6rem;
  align-items: flex-start;
  margin: 1.4rem 0 2rem;
  flex-wrap: wrap;
}
.cover {
  display: block;
  border: 0;
  width: 14rem;
  flex: 0 0 auto;
  transition: transform .22s cubic-bezier(.2,.6,.2,1);
}
.cover:hover, .cover:focus-visible { background: none; transform: translateY(-4px); }
.cover img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--rule);
  box-shadow: 0 2px 8px rgba(44,42,34,.14);
  transition: box-shadow .22s;
}
.cover:hover img, .cover:focus-visible img {
  box-shadow: 0 10px 22px rgba(44,42,34,.24);
}
/* a single cover floated beside its own section */
.cover-inline {
  float: right;
  clear: right;            /* stack flush to the right edge, not staggered */
  width: 14rem;
  margin: .2rem 0 1.3rem 2.1rem;
}

/* ------------------------------------------------------------- hero */
.hero {
  margin: 2.2rem 0 0;
  border: 1px solid var(--rule);
  outline: 6px solid var(--paper);
  outline-offset: -10px;
  overflow: hidden;
  background: var(--paper-deep);
}
.hero img { width: 100%; display: block; }
.hero-cap {
  font-family: var(--utility);
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: .6rem;
}

/* ------------------------------------------------------------- search */
.search-panel {
  display: none;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-deep);
  padding: 1.1rem 0 1.3rem;
}
.search-panel.open { display: block; }
#search-input {
  width: 100%;
  max-width: 32rem;
  font-family: var(--display);
  font-size: 1.05rem;
  padding: .55rem .7rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 0;
}
#search-input:focus { outline: 2px solid var(--turquoise); outline-offset: 1px; }
#search-results { list-style: none; margin: .9rem 0 0; max-width: 42rem; }
#search-results li { margin-bottom: .55rem; }
#search-results a { border: 0; }
#search-results .r-title { color: var(--turquoise-deep); }
#search-results .r-ctx {
  display: block; font-size: .86rem; color: var(--ink-mid);
}
#search-results mark { background: rgba(200,168,111,.42); color: inherit; }
.search-empty { font-size: .9rem; color: var(--ink-mid); font-style: italic; }

/* ------------------------------------------------------------- footer */
footer {
  margin-top: 4.5rem;
  padding: 1.1rem 0 3.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--utility);
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
footer a { border: 0; color: inherit; }
footer a:hover { color: var(--turquoise-deep); background: none; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 720px) {
  .fig-right, .cover-inline {
    float: none;
    width: 100%;
    margin: 1.3rem 0;
  }
  .cover-inline { width: 12rem; margin: 1.2rem auto; }
}

@media (max-width: 620px) {
  /* only at genuinely small widths do the icons move below the links */
  .nav { flex-wrap: wrap; }
  .bar-links { margin-left: 0; width: 100%; padding-bottom: .55rem; }
}

@media (max-width: 680px) {
  :root { --gutter: 1.15rem; }
  body { font-size: 1.02rem; }
  .plates { grid-template-columns: 1fr; gap: 1.9rem; }
  /* touch devices have no hover: show the titles */
  .plate .frame::after { opacity: 1; }
  .plate .reveal { opacity: 1; transform: none; }
  .nav ul { gap: 1.1rem; }
  .bar-links { gap: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .plate:hover img { transform: none; }
}

@media print {
  .nav, .bar-links, .search-panel, footer, .rail { display: none; }
  body { background: #fff; }
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.fineprint {
  margin-top: 2.6rem;
  padding-top: .9rem;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--utility);
  font-size: .64rem;
  letter-spacing: .06em;
  line-height: 1.7;
  color: var(--ink-soft);
}
