:root{
  /* Taken from the paper background of MB002.png (approx). */
  --paper: #f9f5ed;
  --paper-2: #f3efe6;
  --ink: #3c3a36;
  --ink-2: #6a655e;
  --rule: rgba(60,58,54,.16);
  --max: 1040px;
  --gutter: clamp(16px, 4vw, 36px);
  --radius: 20px;
  /* Equal distance from title to BOTH rules */
  --title-gap: clamp(14px, 2.2vh, 22px);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{
  color: inherit;
  text-decoration-color: rgba(60,58,54,.25);
  text-underline-offset: .18em;
}
a:hover{ text-decoration-color: rgba(60,58,54,.55); }

.wrap{
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
}

/* Subtle paper frame */
.page{
  position: relative;
  padding: 18px 0 18px;
}

header{
  text-align: center;
  padding: 8px 0 10px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.title{
  margin: 0;
  padding: var(--title-gap) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  letter-spacing: .18em;
  font-weight: 500;
  font-size: clamp(28px, 3vw, 40px);
  text-transform: uppercase;
  line-height: 1.15;
}

nav{
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--title-gap);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--ink-2);
  padding: 0 0 2px;
  user-select: none;
}

nav a{
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 999px;
}
nav a:hover{ background: rgba(60,58,54,.06); }
nav .sep{ opacity: .35; padding: 6px 0; }

main{ padding-top: 8px; }

/* Hero */
.hero{
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(18px, 3.2vw, 44px);
  align-items: center;
  padding: 12px 0 10px;
}

/* Illustration block with “dissolve into paper” edges */
.figure{
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  user-select: none;
}

.figure img{
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  -webkit-mask-image: radial-gradient(closest-side, rgba(0,0,0,1) 72%, rgba(0,0,0,0) 100%);
  mask-image: radial-gradient(closest-side, rgba(0,0,0,1) 72%, rgba(0,0,0,0) 100%);
}

/* Fallback: soft vignette overlay */
.figure:after{
  content:"";
  position: absolute;
  inset: -10px;
  pointer-events: none;
  background: radial-gradient(closest-side,
    rgba(249,245,237,0) 62%,
    rgba(249,245,237,.92) 100%);
  filter: blur(2px);
}

/* kill dissolve/vignette only for specific images */
.figure.no-vignette img{
  -webkit-mask-image: none !important;
  mask-image: none !important;
  -webkit-mask: none !important;
  mask: none !important;
  filter: sepia(12%) brightness(1.02) contrast(0.98);
}
.figure.no-vignette:after,
.figure.no-vignette::after,
.figure.no-vignette:before,
.figure.no-vignette::before{
  content: none !important;
  display: none !important;
  background: none !important;
  filter: none !important;
}

/* Text column */
.copy{ max-width: 520px; }
.lead{
  font-weight: 600;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.35;
  margin: 0 0 16px;
}
.copy p{
  margin: 0 0 14px;
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.55;
  color: rgba(60,58,54,.92);
}

/* Footer */
footer{
  text-align: center;
  padding: 2px 0 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: .03em;
}

.footer-row{
  display:flex;
  justify-content:center;
  gap: 8px;
  align-items:center;
  flex-wrap: wrap;
  margin-top: 4px;
}
footer a{
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 8px;
}
footer a:hover{ background: rgba(60,58,54,.06); }

/* Accessibility */
:focus-visible{
  outline: 2px solid rgba(60,58,54,.45);
  outline-offset: 3px;
  border-radius: 10px;
}

/* ===== Quotes section (Book page) ===== */
.quotes{
  padding: 22px 0 14px;
  padding-bottom: 24px;
  margin-top: 8px;
}

.quotes-grid{
  column-count: 2;
  column-gap: clamp(16px, 2.4vw, 26px);
}

.quote{
  margin: 0 0 clamp(16px, 2.4vw, 26px);
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: rgba(255,255,255,0.55);
  box-shadow: 0 1px 10px rgba(0,0,0,0.05);
  position: relative;
  break-inside: avoid;
}

/* vertical “bookmark” accent */
.quote::before{
  content: "";
  position: absolute;
  left: 10px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: rgba(60,58,54,0.18);
}

.quote blockquote{
  margin: 0;
  padding-left: 14px;
}

.quote p{
  margin: 0 0 8px;
  line-height: 1.6;
  font-style: italic;
}
.quote p:last-child{ margin-bottom: 0; }

/* author aside inside quotes */
.quote .aside{
  font-style: normal;
  opacity: 0.85;
}

/* ===== Contact page ===== */
.contact{
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
.contact-title,
.contact-links{
  text-align: center;
  font-size: 1.4em;
}
.contact-title{ margin-bottom: .75em; }
.contact-links a{ text-decoration: none; }
.contact-links a:hover{ text-decoration: underline; }

.contact-hero{
  background-image: url("assets/MB019.png");
  background-size: cover;
  background-position: center 25%;
  background-repeat: no-repeat;
  position: relative;
  min-height: 70vh;
  padding: 6rem 1rem 5rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* ===== Notes page: cards + modal (overlay) ===== */

/* Hide title inside modal (keep it on cards grid) */


.notes-cards{
  padding: 10px 0 28px;
}

/* grid */
.notes-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 10px;
}
@media (max-width: 980px){
  .notes-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px){
  .notes-grid{ grid-template-columns: 1fr; }
}

/* card */
.note-card{
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,0.55);
  box-shadow: 0 1px 10px rgba(0,0,0,0.05);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
  cursor: pointer;
}
.note-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(0,0,0,.10);
  background: rgba(255,255,255,0.62);
}
.note-card:focus-visible{
  outline: 2px solid rgba(60,58,54,.45);
  outline-offset: 3px;
  border-radius: 16px;
}

.note-thumb{
  aspect-ratio: 16/10;
  background: rgba(0,0,0,.03);
}
.note-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(closest-side, rgba(0,0,0,1) 72%, rgba(0,0,0,0) 100%);
  mask-image: radial-gradient(closest-side, rgba(0,0,0,1) 72%, rgba(0,0,0,0) 100%);
}

.note-body{
  padding: 14px;
  display: grid;
  gap: 8px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.note-title{
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.note-preview{
  margin: 0;
  color: rgba(60,58,54,.88);
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.45em * 3);
}

.note-cta{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(60,58,54,.72);
  user-select: none;
}
.note-cta .dot{
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(60,58,54,.28);
}

.note-full{ display:none; }

/* overlay */

.notes-overlay .notes-modal-title{
  display: none;
}
/* Tighter typography in modal text */

.notes-overlay .notes-modal-text{
  font-size: 18px;   
  line-height: 1.1 
}

.notes-overlay .notes-modal-text p{
  margin: 0 0 8px 0; 
}

/* Stronger contrast for modal text */
.notes-overlay .notes-modal-text{
  color: #2f2d29;   /* темнее, но не чёрный */
}

.notes-overlay .notes-modal-text p:last-child{
  margin-bottom: 0;
}

.notes-overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;          /* ← вместо center */
  justify-content: center;
  padding: 26px 18px 8px;            /* ↑ больше сверху, ↓ меньше снизу */
  z-index: 999;
  background: rgba(20,18,16,.42);
  backdrop-filter: blur(2px);
}
.notes-overlay.is-open{ display:flex; }

/* modal “paper sheet” */
.notes-modal{
  width: min(920px, 100%);
  max-height: calc(100vh - 34px); /* 26(top) + 8(bottom) */
  overflow: hidden;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 18px 60px rgba(0,0,0,.12);
  border: 1px solid rgba(0,0,0,.10);
  position: relative;
}

/* subtle paper depth */
.notes-modal::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.55), rgba(255,255,255,0) 55%),
    radial-gradient(circle at 70% 80%, rgba(0,0,0,.04), rgba(0,0,0,0) 60%);
  pointer-events:none;
  opacity:.9;
}

.notes-modal-inner{
  position: relative;
  display: grid;
  grid-template-columns: 1fr;    /* one column */
  grid-template-rows: auto 1fr;  /* image on top, text below */
  max-height: inherit;
}

.notes-modal-media{
  border-bottom: 1px solid var(--rule);
  background: transparent;
  padding: 12px 12px 8px;
}

.notes-modal-media img{
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain; /* NO CROP */
  display: block;
  margin: 0 auto;

  -webkit-mask-image: radial-gradient(closest-side, rgba(0,0,0,1) 68%, rgba(0,0,0,0) 100%);
  mask-image: radial-gradient(closest-side, rgba(0,0,0,1) 68%, rgba(0,0,0,0) 100%);
}

.notes-modal-content{
  padding: 18px 18px 20px;
  overflow: auto;
}

.notes-modal-title{
  margin: 0 0 10px 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: .02em;
}

.notes-modal-text{
  font-size: 18px;
  line-height: 1.55;
  color: rgba(60,58,54,.92);
}
.notes-modal-text p{ margin: 0 0 12px 0; }
.notes-modal-text p:last-child{ margin-bottom: 0; }

.notes-close{
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: rgba(255,255,255,.52);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .14s ease, background .14s ease;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 18px;
  line-height: 1;
}
.notes-close:hover{ transform: scale(1.03); background: rgba(255,255,255,.72); }
.notes-close:focus-visible{
  outline: 2px solid rgba(60,58,54,.45);
  outline-offset: 3px;
  border-radius: 999px;
}

/* lock scroll when open */
body.modal-open{
  overflow: hidden;
  padding-right: var(--scrollbar-comp, 0px);
}

/* ===== Responsive ===== */
@media (max-width: 860px){
  .hero{
    grid-template-columns: 1fr;
    padding-top: 10px;
  }
  .copy{
    text-align: center;
    max-width: 680px;
    margin: 0 auto;
  }
  .quotes-grid{ column-count: 1; }
}

/* Author page image */
.hero .figure .author-portrait{
  width: 90% !important;
  height: auto !important;
  display: block;
  margin: 0 auto; /* чтобы уменьшенная картинка была по центру */
}

/* show overlay on standalone note pages */
.notes-overlay.notes-overlay--page{
  display: flex;
}
