/* ============================================================
   Design tokens — formal, black
   ============================================================ */
:root {
  --paper: #0B0B0C;        /* page background */
  --paper-raised: #131315; /* panel background */
  --paper-sunken: #0F0F10;
  --ink: #E9E7E0;          /* primary text, warm off-white */
  --ink-soft: #B9B6AC;
  --muted: #7B7870;
  --rule: #292825;         /* hairline on dark */
  --accent: #B4915C;       /* brass / antique gold (fallback if JS disabled) */
  --accent-hover: #CBA876;
  --accent-soft: rgba(180, 145, 92, 0.10);
  --scarlet: #9C4A45;      /* muted formal red, used sparingly */

  --serif: "Source Serif 4", "Charter", Georgia, serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;

  --max-width: 1180px;
  --content-width: 820px;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  animation: page-fade-in .18s ease;
}

@keyframes page-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Cross-document View Transitions were removed here: with Arabic (RTL)
   now in the mix alongside LTR languages, the automatic Chrome/Edge
   crossfade could look jarring on navigations where text direction
   flips. The plain fade-in above already smooths every navigation,
   in every browser, without that risk. */

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0 0 .5em; color: var(--ink); }
p { margin: 0 0 1.1em; }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-num {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 500;
}

/* ============================================================
   Layout shell
   ============================================================ */
.shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
  min-height: 100vh;
  border-top: 2px solid var(--accent);
}

.site-header {
  padding: 38px 0 0;
}
.site-header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}
.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}
.site-title {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: .01em;
}
.site-title:hover { color: var(--ink); }
.site-tag {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .03em;
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.lang-toggle {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  white-space: nowrap;
}
.lang-current {
  color: var(--accent);
  font-weight: 600;
}
.lang-sep {
  color: var(--rule);
  margin: 0 5px;
}
.lang-toggle a {
  color: var(--muted);
  text-decoration: none;
}
.lang-toggle a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ============================================================
   Tab bar — flat, formal underline navigation
   ============================================================ */
.tabbar-wrap { max-width: var(--content-width); margin: 0 auto; }
.tabbar {
  display: flex;
  gap: 30px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 12.5px;
}
.tabbar a {
  display: block;
  padding: 14px 0 12px;
  text-decoration: none;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.tabbar a .tnum { color: var(--rule); margin-right: 7px; }
.tabbar a:hover { color: var(--ink-soft); }
.tabbar a.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
.tabbar a.active .tnum { color: var(--accent); }

.panel {
  max-width: var(--content-width);
  margin: 0 auto;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  padding: 46px 48px 60px;
}

main { padding: 0 0 60px; }

/* ============================================================
   TOC-style index (homepage / listing pages)
   ============================================================ */
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
}
.toc-item:hover { color: var(--accent); }
.toc-item .num { font-family: var(--mono); color: var(--accent); font-size: 13px; min-width: 44px; }
.toc-item .meta { flex: 1; }
.toc-item .ttl { font-weight: 600; font-size: 17px; }
.toc-item .sub { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.toc-item .date { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

.pdf-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--scarlet);
  border: 1px solid var(--scarlet);
  padding: 1px 5px;
  margin-left: 8px;
  vertical-align: 2px;
}

.group-heading {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 36px 0 4px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}
.group-heading:first-of-type { margin-top: 6px; }

.intro-block { margin-bottom: 44px; display: flow-root; }
.intro-block .eyebrow { margin-bottom: 10px; }
.intro-block h1 { font-size: 32px; margin-bottom: 14px; }
.intro-block p { color: var(--ink-soft); font-size: 18px; max-width: 60ch; }

/* ============================================================
   Article / page content
   ============================================================ */
.article-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.article-meta a { color: var(--muted); }
article h1.title, .cv-head h1.title { font-size: 29px; margin-bottom: 14px; }
.cv-head { margin-bottom: 34px; }
.cv-body h2:first-child { margin-top: 0; }
article .summary { color: var(--ink-soft); font-size: 17px; margin-bottom: 30px; }

article h2 {
  font-size: 21px;
  margin-top: 2.2em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}
article h3 { font-size: 18px; margin-top: 1.8em; }

article code {
  font-family: var(--mono);
  background: var(--accent-soft);
  padding: .1em .35em;
  font-size: .9em;
}
article pre {
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 14px;
}
article pre code { background: none; padding: 0; color: inherit; }

article blockquote {
  margin: 1.4em 0;
  padding: 2px 20px;
  border-left: 2px solid var(--accent);
  color: var(--ink-soft);
  background: var(--accent-soft);
}

article table { border-collapse: collapse; width: 100%; margin: 1.4em 0; font-size: 15px; }
article th, article td { border: 1px solid var(--rule); padding: 8px 12px; text-align: left; }
article th { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; background: var(--paper-sunken); color: var(--ink-soft); }

article img { max-width: 100%; }
article hr { border: none; border-top: 1px solid var(--rule); margin: 2.4em 0; }

.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 34px; }
.tag {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  text-decoration: none;
}

.empty-state {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 13.5px;
  padding: 30px 0;
  border-top: 1px solid var(--rule);
}

/* ============================================================
   Figures / captioned photos
   ============================================================ */
figure.photo {
  margin: 30px 0;
  padding: 0;
}
figure.photo img {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  filter: grayscale(15%);
}
figure.photo figcaption {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--muted);
  font-style: italic;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}
figure.photo.float-right {
  float: right;
  width: 300px;
  margin: 4px 0 20px 36px;
}
@media (max-width: 620px) {
  figure.photo.float-right { float: none; width: 100%; margin: 24px 0; }
}

/* ============================================================
   CV download link
   ============================================================ */
.pdf-open-link {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 16px;
  text-decoration: none;
  margin-top: 6px;
}
.pdf-open-link:hover { background: var(--accent-soft); }

/* ============================================================
   CV resume layout
   ============================================================ */
.cv-header {
  text-align: center;
  margin-bottom: 4px;
}
.cv-name {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .01em;
}
.cv-contact {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 10px;
}
.cv-contact a { color: var(--accent); }

hr.cv-rule {
  border: none;
  border-top: 1px solid var(--accent);
  margin: 22px 0 8px;
}

.cv-body h2 { margin-top: 2.4em; }
.cv-body h2:first-of-type { margin-top: 1.6em; }

.cv-entry { margin: 18px 0; }
.cv-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.cv-org {
  font-weight: 600;
  font-size: 16.5px;
  color: var(--ink);
}
.cv-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.cv-role {
  font-style: italic;
  color: var(--ink-soft);
  margin: 3px 0 8px;
  font-size: 15px;
}
.cv-entry ul {
  margin: 0;
  padding-left: 20px;
}
.cv-entry li {
  margin-bottom: 4px;
  font-size: 15px;
  color: var(--ink-soft);
}

.cv-skills > div {
  margin-bottom: 14px;
  font-size: 15px;
  color: var(--ink-soft);
}
.cv-skill-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

@media (max-width: 620px) {
  .cv-entry-head { flex-direction: column; gap: 2px; }
}

/* ============================================================
   Music tab
   ============================================================ */
.recording-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 8px;
}
.recording-card { color: var(--ink); }
.recording-embed {
  display: block;
  width: 100%;
  border: none;
  border-radius: 6px;
  margin-bottom: 8px;
}
.recording-meta-link,
.recording-plain-link {
  display: block;
  text-decoration: none;
  color: var(--ink);
}
.recording-cover {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--rule);
  margin-bottom: 8px;
  filter: grayscale(10%);
}
.recording-plain-link:hover .recording-cover { border-color: var(--accent); }
.recording-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
}
.recording-meta-link:hover .recording-title,
.recording-plain-link:hover .recording-title { color: var(--accent); }
.recording-performer {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}

.concert-count {
  color: var(--muted);
  font-weight: 400;
}
.concert-year {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 22px 0 4px;
}
.concert-year:first-of-type { margin-top: 6px; }
.concert-list { list-style: none; margin: 0; padding: 0; }
.concert-row {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.concert-row-top {
  display: flex;
  gap: 16px;
  align-items: baseline;
  font-size: 14.5px;
}
.concert-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  min-width: 62px;
  flex-shrink: 0;
}
.concert-conductor { flex: 1; color: var(--ink); font-weight: 600; text-decoration: none; }
a.concert-conductor:hover { color: var(--accent); text-decoration: underline; }
.concert-venue {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.concert-program {
  margin-top: 3px;
  margin-left: 78px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}
.concert-piece { margin-bottom: 1px; }
.concert-piece:last-child { margin-bottom: 0; }

@media (max-width: 620px) {
  .concert-row-top { flex-wrap: wrap; }
  .concert-venue { width: 100%; text-align: left; margin-top: 2px; }
  .concert-program { margin-left: 0; margin-top: 5px; }
  .recording-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* Footer */
footer {
  border-top: 1px solid var(--rule);
  padding: 20px 0 40px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 780px) {
  .shell { padding: 0 16px; }
  body { font-size: 17px; }
  .tabbar { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 20px; }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar a { padding: 12px 0 10px; white-space: nowrap; }
  .panel { padding: 30px 22px 44px; }
  .intro-block h1 { font-size: 26px; }
  main { padding: 0 0 50px; }
  .toc-item { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* ============================================================
   RTL support (Arabic)
   ------------------------------------------------------------
   dir="rtl" on <html> already mirrors most flexbox/grid layouts
   automatically (tab bar order, header row, CV entry rows, concert
   row layout). What's below covers what does NOT auto-mirror:
   physical (left/right) floats, margins, text-align, and borders,
   plus Arabic-specific typography fixes.
   ============================================================ */
html[dir="rtl"] body,
html[dir="rtl"] .cv-body,
html[dir="rtl"] .intro-block p,
html[dir="rtl"] article p,
html[dir="rtl"] .empty-state {
  font-family: "Noto Sans Arabic", "Noto Kufi Arabic", sans-serif;
}
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] .site-title,
html[dir="rtl"] .cv-name {
  font-family: "Noto Kufi Arabic", "Noto Sans Arabic", sans-serif;
}

/* Arabic is a connected/cursive script: letter-spacing breaks the
   joins between letters, and uppercase/small-caps styling has no
   meaning. Reset both wherever the LTR design applies them. */
html[dir="rtl"] .eyebrow,
html[dir="rtl"] .tabbar a,
html[dir="rtl"] .group-heading,
html[dir="rtl"] .pdf-badge,
html[dir="rtl"] .cv-skill-label,
html[dir="rtl"] .site-tag,
html[dir="rtl"] .lang-toggle,
html[dir="rtl"] .concert-year {
  font-family: "Noto Sans Arabic", sans-serif;
  letter-spacing: normal;
  text-transform: none;
}

/* Arabic reads as cramped at the very small sizes tuned for Latin
   mono/uppercase labels (10-13px). Bump these specific spots up a
   notch and give a touch more line-height/padding so letterforms
   have room to sit properly. */
html[dir="rtl"] .eyebrow { font-size: 13px; }
html[dir="rtl"] .tabbar a { font-size: 14px; }
html[dir="rtl"] .group-heading { font-size: 13px; }
html[dir="rtl"] .site-tag { font-size: 13.5px; }
html[dir="rtl"] .lang-toggle { font-size: 13px; }
html[dir="rtl"] .concert-year { font-size: 14px; }
html[dir="rtl"] .pdf-badge {
  font-size: 12px;
  padding: 2px 7px;
  line-height: 1.6;
}
html[dir="rtl"] .cv-skill-label {
  font-size: 12.5px;
  line-height: 1.7;
  margin-bottom: 6px;
}
html[dir="rtl"] .concert-date,
html[dir="rtl"] footer {
  font-size: 13px;
}
html[dir="rtl"] .toc-item .sub,
html[dir="rtl"] .toc-item .date,
html[dir="rtl"] .recording-performer {
  font-size: 12.5px;
}

/* Photo: floats to the opposite side so the whole layout mirrors,
   not just the text direction. */
html[dir="rtl"] figure.photo.float-right {
  float: left;
  margin: 4px 36px 20px 0;
}

/* Badge sits after the title in reading order; in RTL that's
   visually to the left, so the gap needs to flip sides too. */
html[dir="rtl"] .pdf-badge { margin-left: 0; margin-right: 8px; }

/* Blockquote accent bar moves to the side text now starts from. */
html[dir="rtl"] article blockquote {
  border-left: none;
  border-right: 2px solid var(--accent);
}

/* Concert rows: date/name/venue line auto-mirrors via dir, but the
   venue's explicit right-alignment and the program's fixed left
   indent are physical properties that need an explicit flip. */
html[dir="rtl"] .concert-venue { text-align: left; }
html[dir="rtl"] .concert-program { margin-left: 0; margin-right: 78px; }

@media (max-width: 620px) {
  html[dir="rtl"] .concert-venue { text-align: right; }
  html[dir="rtl"] .concert-program { margin-right: 0; }
}
