@import url('https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;600&family=Noto+Sans+Gurmukhi:wght@400;600&display=swap');

:root {
  --bg: #fbf7ef;
  --card: #ffffff;
  --ink: #2a2520;
  --muted: #6b6258;
  --line: #e4dccd;
  --gur: #1f6f8b;      /* Gurmukhi accent */
  --gur-soft: #dcecf1;
  --shah: #b5532a;     /* Shahmukhi accent */
  --shah-soft: #f6e2d6;
  --other: #e9e2d2;
  --gold: #c98a12;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* Scripts */
.gur { font-family: 'Noto Sans Gurmukhi', 'Gurmukhi MN', 'Raavi', sans-serif; }
.shah {
  font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Geeza Pro', serif;
  direction: rtl;
  line-height: 2.3;
}

/* Header */
header.site { background: var(--card); border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand span { color: var(--gold); }
nav.main { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-left: auto; }
nav.main a { color: var(--muted); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
nav.main a:hover, nav.main a.on { color: var(--ink); border-bottom-color: var(--gold); }

/* Type */
h1 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.45rem; margin: 48px 0 12px; }
h3 { font-size: 1.1rem; margin: 24px 0 8px; }
p { margin: 0 0 14px; }
a { color: var(--gur); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 44em; }
.note { color: var(--muted); font-size: 0.92rem; }

.hero { padding: 48px 0 8px; }
.hero .pair { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; font-size: 2rem; margin-bottom: 10px; }
.hero .pair .gur { color: var(--gur); }
.hero .pair .shah { color: var(--shah); line-height: 1.8; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.card h3 { margin-top: 0; }
a.card { color: inherit; text-decoration: none; display: block; }
a.card:hover { border-color: var(--gold); }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--line); }
.timeline li { padding: 0 0 16px 18px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -8px; top: 9px; width: 13px; height: 13px; border-radius: 50%; background: var(--gold); }
.timeline b { display: block; }

/* Map */
.map-box { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.map-box svg { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 12px 4px 4px; font-size: 0.92rem; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 18px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.15); }
.legend i.line { height: 0; border: 0; border-top: 3px dashed #2a2520; border-radius: 0; }
.legend i.river { height: 0; border: 0; border-top: 3px solid #7fb3d3; border-radius: 0; }

/* Letter grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; text-align: center; }
.tile .big { font-size: 2.1rem; line-height: 1.5; color: var(--gur); }
.tile .big.shah { color: var(--shah); line-height: 1.9; }
.tile .name { font-weight: 600; font-size: 0.9rem; }
.tile .snd { color: var(--muted); font-size: 0.8rem; line-height: 1.3; min-height: 2.1em; }
.tile .eq { margin-top: 6px; padding-top: 4px; border-top: 1px dashed var(--line); font-size: 1.15rem; }
.tile .eq.shah { color: var(--shah); line-height: 2; }
.tile .eq.gur { color: var(--gur); }
.tile.tone { border-color: var(--gold); }

/* Tables */
table { border-collapse: collapse; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f4eee1; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.gur { font-size: 1.25rem; color: var(--gur); }
td.shah { font-size: 1.25rem; color: var(--shah); text-align: right; }
.scroll { overflow-x: auto; }

/* Converter */
.convert { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.convert label { font-weight: 600; display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.convert textarea {
  width: 100%; min-height: 260px; padding: 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font-size: 1.25rem; resize: vertical;
}
.convert textarea.gur { border-top: 4px solid var(--gur); line-height: 1.9; }
.convert textarea.shah { border-top: 4px solid var(--shah); }
.convert textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin: 14px 0; }
button, .btn {
  font: inherit; font-size: 0.9rem; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover, button.on { border-color: var(--gold); background: #fff6e0; }
button.small { padding: 2px 10px; font-size: 0.8rem; font-weight: 400; }

/* Library */
.piece { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 18px; }
.piece h3 { margin: 0; }
.piece .by { color: var(--muted); font-size: 0.9rem; margin-bottom: 12px; }
.piece .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.piece .cols > div { padding: 10px 14px; border-radius: 8px; font-size: 1.15rem; }
.piece .cols .gur { background: var(--gur-soft); line-height: 2; }
.piece .cols .shah { background: var(--shah-soft); }
.piece .cols p { margin: 0 0 6px; }
.piece .en { margin: 14px 0 10px; color: var(--muted); font-style: italic; }

footer.site { margin-top: 64px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }

@media (max-width: 680px) {
  h1 { font-size: 1.7rem; }
  nav.main { margin-left: 0; }
  .convert, .piece .cols { grid-template-columns: 1fr; }
  .convert textarea { min-height: 170px; }
}

/* About */
.profile { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: start; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-top: 24px; }
.profile .photo { width: 200px; height: 200px; border-radius: 10px; display: block; object-fit: cover; }
.profile h2 { margin: 0; }
.profile .role { color: var(--muted); margin-bottom: 14px; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 4px 14px; border-radius: 999px; background: var(--gur-soft); font-size: 0.92rem; }
@media (max-width: 680px) { .profile { grid-template-columns: 1fr; } }

/* Icons */
.ico { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; background: var(--gur-soft); color: var(--gur); margin-right: 10px; vertical-align: middle; flex: none; }
.ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.glyph { font-size: 1.25rem; font-weight: 600; line-height: 1; direction: ltr; }
.ico.glyph.shah { background: var(--shah-soft); color: var(--shah); padding-bottom: 8px; }
.card > h3 { display: flex; align-items: center; }
.brand .ico { width: 30px; height: 30px; margin-right: 8px; font-size: 1.05rem; background: var(--gur); color: #fff; }
.chips li { display: inline-flex; align-items: center; gap: 6px; }
.chips .ico, .role .ico { width: 24px; height: 24px; border-radius: 6px; margin-right: 4px; background: none; }
.chips .ico svg, .role .ico svg { width: 16px; height: 16px; }
.role span.item { display: inline-flex; align-items: center; margin-right: 14px; }

.brand { display: inline-flex; align-items: center; }
.brand img { height: 38px; width: auto; display: block; }
