/**
 * Danish Khan website
 * Global reset and element defaults.
 *
 * Keep this file limited to:
 * reset
 * typography foundations
 * generic links
 * media
 * accessibility
 *
 * Layout and components belong in their own files.
 */

/* =============================================================
   FONTS
   ============================================================= */

@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Jost:wght@400;500;600&display=swap");
@import url("https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.5.0/css/flag-icons.min.css");
/* =============================================================
   RESET
   ============================================================= */

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

html {
  margin: 0;
  padding: 0;

  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;

  scroll-behavior: smooth;

  background: var(--color-bg);
}

body {
  min-width: 320px;
  min-height: 100vh;

  margin: 0;
  padding: 0;

  background: var(--color-bg);
  color: var(--color-text-primary);

  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.65;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  text-rendering: optimizeLegibility;
}

/* =============================================================
   BASIC FLOW ELEMENTS
   ============================================================= */

main,
section,
article,
aside,
header,
footer,
nav,
figure {
  display: block;
}

figure {
  margin: 0;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
ul,
ol,
blockquote {
  margin-top: 0;
}

p:last-child,
ul:last-child,
ol:last-child,
blockquote:last-child {
  margin-bottom: 0;
}

/* =============================================================
   TYPOGRAPHY
   ============================================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 0;

  color: var(--color-text-primary);

  font-family: var(--font-sans);
  font-style: normal;

  text-wrap: balance;
}

h1 {
  font: var(--text-h1);
  letter-spacing: var(--letter-spacing-h1);
}

h2 {
  font: var(--text-h2);
  letter-spacing: var(--letter-spacing-h2);
}

h3 {
  font: var(--text-h3);
  letter-spacing: var(--letter-spacing-h3);
}

h4 {
  font: var(--text-h4);
}

h5 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
}

h6 {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}

p {
  margin-bottom: 1.25rem;

  color: var(--color-text-secondary);

  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.65;
}

strong,
b {
  font-weight: 600;
}

em,
i {
  font-style: italic;
}

small {
  font-size: 0.875rem;
}

/* =============================================================
   EDITORIAL TYPE
   ============================================================= */

/*
 * Use this class for the reference-style supporting copy.
 * The reference homepage pairs large Jost headings with
 * EB Garamond body text.
 */

.editorial-copy {
  color: var(--color-text-primary);

  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.5;
}

.editorial-copy em {
  font-style: italic;
}

/* =============================================================
   LINKS
   ============================================================= */

a {
  color: var(--color-text-primary);

  text-decoration-line: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;

  transition:
    color var(--duration-base) var(--easing-standard),
    border-color var(--duration-base) var(--easing-standard),
    background-color var(--duration-base) var(--easing-standard);
}

a:hover {
  color: var(--color-text-primary);
}

/*
 * The reference design uses yellow underline accents selectively,
 * not on every link.
 */

.link-accent {
  display: inline;

  color: var(--color-text-primary);

  text-decoration: none;

  border-bottom: 2px solid var(--color-accent-primary);

  transition: border-color var(--duration-base) var(--easing-standard);
}

.link-accent:hover {
  border-bottom-color: var(--color-text-primary);
}

/* =============================================================
   LISTS
   ============================================================= */

ul,
ol {
  margin-bottom: 1.25rem;
  padding-left: 1.35rem;
}

ul {
  list-style: disc;
}

ol {
  list-style: decimal;
}

li {
  color: var(--color-text-secondary);
  line-height: 1.65;
}

li + li {
  margin-top: 0.4rem;
}

/*
 * Navigation and component lists explicitly remove markers.
 */

nav ul,
nav ol,
[role="list"],
.list-reset {
  margin: 0;
  padding: 0;

  list-style: none;
}

nav li,
[role="list"] > li,
.list-reset > li {
  margin: 0;
}

/* =============================================================
   MEDIA
   ============================================================= */

img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

svg {
  overflow: visible;
}

/* =============================================================
   FORM ELEMENTS
   ============================================================= */

button,
input,
textarea,
select {
  font: inherit;
}

button {
  margin: 0;

  color: inherit;

  border: 0;
  background: transparent;

  cursor: pointer;
}

input,
textarea,
select {
  color: var(--color-text-primary);
}

textarea {
  resize: vertical;
}

/* =============================================================
   TABLES
   ============================================================= */

table {
  width: 100%;

  border-collapse: collapse;
  border-spacing: 0;
}

/* =============================================================
   BLOCKQUOTES
   ============================================================= */

blockquote {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;

  border-left: 3px solid var(--color-accent-primary);

  color: var(--color-text-primary);

  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.55;
}

blockquote p {
  color: inherit;

  font: inherit;
}

/* =============================================================
   HORIZONTAL RULE
   ============================================================= */

hr {
  height: 1px;

  margin: var(--space-7) 0;

  border: 0;
  background: var(--color-border);
}

/* =============================================================
   CODE
   ============================================================= */

code,
kbd,
samp,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

code {
  font-size: 0.9em;
}

pre {
  overflow-x: auto;

  padding: var(--space-5);

  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);

  background: var(--color-surface);

  font-size: 0.875rem;
  line-height: 1.6;
}

/* =============================================================
   TEXT SELECTION
   ============================================================= */

::selection {
  background: var(--color-accent-primary);
  color: var(--color-text-primary);
}

/* =============================================================
   ACCESSIBLE FOCUS
   ============================================================= */

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* =============================================================
   SCREEN-READER SUPPORT
   ============================================================= */

[hidden] {
  display: none !important;
}

/* =============================================================
   MOBILE TYPOGRAPHY POLISH
   ============================================================= */

@media (max-width: 768px) {
  body {
    line-height: 1.6;
  }

  p {
    line-height: 1.6;
  }

  .editorial-copy {
    font-size: 1.125rem;
    line-height: 1.55;
  }
}

/* =============================================================
   REDUCED MOTION
   ============================================================= */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;

    transition-duration: 0.01ms !important;

    scroll-behavior: auto !important;
  }
}
