/* Alfred Megally — site-wide design system ("fable" highlighter language) */

:root {
  --paper: #ffffff;
  --ink: #161616;
  --pencil: #6f6a5e;
  --link: #2b5aa0;
  --hl: #ffe94a;
  --on-hl: #161616;
  --rule: #e9e6dc;
  --print: #ffffff;          /* photo print border stays white in both themes */
  --print-shadow: rgba(20, 18, 10, 0.18);
  --display: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17150f;
    --ink: #f0ede3;
    --pencil: #a29b8a;
    --link: #8fb4e8;
    --hl: #f2d830;
    --rule: #333026;
    --print-shadow: rgba(0, 0, 0, 0.55);
  }
}

html { background: var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}
.page-wide { max-width: 980px; }

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover {
  background: var(--hl);
  color: var(--on-hl);
}
:focus-visible {
  outline: 3px solid var(--hl);
  outline-offset: 2px;
}

/* ---------- highlighter swipe (the signature) ---------- */
.hl {
  position: relative;
  z-index: 0;
  padding: 0 0.08em;
  animation: inkin 0.45s ease-out both;
  animation-delay: var(--d, 0.1s);
}
@keyframes inkin {
  from { color: var(--ink); }
  to   { color: var(--on-hl); }
}
.hl::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0.08em;
  bottom: -0.04em;
  left: -0.14em;
  right: -0.18em;
  background: var(--hl);
  border-radius: 0.4em 0.6em 0.5em 0.7em / 0.6em 0.4em 0.7em 0.5em;
  transform: rotate(-0.6deg) skewX(-6deg) scaleX(1);
  transform-origin: left center;
  animation: swipe 0.45s ease-out both;
  animation-delay: var(--d, 0.1s);
}
@keyframes swipe {
  from { transform: rotate(-0.6deg) skewX(-6deg) scaleX(0); }
  to   { transform: rotate(-0.6deg) skewX(-6deg) scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .hl, .hl::before { animation: none; }
  .hl { color: var(--on-hl); }
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 28px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}
.wordmark {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover { background: none; color: var(--ink); }
.site-header nav {
  display: flex;
  gap: 6px;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.site-header nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 4px 9px;
}
.site-header nav a:hover { background: var(--hl); color: var(--on-hl); }
.site-header nav a[aria-current="page"] {
  background: var(--hl);
  color: var(--on-hl);
}

/* ---------- article pages (projects, books, essays) ---------- */
.entry-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 10px;
  text-wrap: balance;
}
.title-swipe {
  display: block;
  width: 88px;
  height: 10px;
  margin: 14px 0 0;
  background: var(--hl);
  border-radius: 0.4em 0.6em 0.5em 0.7em / 0.6em 0.4em 0.7em 0.5em;
  transform: rotate(-0.8deg) skewX(-8deg);
}
.entry-meta {
  font-style: italic;
  color: var(--pencil);
  margin: 18px 0 0;
}
.entry-header { margin-bottom: 36px; }

.entry-content { max-width: 62ch; }
.entry-content p { margin: 0 0 1.2em; }
.entry-content h2, .entry-content h3 {
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 1.8em 0 0.6em;
}
.entry-content h2 { font-size: 1.25rem; }
.entry-content h3 { font-size: 1.1rem; }
.entry-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.6em 0;
  background: var(--print);
  border: 6px solid var(--print);
  box-shadow: 0 2px 10px var(--print-shadow);
  box-sizing: border-box;
}
.entry-content figure { margin: 1.6em 0; }
.entry-content figure img { margin: 0; }
.entry-content figcaption {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--pencil);
  margin-top: 8px;
}
.entry-content blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 18px;
  border-left: 4px solid var(--hl);
  font-style: italic;
}
.entry-content ul, .entry-content ol { padding-left: 1.3em; }
.entry-content li { margin-bottom: 0.35em; }
.entry-content .video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 1.6em 0;
}
.entry-content .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.backlink {
  display: inline-block;
  margin-bottom: 28px;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.backlink:hover { background: var(--hl); color: var(--on-hl); }

/* ---------- photo album chooser (/portfolio/) ---------- */
.albums-intro { margin: 0 0 40px; }
.albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 40px 32px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.print-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: var(--print);
  padding: 10px 10px 14px;
  box-shadow: 0 3px 14px var(--print-shadow);
  transform: rotate(var(--tilt, -0.7deg));
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.print-card:hover {
  background: var(--print);
  color: var(--ink);
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 0 10px 26px var(--print-shadow);
}
.albums li:nth-child(2n) .print-card { --tilt: 0.8deg; }
.albums li:nth-child(3n) .print-card { --tilt: -1deg; }
.albums li:nth-child(5n) .print-card { --tilt: 0.5deg; }
.print-card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
}
.print-card .album-title {
  display: block;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 12px 2px 2px;
  color: #161616; /* on the white print, always ink-dark */
}
.print-card .album-where {
  display: block;
  font-family: var(--body);
  font-style: italic;
  font-size: 0.88rem;
  color: #6f6a5e; /* pencil on white print */
  margin: 0 2px;
}
.print-card:hover .album-title {
  background: var(--hl);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- album page photo wall ---------- */
.photo-wall {
  columns: 2;
  column-gap: 22px;
  margin-top: 8px;
}
.photo-wall a {
  display: block;
  break-inside: avoid;
  margin: 0 0 22px;
  background: var(--print);
  padding: 8px;
  box-shadow: 0 2px 10px var(--print-shadow);
}
.photo-wall a:hover {
  outline: 4px solid var(--hl);
  outline-offset: 0;
}
.photo-wall img {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- lightbox ---------- */
.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  margin: 0;
}
.lightbox::backdrop { background: rgba(10, 9, 5, 0.92); }
.lightbox img {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  background: var(--print);
  padding: 8px;
  box-sizing: border-box;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.lightbox button {
  position: fixed;
  z-index: 2;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1rem;
  background: var(--hl);
  color: #161616;
  border: none;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 0.4em 0.6em 0.5em 0.7em / 0.6em 0.4em 0.7em 0.5em;
}
.lightbox .lb-close { top: 16px; right: 16px; }
.lightbox .lb-prev  { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next  { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---------- books list ---------- */
.books ul {
  list-style: none;
  padding: 0;
  margin: 0 0 2.2em;
}
.books li {
  font-weight: 700;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}
.books ul li:last-child { border-bottom: none; }
.books br { display: none; }
.books .author {
  font-weight: 400;
  font-size: 0.85em;
  color: var(--pencil);
  margin-left: 4px;
}
.books .desc {
  display: block;
  font-weight: 400;
  font-size: 0.93em;
  line-height: 1.5;
  color: var(--pencil);
  margin-top: 3px;
}
.books p { margin: 1.6em 0 0.2em; }
.books p i {
  font-family: var(--display);
  font-style: normal;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pencil);
}

/* ---------- notes (tumblr export) ---------- */
.year-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 30px;
}
.year-chip {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--on-hl);
  background: var(--hl);
  padding: 6px 12px;
  border-radius: 0.5em 0.8em 0.55em 0.9em / 0.8em 0.5em 0.9em 0.6em;
}
.year-chip span {
  font-weight: 700;
  font-size: 0.72em;
  margin-left: 6px;
  opacity: 0.55;
}
.year-chip:hover { background: var(--ink); color: var(--paper); }
.year-head {
  font-family: var(--display);
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin: 56px 0 8px;
  scroll-margin-top: 24px;
}
.year-head .title-swipe { width: 64px; margin-top: 6px; }
.note {
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
  max-width: 62ch;
}
.note-date {
  display: inline-block;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pencil);
  text-decoration: none;
  margin-bottom: 10px;
}
.note-date:hover { background: var(--hl); color: var(--on-hl); }
.note-body p { margin: 0 0 1em; }
.note-body p:last-child { margin-bottom: 0; }
.note-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 10px 0;
  background: var(--print);
  border: 6px solid var(--print);
  box-shadow: 0 2px 10px var(--print-shadow);
  box-sizing: border-box;
}
.note-body video, .note-body audio {
  width: 100%;
  display: block;
  margin: 10px 0;
}
.note-body h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.note-cap { margin-top: 4px; }
.note-cap p { margin: 0 0 0.8em; }
blockquote.note-quote {
  margin: 0;
  padding: 0 0 0 18px;
  border-left: 4px solid var(--hl);
  font-size: 1.25rem;
  line-height: 1.5;
  font-style: italic;
}
.note-quote-src {
  margin-top: 10px;
  color: var(--pencil);
  font-size: 0.92rem;
}
.note-link {
  font-size: 1.15rem;
  line-height: 1.45;
}
.note-q {
  background: color-mix(in srgb, var(--hl) 18%, var(--paper));
  border-left: 4px solid var(--hl);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-style: italic;
}
.note-asker {
  display: block;
  font-family: var(--display);
  font-style: normal;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.note-tags { margin-top: 12px; }
.note-tag {
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--pencil);
  margin-right: 10px;
}
.note .video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 10px 0;
}
.note .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- shared bits ---------- */
h2.sec {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 24px;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  margin-top: 64px;
  padding-top: 20px;
  font-size: 0.85rem;
  color: var(--pencil);
}
.draw-toggle {
  font-family: var(--body);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--pencil);
  background: none;
  border: none;
  padding: 2px 6px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.draw-toggle:hover {
  background: var(--hl);
  color: var(--on-hl);
  text-decoration: none;
}
body.marker-mode .draw-toggle {
  position: relative;
  z-index: 2147483001;
  background: var(--hl);
  color: var(--on-hl);
  text-decoration: none;
  border-radius: 0.4em 0.6em 0.5em 0.7em / 0.6em 0.4em 0.7em 0.5em;
}
