@font-face
{
  font-family: 'KawkabMono';
  src: url('/res/fonts/KawkabMono/KawkabMono-Light.woff2') format('woff2'),
    /* WOFF2 first for modern browsers */
    url('/res/fonts/KawkabMono/KawkabMono-Light.woff') format('woff'),
    /* Fallback to WOFF */
    url('/res/fonts/KawkabMono/KawkabMono-Light.eot');
  /* IE9 and below */
  src: url('/res/fonts/KawkabMono/KawkabMono-Light.eot?#iefix') format('embedded-opentype'),
    /* EOT workaround */
    url('/res/fonts/KawkabMono/KawkabMono-Light.ttf') format('truetype'),
    /* Fallback to TTF */
    url('/res/fonts/KawkabMono/KawkabMono-Light.otf') format('opentype'),
    /* Fallback to OTF */
    url('/res/fonts/KawkabMono/KawkabMono-Light.svg#KawkabMono') format('svg');
  /* Old mobile browsers */
}

@font-face
{
  font-family: 'NotoKufiArabic';
  src: url('/res/fonts/NotoKufiArabic/NotoKufiArabic-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face
{
  font-family: 'AmiriQuran';
  src: url('/res/fonts/AmiriQuran/AmiriQuran-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face
{
  font-family: 'TraditionalArabic';
  src: url('/res/fonts/TraditionalArabic/TraditionalArabicRegular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face
{
  font-family: 'NotoNaskhArabic';
  src: url('/res/fonts/NotoNaskhArabic/NotoNaskhArabicRegular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face
{
  font-family: 'Almarai';
  src: url('/res/fonts/Almarai/Almarai-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face
{
  font-family: 'IBMPlexSansArabic';
  src: url('/res/fonts/IBMPlexSansArabic/IBMPlexSansArabic-ExtraLight.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root
{
  --bg: rgba(29, 30, 31);
  --alternateBg: rgba(35, 36, 37);
  --text: rgb(218, 218, 218);
  --a-hover-background: rgba(0, 80, 80, 1);

  --insetShadowColor: rgba(20, 20, 20, 0.3);

  --raisedBg: rgb(33, 34, 35);
  --raisedControlShadowColor: rgb(10, 10, 10);

  --hoverBg: rgba(60, 61, 62);

  --textShadow: rgba(200, 200, 200, 0.4);

  --buttonTextColor: #fff;
  --buttonBg: #333;

  --buttonShadowColor: rgba(255, 255, 255, 0.2);

  --shadowColor: rgba(0 0 0 0.58);
  --borderShadowColor: rgb(47, 47, 47);

  --inputBg: rgb(35, 35, 35);
  --inputInsetShadow: rgba(0, 0, 0, 0.8);
  --inputBorderColor: rgba(10, 10, 10, 0.7);

  --sliderGrooveColor: rgba(70, 70, 70, 0.5);

  --menuShadowColor: rgb(0, 0, 0);
  --menuBorderColor: rgb(20, 20, 20);

  --quoteBg: rgb(40, 42, 43, 0.3);
  --quoteTextColor: rgb(200, 200, 200);
}

body.light-mode
{
  --bg: rgb(250, 249, 246);
  --alternateBg: rgba(237, 237, 237);
  --text: black;
  --a-hover-background: rgba(0, 220, 220, 125);
  --hoverBg: rgb(210, 209, 206);

  --insetShadowColor: rgba(150, 150, 150, 0.2);

  --raisedBg: rgb(250, 249, 246);
  --raisedControlShadowColor: rgb(200, 200, 200);

  --textShadow: rgba(0, 0, 0, 0.15);

  --buttonTextColor: #333;
  --buttonBg: #f9f9f9;

  --buttonShadowColor: rgba(0, 0, 0, 0.2);

  --shadowColor: rgba(61, 61, 61, 0.2);
  --borderShadowColor: rgb(220, 220, 220);

  --sliderGrooveColor: rgba(200, 200, 200, 0.5);

  --inputBg: rgb(249, 249, 249);
  --inputInsetShadow: rgba(0, 0, 0, 0.3);
  --inputBorderColor: rgba(0, 0, 0, 0.3);

  --menuShadowColor: rgb(100, 100, 100);
  --menuBorderColor: rgb(70, 70, 70);

  --quoteBg: rgb(210, 208, 207, 0.3);
    --quoteTextColor: rgb(50, 50, 50);
}

html
{
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased; /* macOS/WebKit browsers */
    -moz-osx-font-smoothing: grayscale;  /* macOS/Firefox */
    text-rendering: optimizeLegibility;  /* Enables kerning & shaping */
    font-smooth: always;                 /* Non-standard, some browsers */
}

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

body,
html
{
  font-family: 'AmiriQuran';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* touch-action: none; */

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

  margin: 0;
  padding: 0;

  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5em;

  min-height: 100vh;
  /* height: 100%; */
  /* width: 100%;
  max-height: 100%;
  max-width: 100%; */
  contain: layout style;

  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

header
{
  left: 0;
  top: 0;
  margin-top: 3px;

  flex-shrink: 0;
  display: flex;
  justify-content: space-between;

}

#topToolBar
{
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;

  top: 0;

  height: 2em;
}

body.light-mode #moonIcon
{
  display: inline;
}

body.light-mode #sunIcon
{
  display: none;
}

main
{
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 10em;
  width: 95%;
  /* overflow-y: auto; */

  margin: 0 auto;
}

footer
{
  flex-shrink: 0;

  padding: 10px;
  left: 0;
  bottom: 0;
  width: 100%;
  text-wrap: wordwrap;
  text-align: center;
}

footer,
footer *
{
  font-family: 'IBMPlexSansArabic';
  font-size: 0.9em;
}

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


button
{
  background-color: transparent;
  color: var(--buttonTextColor);
  border: none;

  cursor: pointer;
}

hr
{
  height: 1px;
  margin: 50px 0;
  background: -webkit-gradient(linear, 0 0, 100% 0, from(rgba(0, 0, 0, 0)), color-stop(0.5, #333333), to(rgba(0, 0, 0, 0)));
  background: -webkit-linear-gradient(left, rgba(0, 0, 0, 0), #333333, rgba(0, 0, 0, 0));
  background: -moz-linear-gradient(left, rgba(0, 0, 0, 0), #333333, rgba(0, 0, 0, 0));
  background: -o-linear-gradient(left, rgba(0, 0, 0, 0), #333333, rgba(0, 0, 0, 0));
  background: linear-gradient(left, rgba(0, 0, 0, 0), #333333, rgba(0, 0, 0, 0));
  border: 0;
}

hr:after
{
  display: block;
  content: '';
  height: 30px;
  background-image: -webkit-gradient(radial, 50% 0%, 0, 50% 0%, 116, color-stop(0%, #cccccc), color-stop(100%, rgba(255, 255, 255, 0)));
  background-image: -webkit-radial-gradient(center top, farthest-side, #cccccc 0%, rgba(255, 255, 255, 0) 100%);
  background-image: -moz-radial-gradient(center top, farthest-side, #cccccc 0%, rgba(255, 255, 255, 0) 100%);
  background-image: -o-radial-gradient(center top, farthest-side, #cccccc 0%, rgba(255, 255, 255, 0) 100%);
  background-image: radial-gradient(farthest-side at center top, #cccccc 0%, rgba(255, 255, 255, 0) 100%);
}


/* ############# NAVBAR ############ */

.navbar
{
  background-color: var(--bg);
  box-shadow: inset 0 2px 4px var(--insetShadowColor),
    inset 0 -2px 4px var(--insetShadowColor),
    inset 2px 0 4px var(--insetShadowColor),
    inset -2px 0 4px var(--insetShadowColor);
  display: flex;

  align-items: center;
  /* flex: 1; */


  overflow-x: auto;
  scroll-behavior: smooth;
  white-space: nowrap;
  width: max-content;
  /* Prevents full expansion */
  width: 100%;
  /* Keeps it within the parent */
}

.active
{
    background-color: var(--a-hover-background); /* Change to your preferred color */
    font-weight: bold;
}

#scrollRightNavButton
{
  background-color: var(--bg);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scrollLeftNavButton
{
  background-color: var(--bg);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar a.icon
{
  display: none;
}

#mainnavbar
{
  flex-direction: column;
  gap: 1em;
  justify-content: center;
  overflow: hidden;
  background-color: unset;
  box-shadow: unset;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}

.navbar a
{
  float: right;
  color: var(--text);
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;

  border: none;
  outline: none;
  margin: 0;
  border-radius: 5px;
  font-family: 'AmiriQuran';
  font-size: 0.9em;
  pointer-events: auto;

  
}

.dropdown-content a
{
  float: right;
  color: var(--text);
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;

  border: none;
  outline: none;
  margin: 0;
  border-radius: 5px;
  font-family: 'Almarai';
  font-size: 0.8em;
  pointer-events: auto;

  cursor: pointer;
}

.dropdown-content a:hover
{
  background-color: var(--a-hover-background);
  border-radius: 5px;
}

.dropdown
{
  /* overflow: hidden; */
  position: relative;
  display: inline-block;
  /* background-color: var(--alternateBg); */
}

.navbar button
{
  border: none;
  outline: none;
  color: var(--text);
  margin: 0;
  border-radius: 5px;
  font-family: 'Almarai';
  font-size: 0.8em;
  pointer-events: auto;
}

.navbar a:hover,
.dropdown:hover .dropbtn
{
  background-color: var(--a-hover-background);
  border-radius: 5px;
}

.dropdown-content
{
  position: absolute;
  visibility: hidden;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 100;
  border-radius: 10px;
  background-color: var(--alternateBg);
  white-space: nowrap;
  display: flex;
  flex-direction: column;
}

.dropdown-content button
{
  float: none;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
  width: 100%;
  text-align: right;
}

.dropdown-content button:hover
{
  background-color: var(--a-hover-background);
}

.dropdown:hover .dropdown-content
{
  display: block;
}

/* ############################################
              CUSTOM CONTROLS
###############################################*/

.toolButton
{
  height: 4ch;
  width: 4ch;
  padding: 0px;
}

.iconButton
{
  box-sizing: border-box;

  display: flex;
  align-items: center;
  justify-content: center;

  height: 4ch;
  width: 4ch;
  padding: 0px;

  text-align: center;


}

.svgicon
{
  width: 2em;
  height: 2em;
  max-width: 100%;
  max-height: 100%;
}

input
{
  background-color: var(--inputBg);
  color: var(--text);
  border: 1px solid var(--inputBorderColor);
  border-radius: 3px;
  padding: 2px;
  text-align: center;
  box-shadow: inset 0 0 5px var(--inputInsetShadow);
}

#pagination-spinbox
{
  max-width: 6ch;
}

/* input:invalid
{
  border: 2px solid red;
} */

.modal
{
  display: none;
  /* Hidden by default */
  position: fixed;
  /* Stay in place */
  z-index: 1;
  /* Sit on top */
  left: 0;
  top: 0;
  width: 100vw;
  /* Full width */
  height: 100vh;
  /* Full height */
  overflow: auto;
  /* Enable scroll if needed */
  background-color: rgb(0, 0, 0);
  /* Fallback color */
  background-color: rgba(0, 0, 0, 0.4);
  /* Black w/ opacity */
}

/* Modal Content/Box */
.modal-content
{
  background-color: var(--bg);
  margin: 10% 10%;
  /* 15% from the top and centered */

  border-radius: 5px;
  width: 80%;
  /* Could be more or less, depending on screen size */
  height: 80%;

  box-shadow: 0 0 5px 5px var(--menuShadowColor);

  display: flex;
  flex-direction: column;
}

#modalHeader
{
  margin-right: 0.5em;

  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
}

#modalMain
{
  height: 100%;
  min-height: 10em;
  flex: 1;

  width: 95%;
  margin: 0 auto;

  overflow-y: auto;

  border-top: 2px solid var(--borderShadowColor);
}

/* The Close Button */
.close
{
  color: var(--text);
  float: right;
  font-weight: bold;
}

.close:hover,
.close:focus
{
  color: black;
  text-decoration: none;
  cursor: pointer;
}

.lessonLink
{
  text-decoration: underline;
  cursor: pointer;
}



/* COLLAPSIBLE AREA */

.collapsible
{
  background-color: var(--bg);
  color: var(--text);
  cursor: pointer;
  padding: 18px;
  width: 100%;
  border: none;
  outline: none;
  text-align: right;
}

.active, .collapsible:hover
{
  background-color: var(--a-hover-background);
}

.content
{
  padding: 0 18px;
  display: none;
  overflow: hidden;
  background-color: var(--bg);
}

/* ########### TELEGRAM CLONE */

/* Telegram-style messages */

/* Telegram-style feed */
.telegram-feed {
  display: flex;
  flex-direction: column;
  gap: 1em;
  /* max-width: 600px; */
  /* margin: 0 auto; */
  padding: 1em;
}

.telegram-message {
  background-color: var(--alternateBg);
  border-radius: 12px;
  padding: 10px 14px;
  
  color: var(--text);
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  width: fit-content;
  max-width: 80%;
}

.telegram-message img {
  max-width: 100%;
  border-radius: 8px;
  margin: 0.5em 0;
  display: block;
}

.telegram-message video {
  max-width: 100%;
  border-radius: 8px;
  margin: 0.5em 0;
  display: block;
}


.telegram-message.right {
  margin-left: auto;
  /* background-color: var(--buttonBg); */
}

.telegram-message.left {
  margin-right: auto;
}

.telegram-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.75em;
  font-family: 'Almarai'
}

[dir="rtl"] .telegram-author
{
  margin-left: 0.5em;
}
[dir="ltr"] .telegram-author
{
  margin-right: 0.5em;
}

[dir="rtl"] .telegram-date
{
  margin-right: 0.5em;
}
[dir="ltr"] .telegram-date
{
  margin-left: 0.5em;
}

/* .telegram-text {
  white-space: pre-wrap;
  unicode-bidi: plaintext;
} */

blockquote {
  background: var(--quoteBg);
  border-radius: 10px;
  padding: 10px;
  color: var(--quoteTextColor);
}

[dir="rtl"] blockquote {
  border-left: none;
  border-right: 10px solid rgb(125, 125, 125);
}

[dir="ltr"] blockquote {
  border-right: none;
  border-left: 10px solid rgb(125, 125, 125);
}

/* ########### JMAS ############## */

.scrollabaleTextContainer
{
  flex: 1;
  height: 100%;
  overflow-y: auto;
  text-align: right;
  padding: 15px;
  border-radius: 8px;
  box-shadow: inset 0 2px 5px var(--inputInsetShadow);
}

.ts
{
  color: var(--a-hover-background);
}

/* ############### Khawaatir  #######################*/


.tag
{
  display: inline-block;
    padding: 4px 8px;
    margin: 2px;
    background: var(--bg);
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
    border-radius: 6px;
    border: 1px solid var(--borderShadowColor);
    font-size: 0.9em;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
}

.tag:hover
{
    background: var(--a-hover-background);
    border: 1px solid var(--a-hover-background);
}

.tag.active
{
  background: var(--a-hover-background);
    border: 1px solid var(--a-hover-background);
    font-weight: bold;
}

#blog-section::backdrop {
  background-color: var(--bg);
  color: var(--text)
}


/* ################# PORTFOLIO #####################*/

.portfolio-card {
  display: flex;
  flex-direction: column;
  align-items: start;
  padding: 1em;
  background: var(--card-bg, rgba(255,255,255,0.05));
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  margin: 0.6em;
  transition: transform 0.2s ease;
}
.portfolio-card:hover {
  transform: scale(1.02);
}
.portfolio-thumb {
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin-bottom: 0.6em;
}
.portfolio-grid .clusterize-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1em;
}
