/* ---------------------------------------------------------
   NAIVE CADE — tokens
--------------------------------------------------------- */
:root{
  --paper: #ECEAE4;
  --paper-2: #E4E2DB;
  --ink: #0E0D0B;
  --grey: #6E6C64;
  --grey-soft: #96938A;
  --line: #D3D0C7;
  --line-strong: #B9B6AB;

  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', serif;
  --sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;

  --content-w: 640px;
  --wide-w: 880px;
}

*{ box-sizing: border-box; }

html{ background: var(--paper); }

body{
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection{ background: var(--ink); color: var(--paper); }

a{ color: inherit; text-decoration: none; }

button{
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible{
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------------------------------------------------------
   Paper grain — one quiet, constant texture. Not animated.
--------------------------------------------------------- */
.grain{
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
}

/* ---------------------------------------------------------
   Header / footer chrome
--------------------------------------------------------- */
.site-header{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 28px clamp(20px, 5vw, 56px) 0;
}

.mark{
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.01em;
}

.nav{
  display: flex;
  gap: 22px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.nav a{
  color: var(--grey);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.nav a:hover,
.nav a[aria-current="page"]{
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.site-footer{
  margin-top: auto;
  padding: 40px clamp(20px, 5vw, 56px) 32px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey-soft);
}

/* ---------------------------------------------------------
   Main layout
--------------------------------------------------------- */
main{
  flex: 1;
  padding: 0 clamp(20px, 5vw, 56px);
}

.page{
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 56px 0 80px;
}

.page--wide{ max-width: var(--wide-w); }

/* ---------------------------------------------------------
   Entry — the block used on the home page and on each
   standalone week page (weeks/week-XXX.html)
--------------------------------------------------------- */
.entry__meta{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey);
  margin-bottom: 22px;
}

.entry__index{ color: var(--ink); }

.entry__photo-frame{
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--line);
}

.entry__photo-frame img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.05) saturate(0.92);
}

.entry__title{
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 400;
  line-height: 1.15;
  margin: 30px 0 20px;
}

.entry__writing-title{
  font-style: italic;
  font-weight: 400;
  font-size: 18px;
  color: var(--grey);
  margin: 28px 0 8px;
}

.entry__writing{
  font-size: 18px;
  line-height: 1.7;
  max-width: 62ch;
}

.entry__writing p{ margin: 0 0 1.2em; }
.entry__writing p:last-child{ margin-bottom: 0; }

.home-foot{
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey);
}

.home-foot a:hover{ color: var(--ink); }
.home-foot span{ display: inline-block; }

/* ---------------------------------------------------------
   Custom audio player
--------------------------------------------------------- */
.player{
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin: 26px 0 8px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.player__toggle{
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.player__toggle .icon{
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid var(--ink);
  margin-left: 2px;
}

.player__toggle.is-playing .icon{
  width: 10px;
  height: 14px;
  border: none;
  margin-left: 0;
  background: linear-gradient(to right, var(--ink) 3px, transparent 3px 7px, var(--ink) 7px);
}

.player__time{
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey);
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
}

.player__time--duration{ text-align: right; }

.player__scrub-wrap{
  position: relative;
  width: 100%;
  height: 16px;
  display: flex;
  align-items: center;
}

.player__track,
.player__fill{
  position: absolute;
  left: 0;
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
}

.player__track{
  width: 100%;
  background: var(--line-strong);
}

.player__fill{
  width: 0%;
  background: var(--ink);
}

.player__thumb{
  position: absolute;
  top: 50%;
  left: 0%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.player__scrub{
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 2;
  width: 100%;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.player__scrub::-webkit-slider-runnable-track{
  height: 16px;
  background: transparent;
}

.player__scrub::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.player__scrub::-moz-range-track{
  height: 16px;
  background: transparent;
  border: none;
}

.player__scrub::-moz-range-thumb{
  width: 8px;
  height: 8px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.player.is-disabled{ opacity: 0.45; }
.player.is-disabled .player__scrub,
.player.is-disabled .player__toggle{ pointer-events: none; }

.player__note{
  grid-column: 1 / -1;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--grey-soft);
  font-style: italic;
  margin-top: 2px;
}

/* ---------------------------------------------------------
   Archive
--------------------------------------------------------- */
.page-title{
  font-size: 15px;
  font-family: var(--sans);
  color: var(--grey);
  margin: 0 0 34px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.archive-list{
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.archive-row{
  display: grid;
  grid-template-columns: 44px 56px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.archive-row__index{
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey-soft);
}

.archive-row__thumb{
  width: 56px;
  height: 70px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-2);
}

.archive-row__thumb img{
  width: 100%; height: 100%; object-fit: cover;
  filter: contrast(1.05) saturate(0.92);
}

.archive-row__title{
  font-size: 18px;
}

.archive-row__date{
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey);
  white-space: nowrap;
}

.archive-row:hover .archive-row__title{
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------
   Thoughts
--------------------------------------------------------- */
.thought{
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.thought:first-of-type{ border-top: 1px solid var(--line); }

.thought__meta{
  display: flex;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey);
  margin-bottom: 12px;
}

.thought__title{
  font-style: italic;
  font-size: 18px;
  color: var(--grey);
  margin: 0 0 10px;
}

.thought__body{
  font-size: 18px;
  line-height: 1.7;
  max-width: 62ch;
}

.thought__body p{ margin: 0 0 1.2em; }
.thought__body p:last-child{ margin-bottom: 0; }

/* native <details> used for "read the rest" — no JS required */
.thought__more summary{
  list-style: none;
  cursor: pointer;
  display: inline-block;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
}

.thought__more summary::-webkit-details-marker{ display: none; }

.thought__more summary:hover{ color: var(--ink); text-decoration-color: var(--ink); }

.thought__more[open] summary{ display: none; }

.thought__more .thought__body{ margin-top: 12px; }

.thought__link{
  display: block;
  margin-top: 14px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.thought__link:hover{ color: var(--ink); }

/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */
@media (max-width: 560px){
  .archive-row{
    grid-template-columns: 32px 44px 1fr;
    row-gap: 4px;
  }
  .archive-row__date{
    grid-column: 2 / -1;
    order: 4;
  }
  .site-header{ padding-top: 22px; }
  .page{ padding-top: 40px; }
}
