/*
Theme Name: Thadam
Theme URI: https://ketheeswaransugesan.com
Author: Ke. Sugesan
Description: Tamil-first theme for short weekly articles on electronics, sound engineering and PA service. Circuit-board green masthead with a signal trace, Tamil dates and labels, WhatsApp sharing, link previews for WhatsApp and Facebook.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: thadam
Tags: blog, one-column, custom-logo, editor-style, featured-images, threaded-comments
*/

/* ---------- Tokens ---------- */
:root {
	--solder: #134a3b;
	--solder-deep: #0c3529;
	--silk: #f3f7f2;
	--silk-dim: #c0d4c8;
	--gold: #d9a634;
	--ink: #1b2420;
	--ink-2: #4a5853;
	--paper: #ffffff;
	--mist: #eef3ef;
	--rule: #d6e0d9;
	--link: #0e6a51;

	/* resistor colour code: 1 brown, 2 red, 3 orange, 4 yellow, 5 green, 6 blue, 7 violet, 8 grey */
	--band-1: #7b4a2a;
	--band-2: #c2342c;
	--band-3: #e57a1c;
	--band-4: #e0b416;
	--band-5: #2f8a4c;
	--band-6: #2a62b0;
	--band-7: #74489d;
	--band-8: #868c89;

	--display: "Thadam Display", "Nirmala UI", "Latha", sans-serif;
	--text: "Thadam Text", "Nirmala UI", "Latha", sans-serif;

	--wrap: 1120px;
	--narrow: 680px;
	--wide: 860px;
	--gutter: clamp(16px, 4vw, 32px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--text);
	font-size: 17px;
	line-height: 1.8;
	text-rendering: optimizeLegibility;
}
@media (min-width: 700px) { body { font-size: 18px; } }
img, video { max-width: 100%; height: auto; }
img { display: block; }
a { color: var(--link); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 2px; }
.masthead :focus-visible, .site-foot :focus-visible, .search-panel :focus-visible { outline-color: var(--gold); }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-wide { max-width: calc(var(--wide) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0;
	position: absolute !important; word-wrap: normal !important;
}
.skip-link {
	position: absolute; left: 12px; top: -60px; z-index: 100;
	background: var(--gold); color: var(--ink); padding: 8px 16px; border-radius: 6px;
	font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Masthead ---------- */
.masthead {
	background-color: var(--solder);
	color: var(--silk);
	padding-top: clamp(22px, 4vw, 40px);
	padding-bottom: 6px;
}
.masthead__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 14px 40px;
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand .custom-logo { width: auto; max-height: 64px; }
.brand__name {
	margin: 0;
	font-family: var(--display);
	font-stretch: 75%;
	font-weight: 700;
	font-size: clamp(38px, 7vw, 64px);
	line-height: 1.15;
}
.brand__name a { color: inherit; text-decoration: none; }
.brand__tagline {
	margin: 6px 0 0;
	color: var(--silk-dim);
	font-size: 15px;
	line-height: 1.6;
	max-width: 34em;
}

.topnav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 24px; }
.topnav a {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 8px 0 6px;
	color: var(--silk);
	text-decoration: none;
	font-family: var(--display);
	font-stretch: 90%;
	font-weight: 600;
	font-size: 17px;
	line-height: 1.4;
	border-bottom: 3px solid transparent;
}
.topnav a:hover { border-bottom-color: rgba(217, 166, 52, .55); }
.topnav .is-current > a,
.topnav .current-menu-item > a { border-bottom-color: var(--gold); }
.topnav svg { width: 18px; height: 18px; flex: none; }

@media (max-width: 759px) {
	.topnav {
		flex: 1 0 100%;
		margin-inline: calc(-1 * var(--gutter));
		padding-inline: var(--gutter);
		overflow-x: auto;
		scrollbar-width: none;
	}
	.topnav::-webkit-scrollbar { display: none; }
	.topnav__list { flex-wrap: nowrap; white-space: nowrap; gap: 0 22px; }
}

/* the signal trace: an analog burst and a digital pulse train, pad to pad */
.trace { position: relative; height: 44px; margin: clamp(10px, 2.4vw, 22px) 0 10px; }
.trace svg { display: block; width: 100%; height: 100%; overflow: visible; }
.trace path {
	fill: none;
	stroke: var(--gold);
	stroke-width: 2;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
}
.trace::before, .trace::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 15px; height: 15px;
	margin-top: -7.5px;
	border-radius: 50%;
	border: 4px solid var(--gold);
	background: var(--solder);
}
.trace::before { left: -7px; }
.trace::after { right: -7px; background: var(--gold); }

@media (prefers-reduced-motion: no-preference) {
	.home .trace svg { animation: trace-draw 1.7s cubic-bezier(.35, .6, .3, 1) .2s both; }
	.home .trace::after { animation: pad-light .4s ease-out 1.85s both; }
}
@keyframes trace-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes pad-light {
	from { background: var(--solder); box-shadow: 0 0 0 0 rgba(217, 166, 52, 0); }
	60% { box-shadow: 0 0 0 7px rgba(217, 166, 52, .28); }
	to { background: var(--gold); box-shadow: 0 0 0 0 rgba(217, 166, 52, 0); }
}

.masthead--compact { padding-top: clamp(16px, 3vw, 26px); }
.masthead--compact .brand__name { font-size: clamp(30px, 5vw, 42px); }
.masthead--compact .trace { height: 30px; margin-top: 10px; }
@media (max-width: 759px) { .masthead--compact .brand__tagline { display: none; } }

.search-panel { background: var(--solder-deep); padding: 18px 0; }
.search-panel[hidden] { display: none; }

/* ---------- Shared pieces ---------- */
.site-main { padding: clamp(28px, 5vw, 56px) 0 clamp(48px, 7vw, 80px); }

.meta {
	display: flex; flex-wrap: wrap; align-items: center;
	gap: 4px 18px;
	font-size: 15px; line-height: 1.5;
	color: var(--ink-2);
}
.cat { display: inline-flex; align-items: center; color: var(--ink); font-weight: 600; text-decoration: none; }
a.cat:hover { text-decoration: underline; text-underline-offset: 4px; }
.no { font-family: var(--display); font-stretch: 90%; font-weight: 600; }
.fresh {
	padding: 1px 10px;
	border-radius: 999px;
	background: #fbeccb;
	color: #6a4806;
	font-size: 14px;
	font-weight: 600;
}

/* a tiny resistor whose band is the category colour */
.band {
	position: relative;
	display: inline-block;
	flex: none;
	width: 30px; height: 11px;
	margin-right: 9px;
	background: linear-gradient(#8f9592, #8f9592) center / 100% 1.5px no-repeat;
}
.band::before {
	content: "";
	position: absolute;
	inset: 0 5px;
	border-radius: 4px;
	background: linear-gradient(90deg, #e9d8b2 0 32%, var(--band, var(--band-8)) 32% 58%, #e9d8b2 58%);
}
.band--lg { width: 46px; height: 16px; margin-right: 14px; }
.band--lg::before { inset: 0 8px; border-radius: 6px; }

.byline { display: flex; flex-wrap: wrap; gap: 2px 18px; margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.6; }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 46px;
	padding: 8px 18px;
	border: 1.5px solid var(--rule);
	border-radius: 999px;
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	cursor: pointer;
}
.btn:hover { border-color: var(--ink-2); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--solid { background: var(--solder); border-color: var(--solder); color: var(--silk); }
.btn--solid:hover { background: var(--solder-deep); border-color: var(--solder-deep); }
.btn.is-done { border-color: var(--link); color: var(--link); }

.search-form { display: flex; gap: 8px; max-width: 560px; }
.search-form__field {
	flex: 1; min-width: 0;
	min-height: 46px;
	padding: 8px 18px;
	border: 1.5px solid var(--rule);
	border-radius: 999px;
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	font-size: 16px;
}
.search-form__field::placeholder { color: #6f7c77; }

/* ---------- Home: latest article ---------- */
.lead {
	display: grid;
	gap: 18px 44px;
	align-items: center;
	margin-bottom: clamp(40px, 6vw, 64px);
}
@media (min-width: 900px) { .lead.has-post-thumbnail { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.lead__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--mist); }
.lead__title {
	margin: 10px 0 12px;
	font-family: var(--display);
	font-stretch: 80%;
	font-weight: 700;
	font-size: clamp(28px, 4vw, 42px);
	line-height: 1.32;
}
.lead:not(.has-post-thumbnail) { max-width: 760px; }
.lead:not(.has-post-thumbnail) .lead__title { font-size: clamp(32px, 5vw, 52px); }
.lead__title a, .row__title a { color: var(--ink); text-decoration: none; }
.lead__title a:hover, .row:hover .row__title a {
	text-decoration: underline;
	text-decoration-color: var(--gold);
	text-decoration-thickness: 3px;
	text-underline-offset: 6px;
}
.lead__excerpt { margin: 0 0 12px; color: var(--ink-2); }
.lead .byline { margin-bottom: 20px; }

.section-title {
	margin: 0 0 4px;
	font-family: var(--display);
	font-stretch: 85%;
	font-weight: 700;
	font-size: 22px;
	line-height: 1.4;
}

/* ---------- Article list ---------- */
.log { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 52px; }
@media (min-width: 1000px) { .log--two { grid-template-columns: 1fr 1fr; } }
.row {
	position: relative;
	display: grid;
	gap: 16px;
	padding: 20px 0 22px;
	border-top: 1px solid var(--rule);
}
.row.has-post-thumbnail { grid-template-columns: 96px minmax(0, 1fr); }
@media (min-width: 700px) { .row.has-post-thumbnail { grid-template-columns: 172px minmax(0, 1fr); gap: 24px; } }
.row__thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; background: var(--mist); }
.row__title {
	margin: 4px 0 6px;
	font-family: var(--display);
	font-stretch: 85%;
	font-weight: 600;
	font-size: clamp(19px, 2.3vw, 23px);
	line-height: 1.42;
}
.row__title a::after { content: ""; position: absolute; inset: 0; }
.row__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0 0 6px;
	color: var(--ink-2);
	font-size: 16px;
	line-height: 1.7;
}
@media (max-width: 599px) { .row__excerpt { display: none; } .row .meta { font-size: 14px; } }
.row .byline { font-size: 14px; }

.posts-nav .nav-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--rule); }
.posts-nav a {
	display: inline-flex; align-items: center; min-height: 46px; padding: 8px 18px;
	border: 1.5px solid var(--rule); border-radius: 999px;
	color: var(--ink); font-weight: 600; text-decoration: none;
}
.posts-nav a:hover { border-color: var(--ink-2); }
.posts-nav .nav-next { margin-left: auto; }

/* ---------- Archive and search headers ---------- */
.archive-head { max-width: 760px; margin-bottom: 26px; }
.archive-head h1 {
	display: flex; align-items: center; flex-wrap: wrap;
	margin: 0 0 6px;
	font-family: var(--display);
	font-stretch: 80%;
	font-weight: 700;
	font-size: clamp(28px, 4.5vw, 40px);
	line-height: 1.3;
}
.archive-head p { margin: 0 0 6px; color: var(--ink-2); }
.archive-head .search-form { margin: 14px 0 6px; }

.empty { max-width: 640px; padding: 8px 0 24px; }
.empty h2 { font-family: var(--display); font-stretch: 85%; font-weight: 700; font-size: 26px; line-height: 1.4; margin: 0 0 8px; }
.empty p { color: var(--ink-2); margin: 0 0 18px; }
.empty .search-form { margin-bottom: 22px; }

/* ---------- Single article ---------- */
.article__head { margin-bottom: 28px; }
.article__title {
	margin: 12px 0 14px;
	font-family: var(--display);
	font-stretch: 80%;
	font-weight: 700;
	font-size: clamp(30px, 5vw, 48px);
	line-height: 1.3;
}
.article__dek { margin: 0 0 14px; color: var(--ink-2); font-size: clamp(18px, 2.2vw, 21px); line-height: 1.7; }
.article__image { margin: 0 auto 34px; }
.article__image img { width: 100%; border-radius: 6px; }
.article__image figcaption { margin-top: 8px; color: var(--ink-2); font-size: 15px; line-height: 1.6; }

.article__foot { margin-top: 44px; }
.share { padding-top: 28px; border-top: 1px solid var(--rule); }
.share__label { margin: 0 0 10px; font-family: var(--display); font-stretch: 90%; font-weight: 600; font-size: 18px; }
.share__buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; font-size: 15px; }
.tags a { padding: 2px 12px; border-radius: 999px; background: var(--mist); color: var(--ink); text-decoration: none; }
.tags a:hover { text-decoration: underline; }

.ask { margin-top: 28px; padding: 20px 22px 22px; border-radius: 8px; background: var(--mist); }
.ask .ask__title { margin: 0 0 4px; color: var(--ink); font-family: var(--display); font-stretch: 85%; font-weight: 700; font-size: 20px; line-height: 1.45; }
.ask p { margin: 0 0 14px; color: var(--ink-2); font-size: 16px; line-height: 1.7; }

.post-nav { max-width: calc(var(--narrow) + 2 * var(--gutter)); margin: 40px auto 0; padding-inline: var(--gutter); }
.post-nav .nav-links { display: grid; gap: 12px; }
@media (min-width: 700px) { .post-nav .nav-links { grid-template-columns: 1fr 1fr; } .post-nav .nav-next { grid-column: 2; text-align: right; } }
.post-nav a {
	display: block; height: 100%;
	padding: 14px 18px 16px;
	border: 1.5px solid var(--rule);
	border-radius: 8px;
	color: var(--ink);
	text-decoration: none;
}
.post-nav a:hover { border-color: var(--ink-2); }
.nav-label { display: block; color: var(--ink-2); font-size: 14px; }
.nav-title { display: block; font-family: var(--display); font-stretch: 88%; font-weight: 600; font-size: 18px; line-height: 1.45; }

.page-body .article__title { margin-top: 0; }

/* ---------- Comments ---------- */
.comments { margin-top: 48px; }
.comments__title, .comment-reply-title {
	margin: 0 0 14px;
	font-family: var(--display); font-stretch: 85%; font-weight: 700; font-size: 22px; line-height: 1.4;
}
.comment-list, .comment-list .children { list-style: none; margin: 0; padding: 0; }
.comment-list .children { margin-left: clamp(16px, 4vw, 40px); }
.comment-body { padding: 16px 0; border-top: 1px solid var(--rule); }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 15px; }
.comment-head img { border-radius: 50%; }
.comment-head time { color: var(--ink-2); }
.comment-text p { margin: 8px 0; font-size: 16px; }
.comment-wait { margin: 8px 0 0; color: #6a4806; font-size: 15px; }
.comment-reply-link { font-size: 15px; font-weight: 600; }
.comment-respond { margin-top: 24px; }
.comment-form p { margin: 0 0 14px; }
.comment-form label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.comment-form .comment-form-cookies-consent { display: flex; gap: 8px; align-items: flex-start; }
.comment-form .comment-form-cookies-consent label { font-weight: 400; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form textarea {
	width: 100%; padding: 10px 14px;
	border: 1.5px solid var(--rule); border-radius: 8px;
	font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
}
.comment-form .submit {
	min-height: 46px; padding: 8px 20px; border: 0; border-radius: 999px;
	background: var(--solder); color: var(--silk); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.comment-notes, .logged-in-as { color: var(--ink-2); font-size: 15px; }

/* ---------- Footer ---------- */
.site-foot { background: var(--solder-deep); color: var(--silk); padding: 48px 0 24px; }
.site-foot a { color: var(--silk); }
.site-foot__inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 34px; }
@media (min-width: 800px) { .site-foot__inner { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 60px; } }
.site-foot__about .site-foot__name { margin: 0 0 8px; color: var(--silk); font-family: var(--display); font-stretch: 80%; font-weight: 700; font-size: 28px; line-height: 1.3; }
.site-foot__about p { max-width: 40em; color: var(--silk-dim); font-size: 16px; line-height: 1.75; }
.site-foot .btn--solid { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.site-foot .btn--solid:hover { background: #e7b84b; border-color: #e7b84b; }
.site-foot__head { margin: 0 0 6px; font-family: var(--display); font-stretch: 90%; font-weight: 600; font-size: 18px; }
.site-foot__cats ul { list-style: none; margin: 0 0 20px; padding: 0; }
.site-foot__cats a { display: inline-flex; align-items: center; padding: 5px 0; text-decoration: none; font-size: 16px; }
.site-foot__cats a:hover { text-decoration: underline; }
.site-foot__cats .count { margin-left: 8px; color: var(--silk-dim); font-size: 14px; }
.site-foot .search-form__field { border-color: transparent; }
.site-foot__base {
	display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px;
	margin-top: 38px; padding-top: 18px;
	border-top: 1px solid rgba(243, 247, 242, .14);
	color: var(--silk-dim); font-size: 14px;
}
.site-foot__base p { margin: 0; }

/* ---------- WordPress core classes ---------- */
.alignleft { float: left; margin: .3em 1.4em 1em 0; }
.alignright { float: right; margin: .3em 0 1em 1.4em; }
.aligncenter { margin-inline: auto; }
.wp-caption { max-width: 100%; }
.wp-caption-text, .gallery-caption { color: var(--ink-2); font-size: 15px; }
.sticky .row__title::before { content: ""; }
.bypostauthor > .comment-body .comment-author::after { content: " (ஆசிரியர்)"; font-weight: 400; color: var(--ink-2); }
@media (max-width: 599px) { .alignleft, .alignright { float: none; margin-inline: 0; } }

@media print {
	.masthead .topnav, .trace, .article__foot, .post-nav, .comments, .site-foot { display: none; }
	.masthead { background: none; color: #000; }
}
