:root {
  --bg: #FAFAF8;
  --text: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #999999;
  --accent: #7a2e1f;     /* oxblood — link color */
  --rule: #e0e0e0;
}

html[data-theme="dark"] {
  --bg: #111110;
  --text: #e8e8e4;
  --text-secondary: #999999;
  --text-tertiary: #666666;
  --accent: #c9a87c;   /* warm gold for dark mode */
  --rule: #2a2a2a;
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 100;
  background: var(--bg);
  color: var(--text-tertiary);
  border: 1px solid var(--rule);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
  padding: 0;
  line-height: 1;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

/* iA Writer Mono S */
@font-face {
  font-family: "iA Writer Mono S";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/iaolo/iA-Fonts@master/iA%20Writer%20Mono/Static/iAWriterMonoS-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "iA Writer Mono S";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/iaolo/iA-Fonts@master/iA%20Writer%20Mono/Static/iAWriterMonoS-Italic.ttf") format("truetype");
}
@font-face {
  font-family: "iA Writer Mono S";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/iaolo/iA-Fonts@master/iA%20Writer%20Mono/Static/iAWriterMonoS-Bold.ttf") format("truetype");
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
}
}

body {
  font-family: "EB Garamond", Garamond, "Adobe Garamond", Georgia, serif;
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga", "kern", "onum";
}

/* Burj Khalifa, ASCII, anchored bottom-right.
   Fixed position so it stays put on scroll. Faded to ~5% so text
   sits comfortably on top. pointer-events: none so it never intercepts
   clicks or text selection. text-transform: none on the pre to preserve
   the literal character art (otherwise body lowercase would mangle it,
   though it's mostly punctuation). */
/* ASCII Dubai skyline — anchored bottom-right of viewport,
   the way Ali's Taipei 101 sits in his page. Generated from a real
   backlit Dubai photo via image-to-ASCII conversion. */

/* Make sure all real content sits above the background */
main { position: relative; z-index: 1; }

@media (max-width: 720px) {
  .bg-burj { display: none; }
}

@media print {
  .bg-burj { display: none; }
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 32px 3rem;
}

@media (max-width: 768px) {
  main { padding: 2rem 24px 2.5rem; }
}

h1 {
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-weight: 500;
  font-size: 2.1rem;
  line-height: 1.05;
  letter-spacing: -0.005em;
  margin: 0 0 0.3rem;
}

h1.name-email {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0;
}

h1.name-email .name-part {
  font-size: 2.6rem;
}

h1.name-email .email-sep {
  font-family: "iA Writer Mono S", ui-monospace, monospace;
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin: 0 0.3em;
  position: relative;
  top: -0.1em;
  letter-spacing: 0.02em;
}

.links {
  font-family: "iA Writer Mono S", "iA Writer Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.links a { color: var(--text-secondary); }
.links .sep { color: var(--text-tertiary); margin: 0 0.4em; }

/* Top nav — plain serif labels, not a chip strip */
nav.primary {
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-size: 1rem;
  font-style: italic;
  margin-top: 0.6rem;
  color: var(--text-secondary);
}
nav.primary a {
  color: var(--text-secondary);
  margin-right: 1em;
  /* override the global a defaults so the wipe still works */
  border-bottom: 0;
}
nav.primary a:hover, nav.primary a:focus-visible { color: var(--text); }
nav.primary a[aria-current="page"] {
  color: var(--text);
  font-style: normal;
  /* current page: persistent underline so the user knows where they are */
  background-size: 100% 1px;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 1rem 0;
}

h2 {
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-weight: 500;
  font-style: normal;
  font-size: 1.2rem;
  margin: 0 0 0.35rem;
  color: var(--text);
}

h3 {
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-weight: 500;
  font-size: 1.05rem;
  margin: 1.25rem 0 0.3rem;
  color: var(--text);
}

p {
  margin: 0 0 0.4rem;
  line-height: 1.45;
}
p:last-child { margin-bottom: 0; }

/* All links: left-to-right wipe underline on hover. No persistent
   underline by default — the line draws in on hover and out on leave. */
a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 2px;
  transition: background-size 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}
a:hover, a:focus-visible {
  background-size: 100% 1px;
}

/* For inline body links, give a quiet always-visible hint so people
   know they're links before they hover (a faint dotted underline). */
section p a, section li a, .body a {
  font-weight: 500;
  border-bottom: none;
}

em { font-style: italic; }

ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.3rem;
}
ul li {
  position: relative;
  padding-left: 1rem;
  margin: 0.08rem 0;
  line-height: 1.4;
}
ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--text-tertiary);
}

.meta {
  font-family: "iA Writer Mono S", ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

/* When .meta sits inline before an em dash, give it a touch of right
   padding so the dash doesn't kiss the closing letter. */
.meta + .dash,
.meta-line + .dash {
  margin: 0 0.15em 0 0.05em;
}

/* A label/value bullet pattern: small mono label, gap, value.
   Used on the home page status block. */
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  column-gap: 0.6rem;
  align-items: baseline;
  padding: 0;
  margin: 0.25rem 0;
  line-height: 1.45;
}
.status-list li::before { content: none; }
.status-list .label {
  font-family: "iA Writer Mono S", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.status-list .value { color: var(--text); }

@media (max-width: 480px) {
  .status-list li {
    grid-template-columns: 7rem 1fr;
    column-gap: 0.5rem;
  }
}

/* Read-more inline link */
.more {
  font-family: "iA Writer Mono S", ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.more a { color: var(--text-secondary); }

.locations {
  margin-top: 0.6rem;
  font-family: "iA Writer Mono S", ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}
.locations .current { color: var(--text); }

/* Bio section spacing */
.bio p { margin-bottom: 1.15rem; line-height: 1.7; }
.bio p:last-child { margin-bottom: 0; }

/* Deep-page entries with proper narrative bodies */
article.entry { margin-bottom: 1.5rem; }
article.entry:last-child { margin-bottom: 0; }

article.entry .head {
  font-style: normal;
  margin-bottom: 0.45rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

article.entry .head .head-left {
  flex: 1;
  min-width: 0;
}

article.entry .head .head-right {
  flex-shrink: 0;
  font-family: "iA Writer Mono S", ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

article.entry .head strong {
  font-weight: 600;
  color: var(--text);
}

article.entry .head a { color: var(--text); }

article.entry .head .logo {
  display: inline-block;
  height: 1.5em;
  width: 1.5em;
  vertical-align: -0.3em;
  margin-right: 0.5em;
  border-radius: 3px;
  object-fit: contain;
  opacity: 0.95;
}

article.entry .meta-line {
  display: block;
  font-family: "iA Writer Mono S", ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 0.1rem;
  margin-bottom: 0.45rem;
}

article.entry .body { line-height: 1.55; }

footer.colophon {
  text-align: left;
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
  line-height: 1.5;
}

@media (max-width: 480px) {
  main { padding: 2rem 20px 2.5rem; }
  h1 { font-size: 1.85rem; }
  h1.name-email .name-part { font-size: 2.2rem; }
  hr { margin: 1.2rem 0; }
  body { font-size: 17px; }
}

@media print {
  :root {
    --bg: #fff; --text: #000; --text-secondary: #444;
    --text-tertiary: #666; --rule: #ccc; --accent: #000;
  }
  main { max-width: none; padding: 0; }
  hr { margin: 1rem 0; }
}
