﻿/* ==========================================================================
   St-Takla.org — صفحة التلوين
   Layout for the colouring studio: palette rail beside a canvas that keeps the
   drawing's own aspect ratio, plus the print sheet.
   ========================================================================== */

.stk-color-head {
  padding: 22px 0 24px;
  background:
    radial-gradient(900px 300px at 50% -110px, var(--teal-400) 0%, transparent 62%),
    linear-gradient(180deg, var(--teal-700), var(--teal-900));
  text-align: center;
}
/* The book's name is the headline here — white and large. The page number
   underneath is the secondary line. */
.stk-book-title {
  margin: 0 0 6px;
  font-size: clamp(30px, 5.4vw, 48px);
  font-weight: 800;
  line-height: 1.3;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .2), 0 10px 30px rgba(0, 0, 0, .25);
}
.stk-book-title * { font-size: inherit !important; }
/* !important because /resources/common.css forces every anchor blue site-wide. */
.stk-book-title a,
.stk-book-title a:link,
.stk-book-title a:visited { color: #fff !important; text-decoration: none; }
.stk-book-title a:hover,
.stk-book-title a:focus { color: #fff !important; text-decoration: underline; }

.stk-color-sub {
  margin: 0;
  font-size: clamp(15px, 2.1vw, 19px);
  font-weight: 700;
  color: var(--gold-300);
}

/* --------------------------------------------------------------------------
   Studio shell
   -------------------------------------------------------------------------- */

.stk-studio {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 26px 0 10px;
}

@media (max-width: 900px) {
  .stk-studio {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  /* on a phone the drawing comes first and the palette sits under it,
     within thumb reach */
  .stk-canvas-wrap { order: 1; }
  .stk-tools { order: 2; }
}

/* --------------------------------------------------------------------------
   Tool rail
   -------------------------------------------------------------------------- */

.stk-tools {
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (max-width: 900px) {
  .stk-tools { position: static; }
}

.stk-tool-block {
  padding: 14px 16px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--gold-500);
  background: linear-gradient(180deg, var(--parch-300), var(--parch-400));
  box-shadow: var(--shadow-sm);
}

.stk-tool-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--teal-800);
}
.stk-tool-title * { font-size: inherit !important; }

/* --- swatches --- */

.stk-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 7px;
}

.stk-swatch {
  position: relative;
  aspect-ratio: 1;
  min-height: 38px;
  padding: 0;
  border: 3px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(13, 79, 87, .28);
  transition: transform .15s, box-shadow .2s;
}
@supports not (aspect-ratio: 1) {
  .stk-swatch { height: 38px; }
}
.stk-swatch:hover { transform: scale(1.12); }
.stk-swatch.is-active {
  border-color: var(--ink);
  transform: scale(1.16);
  box-shadow: 0 0 0 3px var(--gold-500), 0 2px 8px rgba(13, 79, 87, .35);
}
.stk-swatch.is-white { border-color: #b9c4cc; }

.stk-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--teal-800);
}
.stk-custom input[type="color"] {
  width: 54px;
  height: 36px;
  padding: 2px;
  border: 2px solid var(--teal-600);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

/* --- tool buttons --- */

.stk-toolbtns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stk-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px;
  border: 2px solid var(--teal-600);
  border-radius: 14px;
  background: #fff;
  color: var(--teal-800);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, color .18s, transform .15s;
}
.stk-tool:hover { background: var(--teal-100); }
.stk-tool.is-active {
  background: var(--teal-700);
  border-color: var(--teal-900);
  color: #fff;
  transform: translateY(-1px);
}
.stk-tool-ico { font-size: 21px; line-height: 1; }

.stk-size {
  margin-top: 12px;
  display: none;
}
.stk-size.is-on { display: block; }
.stk-size label {
  display: block;
  margin-bottom: 4px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--teal-800);
}
.stk-size input[type="range"] { width: 100%; accent-color: var(--teal-700); }

.stk-actionbtns {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.stk-actionbtns:last-of-type { margin-bottom: 0; }
.stk-actionbtns .stk-btn { flex: 1 1 0; padding-left: 8px; padding-right: 8px; }

.stk-saved {
  min-height: 20px;
  margin: 8px 0 0;
  text-align: center;
  color: #10603a;
  font-weight: 700;
  opacity: 0;
  transition: opacity .25s;
}
.stk-saved.is-on { opacity: 1; }

/* --------------------------------------------------------------------------
   Canvas
   -------------------------------------------------------------------------- */

.stk-canvas-wrap { min-width: 0; }

.stk-canvas-stage {
  position: relative;
  margin: 0 auto;
  max-width: 100%;
  border-radius: var(--radius);
  border: 3px solid var(--gold-500);
  background: #fff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  touch-action: none;            /* we handle the drawing gestures ourselves */
  line-height: 0;
}

.stk-canvas-stage canvas {
  display: block;
  width: 100%;
  height: auto;
}
#stk-line {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stk-canvas-stage.is-fill { cursor: crosshair; }
.stk-canvas-stage.is-brush,
.stk-canvas-stage.is-erase { cursor: cell; }

.stk-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--parch-300);
  color: var(--teal-800);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.6;
}
.stk-loading.is-off { display: none; }

.stk-canvas-hint { text-align: center; margin-top: 10px; }

/* --------------------------------------------------------------------------
   Caption under the drawing — the story text, set larger than body copy so a
   parent can read it aloud from across the table.
   -------------------------------------------------------------------------- */

.stk-caption-big {
  max-width: 900px;
  margin: 26px auto 0;
}
.stk-caption-big .stk-caption-title {
  font-size: clamp(18px, 2.4vw, 22px);
}
.stk-caption-big .stk-caption-text {
  font-size: clamp(18px, 2.5vw, 22px);
  line-height: 2.1;
}
.stk-caption-big .stk-lang-btn {
  min-width: 52px;
  padding: 7px 15px;
  font-size: 16px;
}

.stk-page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 22px auto 0;
  max-width: 620px;
}

/* --------------------------------------------------------------------------
   Print: just the artwork, at page width
   -------------------------------------------------------------------------- */

#stk-print-area { display: none; }

@media print {
  body > *:not(#stk-print-area) { display: none !important; }

  #stk-print-area {
    display: block !important;
    margin: 0;
    padding: 0;
    text-align: center;
  }
  #stk-print-img {
    max-width: 100%;
    max-height: 100vh;
    height: auto;
  }

  @page { margin: 10mm; }
}
