/*
Theme Name: Srijidh
Theme URI: https://srijidhmadhavan.com
Author: Srijidh Madhavan
Author URI: https://srijidhmadhavan.com
Description: Personal block theme for srijidhmadhavan.com. Notes from 15 years of building a business in India.
Version: 1.1.0
Requires at least: 6.6
Tested up to: 6.9
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: srijidh
*/

/* Small touches theme.json can't express. Kept deliberately tiny. */

html { scroll-behavior: smooth; }

::selection { background: var(--wp--preset--color--laterite-tint); }

.screen-reader-text:focus,
.skip-link:focus {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
	padding: 0.5rem 1rem;
	z-index: 1000;
}

/* Header */
.sm-header { border-bottom: 1px solid var(--wp--preset--color--line); }

/* Gentle fade on load, respects reduced motion */
@media (prefers-reduced-motion: no-preference) {
	.sm-fade { animation: sm-fade 500ms ease both; }
	.sm-fade-2 { animation-delay: 120ms; }
	.sm-fade-3 { animation-delay: 240ms; }
	@keyframes sm-fade {
		from { opacity: 0; transform: translateY(6px); }
		to { opacity: 1; transform: none; }
	}
}
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
}

/* Eyebrow labels above sections */
.sm-eyebrow {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--stone);
	font-weight: 500;
}

/* Outline button style */
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--ink);
	border: 1px solid var(--wp--preset--color--ink);
}
.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}

/* Topic list: quiet rows with an arrow */
.sm-topics { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--wp--preset--color--line); }
.sm-topics li { border-bottom: 1px solid var(--wp--preset--color--line); }
.sm-topics a {
	display: grid; grid-template-columns: 1fr auto; column-gap: 1rem; row-gap: 0.15rem; align-items: center;
	padding: 1rem 0; text-decoration: none; color: var(--wp--preset--color--ink);
	transition: color var(--wp--custom--transition), padding var(--wp--custom--transition);
}
.sm-topics a span { color: var(--wp--preset--color--stone); font-size: var(--wp--preset--font-size--small); }
.sm-topics a::after { content: "\2192"; color: var(--wp--preset--color--laterite); grid-column: 2; grid-row: 1 / span 2; }
.sm-topics strong, .sm-topics a span { grid-column: 1; }
.sm-topics a:hover { color: var(--wp--preset--color--laterite); padding-left: 0.25rem; }
.sm-topics strong { font-family: var(--wp--preset--font-family--serif); font-weight: 500; font-size: var(--wp--preset--font-size--large); }

/* Post list rows */
.sm-post-list .wp-block-post { border-bottom: 1px solid var(--wp--preset--color--line); padding-bottom: 1.5rem; }
.sm-post-list .wp-block-post:last-child { border-bottom: 0; }

/* Callout: "What I'd do now" */
.sm-callout { border-radius: var(--wp--custom--radius); }

/* Forms */
.sm-form { display: grid; gap: 1rem; }
.sm-form label { display: block; font-size: var(--wp--preset--font-size--small); font-weight: 500; margin-bottom: 0.35rem; }
.sm-form input[type="text"],
.sm-form input[type="email"],
.sm-form select,
.sm-form textarea {
	width: 100%; box-sizing: border-box;
	font: inherit; color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--white);
	border: 1px solid #CFC6BA; border-radius: var(--wp--custom--radius);
	padding: 0.7rem 0.85rem;
}
.sm-form input:focus, .sm-form select:focus, .sm-form textarea:focus {
	outline: 2px solid var(--wp--preset--color--laterite); outline-offset: 1px; border-color: transparent;
}
.sm-form textarea { min-height: 140px; resize: vertical; }
.sm-form button {
	justify-self: start; cursor: pointer; font: inherit; font-size: 1rem; font-weight: 500;
	background: var(--wp--preset--color--laterite); color: #fff;
	border: 0; border-radius: var(--wp--custom--radius); padding: 0.75rem 1.25rem;
	transition: background var(--wp--custom--transition);
}
.sm-form button:hover { background: var(--wp--preset--color--laterite-dark); }
.sm-form > div { position: relative; }
.sm-form .sm-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sm-form-inline { grid-template-columns: 1fr auto; align-items: end; }
@media (max-width: 520px) { .sm-form-inline { grid-template-columns: 1fr; } }
.sm-notice {
	padding: 0.85rem 1rem; border-radius: var(--wp--custom--radius);
	background: var(--wp--preset--color--laterite-tint); margin-bottom: 1rem;
}
.sm-notice.is-error { background: #FBE3E0; }
.sm-cal-embed { width: 100%; min-height: 640px; border: 0; border-radius: var(--wp--custom--radius); background: var(--wp--preset--color--white); }

/* Video embeds keep their ratio */
.wp-block-embed.is-type-video iframe { border-radius: var(--wp--custom--radius); }

/* Topics: two columns on wider screens */
@media (min-width: 720px) {
	.sm-topics { display: grid; grid-template-columns: 1fr 1fr; column-gap: 2.5rem; border-top: 0; }
	.sm-topics li:nth-child(-n+2) { border-top: 1px solid var(--wp--preset--color--line); }
}

/* Compact post list: title and date on one line */
.sm-post-list-compact .wp-block-post { border-bottom: 1px solid var(--wp--preset--color--line); padding: 0.85rem 0; }
.sm-post-list-compact .wp-block-post:first-child { border-top: 1px solid var(--wp--preset--color--line); }
.sm-post-list-compact .wp-block-post-title { margin: 0; }
.sm-post-list-compact .wp-block-post-date { flex-shrink: 0; }

/* Footer columns */
.sm-footer-cols .wp-block-button__link { font-size: 0.9375rem; padding: 0.6rem 1rem; }
.sm-footer-cols p { margin-top: 0.5rem; margin-bottom: 0; font-size: var(--wp--preset--font-size--small); }
.sm-footer-cols .sm-form { margin-top: 0.75rem; gap: 0.6rem; }
.sm-footer-cols .sm-form input[type="email"] { padding: 0.6rem 0.75rem; }
.sm-footer-cols .sm-form button { padding: 0.6rem 1rem; font-size: 0.9375rem; }
.sm-footer-cols .wp-block-buttons { margin-top: 0.75rem; }

.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important;
}

/* ------------------------------------------------------------------
   Notebook layer: ruled paper, a margin line, handwritten notes,
   highlighter marks and sticky notes. Kept light so reading comes first.
   ------------------------------------------------------------------ */

body {
	background-image: repeating-linear-gradient(
		to bottom,
		transparent 0,
		transparent 35px,
		rgba(107, 98, 89, 0.09) 35px,
		rgba(107, 98, 89, 0.09) 36px
	);
	background-attachment: local;
}

/* The red margin line of an exercise book, beside the reading column */
main.wp-block-group { position: relative; }
main.wp-block-group::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: max(0.4rem, calc(50% - 340px - 2.4rem));
	width: 3px;
	border-left: 1px solid rgba(180, 83, 42, 0.55);
	border-right: 1px solid rgba(180, 83, 42, 0.35);
	pointer-events: none;
}
@media (max-width: 760px) {
	main.wp-block-group::before { left: 0.4rem; }
}

/* Handwriting */
.sm-hand,
.sm-eyebrow {
	font-family: var(--wp--preset--font-family--hand);
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
	color: var(--wp--preset--color--laterite);
}
.sm-eyebrow {
	font-size: 1.15rem;
	line-height: 1.3;
	display: inline-block;
	transform: rotate(-1deg);
	transform-origin: left center;
}
.sm-kicker {
	font-size: 1.5rem;
	margin-bottom: -0.5rem;
	transform: rotate(-2deg);
	transform-origin: left center;
}
.wp-block-post-terms.sm-eyebrow a { color: inherit; text-decoration: none; }

/* Highlighter */
.sm-hl {
	background-image: linear-gradient(
		100deg,
		rgba(180, 83, 42, 0) 0.5%,
		rgba(180, 83, 42, 0.18) 2%,
		rgba(180, 83, 42, 0.14) 96%,
		rgba(180, 83, 42, 0) 99%
	);
	background-size: 100% 42%;
	background-position: 0 88%;
	background-repeat: no-repeat;
	padding: 0 0.08em;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

/* Topics as a contents page: numbered entries */
.sm-topics { counter-reset: sm-topic; }
.sm-topics a { grid-template-columns: 2rem 1fr auto; }
.sm-topics a::before {
	counter-increment: sm-topic;
	content: counter(sm-topic, decimal-leading-zero);
	font-family: var(--wp--preset--font-family--hand);
	font-size: 1.25rem;
	color: var(--wp--preset--color--laterite);
	grid-column: 1;
	grid-row: 1 / span 2;
	align-self: center;
}
.sm-topics strong, .sm-topics a span { grid-column: 2; }
.sm-topics a::after { grid-column: 3; }

/* Journal dates */
.sm-post-list-compact .wp-block-post-date {
	font-family: var(--wp--preset--font-family--hand);
	font-size: 1.05rem;
	color: var(--wp--preset--color--stone);
}

/* Sticky notes with a strip of tape */
.sm-note {
	position: relative;
	box-shadow: 0 1px 0 rgba(31, 27, 22, 0.04), 0 10px 22px -12px rgba(31, 27, 22, 0.28);
	transform: rotate(-0.6deg);
	border-radius: 2px !important;
}
.sm-note::before {
	content: "";
	position: absolute;
	top: -11px;
	left: 50%;
	width: 96px;
	height: 22px;
	transform: translateX(-50%) rotate(-3deg);
	background: rgba(255, 255, 255, 0.55);
	border: 1px solid rgba(31, 27, 22, 0.06);
	box-shadow: 0 1px 2px rgba(31, 27, 22, 0.06);
}
.sm-note .sm-eyebrow { transform: none; }
@media (prefers-reduced-motion: no-preference) {
	.sm-note { transition: transform var(--wp--custom--transition); }
	.sm-note:hover { transform: rotate(0deg); }
}

/* Single post: notebook-style section headings */
.wp-block-post-content h2 {
	background-image: linear-gradient(rgba(180, 83, 42, 0.16), rgba(180, 83, 42, 0.16));
	background-size: 2.5rem 0.35em;
	background-position: 0 88%;
	background-repeat: no-repeat;
}
.wp-block-post-content .sm-callout h2,
.sm-callout h2 {
	background: none;
	font-family: var(--wp--preset--font-family--hand);
	font-weight: 400;
	color: var(--wp--preset--color--laterite);
	font-size: 1.6rem;
}
.sm-footer-cols p.sm-eyebrow { font-size: 1.15rem; }

/* Long reads: ruled lines fade right back so they don't compete with the text */
body.single {
	background-image: repeating-linear-gradient(
		to bottom,
		transparent 0,
		transparent 35px,
		rgba(107, 98, 89, 0.035) 35px,
		rgba(107, 98, 89, 0.035) 36px
	);
}

/* Tables in posts */
.wp-block-table { margin: 1.75rem 0; overflow-x: auto; }
.wp-block-table table { border-collapse: collapse; width: 100%; font-size: 0.86em; line-height: 1.45; }
.wp-block-table th,
.wp-block-table td { border: 0; border-bottom: 1px solid var(--wp--preset--color--line, #E7E0D6); padding: 0.6em 0.75em; text-align: left; vertical-align: top; }
.wp-block-table thead th { background: var(--wp--preset--color--laterite-tint, #F4E6DC); border-bottom: 2px solid var(--wp--preset--color--laterite, #B4532A); font-weight: 600; }
.wp-block-table tbody td:first-child { font-weight: 600; }
@media (max-width: 640px) { .wp-block-table table { min-width: 560px; } }
