/*
Theme Name: Handhook
Theme URI: https://lifeafter4.online
Author: Site owner
Description: A photo-first theme for a hand-made crochet pattern and project journal. Posts carry a yarn hang tag with the real hook, yarn and time details.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: handhook
*/

:root {
  --paper: #F3F5F2;
  --ink: #1B2340;
  --ink-soft: #4A5270;
  --raspberry: #B8265A;
  --raspberry-dark: #8F1D45;
  --marigold: #F2B632;
  --lake: #1E7F86;
  --white: #FFFFFF;
  --line: rgba(27, 35, 64, .18);
  --head: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --wrap: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--raspberry); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--raspberry-dark); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 99; font-family: var(--head); }
.skip:focus { left: 0; }

/* ---- stitch bands: rows of single-crochet "V" stitches ---- */
.stitch { height: 14px; background-repeat: repeat-x; background-size: 18px 14px; }
.stitch-rasp { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='14' viewBox='0 0 18 14'%3E%3Cpath d='M3 3l6 8 6-8' fill='none' stroke='%23B8265A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.stitch-gold { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='14' viewBox='0 0 18 14'%3E%3Cpath d='M3 3l6 8 6-8' fill='none' stroke='%23F2B632' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* ---- header ---- */
.site-header { background: var(--paper); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-block: 1.1rem; }
.logo { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--head); font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; line-height: 1; color: var(--ink); text-decoration: none; }
.logo:hover { color: var(--ink); }
.ball { width: 2rem; height: 2rem; flex: none; }

.nav .menu { display: flex; flex-wrap: wrap; gap: .4rem 1.75rem; list-style: none; margin: 0; padding: 0; }
.nav a { display: inline-block; padding: .3rem 0; font-family: var(--head); font-weight: 600; font-size: 1.02rem; color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent; }
.nav a:hover { color: var(--raspberry); }
.nav .current-menu-item > a, .nav .current_page_item > a { border-bottom-color: var(--marigold); }

.nav-toggle { display: none; font-family: var(--head); font-weight: 700; font-size: 1rem; background: none; color: var(--ink); border: 2px solid var(--ink); border-radius: 4px; padding: .45rem .9rem; cursor: pointer; }

/* ---- buttons ---- */
.btn { display: inline-block; background: var(--raspberry); color: var(--white); font-family: var(--head); font-weight: 700; font-size: 1.02rem; text-decoration: none; padding: .8rem 1.4rem; border-radius: 4px; transition: background-color .15s; }
.btn:hover { background: var(--raspberry-dark); color: var(--white); }

/* ---- hero ---- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(2rem, 6vw, 5rem); align-items: center; padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.hero h1 { font-family: var(--head); font-weight: 800; font-size: clamp(2.4rem, 5.4vw, 4.4rem); line-height: 1.02; letter-spacing: -.03em; margin: 0; text-wrap: balance; }
.hero-intro { font-size: 1.25rem; line-height: 1.5; color: var(--ink-soft); margin: 1.25rem 0 0; max-width: 32rem; }
.hero-latest { margin-top: 2.25rem; max-width: 26rem; }
.hero-latest h2 { font-family: var(--head); font-weight: 700; font-size: 1.6rem; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .25rem; }
.hero-latest h2 a { color: var(--ink); text-decoration: none; }
.hero-latest h2 a:hover { color: var(--raspberry); }
.hero-latest p { color: var(--ink-soft); margin: .5rem 0 0; }
.hero-latest .tag { margin-block: 1rem 1.5rem; }
.hero-latest .btn { margin-top: 1.25rem; }
.hero-empty { font-size: 1.25rem; color: var(--ink-soft); margin: 1.5rem 0 0; max-width: 26rem; }

/* The one loud thing: a photo with a stitched running-stitch frame */
.hero-photo, .post-photo img { display: block; }
.hero-photo { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 4px; outline: 2px dashed var(--ink); outline-offset: 9px; margin: 9px; }
.hero-photo img, .hero-photo .tile-blank { width: 100%; height: 100%; object-fit: cover; }

/* ---- hang tag ---- */
.tag { background: var(--white); border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; }
.tag-head { position: relative; background: var(--marigold); color: var(--ink); font-family: var(--head); font-weight: 700; font-size: 1rem; padding: .7rem 1rem .6rem 2.5rem; border-bottom: 2px solid var(--ink); }
.tag-head::before { content: ""; position: absolute; left: .9rem; top: 50%; width: .8rem; height: .8rem; margin-top: -.4rem; background: var(--paper); border: 2px solid var(--ink); border-radius: 50%; }
.tag-rows { margin: 0; padding: .35rem 0; }
.tag-rows > div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .75rem; padding: .5rem 1rem; border-bottom: 1px dotted var(--line); }
.tag-rows > div:last-child { border-bottom: 0; }
.tag-rows dt { font-family: var(--head); font-weight: 500; font-size: .92rem; color: var(--ink-soft); padding-top: .12rem; }
.tag-rows dd { margin: 0; font-weight: 600; font-size: 1.02rem; line-height: 1.4; overflow-wrap: anywhere; }

/* ---- page heads ---- */
.page-head, .post-head { padding-top: clamp(2.25rem, 5vw, 3.75rem); padding-bottom: 1.25rem; }
.page-head h1, .post-head h1 { font-family: var(--head); font-weight: 800; font-size: clamp(2.1rem, 4.8vw, 3.6rem); line-height: 1.05; letter-spacing: -.028em; margin: 0; max-width: 24ch; text-wrap: balance; }
.page-lede { font-size: 1.25rem; line-height: 1.55; color: var(--ink-soft); max-width: 40rem; margin: 1rem 0 0; }
.page-lede p { margin: 0; }
.byline { font-family: var(--head); font-weight: 500; font-size: .98rem; color: var(--ink-soft); margin: 1rem 0 0; }

/* ---- post layout ---- */
.post-grid { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; grid-template-rows: auto 1fr; grid-template-areas: "photo tag" "body tag"; column-gap: clamp(2rem, 5vw, 3.5rem); padding-block: 1.5rem 3rem; }
.post-grid.no-tag { grid-template-columns: minmax(0, 46rem); grid-template-areas: "photo" "body"; grid-template-rows: auto; }
.post-photo { grid-area: photo; margin: 9px 9px 2.25rem; }
.post-photo img { width: 100%; border-radius: 4px; outline: 2px dashed var(--ink); outline-offset: 9px; }
.post-photo figcaption { margin-top: 1.25rem; font-family: var(--head); font-size: .92rem; color: var(--ink-soft); }
.post-tag { grid-area: tag; align-self: start; position: sticky; top: 1.5rem; margin-top: 9px; }
.post-body { grid-area: body; }
.post-end { padding-bottom: 1rem; }

/* ---- prose ---- */
.prose { max-width: 38rem; font-size: 1.1875rem; line-height: 1.72; }
.prose > *:first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.2em; }
.prose h2 { font-family: var(--head); font-weight: 700; font-size: 1.75rem; line-height: 1.15; letter-spacing: -.015em; margin: 2.2em 0 .6em; }
.prose h3 { font-family: var(--head); font-weight: 700; font-size: 1.3rem; line-height: 1.2; margin: 1.9em 0 .5em; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--raspberry); font-weight: 600; }
.prose blockquote { margin: 1.8em 0; padding: .1em 0 .1em 1.25rem; border-left: 4px solid var(--marigold); font-style: italic; }
.prose figure { margin: 2rem 0; }
.prose figcaption { margin-top: .6rem; font-family: var(--head); font-size: .92rem; color: var(--ink-soft); }
.prose img { border-radius: 3px; }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--head); font-size: .98rem; margin: 1.6em 0; }
.prose th, .prose td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 700; border-bottom: 2px solid var(--ink); }
.prose hr { border: 0; height: 14px; margin: 2.5rem 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='14' viewBox='0 0 18 14'%3E%3Cpath d='M3 3l6 8 6-8' fill='none' stroke='%23B8265A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") repeat-x; }
.alignwide { max-width: none; }
.aligncenter { margin-inline: auto; }

/* ---- tiles ---- */
.block { padding-block: clamp(2rem, 4vw, 3.25rem); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.block-head h2 { font-family: var(--head); font-weight: 700; font-size: 1.8rem; letter-spacing: -.015em; line-height: 1.1; margin: 0; }
.block-head a { font-family: var(--head); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 2.5rem 1.75rem; }
.tile { display: block; color: var(--ink); text-decoration: none; }
.tile-img { display: block; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 4px; background: var(--line); }
.tile-img img { width: 100%; height: 100%; object-fit: cover; }
.tile-title { display: block; margin-top: .85rem; font-family: var(--head); font-weight: 700; font-size: 1.2rem; line-height: 1.2; letter-spacing: -.01em; }
.tile-note { display: block; margin-top: .3rem; font-size: 1rem; line-height: 1.45; color: var(--ink-soft); }
.tile:hover .tile-title { color: var(--raspberry); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }

.tile-blank { display: block; width: 100%; height: 100%; background-size: 22px 18px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='18' viewBox='0 0 22 18'%3E%3Cpath d='M4 4l7 10 7-10' fill='none' stroke='%23000' stroke-opacity='.16' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.c0 { background-color: var(--marigold); }
.c1 { background-color: var(--lake); }
.c2 { background-color: var(--raspberry); }
.c3 { background-color: var(--ink-soft); }

.empty { color: var(--ink-soft); font-size: 1.15rem; }

/* ---- maker ---- */
.maker { display: flex; gap: 1.5rem; align-items: flex-start; margin-top: 1rem; padding-top: 2rem; border-top: 2px dashed var(--ink); max-width: 46rem; }
.maker-img { flex: none; width: 6.5rem; }
.maker-photo { width: 6.5rem; height: 6.5rem; object-fit: cover; border-radius: 4px; }
.maker h2 { font-family: var(--head); font-weight: 700; font-size: 1.35rem; margin: 0 0 .3rem; }
.maker p { margin: 0 0 .6rem; font-size: 1.05rem; line-height: 1.55; }
.maker-wide { max-width: none; background: var(--white); border: 2px solid var(--ink); border-radius: 8px; padding: clamp(1.25rem, 3vw, 2rem); margin-top: 0; }
.maker-wide .maker-img, .maker-wide .maker-photo { width: 8rem; }
.maker-wide .maker-photo { height: 8rem; }

/* ---- pagination, search ---- */
.nav-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2.5rem; font-family: var(--head); font-weight: 600; }
.nav-links .page-numbers { padding: .4rem .85rem; border: 2px solid var(--ink); border-radius: 4px; color: var(--ink); text-decoration: none; }
.nav-links .page-numbers.current { background: var(--ink); color: var(--paper); }
.nav-links a.page-numbers:hover { border-color: var(--raspberry); color: var(--raspberry); }
.search-form { display: flex; gap: .5rem; max-width: 26rem; margin-bottom: 1.5rem; }
.search-form label { flex: 1; }
.search-field { width: 100%; font: inherit; padding: .6rem .8rem; border: 2px solid var(--ink); border-radius: 4px; background: var(--white); }
.search-submit { font-family: var(--head); font-weight: 700; font-size: 1rem; padding: .6rem 1.1rem; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: 4px; cursor: pointer; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- footer ---- */
.site-footer { margin-top: 3rem; background: var(--ink); color: var(--paper); }
.foot { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem; padding-block: 2.5rem 1.5rem; }
.foot-name { font-family: var(--head); font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; line-height: 1.1; margin: 0 0 .5rem; }
.foot-about p { margin: 0; color: rgba(243, 245, 242, .8); max-width: 28rem; }
.foot-about .foot-name { color: var(--paper); }
.foot-nav .menu { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.foot-nav a { font-family: var(--head); font-weight: 500; color: var(--paper); text-decoration: none; }
.foot-nav a:hover { color: var(--marigold); text-decoration: underline; }
.foot-base { border-top: 1px solid rgba(243, 245, 242, .2); padding-block: 1.1rem 1.6rem; }
.foot-base p { margin: 0; font-family: var(--head); font-size: .92rem; color: rgba(243, 245, 242, .75); }
.site-footer :focus-visible { outline-color: var(--marigold); }

/* ---- small screens ---- */
@media (max-width: 52rem) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-photo { order: -1; }
  .post-grid, .post-grid.no-tag { grid-template-columns: minmax(0, 1fr); grid-template-areas: "photo" "tag" "body"; grid-template-rows: auto; }
  .post-tag { position: static; margin: 0 0 2rem; }
  .foot { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 40rem) {
  .nav-toggle { display: inline-block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 2px solid var(--ink); padding: .5rem clamp(1rem, 4vw, 2rem) 1rem; z-index: 20; }
  .nav.open { display: block; }
  .nav .menu { flex-direction: column; gap: .2rem; }
  .site-header { position: relative; }
  .maker { flex-direction: column; }
  .block-head { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1rem; }
  .tile-title { font-size: 1.05rem; }
  .tile-note { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
