@import url("../fonts/Inter-4.1/inter.css");
@import url("../fonts/CommitMono-1.143/commit-mono.css");

:root {
  /* Font families */
  --font-family-main: Inter, -apple-system, Helvetica, BlinkMacSystemFont, 'Segoe UI', Roboto, "Helvetica", "Arial", sans-serif;
  --font-family-variable: "InterVariable", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  --font-family-monospace: "CommitMono", "SF Mono", Monaco, Menlo, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  --font-family-serif: "Garamond", "Times New Roman", "Georgia", "Charter", "Iowan Old Style", "Sitka Text", "Book Antiqua", serif;
  /* Colors */
  --background-color: #ffffff;
  --secondary-background: #f8f9fa;
  --font-color: #1a1a1a;
  --font-color-muted: #6c757d;
  --accent-color: #fdf52b;
  --accent-color-hover: #e8dc26;
  --border-color: #dee2e6;
  --selection-background: #fdf52b;
  --selection-color: #1a1a1a;
  --link-color: #1a1a1a;
  --link-hover-background: #fdf52b;
  --link-hover-color: #1a1a1a;
  --image-opacity: 1;
  --image-opacity-hover: 1;
}

html {
  height: 100%;
  /* Enable safe area support */
  viewport-fit: cover;
}

body {
  font-family: var(--font-family-main);
  background-color: var(--background-color);
  color: var(--font-color);
  transition: background-color 0.3s ease, color 0.3s ease;
  /* Prevent scrolling on mobile */
  overflow-x: hidden;
  /* Safe area support for modern browsers */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

@supports (font-variation-settings: normal) {
  body {
    font-family: var(--font-family-variable);
    font-optical-sizing: auto;
  }
}

h1 {

}

h2 {

}


/* blockquote {
  font-family: var(--font-family-serif);
  font-style: italic;
}

blockquote p:first-child::before {
  content: "☞ ";
  font-style: normal;
}

blockquote::before {
  content: "";
} */


code,
kbd,
samp,
pre,
tt,
.monospace,
.code {
  font-family: var(--font-family-monospace);
  font-feature-settings: "liga" 0; /* Disable ligatures for better code readability */
  font-size: 0.9em;
}

code,
kbd,
samp,
pre {
  font-variant-ligatures: none;
}

.highlight {
  background: var(--secondary-background);
  margin: 1em 0;
  overflow-x: auto;
}

.highlight pre {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  overflow: visible;
}

.highlight code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.9em;
  line-height: 1.4;
}

/* Rouge syntax highlighting tokens */
.highlight .c { color: #6c757d; font-style: italic; } /* Comment */
.highlight .err { color: #dc3545; } /* Error */
.highlight .k { color: #0d47a1; } /* Keyword */
.highlight .l { color: #2e7d32; } /* Literal */
.highlight .n { color: #1a1a1a; } /* Name */
.highlight .o { color: #e65100; } /* Operator */
.highlight .p { color: #1a1a1a; } /* Punctuation */
.highlight .cm { color: #6c757d; font-style: italic; } /* Comment.Multiline */
.highlight .cp { color: #6c757d; } /* Comment.Preproc */
.highlight .c1 { color: #6c757d; font-style: italic; } /* Comment.Single */
.highlight .cs { color: #6c757d; font-style: italic; } /* Comment.Special */
.highlight .gd { color: #dc3545; } /* Generic.Deleted */
.highlight .ge { font-style: italic; } /* Generic.Emph */
.highlight .gr { color: #dc3545; } /* Generic.Error */
.highlight .gh { color: #1a1a1a; } /* Generic.Heading */
.highlight .gi { color: #28a745; } /* Generic.Inserted */
.highlight .go { color: #6c757d; } /* Generic.Output */
.highlight .gp { color: #6c757d; } /* Generic.Prompt */
.highlight .gs { } /* Generic.Strong */
.highlight .gu { color: #6c757d; } /* Generic.Subheading */
.highlight .gt { color: #dc3545; } /* Generic.Traceback */
.highlight .kc { color: #0d47a1; } /* Keyword.Constant */
.highlight .kd { color: #0d47a1; } /* Keyword.Declaration */
.highlight .kn { color: #0d47a1; } /* Keyword.Namespace */
.highlight .kp { color: #0d47a1; } /* Keyword.Pseudo */
.highlight .kr { color: #0d47a1; } /* Keyword.Reserved */
.highlight .kt { color: #6f42c1; } /* Keyword.Type */
.highlight .ld { color: #2e7d32; } /* Literal.Date */
.highlight .m { color: #d63384; } /* Literal.Number */
.highlight .s { color: #2e7d32; } /* Literal.String */
.highlight .na { color: #e65100; } /* Name.Attribute */
.highlight .nb { color: #6f42c1; } /* Name.Builtin */
.highlight .nc { color: #6f42c1; } /* Name.Class */
.highlight .no { color: #d63384; } /* Name.Constant */
.highlight .nd { color: #6f42c1; } /* Name.Decorator */
.highlight .ni { color: #d63384; } /* Name.Entity */
.highlight .ne { color: #dc3545; } /* Name.Exception */
.highlight .nf { color: #0d47a1; } /* Name.Function */
.highlight .nl { color: #d63384; } /* Name.Label */
.highlight .nn { color: #6f42c1; } /* Name.Namespace */
.highlight .nx { color: #1a1a1a; } /* Name.Other */
.highlight .py { color: #d63384; } /* Name.Property */
.highlight .nt { color: #0d47a1; } /* Name.Tag */
.highlight .nv { color: #d63384; } /* Name.Variable */
.highlight .ow { color: #0d47a1; } /* Operator.Word */
.highlight .w { color: #f8f9fa; } /* Text.Whitespace */
.highlight .mf { color: #d63384; } /* Literal.Number.Float */
.highlight .mh { color: #d63384; } /* Literal.Number.Hex */
.highlight .mi { color: #d63384; } /* Literal.Number.Integer */
.highlight .mo { color: #d63384; } /* Literal.Number.Oct */
.highlight .sb { color: #2e7d32; } /* Literal.String.Backtick */
.highlight .sc { color: #2e7d32; } /* Literal.String.Char */
.highlight .sd { color: #2e7d32; } /* Literal.String.Doc */
.highlight .s2 { color: #2e7d32; } /* Literal.String.Double */
.highlight .se { color: #e65100; } /* Literal.String.Escape */
.highlight .sh { color: #2e7d32; } /* Literal.String.Heredoc */
.highlight .si { color: #e65100; } /* Literal.String.Interpol */
.highlight .sx { color: #2e7d32; } /* Literal.String.Other */
.highlight .sr { color: #2e7d32; } /* Literal.String.Regex */
.highlight .s1 { color: #2e7d32; } /* Literal.String.Single */
.highlight .ss { color: #d63384; } /* Literal.String.Symbol */
.highlight .bp { color: #6f42c1; } /* Name.Builtin.Pseudo */
.highlight .vc { color: #d63384; } /* Name.Variable.Class */
.highlight .vg { color: #d63384; } /* Name.Variable.Global */
.highlight .vi { color: #d63384; } /* Name.Variable.Instance */
.highlight .il { color: #d63384; } /* Literal.Number.Integer.Long */

/* Language-specific wrapper styling */
.highlighter-rouge {
  margin: 1em 0;
}

.highlighter-rouge .highlight {
  margin: 0;
}

/* Inline code styling */
code {
  background: var(--secondary-background);
  font-size: 0.9em;
}

/* Don't style code inside pre blocks (already styled by .highlight) */
pre code {
  background: transparent;
  padding: 0;
}

::selection {
  background: var(--selection-background);
  color: var(--selection-color);
}

a:link {
  color: var(--link-color);
  text-decoration: underline;
}

a:hover {
  background: var(--link-hover-background);
  color: var(--link-hover-color);
  text-decoration: none;
}

a,
a:visited {
  color: var(--link-color);
  text-decoration: underline;
}

.row {
  display: flex;
}

.column {
  flex: 50%;
  padding-top: 20px;
  line-height: 2;
  border-color: var(--border-color);
}

input, textarea, select {
  background-color: var(--secondary-background);
  color: var(--font-color);
  border-color: var(--border-color);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-color);
  outline: none;
}

hr {
  border: none;
  height: 1px;
  background-color: var(--border-color);
  margin: 2em 0;
}

img {
  opacity: var(--image-opacity);
  transition: opacity 0.2s ease;
}

img:hover {
  opacity: var(--image-opacity-hover);
}

/* Override hover effect for logo link */
a:hover picture,
a:hover picture img {
  background: transparent !important;
}

a:has(picture):hover {
  background: transparent !important;
}

.blink {
  animation: blink-animation 1s step-start 0s infinite;
}

@keyframes blink-animation {
  50% {
    opacity: 0;
  }
}

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 0, 0, 0.15);
  border-top: 3px solid var(--accent-color, #007bff);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Custom Context Menu Styles */
.custom-context-menu {
  position: fixed;
  background: white;
  border: 1px solid black;
  min-width: 160px;
  z-index: 1000;
  display: none;
}

.custom-context-menu.show {
  display: block;
}

.custom-context-menu-item {
  padding: 4px 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  color: var(--font-color);
}

.custom-context-menu-item:hover {
  background: var(--accent-color);
}

.custom-context-menu-separator {
  height: 1px;
  background: black;
}

/* Prevent text selection on context menu */
.custom-context-menu {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Search UI Styles */
#searchOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9999;
  display: none;
  backdrop-filter: blur(1px) brightness(1.25);
}

#spotlightSearch {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent-color);
  border: 1px solid black;
  padding: 16px;
  width: clamp(300px, 90vw, 600px);
  max-height: 80vh;
  z-index: 10000;
  display: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#spotlightSearchInput {
  width: 100%;
  padding: clamp(10px, 2vw, 14px);
  border: solid 1px black;
  box-sizing: border-box;
  font-size: 1em;
}

#searchResults {
  max-height: clamp(200px, 40vh, 400px);
  overflow-y: auto;
  margin-top: clamp(12px, 2vw, 16px);
  display: none;
  background-color: white;
  border: 1px solid black;
}

#searchHint {
  text-align: center;
  font-size: 0.7em;
  display: none;
  padding: 12px 0 0 0;
}

.search-result-item {
  padding: clamp(6px, 1.5vw, 10px) clamp(8px, 2vw, 12px);
  cursor: pointer;
  transition: background-color 0.2s ease;
  color: var(--font-color, #1a1a1a);
  text-decoration: none;
  display: block;
}

.search-result-item.selected {
  background-color: rgba(0, 0, 0, 0.1);
}

.search-message {
  text-align: center;
  color: var(--font-color-muted, #6c757d);
  padding: 20px;
}

.search-highlight {
  text-decoration: underline;
}

blockquote {
  position: relative;
  margin-left: 1em;
  padding-left: 0.2em;
}

/* Blockquote rounded border */
blockquote::before {
  content: '';
  position: absolute;
  left: -1em;
  top: 0.5em;
  bottom: 0.5em;
  width: 3px;
  background: lightgrey;
  border-radius: 2px;
}

/* iOS Button Overrides */
/* Override default iOS button styling to make labels black instead of blue */
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  color: var(--font-color);
  -webkit-appearance: none;
  appearance: none;
}

/* iOS Safari specific overrides */
@supports (-webkit-touch-callout: none) {
  button,
  input[type="button"],
  input[type="submit"],
  input[type="reset"] {
    color: var(--font-color);
    -webkit-text-fill-color: var(--font-color);
  }
  
  /* Override iOS default button colors */
  button:not([disabled]),
  input[type="button"]:not([disabled]),
  input[type="submit"]:not([disabled]),
  input[type="reset"]:not([disabled]) {
    color: var(--font-color);
    -webkit-text-fill-color: var(--font-color);
  }
}

