/* =========================================================
   Lesson 11 Practice Activities
   Author: Julian Burnley
   ========================================================= */

/* =========================
   Reset and Variables
   ========================= */

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

:root {
  color-scheme: light;

  --color-background: hsl(165, 25%, 96%);
  --color-surface: hsl(0, 0%, 100%);
  --color-surface-soft: hsl(165, 22%, 94%);

  --color-primary: hsl(165, 50%, 22%);
  --color-primary-light: hsl(165, 32%, 42%);
  --color-accent: hsl(355, 50%, 29%);
  --color-accent-light: hsl(355, 65%, 95%);

  --color-text: hsl(165, 28%, 18%);
  --color-muted: hsl(165, 12%, 40%);
  --color-border: hsl(165, 22%, 78%);
  --color-white: hsl(0, 0%, 100%);

  --footer-background: hsl(165, 50%, 16%);
  --footer-text: hsl(165, 20%, 94%);
  --footer-muted: hsl(165, 18%, 76%);

  --shadow-small: 0 8px 22px hsl(165 35% 15% / 10%);
  --shadow-medium: 0 15px 35px hsl(165 35% 15% / 15%);

  --radius-small: 0.65rem;
  --radius-medium: 1rem;
  --radius-large: 1.25rem;

  --transition-speed: 180ms;
}

/* =========================
   Base Page Styles
   ========================= */

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;

  display: flex;
  flex-direction: column;

  background:
    radial-gradient(
      circle at top left,
      hsl(165 45% 88% / 55%),
      transparent 26rem
    ),
    var(--color-background);

  color: var(--color-text);

  font-family: Verdana, Geneva, Tahoma, sans-serif;
  line-height: 1.7;

  transition:
    background-color 250ms ease,
    color 250ms ease;
}

main {
  width: min(calc(100% - 2rem), 72rem);
  margin-inline: auto;
  padding: 3rem 0 5rem;

  flex: 1;
}

h1,
h2,
h3 {
  line-height: 1.2;
}

h1 {
  color: var(--color-primary);
  font-size: clamp(2.3rem, 7vw, 4rem);
}

h2 {
  color: var(--color-primary);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

h3 {
  color: var(--color-accent);
  font-size: 1rem;
}

p {
  max-width: 75ch;
}

a {
  color: inherit;
}

code,
pre {
  font-family: Consolas, "Courier New", monospace;
}

/* =========================
   Header
   ========================= */

.site-header {
  padding: 3rem 1rem 0;

  background:
    linear-gradient(
      135deg,
      hsl(0 0% 100% / 95%),
      hsl(165 35% 92% / 92%)
    );

  text-align: center;
}

.header-content {
  width: min(100%, 60rem);
  margin-inline: auto;
}

.header-content > p:last-child {
  margin: 0.75rem auto 0;

  color: var(--color-muted);

  font-style: italic;
  font-weight: 700;
}

.eyebrow {
  margin-bottom: 0.5rem;

  color: var(--color-accent);

  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* =========================
   Navigation
   ========================= */

.main-navigation {
  margin-top: 2rem;
  padding-top: 1rem;

  border-bottom: 0.25rem solid var(--color-accent);

  background:
    linear-gradient(
      to top,
      hsl(355 45% 30% / 100%) 0%,
      hsl(355 45% 30% / 0%) 70%
    );
}

.main-navigation ul {
  display: flex;
  justify-content: center;
  gap: 0.5rem;

  list-style: none;
}

.main-navigation li {
  list-style: none;
}

.main-navigation a {
  display: block;

  padding: 0.8rem 1.5rem;

  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius-small) var(--radius-small) 0 0;

  background-color: var(--color-surface);
  color: var(--color-accent);

  font-weight: 700;
  text-decoration: none;

  transition:
    background-color var(--transition-speed) ease,
    color var(--transition-speed) ease,
    transform var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
}

.main-navigation a:hover,
.main-navigation a:focus-visible,
.main-navigation a[aria-current="page"] {
  background-color: var(--color-accent);
  color: var(--color-white);

  box-shadow: 0 -4px 12px hsl(0 0% 20% / 25%);
  transform: translateY(-2px);
}

.main-navigation a:focus-visible {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 3px;
}

/* =========================
   Theme Button
   ========================= */

.theme-toggle {
  margin: 1.5rem auto 0;
  padding: 0.65rem 1rem;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;

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

  background-color: var(--color-surface);
  color: var(--color-primary);

  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;

  cursor: pointer;

  box-shadow: var(--shadow-small);

  transition:
    background-color var(--transition-speed) ease,
    color var(--transition-speed) ease,
    border-color var(--transition-speed) ease,
    transform var(--transition-speed) ease;
}

.theme-toggle:hover {
  border-color: var(--color-primary-light);
  transform: translateY(-2px);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 3px;
}

.theme-toggle__icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* =========================
   Shared Content Sections
   ========================= */

.writing-section,
.cli-section,
.commands-section {
  margin-bottom: 2rem;
  padding: clamp(1.5rem, 4vw, 2.75rem);

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

  background-color: var(--color-surface);

  box-shadow: var(--shadow-medium);
}

.section-heading {
  margin-bottom: 1rem;
}

.introduction {
  margin-bottom: 2rem;
  color: var(--color-muted);
}

/* =========================
   Internationalization Page
   ========================= */

.example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.language-card {
  min-height: 10rem;
  padding: 1.25rem;

  display: flex;
  flex-direction: column;
  gap: 0.8rem;

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

  background-color: var(--color-surface-soft);

  box-shadow: var(--shadow-small);

  transition:
    transform var(--transition-speed) ease,
    border-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
}

.language-card:hover {
  border-color: var(--color-primary-light);

  box-shadow: var(--shadow-medium);
  transform: translateY(-4px);
}

.language-card bdi,
.language-card > p:not(.language-note) {
  display: block;

  width: 100%;
  max-width: 100%;

  padding: 0.5rem 0;

  color: var(--color-text);

  font-size: 1.05rem;
  font-weight: 700;
}

.language-note {
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

/* Add International styles below this comment */

bdi {
  display: block;
  width: 100%;
  padding: 0.5rem 0;
}

[lang="zh-CN"] {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

[lang="he"] {
  direction: rtl;
  text-align: right;
}

.vertical-example {
  align-items: flex-start;
}

.rtl-example bdi {
  text-align: right;
}

/* =========================
   CLI Page
   ========================= */

.git-information {
  margin-top: 1.5rem;
  padding: 0;

  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 1rem;

  list-style: none;
}

.git-information li {
  margin: 0;
  padding: 1rem;

  list-style: none;

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

  background-color: var(--color-surface-soft);

  transition:
    transform var(--transition-speed) ease,
    border-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
}

.git-information li::marker {
  content: "";
}

.git-information li:hover {
  border-color: var(--color-primary-light);

  box-shadow: var(--shadow-small);
  transform: translateY(-2px);
}

.git-information strong {
  display: block;
  margin-bottom: 0.5rem;

  color: var(--color-accent);

  font-size: 1.1rem;
}

.git-information code {
  color: var(--color-primary);

  font-size: 0.95rem;
  font-weight: 700;

  overflow-wrap: anywhere;
}

/* =========================
   Git Commands Table
   ========================= */

.table-container {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 58rem;
  margin-top: 1.5rem;

  border-collapse: collapse;

  background-color: var(--color-surface);

  box-shadow: var(--shadow-small);
}

caption {
  padding: 0 0 1rem;

  color: var(--color-muted);

  font-weight: 700;
  text-align: left;
}

th,
td {
  padding: 1rem;

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

  text-align: left;
  vertical-align: top;
}

th {
  background-color: var(--color-primary);
  color: var(--color-white);

  text-align: center;
}

tbody tr:nth-child(even) {
  background-color: var(--color-surface-soft);
}

tbody tr:hover {
  background-color: var(--color-accent-light);
}

td code {
  color: var(--color-primary);

  font-size: 0.9rem;
  font-weight: 700;

  overflow-wrap: anywhere;
}

pre {
  max-width: 30rem;
  padding: 0.8rem;

  overflow-x: auto;

  border-radius: var(--radius-small);

  background-color: hsl(165, 30%, 15%);
  color: hsl(165, 40%, 92%);

  font-size: 0.82rem;
  line-height: 1.5;

  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* =========================
   Decorated Footer
   ========================= */

.site-footer {
  position: relative;

  margin-top: 3rem;

  overflow: hidden;

  background:
    radial-gradient(
      circle at top left,
      hsl(165 45% 32% / 45%),
      transparent 28rem
    ),
    linear-gradient(
      135deg,
      var(--footer-background),
      hsl(355, 45%, 20%)
    );

  color: var(--footer-text);
}

.site-footer::before {
  content: "";

  position: absolute;
  inset: 0 0 auto;

  height: 0.3rem;

  background:
    linear-gradient(
      90deg,
      var(--color-primary-light),
      var(--color-accent),
      var(--color-primary-light)
    );
}

.footer-content {
  width: min(calc(100% - 2rem), 72rem);
  margin-inline: auto;
  padding: 2.75rem 0 2rem;

  display: grid;
  grid-template-columns: minmax(14rem, 0.8fr) minmax(0, 1.7fr);
  gap: 3rem;
  align-items: start;
}

.footer-title {
  margin-bottom: 0.65rem;

  color: var(--color-white);

  font-size: 1.3rem;
  font-weight: 800;
}

.footer-description {
  max-width: 38rem;

  color: var(--footer-muted);
  line-height: 1.7;
}

.footer-details {
  display: grid;
  grid-template-columns:
    minmax(10rem, 1fr)
    minmax(18rem, 1.8fr)
    minmax(10rem, 1fr);
  gap: 0.75rem;
}

.footer-details p {
  padding: 0.9rem;

  border: 1px solid hsl(0 0% 100% / 14%);
  border-radius: var(--radius-small);

  background-color: hsl(0 0% 100% / 7%);

  color: var(--footer-text);
}

.footer-details span {
  display: block;
  margin-bottom: 0.3rem;

  color: var(--footer-muted);

  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-details a,
.footer-bottom a {
  color: var(--footer-text);

  font-weight: 700;
  overflow-wrap: anywhere;
  text-decoration-thickness: 0.1rem;
  text-underline-offset: 0.25rem;
}

.footer-details a:hover,
.footer-bottom a:hover {
  color: hsl(165, 65%, 75%);
}

.footer-bottom {
  width: min(calc(100% - 2rem), 72rem);
  margin-inline: auto;
  padding: 1rem 0 1.5rem;

  display: flex;
  justify-content: space-between;
  gap: 1rem;

  border-top: 1px solid hsl(0 0% 100% / 14%);

  color: var(--footer-muted);

  font-size: 0.85rem;
}

/* Support for the original simple footer markup */

.site-footer:not(:has(.footer-content)) {
  padding: 1.75rem 1rem;

  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem 2rem;

  text-align: center;
}

.site-footer:not(:has(.footer-content)) p {
  padding: 0.65rem 1rem;

  border: 1px solid hsl(0 0% 100% / 14%);
  border-radius: var(--radius-small);

  background-color: hsl(0 0% 100% / 7%);
}

.site-footer:not(:has(.footer-content)) p:nth-child(2) {
  flex: 1 1 20rem;
  max-width: 24rem;
}

.site-footer:not(:has(.footer-content)) p:nth-child(2) a {
  overflow-wrap: anywhere;
}

.site-footer:not(:has(.footer-content)) span {
  color: var(--footer-muted);
  font-weight: 700;
}

/* =========================
   Dark Mode
   ========================= */

body.dark-mode {
  color-scheme: dark;

  --color-background: hsl(165, 25%, 8%);
  --color-surface: hsl(165, 22%, 12%);
  --color-surface-soft: hsl(165, 20%, 15%);

  --color-primary: hsl(165, 55%, 76%);
  --color-primary-light: hsl(165, 48%, 62%);
  --color-accent: hsl(355, 68%, 73%);
  --color-accent-light: hsl(355, 30%, 18%);

  --color-text: hsl(165, 20%, 91%);
  --color-muted: hsl(165, 12%, 67%);
  --color-border: hsl(165, 18%, 28%);

  --footer-background: hsl(165, 30%, 5%);
  --footer-text: hsl(165, 15%, 94%);
  --footer-muted: hsl(165, 12%, 68%);

  --shadow-small: 0 8px 22px hsl(0 0% 0% / 25%);
  --shadow-medium: 0 15px 35px hsl(0 0% 0% / 38%);
}

body.dark-mode .site-header {
  background:
    linear-gradient(
      135deg,
      hsl(165 24% 11% / 98%),
      hsl(165 28% 14% / 96%)
    );
}

body.dark-mode .main-navigation {
  background:
    linear-gradient(
      to top,
      hsl(355 32% 17% / 100%) 0%,
      hsl(355 32% 17% / 0%) 70%
    );
}

body.dark-mode pre {
  background-color: hsl(165, 24%, 6%);
}

body.dark-mode th {
  color: hsl(165, 25%, 10%);
}

/* =========================
   Responsive Styles
   ========================= */

@media (max-width: 900px) {
  .git-information {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .site-header {
    padding-top: 2rem;
  }

  .main-navigation ul {
    flex-direction: column;
    gap: 0;
  }

  .main-navigation a {
    border: 1px solid var(--color-border);
    border-radius: 0;
  }

  .writing-section,
  .cli-section,
  .commands-section {
    padding: 1.25rem;
  }

  .example-grid {
    grid-template-columns: 1fr;
  }

  .language-card {
    min-height: auto;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  th,
  td {
    padding: 0.75rem;
  }
}

@media (max-width: 480px) {
  main {
    width: min(calc(100% - 1rem), 72rem);
  }

  .writing-section,
  .cli-section,
  .commands-section {
    padding: 1rem;

    border-radius: var(--radius-small);
  }

  .theme-toggle__text {
    display: none;
  }
}

/* =========================
   Reduced Motion
   ========================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
/* =========================
   Dark Mode
   ========================= */

body.dark-mode {
  color-scheme: dark;

  --color-background: hsl(165, 25%, 8%);
  --color-surface: hsl(165, 22%, 12%);
  --color-surface-soft: hsl(165, 20%, 16%);

  --color-primary: hsl(165, 55%, 76%);
  --color-primary-light: hsl(165, 48%, 62%);
  --color-accent: hsl(355, 68%, 73%);
  --color-accent-light: hsl(355, 30%, 18%);

  --color-text: hsl(165, 20%, 91%);
  --color-muted: hsl(165, 12%, 67%);
  --color-border: hsl(165, 18%, 28%);

  --footer-background: hsl(165, 30%, 5%);
  --footer-text: hsl(165, 15%, 94%);
  --footer-muted: hsl(165, 12%, 68%);

  --shadow-small: 0 8px 22px hsl(0 0% 0% / 30%);
  --shadow-medium: 0 15px 35px hsl(0 0% 0% / 45%);
}

body.dark-mode {
  background:
    radial-gradient(
      circle at top left,
      hsl(165 35% 18% / 45%),
      transparent 26rem
    ),
    var(--color-background);

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

body.dark-mode .site-header {
  background:
    linear-gradient(
      135deg,
      hsl(165 24% 10%),
      hsl(165 28% 14%)
    );
}

body.dark-mode .writing-section,
body.dark-mode .cli-section,
body.dark-mode .commands-section,
body.dark-mode .language-card,
body.dark-mode .git-information li,
body.dark-mode table,
body.dark-mode .theme-toggle,
body.dark-mode .main-navigation a {
  background-color: var(--color-surface);
  color: var(--color-text);
}

body.dark-mode .language-card,
body.dark-mode .git-information li,
body.dark-mode tbody tr:nth-child(even) {
  background-color: var(--color-surface-soft);
}

body.dark-mode tbody tr:hover {
  background-color: var(--color-accent-light);
}

body.dark-mode .main-navigation {
  background:
    linear-gradient(
      to top,
      hsl(355 32% 17%) 0%,
      transparent 70%
    );
}

body.dark-mode .main-navigation a:hover,
body.dark-mode .main-navigation a:focus-visible,
body.dark-mode .main-navigation a[aria-current="page"] {
  background-color: var(--color-accent);
  color: hsl(165, 25%, 9%);
}

body.dark-mode th {
  background-color: var(--color-primary);
  color: hsl(165, 25%, 9%);
}

body.dark-mode pre {
  background-color: hsl(165, 25%, 5%);
  color: hsl(165, 35%, 90%);
}
