/* Ben Mo — Personal Archive
   Shared styles for all pages. Edit fonts, colors, spacing here. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;600&display=swap');

:root {
  --paper: #f1ede2;
  --ink: #26241e;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Folder colors */
  --folder-fiction:     #e6d8b0;
  --folder-travelogue:  #d8c79c;
  --folder-photographs: #e0d3a8;
  --folder-notes:       #dccfa3;
  --folder-projects:    #cfbc8c;
  --folder-letters:     #e8dcb7;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: var(--ink); color: var(--paper); }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }

/* ─── Page shell ─── */
.shell { max-width: 1240px; margin: 0 auto; padding: 44px 60px 60px; }

.meta-bar {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  opacity: 0.6;
  letter-spacing: 0.05em;
}

.hairline { height: 1px; background: var(--ink); opacity: 0.2; margin-top: 10px; }
.hairline--light { opacity: 0.15; }
.hairline--dashed { background: transparent; border-top: 1px dashed rgba(38,36,30,0.25); height: 0; }

.footer-bar {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid rgba(38,36,30,0.15);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  opacity: 0.55;
}

/* blinking caret */
.cursor::after {
  content: '▍';
  animation: blink 1.2s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ─── Identity block (home page) ─── */
.identity {
  margin-top: 44px;
  display: grid;
  grid-template-columns: 180px 1fr;
  row-gap: 12px;
  column-gap: 24px;
  max-width: 900px;
}
.identity .label { opacity: 0.55; }
.identity .label .dots { opacity: 0.35; }
.identity .value { line-height: 1.6; text-wrap: pretty; }
.identity .value--big { font-size: 15px; }

/* ─── Section header (§ FOLDERS, etc) ─── */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 11px;
  opacity: 0.6;
  letter-spacing: 0.05em;
}

.section { margin-top: 64px; }

/* ─── Folder grid (home) ─── */
.folders {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 44px 32px;
  margin-top: 36px;
}

.folder {
  position: relative;
  margin-top: 28px;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 280ms cubic-bezier(.2,.7,.2,1), filter 280ms;
  filter: drop-shadow(0 2px 3px rgba(38,36,30,0.10))
          drop-shadow(0 8px 14px rgba(38,36,30,0.06));
}
.folder:hover, .folder:focus-visible {
  outline: none;
  transform: translateY(-10px);
  filter: drop-shadow(0 22px 28px rgba(38,36,30,0.22))
          drop-shadow(0 4px 6px rgba(38,36,30,0.10));
}

/* tab */
.folder__tab {
  position: absolute;
  top: -22px;
  left: 4px;
  height: 26px;
  background: var(--tab-color, var(--folder-fiction));
  padding: 0 22px 0 14px;
  border-radius: 5px 18px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #3b362a;
}
.folder__tab .num { opacity: 0.55; }

/* paper peek */
.folder__peek {
  position: absolute;
  top: -6px;
  right: 16px;
  width: 55%;
  height: 8px;
  background: #f7f1e1;
  border-radius: 3px 3px 0 0;
  opacity: 0.85;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 280ms cubic-bezier(.2,.7,.2,1);
}
.folder:hover .folder__peek { transform: translateY(-4px); opacity: 1; }

/* body */
.folder__body {
  background: var(--tab-color, var(--folder-fiction));
  border-radius: 0 6px 6px 6px;
  padding: 30px 24px 22px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}
.folder__zh { font-size: 11px; opacity: 0.55; letter-spacing: 0.06em; }
.folder__title { font-size: 30px; line-height: 1.05; margin-top: 10px; letter-spacing: -0.01em; }
.folder__note { font-size: 12px; opacity: 0.65; margin-top: 10px; line-height: 1.5; max-width: 240px; text-wrap: pretty; }
.folder__foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  opacity: 0.55;
  margin-top: 28px;
}
.folder__open { transition: transform 280ms cubic-bezier(.2,.7,.2,1), opacity 280ms; }
.folder:hover .folder__open { transform: translateX(4px); opacity: 1; }

/* ─── Category page header ─── */
.back-link {
  display: inline-block;
  margin-top: 28px;
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 0.7;
  text-decoration: none;
  transition: opacity 200ms, transform 200ms;
}
.back-link:hover { opacity: 1; transform: translateX(-3px); }

.cat-head {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 32px;
  padding-bottom: 24px;
}
.cat-head__kicker { font-size: 11px; opacity: 0.55; letter-spacing: 0.18em; text-transform: uppercase; }
.cat-head__title { margin-top: 14px; font-size: 64px; line-height: 1; letter-spacing: -0.02em; }
.cat-head__zh { opacity: 0.45; margin-left: 18px; font-size: 28px; }
.cat-head__desc { margin-top: 16px; font-size: 14px; opacity: 0.75; max-width: 540px; line-height: 1.55; text-wrap: pretty; }
.cat-head__meta { text-align: right; font-size: 11px; opacity: 0.55; line-height: 1.6; }

/* ─── Work grid ─── */
.works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 32px;
  margin-top: 36px;
}

.work {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 260ms cubic-bezier(.2,.7,.2,1), filter 260ms;
  filter: drop-shadow(0 2px 3px rgba(38,36,30,0.08));
}
.work:hover, .work:focus-visible {
  outline: none;
  transform: translateY(-10px);
  filter: drop-shadow(0 22px 26px rgba(38,36,30,0.18));
}

.work__img {
  aspect-ratio: var(--cover-ratio, 4 / 5);
  width: 100%;
  background:
    repeating-linear-gradient(var(--stripe-angle, 120deg),
      var(--stripe-bg, #ece6d6) 0 7px,
      var(--stripe-fg, #bdb29a) 7px 8px);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
}
/* Aspect-ratio modifiers — apply on .work__img to match the cover image */
.work__img--landscape { --cover-ratio: 3 / 2; }   /* 横版照片 */
.work__img--square    { --cover-ratio: 1 / 1; }   /* 方图 */
.work__img--tall      { --cover-ratio: 2 / 3; }   /* 更竖一些 */
/* Cover image: drop in an <img class="work__cover" src="..."> inside .work__img.
   To control how the image is cropped, set style="object-position: …" on the <img>.
   Common values: "center" (default), "top", "bottom", "left", "right",
   or two values like "center top" / "50% 30%". */
.work__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 600ms cubic-bezier(.2,.7,.2,1);
}
/* Opt-in: add class="work__cover work__cover--contain" to fit the whole image
   instead of cropping (will show paper background as letterbox). */
.work__cover--contain { object-fit: contain; background: var(--paper); }
.work:hover .work__cover,
.work:focus-visible .work__cover { transform: scale(1.04); }
/* Hide stripe label when a real cover image is present */
.work__img:has(.work__cover) .work__img-label { display: none; }
.work__img-label {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stripe-text, #5a513f);
  position: relative;
  z-index: 1;
}
.work__index {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 10px;
  opacity: 0.85;
  color: #3b362a;
  background: rgba(241,237,226,0.85);
  padding: 2px 6px;
  z-index: 2;
}

.work__meta { padding-top: 14px; padding-bottom: 8px; }
.work__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.work__title { font-size: 15px; letter-spacing: -0.005em; }
.work__year { font-size: 11px; opacity: 0.55; }
.work__sub { font-size: 11px; opacity: 0.55; margin-top: 4px; }

/* reveal on hover */
.work__reveal {
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  overflow: hidden;
  margin-top: 0;
  transition: max-height 320ms cubic-bezier(.2,.7,.2,1),
              opacity 260ms,
              transform 320ms,
              margin-top 320ms;
}
.work:hover .work__reveal,
.work:focus-visible .work__reveal {
  max-height: 100px;
  opacity: 1;
  transform: translateY(0);
  margin-top: 10px;
}
.work__reveal-inner {
  padding-top: 10px;
  border-top: 1px dashed rgba(38,36,30,0.25);
  font-size: 12px;
  line-height: 1.55;
  opacity: 0.78;
  text-wrap: pretty;
}

/* ─── Image stripe tones for work cards (cycle 1..4) ─── */
.tone-warm  { --stripe-bg: #ece6d6; --stripe-fg: #bdb29a; --stripe-text: #5a513f; }
.tone-paper { --stripe-bg: #eae5d8; --stripe-fg: #c0b8a4; --stripe-text: #4d4737; }
.tone-cool  { --stripe-bg: #e1ded2; --stripe-fg: #bdb9a8; --stripe-text: #5a574a; }
.tone-ink   { --stripe-bg: #2a2823; --stripe-fg: #3d3a33; --stripe-text: #9e978a; }

/* fade in */
body { animation: fadeIn 360ms ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ─────────────────────────────────────────────────────────────
   Responsive — tablet (≤ 1024px) and phone (≤ 720px)
   ───────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .shell { padding: 36px 36px 48px; }

  /* Identity becomes single column with smaller label */
  .identity { grid-template-columns: 130px 1fr; column-gap: 18px; }

  /* Folder & work grids drop to 2 columns */
  .folders { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 24px; }
  .works   { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; }

  /* Category title scales down */
  .cat-head__title { font-size: 52px; }
  .cat-head__zh    { font-size: 22px; margin-left: 12px; }
}

@media (max-width: 720px) {
  .shell { padding: 28px 22px 40px; }

  /* Meta + footer: hide middle item, tighten */
  .meta-bar > :nth-child(2),
  .footer-bar > :nth-child(2) { display: none; }
  .meta-bar, .footer-bar { font-size: 10px; }

  /* Identity becomes stacked: each label sits above its value */
  .identity {
    grid-template-columns: 1fr;
    row-gap: 4px;
    margin-top: 28px;
  }
  .identity .label { font-size: 11px; margin-top: 12px; }
  .identity .label:first-child { margin-top: 0; }
  .identity .label .dots { display: none; }
  .identity .value--big { font-size: 16px; }

  /* Folder & work grids: single column */
  .folders { grid-template-columns: 1fr; gap: 36px 0; margin-top: 28px; }
  .works   { grid-template-columns: 1fr; gap: 28px 0; }

  /* Folder card: a bit more compact */
  .folder { margin-top: 24px; }
  .folder__body { min-height: 180px; padding: 24px 20px 18px; }
  .folder__title { font-size: 26px; }

  /* Section heading: stack instead of justify */
  .section-head { flex-direction: column; gap: 4px; align-items: flex-start; }
  .section { margin-top: 48px; }

  /* Category head: stack title and meta */
  .cat-head { grid-template-columns: 1fr; gap: 16px; padding-bottom: 18px; }
  .cat-head__meta { text-align: left; }
  .cat-head__title { font-size: 40px; }
  .cat-head__zh { font-size: 18px; margin-left: 8px; }
  .cat-head__desc { font-size: 13px; }

  /* Work card: keep 4:5 portrait ratio on mobile too — cover image stays full-visible */
  .work__img { aspect-ratio: var(--cover-ratio, 4 / 5); }

  /* Footer: stack vertically */
  .footer-bar { flex-direction: column; gap: 6px; align-items: flex-start; margin-top: 40px; }
}
