/* Minimalist Editorial Stylesheet — michaelmattioli.org
   Editorial typography and minimal layout.
   Zero external dependencies · Zero trackers · Instant paint. */

:root {
  --bg: #faf9f6;
  --surface: #f2f0ea;
  --ink: #1a1917;
  --muted: #5c5953;
  --rule: #ddd8ce;
  --accent: #1d4e4f;
  --accent-hover: #133536;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 43rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151413;
    --surface: #1e1d1b;
    --ink: #ece9e2;
    --muted: #a6a197;
    --rule: #2e2c28;
    --accent: #7ec4c6;
    --accent-hover: #a2d8da;
  }
}

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

html {
  font-size: 106.25%;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-serif);
  line-height: 1.65;
  border-top: 3.5px solid var(--accent);
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.35rem 4rem;
}

/* Header & Navigation (small-caps wordmark, no redundant H1 on home) */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem 1.5rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.25rem;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/* Typography */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: 1.7rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.22rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2.35rem;
  margin-bottom: 0.85rem;
}

.section-kicker {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 2.35rem;
  margin-bottom: 0.85rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
}

/* Compact Editorial Intro Row */
.intro-block {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.intro-portrait {
  flex: 0 0 132px;
  width: 132px;
  height: 162px;
  object-fit: cover;
  object-position: center top;
  border-radius: 4px;
  border: 1px solid var(--rule);
  background: var(--surface);
  display: block;
}

.intro-body {
  flex: 1 1 auto;
  min-width: 0;
}

.intro-text {
  font-size: 0.98rem;
  line-height: 1.62;
  margin: 0 0 0.7rem;
}

.intro-meta {
  font-family: var(--font-sans);
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 0.65rem;
  margin-bottom: 0;
}

.intro-meta a {
  color: var(--muted);
}

.intro-meta a:hover {
  color: var(--accent);
}

@media (max-width: 560px) {
  .intro-block {
    flex-direction: column;
    gap: 1rem;
  }
  .intro-portrait {
    width: 112px;
    height: 136px;
  }
}

/* Author Placeholder Slot (remove once replaced with human copy) */
.author-slot {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--rule);
  border-radius: 4px;
  padding: 0.75rem 0.9rem;
  margin: 0 0 0.85rem;
}

/* Selected Work List (clean typography + small-caps pointer tags) */
.work-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.work-list li {
  position: relative;
  padding: 0.42rem 0 0.42rem 1.05rem;
}

.work-list li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--muted);
  font-weight: 700;
}

.work-link {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
  white-space: nowrap;
  margin-left: 0.35rem;
}

.work-link:hover {
  text-decoration: underline;
}

.work-note {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.12rem;
}

.paper-note {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 0.28rem;
}

.item-archival {
  color: var(--muted);
}

/* Structured Archive Lists (Essays, Books, Scholarship, Teaching) */
.item-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--rule);
}

.item-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.2rem 1.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
}

.item-main {
  flex: 1 1 22rem;
}

.item-sub {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.item-meta {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
}

.item-placeholder {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
}

.type-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.04rem 0.36rem;
  margin-right: 0.45rem;
  vertical-align: 0.04em;
}

.more-link {
  display: inline-block;
  margin-top: 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  text-decoration: none;
}

.more-link:hover {
  text-decoration: underline;
}

/* Book Entry Cards (Minimalist editorial cover + catalog metadata) */
.book-entry {
  display: flex;
  align-items: flex-start;
  gap: 1.4rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--rule);
}

.book-entry:first-of-type {
  border-top: 1px solid var(--rule);
}

.book-cover {
  flex: 0 0 108px;
  width: 108px;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  background: var(--surface);
}

.book-cover-placeholder {
  flex: 0 0 108px;
  width: 108px;
  min-height: 158px;
  padding: 0.7rem 0.6rem;
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 2px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
}

.book-cover-kicker {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.book-cover-title {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  margin: 0.35rem 0;
}

.book-cover-press {
  font-family: var(--font-sans);
  font-size: 0.64rem;
  color: var(--muted);
}

.book-info {
  flex: 1 1 auto;
  min-width: 0;
}

.book-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.book-pub {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.book-blurb {
  font-size: 0.94rem;
  line-height: 1.58;
  margin: 0 0 0.7rem;
}

.book-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.95rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
}

.book-links a {
  text-decoration: none;
  font-weight: 500;
}

.book-links a:hover {
  text-decoration: underline;
}

/* Clickable list titles — unmistakable subtle underline at rest */
.item-title-link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.item-title-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.aux-link {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
  margin-left: 0.4rem;
  white-space: nowrap;
}

.aux-link:hover {
  text-decoration: underline;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

/* Research & Inquiry Surface Cards */
.info-panel {
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin: 1.25rem 0 2rem;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  line-height: 1.55;
}

.info-panel .panel-heading {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.55rem;
}

.info-panel p {
  margin: 0 0 0.5rem;
}

.info-panel p:last-child {
  margin-bottom: 0;
}

.info-panel .panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.2rem;
  margin-top: 0.65rem;
}

.recognition-line {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  color: var(--muted);
  margin: -0.35rem 0 1.6rem;
}

@media (max-width: 560px) {
  .book-entry {
    flex-direction: column;
    gap: 0.9rem;
  }
}

/* Scholarship CV Bar */
.cv-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  padding: 0.95rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin: 1rem 0 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.cv-bar-info {
  flex: 1 1 auto;
  min-width: 0;
}

.btn-link {
  flex: 0 0 auto;
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 3px;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .cv-bar {
    flex-wrap: wrap;
  }
}

.btn-link:hover {
  background: var(--accent-hover);
  color: var(--bg);
}

/* Newsletter Embed Box (Buttondown-ready, zero JS, zero popups) */
.subscribe-box {
  margin-top: 2.5rem;
  padding: 1.2rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.subscribe-box .section-kicker {
  margin-top: 0;
  margin-bottom: 0.55rem;
}

.subscribe-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.subscribe-form input[type="email"] {
  flex: 1 1 14rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--bg);
  color: var(--ink);
}

.subscribe-form button {
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 0.48rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}

.subscribe-form button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Footer */
.site-footer {
  margin-top: 3.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
}

.site-footer a {
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 1rem;
}

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

/* Mobile Polish (Apple HIG type scale, editorial text+image alignment & touch targets) */
@media (max-width: 560px) {
  html {
    font-size: 112.5%;
  }

  .wrap {
    padding: 1.3rem 1.05rem 3rem;
  }

  .site-header {
    gap: 0.55rem 1rem;
    padding-bottom: 0.9rem;
    margin-bottom: 1.55rem;
  }

  .site-nav {
    width: 100%;
    justify-content: space-between;
    gap: 0.35rem 0.45rem;
    font-size: 0.79rem;
  }

  .site-nav a,
  .footer-links a {
    padding: 0.2rem 0;
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.22rem;
  }

  .section-kicker {
    font-size: 0.78rem;
  }

  /* Home: Editorial portrait wrap (eliminates empty space beside portrait) */
  .intro-block {
    display: block;
    margin-bottom: 1.85rem;
  }

  .intro-block::after {
    content: "";
    display: table;
    clear: both;
  }

  .intro-portrait {
    float: left;
    width: 108px;
    height: 134px;
    margin: 0.22rem 1rem 0.45rem 0;
  }

  .intro-body {
    display: contents;
  }

  .intro-text {
    font-size: 1rem;
    line-height: 1.58;
  }

  .intro-meta {
    clear: both;
    font-size: 0.84rem;
    line-height: 1.55;
    padding-top: 0.3rem;
  }

  /* Books: Two-zone grid (cover beside title/publisher, full-width blurb & links below) */
  .book-entry {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-rows: auto 1fr auto auto;
    column-gap: 0.95rem;
    row-gap: 0;
    align-items: start;
  }

  .book-info {
    display: contents;
  }

  .book-cover,
  .book-cover-placeholder {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 92px;
    flex: none;
  }

  .book-cover-placeholder {
    min-height: 134px;
    padding: 0.55rem 0.5rem;
  }

  .book-cover-kicker {
    font-size: 0.62rem;
    letter-spacing: 0.04em;
  }

  .book-cover-title {
    font-size: 0.76rem;
  }

  .book-cover-press {
    font-size: 0.64rem;
  }

  .book-title {
    grid-column: 2;
    grid-row: 1;
    font-size: 1.06rem;
    line-height: 1.25;
    margin: 0 0 0.3rem;
  }

  .book-pub {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.83rem;
    line-height: 1.42;
    margin: 0;
  }

  .book-blurb {
    grid-column: 1 / -1;
    grid-row: 3;
    font-size: 0.96rem;
    line-height: 1.58;
    margin: 0.85rem 0 0.65rem;
  }

  .book-links {
    grid-column: 1 / -1;
    grid-row: 4;
    font-size: 0.84rem;
    gap: 0.4rem 1rem;
  }

  /* HIG-comfortable secondary text & metadata floors across all pages */
  .work-note,
  .item-sub,
  .recognition-line,
  .info-panel,
  .cv-bar {
    font-size: 0.85rem;
    line-height: 1.52;
  }

  .paper-note {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .item-meta,
  .work-link,
  .aux-link,
  .more-link,
  .profile-links,
  .btn-link,
  .site-footer {
    font-size: 0.78rem;
  }

  .type-tag {
    font-size: 0.72rem;
  }

  .site-footer {
    margin-top: 2.5rem;
  }
}
